home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / oberon / system1 / dialoglines.mod (.txt) < prev    next >
Oberon Text  |  1977-12-31  |  3KB  |  91 lines

  1. Syntax10.Scn.Fnt
  2. Syntax10i.Scn.Fnt
  3. StampElems
  4. Alloc
  5. 25 Oct 94
  6. Syntax10b.Scn.Fnt
  7. MODULE DialogLines;
  8.     (** Markus Knasm
  9. ller 29 Aug 94 - 
  10.     IMPORT DialogFrames, Dialogs, DialogTexts, Display, Display1, In, Input, Oberon, Printer, TextFrames, Texts, Viewers;
  11.     CONST MM = 1; W* = 30; H* = 2; black = 15;
  12.     TYPE
  13.         Item* = POINTER TO ItemDesc;
  14.         ItemDesc* = RECORD (Dialogs.ObjectDesc)
  15.         END;
  16.     PROCEDURE (l: Item) Draw* (x, y: INTEGER; f: Display.Frame);
  17.     (** displays the object at (x, y) in frame f *)
  18.         VAR mode, w, h, bx, by: INTEGER;
  19.     BEGIN
  20.         l.GetDim (bx, by, w, h);
  21.         IF l.selected THEN mode := Display.invert ELSE mode := Display.replace END;
  22.         Display.ReplConstC (f, black, x, y, w, h, mode);
  23.     END Draw;
  24.     PROCEDURE (l: Item) Print* (x, y: INTEGER);
  25.     (** prints the object at printer coordinates (x, y)  *)
  26.         VAR w, h, bx, by: INTEGER;
  27.     BEGIN
  28.         l.GetPDim (bx, by, w, h);
  29.         Printer.Line (x, y, x + w, y + h)
  30.     END Print;
  31.     PROCEDURE (l: Item) Copy* (VAR dup: Dialogs.Object);
  32.     (** allocates dup and makes a deep copy of o. Before calling this methode dup should be equal NIL *)
  33.         VAR x: Item;
  34.     BEGIN
  35.         IF dup = NIL THEN NEW (x); dup := x ELSE x := dup(Item) END;
  36.         l.Copy^ (dup);
  37.     END Copy;
  38.     PROCEDURE (l: Item) Track (x, y: INTEGER; keys: SET; f: Display.Frame; p: Dialogs.Panel);
  39.         VAR keysum: SET; t: Texts.Text;
  40.     BEGIN
  41.         IF keys = {MM} THEN 
  42.             keysum := keys;
  43.             REPEAT 
  44.                 Input.Mouse(keys, x, y); keysum := keysum + keys;
  45.                 Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y)
  46.             UNTIL keys = {};
  47.             IF keysum = {MM} THEN 
  48.                 IF l.cmd[0] # 0X THEN
  49.                     DialogTexts.GetParText (l.par, l.panel, t); 
  50.                     l.CallCmd (f, Viewers.This (x, y), t)
  51.                 END
  52.             END
  53.         ELSE Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y)
  54.         END
  55.     END Track;
  56.     PROCEDURE (l: Item) Handle* (f: Display.Frame; VAR m: Display.FrameMsg);
  57.     (** handles messages which were sent to frame f *)
  58.     BEGIN
  59.         l.Handle^ (f, m);
  60.         WITH f: DialogFrames.Frame DO
  61.             WITH m: Oberon.InputMsg DO
  62.                 IF m.id = Oberon.track THEN l.Track (m.X, m.Y, m.keys, f, f.panel) END
  63.             ELSE
  64.             END
  65.         ELSE
  66.         END
  67.     END Handle;
  68.     PROCEDURE Insert*;
  69.     (** Insert ([name] [x y w h] | ^ ) inserts a line - item in the panel containing the caret position *)
  70.         VAR x, y, x1, y1, w, h: INTEGER; l: Item; p: Dialogs.Panel; name: ARRAY 64 OF CHAR; 
  71.     BEGIN 
  72.         NEW (l); 
  73.         DialogFrames.GetCaretPosition (p, x, y); 
  74.         IF (p # NIL) THEN 
  75.             l.Init; In.Open; In.Name (name);
  76.             IF ~In.Done THEN COPY ("", name); In.Open END;
  77.             l.SetName (name); 
  78.             In.Int (x1); In.Int (y1); In.Int (w); In.Int (h);
  79.             IF ~In.Done THEN x1 := x; y1 := y; w := W; h := H 
  80.             ELSE
  81.                 IF w < 0 THEN w := W END;
  82.                 IF h < 0 THEN h := H END
  83.             END;
  84.             l.SetDim (x1, y1, w, h, FALSE); p.Insert (l, FALSE) 
  85.         ELSE
  86.             Dialogs.res := Dialogs.noPanelSelected
  87.         END;
  88.         IF Dialogs.res # 0 THEN Dialogs.Error ("DialogLines") END;
  89.     END Insert;
  90. END DialogLines.
  91.