<> <> DIRECTORY <> <> <> <> ViewerSpecs, ViewerOps, Containers, Imager, ImagerBasic, MessageWindow, PressScreen, Menus, <> Rope, <> ViewerClasses; menutest: CEDAR PROGRAM IMPORTS -- Interpreter, AMBridge, -- Containers, Imager, Menus, --VFonts, -- --MenusPrivate, -- MessageWindow, PressScreen, Rope = BEGIN c: Containers.Container; earsH: INTEGER = ViewerSpecs.menuHeight; earsW: INTEGER = 16; pEars: bitmapArray _ [ 000000B, 034070B, 076174B, 076174B, 076174B, 077774B, 037760B, 007760B, 007760B, 007760B, 003700B, 001600B ]; pFlag: bitmapArray _ [ 000000B, 000000B, 152400B, 177777B, 152400B, 177777B, 100001B, 177777B, 100001B, 177777B, 100001B, 177777B ]; bitmapArray : TYPE = ARRAY [0..earsH) OF UNSPECIFIED; DoRedraw: PROC = { <> <> RETURN; -- until we convert the commander <<[temp, ----, ----] _ Interpreter.Evaluate["ViewerOpsImplB.PaintEverything"];>> <> <> < {>> <> <> <> <<};>> < MessageWindow.Append["wrong type!!"]; >> }; Mynotify: ViewerClasses.NotifyProc = { <<[self: Viewer, input: LIST OF REF ANY] >> FOR current: LIST OF REF ANY _ input, current.rest UNTIL current = NIL DO SELECT current.first FROM $A12 => MessageWindow.Append["container menu 12 hit", TRUE]; $A13 => MessageWindow.Append["container menu 13 hit", TRUE]; $A14 => MessageWindow.Append["container menu 14 hit", TRUE]; $A21 => MessageWindow.Append["container menu 21 hit", TRUE]; $A22 => MessageWindow.Append["container menu 22 hit", TRUE]; $A23 => MessageWindow.Append["container menu 23 hit", TRUE]; $LEFTPRESS => { MessageWindow.Append["LEFTPRESS hit", TRUE]; TRUSTED {PressScreen.PressScreen[PressScreen.NewPressName[], leftSide];}; }; $MIDDLEPRESS => { MessageWindow.Append["MIDDLEPRESS hit", TRUE]; TRUSTED {PressScreen.PressScreen[PressScreen.NewPressName[], bothSides];}; }; $RIGHTPRESS => { MessageWindow.Append["RIGHTPRESS hit", TRUE]; TRUSTED {PressScreen.PressScreen[PressScreen.NewPressName[], rightSide];}; }; $repaint => { MessageWindow.Append["container menu 24 hit, REDRAW", TRUE]; DoRedraw[]; }; $A31 => MessageWindow.Append["container menu 31 hit", TRUE]; $A32 => MessageWindow.Append["container menu 32 hit", TRUE]; $A33 => MessageWindow.Append["container menu 33 hit", TRUE]; $A34 => MessageWindow.Append["container menu 34 hit", TRUE]; $A35 => MessageWindow.Append["container menu 35 hit", TRUE]; $A36 => MessageWindow.Append["container menu 36 hit", TRUE]; ENDCASE => ERROR; ENDLOOP; }; myDrawingRec: Menus.DrawingRec ~ [myDrawingProc, "M23M"]; myDrawingRec2: Menus.DrawingRec ~ [myDrawingProc2, "M23M"]; myUnGuardingRec: Menus.UnGuardRec ~ [myUnGuardingProc, "hello"]; OctRep: TYPE = RECORD[x: REAL, y: REAL, radius: REAL]; <> <<{ >> <> <<>> <> <> <<>> <> <> <> <> <> <> <> <> <> <<>> <> <<>> <<}; >> myUnGuardingProc: Menus.UnGuardProc = { MessageWindow.Append[Rope.Cat["unguardproc called with -->", NARROW[clientData,Rope.ROPE]]]; }; myDrawingProc: Menus.DrawingProc = { p: Imager.IntPair; IF op = query THEN RETURN[earsW]; p _ Imager.GetIntCP[ctx]; TRUSTED {Imager.MaskBits[ctx, @pEars, 1, [p.x,p.y, earsW, earsH], [p.x,p.y, earsW, earsH] ]}; }; myDrawingProc2: Menus.DrawingProc = { p: Imager.IntPair; IF op = query THEN RETURN[earsW]; p _ Imager.GetIntCP[ctx]; TRUSTED {Imager.MaskBits[ctx, @pFlag, 1, [p.x,p.y, earsW, earsH], [p.x,p.y, earsW, earsH] ]}; }; <> <> <> <> <> <> <> <> <> <<>> <> <<[op: ViewerClasses.MenuEntryDisplayOp, ctx: Imager.Context _ NIL, clientData: REF ANY _ NIL] RETURNS[width: INTEGER _ 64]>> <> <

> <> <> <> <<>> <> <> <> <> <<}>> <> <> <> <<}>> <> <> <> <<}; >> <> <<>> <> <<>> <<>> <> <> <> <

> <> <> <> <<>> <<};>> <<>> <<-- note: this should be read from a file, but FIleIO hasn't been converted to the new world yet.>> <<>> myMenuDescription: Rope.ROPE = " [ m1 breakBefore: FALSE [printScreen => [leftup => $LEFTPRESS] [allnonshifTS => $MIDDLEPRESS] [allshifTS => $RIGHTPRESS] ] [Save display: \"2--putupmenuThree\" => [ all makeActive: \"m3\" => $A12 ] ] [Sort display: threeputdownmenuThree => [ all makeInActive: \"m3\" => $A13 ] ] [DisplayErrors display: \"4, toggles menu 2 puts up menu 3\" => [ [all] makeActive: \"m3\" toggle: \"m2\" => $A14 ] ] ] [ m2 beginsActive: TRUE breakBefore: FALSE [Save => $A21] [Compile => $A22] [RepaintViewers => $repaint] [Sort => $A23] ] [ m3 beginsActive: TRUE breakBefore: FALSE breakAfter: TRUE [ThisHasLongMenuButtons => $A31] [ThisHasLongMenuButtons => $A32] [ThisHasLongMenuButtons => $A33] [ThisHasLongMenuButtons => $A34] [ThisHasLongMenuButtons => $A35] [ThisHasLongMenuButtons => $A36] ] RElabel[ Sort LetsSort ] relabel [ m2 Save MenuTwoSave ] "; menus: LIST OF Menus.Menu _ Menus.ParseDescription[myMenuDescription]; <> <<[name: "m1",>> <> <> <> <> <> <<["printScreen", FALSE, NIL, LIST[>> <<[LIST[leftup], LIST[$LEFTPRESS], "DOC", "", NIL, NIL, NIL],>> <<[LIST[middleup], LIST[$MIDDLEPRESS], "DOC", "", NIL, NIL, NIL],>> <<[LIST[rightup], LIST[$RIGHTPRESS], "DOC", "", NIL, NIL, NIL],>> <<] ],>> <<["Save", FALSE, "2--putupmenuThree", LIST[>> <<[LIST[all], LIST[$A12], "DOC", "", LIST["m3"], NIL, NIL] >> <<] ],>> <<["Sort", FALSE, "3--putdownmenuThree", LIST[>> <<[LIST[all], LIST[$A13], "DOC", "", NIL, LIST["m3"], NIL] >> <<] ],>> <<["DisplayErrors", FALSE, "4, toggles menu 2 puts up menu 3", LIST[>> <<[LIST[all], LIST[$A14], "DOC ", "", LIST["m3"], NIL, LIST["m2"]],>> <<] ]>> <<]>> <<],>> <<>> <<>> <<[name: "m2",>> <> <> <> <> <> <<["Search", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A21], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["Compile", FALSE, NEW[Menus.DrawingRec _ myDrawingRec], LIST[>> <<[LIST[all], LIST[$A22], "DOC", "", NIL, NIL, NIL] >> <<] ],>> <<["RepaintViewers", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$repaint], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["StartSession", FALSE, --NIL-- NEW[Menus.DrawingRec _ myDrawingRec2], LIST[>> <<[LIST[all], LIST[$A23], "DOC", "", NIL, NIL, NIL]>> <<] ]>> <<]>> <<],>> <<>> <<[name: "m3",>> <> <> <> <> <> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A31], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A32], "DOC", "", NIL, NIL, NIL] >> <<] ],>> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A33], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A34], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A35], "DOC", "", NIL, NIL, NIL]>> <<] ],>> <<["ThisHasLongMenuButtons", FALSE, NIL, LIST[>> <<[LIST[all], LIST[$A36], "DOC", "", NIL, NIL, NIL]>> <<] ]>> <<]>> <<]>> <<] ;-- end list of type ViewerMenus>> <<>> c _ Containers.Create[[name: "#4 Empty PROTECTED Container #4", guardDestroy: TRUE]]; FOR m: LIST OF Menus.Menu _ menus, m.rest UNTIL m = NIL DO Menus.RegisterMenu[m.first]; Menus.AddMenu[c, m.first.name, FALSE]; ENDLOOP; c _ Containers.Create[[name: "#5 Empty PROTECTED Container #5", guardDestroy: TRUE]]; FOR m: LIST OF Menus.Menu _ menus, m.rest UNTIL m = NIL DO Menus.AddMenu[c, m.first.name, FALSE]; ENDLOOP; c _ Containers.Create[[name: "#6 Empty PROTECTED Container #6", guardDestroy: TRUE]]; FOR m: LIST OF Menus.Menu _ menus, m.rest UNTIL m = NIL DO Menus.AddMenu[c, m.first.name, FALSE]; ENDLOOP; END.