EdVisualText.dcl 1.68 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
definition module EdVisualText

3
// visual operations on texts
Diederik van Arkel's avatar
Diederik van Arkel committed
4

5
6
from StdIOCommon	import	:: ViewFrame, :: Rectangle, :: Point2, :: ViewDomain
from EdText			import	:: TextFragment, :: StrictList, stringsToString,
Diederik van Arkel's avatar
Diederik van Arkel committed
7
8
							getTextFragment, stringToStrings, getLine, textLength,
							newText, emptyText, stringsToText, updateLine, lastLineNr
9
from StdPicture		import	:: Picture, :: FontName
Diederik van Arkel's avatar
Diederik van Arkel committed
10
import EdMonad
11

Diederik van Arkel's avatar
Diederik van Arkel committed
12
13
14
15
16

vUpdateText		:: !FontInfo !Text !ViewFrame ![Rectangle] -> (*Picture -> *Picture)
// vUpdateText:		updates the text in the rectangles within 
//					the given view frame

Diederik van Arkel's avatar
Diederik van Arkel committed
17
vInsertText		:: Position TextFragment		->	EditMonad (PSt .l) nothing
Diederik van Arkel's avatar
Diederik van Arkel committed
18
19
20
// vInsertText:		inserts a piece of text into the visual text
//					(assumes that the position where the insert takes place is visible)

Diederik van Arkel's avatar
Diederik van Arkel committed
21
22
vAppendLines	:: TextFragment					->	EditMonad (PSt .l) nothing
vAppendText		:: TextFragment					->	EditMonad (PSt .l) nothing
Diederik van Arkel's avatar
Diederik van Arkel committed
23

Diederik van Arkel's avatar
Diederik van Arkel committed
24
vRemoveText		:: !Selection					->	EditMonad (PSt .l) nothing
Diederik van Arkel's avatar
Diederik van Arkel committed
25
26
27
28
// vRemoveText:		removes a piece of text from the visual text.
//					(assumes that the first position in the selection is visible)

computeViewDomain	::								EditMonad .env ViewDomain 
Diederik van Arkel's avatar
Diederik van Arkel committed
29
30
31
32
getViewFrame		::								EditMonad (PSt .l) ViewFrame
vResetViewDomain	::								EditMonad !(PSt .l) nothing
vTextUpdate			:: !Position Int			->	EditMonad (PSt .l) nothing
vDraw				:: (*Picture -> *Picture)	->	EditMonad (PSt .l) a
Diederik van Arkel's avatar
Diederik van Arkel committed
33
34
35
36
37
38
39
40

pointToPosition :: !Point2 !Text !FontInfo		->	Position
positionToPoint :: !Position !Text !FontInfo	->	Point2

tabStringWidth	:: !Int ![String] !FontInfo		->	Int
// tabStringWidth: computes the width of a string that is already split 
//				   at tabs. The first argument specifies the x-coordinate 
//				   where string is placed.