ð¡Syntax10.Scn.FntõÿÿÿÐÝðIStampElemsAlloc23 Nov 95eSyntax10b.Scn.Fnt ";)ºüÿÿ€8ÀÔFoldElemsNew#Syntax10.Scn.Fnt$$ VAR copy: Elem; par: Oberon.ParList; res: INTEGER; BEGIN WITH e: Elem DO WITH msg: Texts.CopyMsg DO IF msg.e = NIL THEN NEW(copy); msg.e := copy END; COPY(e.cmd, copy.cmd); PopupElems.Handle(e, msg) | msg: Texts.FileMsg DO PopupElems.Handle(e, msg); IF msg.id=Texts.load THEN Files.ReadString(msg.r, e.cmd) ELSIF msg.id=Texts.store THEN Files.WriteString(msg.r, e.cmd) END | msg: TextFrames.DisplayMsg DO PopupElems.Handle(e, msg); IF ~msg.prepare THEN e.host := msg.frame END; | msg: Texts.IdentifyMsg DO msg.mod := "CommandElems"; msg.proc := "Alloc" | msg: PopupElems.ExecMsg DO NEW(par); par.frame := e.host; par.text := e.menu; par.pos := msg.pos; Oberon.Call(e.cmd, par, FALSE, res) ELSE PopupElems.Handle(e, msg) END END END Handle; ÿÿÿÿ€8ÀÔ ƒÿÿÿ€8ÀÔ#Syntax10.Scn.Fnt[[ VAR e: Elem; BEGIN NEW(e); e.handle := Handle; e.host := NIL; Texts.new := e END Alloc; ÿÿÿÿ€8ÀÔ Ëþÿÿ€8ÀÔ#Syntax10.Scn.Fnt VAR msg: TextFrames.InsertElemMsg; e: Elem; BEGIN NEW(e); e.handle := Handle; In.Open; In.Name(e.name); IF In.Done THEN In.Name(e.cmd); e.small := TRUE; e.menu := TextFrames.Text(""); PopupElems.MeasureMenu(e); msg.e := e; Viewers.Broadcast(msg) END END Insert; ÿÿÿÿ€8ÀÔ pþÿÿ€8ÀÔ#Syntax10.Scn.Fntnn VAR R: Texts.Reader; name: ARRAY N OF CHAR; text: Texts.Text; beg, end, time: LONGINT; BEGIN In.Open; In.Name(name); IF In.Done THEN Oberon.GetSelection(text, beg, end, time); IF time > 0 THEN Texts.OpenReader(R, text, beg); Texts.ReadElem(R); IF (R.elem # NIL) & (R.elem IS Elem) THEN COPY(name, R.elem(Elem).cmd) END END END END SetCmd; ÿÿÿÿ€8ÀÔSyntax12.Scn.FntSyntax10i.Scn.Fnt[ ŽMODULE CommandElems; (* CM  *) IMPORT Display, Files, Texts, TextFrames, Oberon, PopupElems, Viewers, In; CONST N = 32; TYPE Elem* = POINTER TO ElemDesc; ElemDesc* = RECORD (PopupElems.ElemDesc) cmd*: ARRAY N OF CHAR; host: Display.Frame END; PROCEDURE Handle* (e: Texts.Elem; VAR msg: Texts.ElemMsg); PROCEDURE Alloc*; PROCEDURE Insert*; PROCEDURE SetCmd*; END CommandElems. Command Description CommandElems.Insert [^] name cmd name, name of the element. cmd, oberon command which will be executed with the selected line as parameter. CommandElems.SetCmd cmd cmd, assigns the oberon command cmd to the selected CommandElem.