DIRECTORY Atom, BiScrollers, GGInterfaceTypes, GGUserInput, GGProps, InputFocus, IO, PropRegistry, Rope, ViewerClasses; GGRegistryImpl: CEDAR PROGRAM IMPORTS Atom, BiScrollers, GGUserInput, InputFocus, PropRegistry, Rope = BEGIN Viewer: TYPE = ViewerClasses.Viewer; GGData: TYPE = GGInterfaceTypes.GGData; STREAM: TYPE = IO.STREAM; ROPE: TYPE = PropRegistry.ROPE; Doc: TYPE = PropRegistry.Doc; Key: TYPE = PropRegistry.Key; lf: ROPE = "\l"; noFocus: ROPE = "No input focus in any viewer"; noGGFocus: ROPE = "No input focus in Gargoyle viewer"; LFNewLine: PROC [in: ROPE] RETURNS [out: ROPE] = { IF in#NIL THEN { size: INT = Rope.Size[in]; out ¬ in; FOR index: INT ¬ Rope.SkipTo[s: in, pos: 0, skip: "\l\r"], Rope.SkipTo[s: in, pos: index+1, skip: "\l\r"] UNTIL index = size DO out ¬ Rope.Replace[base: out, start: index, len: 1, with: lf]; ENDLOOP; }; }; GGPropGet: PropRegistry.PropGetProc = { lor: LIST OF ROPE; extRef: GGUserInput.External; ggData: GGData; focus: InputFocus.Focus ¬ InputFocus.GetInputFocus[]; from: Viewer ¬ IF focus#NIL THEN focus.owner ELSE NIL; IF from=NIL THEN RETURN [NIL, noFocus]; ggData ¬ NARROW[BiScrollers.ClientDataOfViewer[from]]; IF ggData=NIL THEN RETURN [NIL, noGGFocus]; extRef ¬ NEW[GGUserInput.ExternalRec ¬ [FALSE, key] ]; -- pass in Key GGUserInput.EventNotify[ggData, LIST[$GetPropExternal, extRef] ]; UNTIL extRef.valid DO GGUserInput.WaitExternal[extRef] ENDLOOP; lor ¬ NARROW[extRef.results]; prop ¬ LFNewLine[lor.first]; error ¬ LFNewLine[lor.rest.first]; }; GGPropList: PropRegistry.PropListProc = { extRef: GGUserInput.External; ggData: GGData; focus: InputFocus.Focus ¬ InputFocus.GetInputFocus[]; from: Viewer ¬ IF focus#NIL THEN focus.owner ELSE NIL; IF from=NIL THEN RETURN [NIL]; ggData ¬ NARROW[BiScrollers.ClientDataOfViewer[from]]; IF ggData=NIL THEN RETURN [NIL]; extRef ¬ NEW[GGUserInput.ExternalRec ¬ [] ]; GGUserInput.EventNotify[ggData, LIST[$ListPropsExternal, extRef] ]; UNTIL extRef.valid DO GGUserInput.WaitExternal[extRef] ENDLOOP; props ¬ NARROW[extRef.results]; }; GGPropRem: PropRegistry.PropRemProc = { ggData: GGData; focus: InputFocus.Focus ¬ InputFocus.GetInputFocus[]; from: Viewer ¬ IF focus#NIL THEN focus.owner ELSE NIL; IF from=NIL THEN RETURN; ggData ¬ NARROW[BiScrollers.ClientDataOfViewer[from]]; IF ggData=NIL THEN RETURN; GGUserInput.EventNotify[ggData, LIST[$RemoveProp, Atom.GetPName[key]] ]; }; GGPropSet: PropRegistry.PropSetProc = { keyVal: Rope.ROPE; ggData: GGData; focus: InputFocus.Focus ¬ InputFocus.GetInputFocus[]; from: Viewer ¬ IF focus#NIL THEN focus.owner ELSE NIL; IF from=NIL THEN RETURN; ggData ¬ NARROW[BiScrollers.ClientDataOfViewer[from]]; IF ggData=NIL THEN RETURN; keyVal ¬ Rope.Cat[Atom.GetPName[key], " ", prop]; -- that's what GG wants GGUserInput.EventNotify[ggData, LIST[$SetProp, keyVal] ]; }; GGGetTarget: PropRegistry.GetTargetProc = { success ¬ TRUE; -- LIE FOR NOW }; GGSetTarget: PropRegistry.SetTargetProc = { success ¬ TRUE; -- LIE FOR NOW }; GGValidateTarget: PropRegistry.ValidateTargetProc = { v: ViewerClasses.Viewer ~ NARROW[doc]; success ¬ NOT (v.destroyed OR v.iconic); IF NOT success THEN error ¬ IF v.destroyed THEN "target viewer destroyed" ELSE "target viewer iconic" }; RegisterGG: PROC = { class: PropRegistry.RegistryClass ¬ NEW[PropRegistry.RegistryClassObj]; class­¬ [ name: $ActionArea, getProp: GGPropGet, setProp: GGPropSet, remProp: GGPropRem, listProps: GGPropList, getTarget: GGGetTarget, setTarget: GGSetTarget, validTarget: GGValidateTarget ]; PropRegistry.Register[class]; }; RegisterGG[]; END. Θ GGRegistryImpl.mesa Copyright Σ 1991, 1992 by Xerox Corporation. All rights reserved. Kenneth A. Pier, July 7, 1992 10:11 am PDT PROC [key: Key, doc: Doc, hint: REF] RETURNS [prop, error: ROPE]; extRef action type triggers BROADCAST when completed GetPropExternal returns LIST[prop, error] in extRef.results PROC [doc: Doc, hint: REF] RETURNS [props: LIST OF Key]; extRef action type triggers BROADCAST when completed ListPropsExternal returns LIST OF ATOM in extRef.results PROC [key: Key, doc: Doc, hint: REF, edited: BOOL]; no need for special RemPropExternal since nothing is returned PROC [key: Key, doc: Doc, hint: REF, prop: ROPE, edited: BOOL]; no need for special SetPropExternal since nothing is returned PROC [doc: Doc, hint: REF] RETURNS [success: BOOL, t: Target]; RETURN [FALSE, [NIL, NIL]]; PROC [doc: Doc, hint: REF, t: Target] RETURNS [success: BOOL, error: ROPE]; PROC [doc: Doc, hint: REF, t: Target] RETURNS [success: BOOL, error: ROPE]; Κχ•NewlineDelimiter –(cedarcode) style™šœ™Jšœ Οeœ7™BJ™*J™—codešΟk ˜ KšœGžœ$˜m—K˜šΟnœžœž˜KšžœBž˜N—K˜Kšœžœ˜$Kšœžœ˜'Kšžœžœžœžœ˜Kšžœžœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ žœ"˜/Kšœ žœ'˜6K˜š Ÿ œžœžœžœžœ˜2šžœžœžœ˜Kšœžœ˜K˜ •StartOfExpansion)[s: ROPE, pos: INT _ 0, skip: ROPE]šžœžœ\žœž˜K˜>Kšžœ˜—K˜—K˜—K˜šŸ œ˜'Kšžœžœžœžœ™AKšœžœžœžœ˜Kšœ˜Kšœ˜K˜5Kš œžœžœžœ žœžœ˜6Kš žœžœžœžœžœ ˜'Kšœ žœ'˜6Kš žœžœžœžœžœ ˜+Kšœ žœžœ Οc˜EKšœ žœΟbœ ˜Ašžœžœ ‘ œ žœ˜?Kš 4™4—šœžœ˜Kš‘œ,™;—K˜K˜"K˜K˜—šŸ œ˜)Kš žœžœžœ žœžœ™8Kšœ˜Kšœ˜K˜5Kš œžœžœžœ žœžœ˜6Kš žœžœžœžœžœ˜Kšœ žœ'˜6Kš žœžœžœžœžœ˜ Kšœ žœ ˜,šœ žœ‘œ ˜CKš 4™4—šžœžœ ‘ œ žœ˜?Kš‘œ'™8—Kšœžœ˜K˜K˜—šŸ œ˜'Kšžœžœ žœ™3Kšœ˜K˜5Kš œžœžœžœ žœžœ˜6Kšžœžœžœžœ˜Kšœ žœ'˜6Kšžœžœžœžœ˜šœ žœ‘ œ˜HK™=—K˜K˜—šŸ œ˜'Kšžœžœžœ žœ™?Kšœ žœ˜Kšœ˜K˜5Kš œžœžœžœ žœžœ˜6Kšžœžœžœžœ˜Kšœ žœ'˜6Kšžœžœžœžœ˜Kšœ2 ˜Išœ žœ˜9K™=—K˜K˜—šŸ œ ˜+Kšžœžœžœ žœ ™>Kšœ žœ Πbc ˜Kšžœžœžœžœ™K˜K˜—šŸ œ ˜+Kš žœžœ žœ žœ žœ™KKšœ žœ ’ ˜K˜K˜—šŸœ%˜5Kš žœžœ žœ žœ žœ™KKšœžœ˜&Kšœ žœžœ ˜(Kš žœžœ žœ žœ žœžœ˜eK˜—K˜šŸ œžœ˜Kšœ$žœ ˜G˜ Kšœ˜K˜K˜Kšœ˜K˜K˜K˜K˜K˜—Kšœ˜K˜—K˜Kšœ ˜ K˜Kšžœ˜—…— β‘