EdLook.icl 1.23 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
implementation module EdLook

3
4
// the edit window update function

Diederik van Arkel's avatar
Diederik van Arkel committed
5
6
7
import StdInt, StdBool, StdClass
import StdIOCommon
import StdPicture
8
import EdVisualText, EdVisualCursor, EdVisualLineNr, EdSelection
Diederik van Arkel's avatar
Diederik van Arkel committed
9
10
11
12

// editWindowLook: updating the affected areas is done by updating
// each of the rectangles.

Diederik van Arkel's avatar
Diederik van Arkel committed
13
editWindowLook :: EditState SelectState !UpdateState -> (!*Picture -> *Picture)
Diederik van Arkel's avatar
Diederik van Arkel committed
14
15
editWindowLook editState selectState updateState=:{ updArea, newFrame, oldFrame }
	= editWindowLook`
Diederik van Arkel's avatar
Diederik van Arkel committed
16
where
Diederik van Arkel's avatar
Diederik van Arkel committed
17
	editWindowLook`  picture
Diederik van Arkel's avatar
Diederik van Arkel committed
18
19
20
21
22
23
24
25
26
27
28
		# updArea = cleanUpdate updArea	// hack around object i/o bug...
		# picture = vDrawLineNrs fontInfo text newFrame updArea picture
		# picture = vUpdateText fontInfo text newFrame updArea picture
		# picture = case visible of
			True -> vUpdateCursor visible end height fontInfo text newFrame updArea picture
			_    -> vUpdateSelection selection fontInfo text newFrame updArea picture
		= picture
	(fontInfo,ds1)			= getFontInfo (editState,42)
	(text,ds2)				= getText ds1
	(visible,ds3)			= getCursorVisibility ds2
	(height,ds4)			= getCursorHeight ds3
Diederik van Arkel's avatar
Diederik van Arkel committed
29
	(selection=:{end},_)	= getSelection ds4
Diederik van Arkel's avatar
Diederik van Arkel committed
30
31
32
33
34
35

cleanUpdate [] = []
cleanUpdate [h:t]
	| h.corner1.x == h.corner2.x = cleanUpdate t
	| h.corner1.y == h.corner2.y = cleanUpdate t
	= [h: cleanUpdate t]