ð#Syntax10.Scn.FntŽŽMODULE PostIt; IMPORT TextFrames, Boards, Files, Texts, Oberon, Viewers, BoardFrames, MenuViewers; VAR W: Texts.Writer; PROCEDURE XYinRect(X, Y, RX, RY, RW, RH: INTEGER): BOOLEAN; BEGIN RETURN (X >= RX) & (X < RX + RW) & (Y >= RY) & (Y (F.X + F.W)) OR (BoardFrames.This(F, x, y) = NIL); UNTIL (y < F.Y) OR ((x + w) <= (F.X + F.W)) & (BoardFrames.This(F, x, y) = NIL) END; NEW(N); N.X := F.Xboard + x - F.X; N.Y := F.Yboard + y - F.Y - F.H; N.W := w; N.H := h; N.text := TextFrames.Text(""); Oberon.GetClock(t, d); Texts.WriteDate(W, t, d); Texts.WriteLn(W); Texts.Append(N.text, W.buf); Boards.Poste(F.board, N); END END New; PROCEDURE Open*; VAR S: Texts.Scanner; V: MenuViewers.Viewer; X, Y: INTEGER; B: Boards.Board; menuF: TextFrames.Frame; mainF: BoardFrames.Frame; text: Texts.Text; beg, end, time: LONGINT; BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); IF ((S.class = Texts.Char) & (S.c = "^")) OR (S.class # Texts.Name) THEN S.s := "Boards.Board"; Oberon.GetSelection(text, beg, end, time); IF time >= 0 THEN (* selection exists *) Texts.OpenScanner(S, text, beg); Texts.Scan(S); END; END; NEW(B); Boards.Open(B, S.s); menuF := TextFrames.NewMenu(S.s, "System.Close System.Copy System.Grow PostIt.New PostIt.Store"); mainF := BoardFrames.New(B, 0, 0); Oberon.AllocateUserViewer(Oberon.Mouse.X, X, Y); V := MenuViewers.New(menuF, mainF, TextFrames.menuH, X, Y); END Open; PROCEDURE Store*; VAR V: Viewers.Viewer; S: Texts.Scanner; text: Texts.Text; beg, end, time: LONGINT; BEGIN V := Oberon.Par.vwr; IF Oberon.Par.frame = V.dsc THEN (* command executed from menu frame *) IF (V.dsc # NIL) & (V.dsc.next IS BoardFrames.Frame) THEN Texts.OpenScanner(S, Oberon.Par.text, 0); Texts.Scan(S); IF S.class = Texts.Name THEN Backup(S.s); Boards.Store(V.dsc.next(BoardFrames.Frame).board, S.s); PutStr("PostIt.Store: ",S.s) ELSE PutStr("PostIt.Store: ","illegal name"); END ELSE PutStr("PostIt.Store: ","not a board viewer"); END ELSE (*command executed from frame other than menu *) V := Oberon.MarkedViewer(); IF (V.dsc # NIL) & (V.dsc.next IS BoardFrames.Frame) THEN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); IF ((S.class = Texts.Char) & (S.c = "^")) OR (S.class # Texts.Name) THEN S.s := "Boards.Board"; Oberon.GetSelection(text, beg, end, time); IF time >= 0 THEN (* selection exists *) Texts.OpenScanner(S, text, beg); Texts.Scan(S) END END; Backup(S.s); Boards.Store(V.dsc.next(BoardFrames.Frame).board, S.s); PutStr("PostIt.Store: ",S.s); ELSE PutStr("PostIt.Store: ","not a board viewer") END END END Store; BEGIN Texts.OpenWriter(W); END PostIt.