MenusPrivate.mesa; Written by S. McGregor
Edited by McGregor on July 21, 1983 10:43 am
Last Edited by: Maxwell, December 17, 1982 9:59 am
Last Edited by: Pausch, August 17, 1983 4:38 pm
DIRECTORY
Imager USING [Context],
Menus USING [Entry, MenuEntryTrigger],
Process USING [Milliseconds],
Rope USING [ROPE],
TIPUser USING [TIPScreenCoords],
ViewerClasses USING [NotifyProc, Viewer];
MenusPrivate: CEDAR DEFINITIONS = BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;
Implementor private stuff
menuHLeading: INTEGER = 5; -- white space before first entry
menuHSpace: INTEGER = 12; -- white space between entries
InternalFormatMenuRef: TYPE = REF InternalFormatMenu;
InternalFormatMenu: TYPE = RECORD[
This data structure is used internally because pointers to the Entry fields are needed for the common representation to be accessed by the different menus that reference it. When a user registers a menu, a data structure of this type is created, differing only in that 'entries' is a LIST OF EntryRef, not a list of Entry.
name: ROPE,
beginsActive: BOOLEANTRUE,
breakBefore: BOOLEANTRUE,
breakAfter: BOOLEANTRUE,
notify: ViewerClasses.NotifyProc ← NIL,
entries: LIST OF EntryRef ← NIL
];
EntryRef: TYPE = REF Menus.Entry;
ViewerMenus: TYPE = REF ViewerMenusRec;
ViewerMenusRec: TYPE = RECORD [
x: INTEGER ← 0,  -- lower-left hand corner of entire menu area of viewer
y: INTEGER ← 0,  -- the x and y are RELATIVE to the viewer.
w: INTEGER ← 0,  -- width of entire menu area of viewer
h: INTEGER ← 0,  -- height
list: LIST OF ViewerMenu ← NIL,
inverted: EntryState ← NIL
];
ViewerMenu: TYPE = REF ViewerMenuRec;
ViewerMenuRec: TYPE = RECORD [
commonData: InternalFormatMenuRef , -- data common to all instances of the menu
entries: LIST OF EntryState ← NIL,
active: BOOLEANTRUE
];
EntryState: TYPE = REF EntryStateRec;
EntryStateRec: TYPE = MONITORED RECORD [
width: INTEGER ← 0,
xPos: INTEGER ← 0,
yPos: INTEGER ← 0,
greyed: BOOLFALSE,
guardState: GuardState ← armed,
commonData: EntryRef ← NIL
];
GuardState: TYPE = { guarded, arming, armed };
armingTime: Process.Milliseconds = 100; -- cover removal time.
armedTime: Process.Milliseconds = 5000; -- unguarded interval.
MarkMenu: PROC [menus: ViewerMenus, parent: Viewer, mousePos: TIPUser.TIPScreenCoords];
to be called when the mouse is pressed down over a menu, the proper inverse-video stuff is done.
HitMenu: PROC [menus: ViewerMenus, parent: Viewer, mousePos: TIPUser.TIPScreenCoords, trigger: Menus.MenuEntryTrigger] ;
ClearMenu: PROC [menus: ViewerMenus, parent: Viewer, paint: BOOLTRUE] ;
DrawMenu: PROC [v: Viewer, menus: ViewerMenus, context: Imager.Context, whatChanged: REF ANYNIL];
ViewerlessAddMenu: PROC [name: ROPE, addBefore: ROPENIL, paint: BOOLTRUE];
provided for convenience of BuildWindowMenus in WindowManagerImpl
ReComputeMenus: PROC [v: Viewer] RETURNS[heightDelta: INTEGER];
ReComputeWindowMenus: PROC [v: Viewer, guard: BOOL, color: BOOL];
this will reset all fields in the data structure, including position and size of each entry.
Debug: PROC [msg: ROPE, waitForLeftShift: BOOLTRUE, level: INTEGER ← 1];
AlterDebuggingLevel: PROC [amount: INTEGER, relative: BOOLTRUE];
END.