DIRECTORY DB, Icons USING [IconFlavor], MBQueue USING [Queue], Nut USING [NutType], Buttons, Menus, Rope, ViewerClasses, VFonts; NutViewer: CEDAR DEFINITIONS IMPORTS VFonts = BEGIN OPEN DB; Viewer: TYPE = ViewerClasses.Viewer; ROPE: TYPE = Rope.ROPE; Queue: TYPE = MBQueue.Queue; iconAttribute: Attribute; Message: PUBLIC PROC[v: Viewer, msg1, msg2, msg3, msg4: ROPE_ NIL]; Error: PUBLIC PROC[v: Viewer, msg1, msg2, msg3, msg4: ROPE_ NIL]; MessageRope: PUBLIC PROC[v: Viewer, msg: ROPE_ NIL]; Initialize: PROC[parent: Viewer] RETURNS [nV: Viewer]; MakeLabel: PROC[name: ROPE, sib: Viewer, newLine: BOOL_ FALSE] RETURNS [nV: Viewer]; MakeTextViewer: PROC[sib: Viewer, w: INTEGER_ 0, fullLine: BOOL_ FALSE] RETURNS [nV: Viewer]; MakeButton: PROC[q: Queue, name: ROPE, proc: Buttons.ButtonProc, sib: Viewer, data: REF ANY_ NIL, border: BOOL_ FALSE, width: INTEGER_ 0, guarded: BOOL_ FALSE, font: VFonts.Font _ VFonts.defaultFont, newLine: BOOL_ FALSE] RETURNS [nV: Viewer]; MakeMenuEntry: PROC[q: Queue, name: ROPE, proc: Menus.MenuProc, clientData: REF ANY_ NIL, documentation: REF ANY_ NIL, fork: BOOL_ TRUE, guarded: BOOL_ FALSE] RETURNS[Menus.MenuEntry]; MakeTypescript: PROC[sib: Viewer] RETURNS [ts: Viewer]; MakeRuler: PROC[sib: Viewer, h: INTEGER_ 1] RETURNS [r: Viewer]; MakeBigTextBox: PUBLIC PROC[sib: Viewer, contents: ROPE] RETURNS [nV: Viewer]; DBQueue: PROC RETURNS[Queue]; NextTextViewer: PROC[sib: Viewer] RETURNS [nV: Viewer] = INLINE { RETURN[MakeTextViewer[sib, , TRUE]]}; NextRightTextViewer: PROC[sib: Viewer, w: INTEGER] RETURNS [nV: Viewer] = INLINE { RETURN[MakeTextViewer[sib, w, FALSE]]}; DBNotifier: PUBLIC PROC [q: MBQueue.Queue]; DefaultFreezeProc: Menus.MenuProc; ProcessSelection: Buttons.ButtonProc; FieldHandle: TYPE = REF FieldObject; FieldObject: TYPE = RECORD[ tuple: Relship, attribute: Attribute ]; FindViewerForEntity: PROCEDURE[e: Entity, segment: Segment _ NIL] RETURNS[viewer: ViewerClasses.Viewer]; ConvertViewerToEntity: PROCEDURE[v: ViewerClasses.Viewer, create: BOOL _ TRUE] RETURNS[e: Entity, name: ROPE]; GetNutInfo: PROC[v: Viewer] RETURNS[segment: Segment, domain: Domain, entity: ROPE]; ToolViewer: Rope.ROPE; -- the name of the tool viewer domain used in Find and Convert TextViewer: Rope.ROPE; -- the name of the text viewer domain used in Find and Convert SetIcon: PROC[e: Entity, iconFile: ROPE, fileIndex: CARDINAL]; NewIcon: PROC[file: ROPE, index: CARDINAL] RETURNS[Icons.IconFlavor]; GetIcon: PROC[e: Entity, seg: DB.Segment _ NIL] RETURNS[Icons.IconFlavor]; GetIconFromName: PROC[ name: ROPE ] RETURNS[Icons.IconFlavor]; FindViewer: PROC[type: Nut.NutType, domain: Domain, eName: ROPE, seg: Segment] RETURNS[Viewer]; FindSpawned: PROC[v: Viewer] RETURNS[Viewer]; SetSpawned: PROC[parent, spawned: Viewer]; END. :File: NutViewer.mesa Contents: Handy Squirrel procedures for building database application Viewers. Created by: Rick Cattell on 11-Dec-81 12:29:29 Last edited by: Cattell, July 5, 1983 4:48 pm Willie-Sue on: January 21, 1983 8:48 am Donahue, July 29, 1983 9:41 am ******************************************************************** Message procedures for interacting with user (in NutViewerMiscImpl.mesa). ******************************************************************** If the top level viewer in which v is nested has a $Typescript property, then prints the concatenated values msg1 through msg4 on the stream that is the value of that property. Otherwise, if the Squirrel window is on the screen, prints the messages in the Squirrel window. Otherwise, sprint the messages in the Message area. Same as Message proc above, but blinks the screen first. Prints the given msg as with Message proc above, but without CR. ******************************************************************** Handy procedures for dealing with viewers (in NutViewerMiscImpl.mesa). These procedures can be used by applications to created menus, buttons, labels, and text viewers which are automatically placed at the next x/y position in the parent viewer. In the case of menus and buttons, they are automatically given a top-level catch phrase for database errors and are synchronized with an MBQueue specified as argument. A default MBQueue may be used, or the synchronization and catch phrases may be omitted by passing a NIL MBQueue. Some examples of the use of these procedures: nV: Viewer_ Initialize[parent]; nV_ MakeButton[DBQueue[], "Name: ", SelectProc, nV]; (Makes button on top line) nV_ MakeTextViewer[sib: nV, fullLine: FALSE]; (Make text label on same line) []_ MakeTypeScript[nV]; (Make a typescript at the end of the window). ******************************************************************** Initializes a viewer so that MakeButton, MakeLabel, MakeTextViewer, etc., may be used. The argument nV returned is passed along through each call to keep track of sibling pos'n, e.g.: nV_ MakeLabel["Foo", nV]. The sib is a viewer to the left or above the label to be made, according to newLine. Creates a text viewer, next right on the same line as v, or full width of next line if fullLine=TRUE Creates a new button, to the right or below sib, according to newLine. Creates a menu entry, suitable to use as follows: Menus.AppendMenuEntry[myMenu, MakeMenuEntry[...]]. Main purpose of this procedure is to allow menu items to be queued. The sib is sibling to create TS after, this must be last child of non-NIL sib.parent. Put a h-bit wide line after sib. We assume sib.parent#NIL. Makes editable text viewer taking rest of sib.parent's viewer, suitable for msg body or whatever. The sib is a sibling to create text box after, this must be last child of sib.parent. Again, we assume sib.parent#NIL. Returns Squirrel's default Queue. E.g., can be used as follows: nV _ MakeButton[DBQueue[], "Foo", FooProc, nV]. Backwards compatible: creates text viewer on line following sib, full width of sib.parent Backwards compatible: creates a text viewer, next right on the same line as v The notifier for database actions; tries to recover from DB.Error[Nullfied] and DB.Aborted, calling Message procedure above to notify user. This notifier is automatically used on any buttons created using AnotherButton below, if defaultDBQueue is used. A standard proc for freezing a Nut (make it not reuseable). A standard ButtonProc that assumes the button's REF ANY data is the FieldHandle above. Insures attribute of tuple is entity-valued and non-NIL, then calls Nut.Display on it. ***************** Mapping between entities and viewers ******************* Tries to find a viewer displaying the given entity. Guesses at an appropriate entity for the given viewer. Returns the name (in DBNames format) if the entity would be in a segment that is not open. If the entity is a ToolViewer or a TextViewer, then it will be added to the database if create is TRUE; otherwise it will simply return the name Returns segment, domain, and entity name (if any) using the $Segment, $Domain, and $Entity properties set up by the [default] create proc. ***************** Icon management (NutViewerIconImpl) ******************* sets an icon for an entity or a domain gets e's icon, else gets DomainOf[e]'s icon, else returns the acorn icon assumes the name is in the form produced by DBNames; same result as GetIcon, but works if the entity doesn't exist ***************** Nut Viewers (NutViewerPrivateImpl) ******************* ********************************************************** ʘJ˜Jšœ™JšœO™OJšœ.™.Jšœ™Jšœ™Jšœ'™'Jšœ™J˜šÏk ˜ Jšœ˜Jšœœ˜Jšœœ ˜Jšœœ ˜J˜,J˜—šœ œ œ˜Jšœ ˜J˜—Jšœœœ˜J˜Jšœœ˜$Jšœœœ˜Jšœœ˜J˜J˜J˜JšœD™DJšœI™IJšœD™DJ˜š Ïnœœœ$œœ˜CJšœM™MJšœP™PJšœQ™QJšœU™UJ˜—š žœœœ$œœ˜AJšœ8™8J˜—š ž œœœœœ˜4Jšœ@™@J˜J˜—JšœD™DJšœF™FJšœY™YJšœU™UJšœW™WJšœO™OJšœN™NJšœP™PJšœ™JšœO™OJšœL™LJšœE™EJšœD™DJ˜šž œœœ˜7JšœV™VJšœZ™ZJšœ™J˜—š ž œœœœœœ˜TJšœT™TJ˜—š žœœœœœœ˜]JšœS™SJšœ™J˜—šž œœœ/œœœ œœ œœœ3œœœ˜óJšœF™FJ˜—šž œœœ$œœœœœœœœ œœœ˜¸Jšœ1™1Jšœ2™2JšœC™CJ˜—šžœœœ˜7JšœU™UJ˜—šž œœœœ ˜@Jšœ;™;J˜—š žœœœœœ˜NJšœX™XJšœ`™`Jšœ ™ J˜—šžœœœ˜Jšœ@™@Jšœ/™/J˜—šžœœœœ˜BJšœY™YJšœœ˜%J˜—š žœœœœœ˜RJšœM™MJšœœ˜'J˜—šž œœœ˜+Jšœ[™[Jšœ[™[JšœE™EJ˜—˜"Jšœ;™;J˜—˜%JšœV™VJšœV™VJ˜—Jšœ œœ ˜$Jšœ œœ)˜CJ˜J˜JšœJ™JJ˜šžœ œœœ˜hJšœ3™3J˜—š žœ œ"œœœœ˜nJšœ6™6JšœP™PJšœV™VJšœE™EJ˜—šž œœ œ+œ˜TJšœR™RJšœ7™7J˜—JšœœÏc>˜VJ˜JšœœŸ>˜UJ˜J˜JšœI™IJ˜šžœœœ œ˜>Jšœ&™&J˜—Jš žœœœ œœ˜EJ˜š žœœœ œœ˜JJšœH™HJ˜—šžœœœœ˜>JšœP™PJšœ!™!J˜—JšœH™HJ˜Jšž œœ+œœ ˜_J˜Jšž œœ œ ˜-J˜Jšž œœ˜*J˜Jšœ:™:J˜Jšœ˜J˜J˜—…— #I