Syntax10.Scn.Fnt Syntax10i.Scn.Fnt StampElems Alloc 25 Oct 94 Syntax10b.Scn.Fnt MODULE DialogLines; (** Markus Knasm ller 29 Aug 94 - IMPORT DialogFrames, Dialogs, DialogTexts, Display, Display1, In, Input, Oberon, Printer, TextFrames, Texts, Viewers; CONST MM = 1; W* = 30; H* = 2; black = 15; TYPE Item* = POINTER TO ItemDesc; ItemDesc* = RECORD (Dialogs.ObjectDesc) END; PROCEDURE (l: Item) Draw* (x, y: INTEGER; f: Display.Frame); (** displays the object at (x, y) in frame f *) VAR mode, w, h, bx, by: INTEGER; BEGIN l.GetDim (bx, by, w, h); IF l.selected THEN mode := Display.invert ELSE mode := Display.replace END; Display.ReplConstC (f, black, x, y, w, h, mode); END Draw; PROCEDURE (l: Item) Print* (x, y: INTEGER); (** prints the object at printer coordinates (x, y) *) VAR w, h, bx, by: INTEGER; BEGIN l.GetPDim (bx, by, w, h); Printer.Line (x, y, x + w, y + h) END Print; PROCEDURE (l: Item) Copy* (VAR dup: Dialogs.Object); (** allocates dup and makes a deep copy of o. Before calling this methode dup should be equal NIL *) VAR x: Item; BEGIN IF dup = NIL THEN NEW (x); dup := x ELSE x := dup(Item) END; l.Copy^ (dup); END Copy; PROCEDURE (l: Item) Track (x, y: INTEGER; keys: SET; f: Display.Frame; p: Dialogs.Panel); VAR keysum: SET; t: Texts.Text; BEGIN IF keys = {MM} THEN keysum := keys; REPEAT Input.Mouse(keys, x, y); keysum := keysum + keys; Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y) UNTIL keys = {}; IF keysum = {MM} THEN IF l.cmd[0] # 0X THEN DialogTexts.GetParText (l.par, l.panel, t); l.CallCmd (f, Viewers.This (x, y), t) END END ELSE Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y) END END Track; PROCEDURE (l: Item) Handle* (f: Display.Frame; VAR m: Display.FrameMsg); (** handles messages which were sent to frame f *) BEGIN l.Handle^ (f, m); WITH f: DialogFrames.Frame DO WITH m: Oberon.InputMsg DO IF m.id = Oberon.track THEN l.Track (m.X, m.Y, m.keys, f, f.panel) END ELSE END ELSE END END Handle; PROCEDURE Insert*; (** Insert ([name] [x y w h] | ^ ) inserts a line - item in the panel containing the caret position *) VAR x, y, x1, y1, w, h: INTEGER; l: Item; p: Dialogs.Panel; name: ARRAY 64 OF CHAR; BEGIN NEW (l); DialogFrames.GetCaretPosition (p, x, y); IF (p # NIL) THEN l.Init; In.Open; In.Name (name); IF ~In.Done THEN COPY ("", name); In.Open END; l.SetName (name); In.Int (x1); In.Int (y1); In.Int (w); In.Int (h); IF ~In.Done THEN x1 := x; y1 := y; w := W; h := H ELSE IF w < 0 THEN w := W END; IF h < 0 THEN h := H END END; l.SetDim (x1, y1, w, h, FALSE); p.Insert (l, FALSE) ELSE Dialogs.res := Dialogs.noPanelSelected END; IF Dialogs.res # 0 THEN Dialogs.Error ("DialogLines") END; END Insert; END DialogLines.