diff -r be1357e3bf7f -r 155310ec83aa MenuEditor.st --- a/MenuEditor.st Mon Jan 05 17:48:53 1998 +0100 +++ b/MenuEditor.st Fri Jan 09 17:07:47 1998 +0100 @@ -12,7 +12,7 @@ -ApplicationModel subclass:#MenuEditor +ToolApplicationModel subclass:#MenuEditor instanceVariableNames:'isModified specClass specCanvas helpCanvas tabSelection aspects slices didInstall' classVariableNames:'' @@ -23,7 +23,7 @@ Object subclass:#Item instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey accessCharaterPos retriever icon iconAndLabel submenuChannel - argument' + argument translateLabel isButton' classVariableNames:'' poolDictionaries:'' privateIn:MenuEditor @@ -70,7 +70,7 @@ SelectionInTreeView [author:] - Claus Atzkern + Claus Atzkern, Thomas Zwick " ! ! @@ -121,46 +121,69 @@ ^ super helpSpec addPairsFrom:#( #accessCharaterPos -'the index of the access character position into the textual label (optional).' +'The index of the access character position +into the textual label (optional).' #argument -'an argument passed to the value method, if the value selector is a one- or two-arg selector (i.e. ends with '':''). The argument is passed as a string.' +'An argument passed to the value method, if the value +selector is a one- or two-arg selector (i.e. ends with '':''). +The argument is passed as a string.' #enbled -'This enabled field specifies the name of the aspect (-method or binding) in your application, which returns a valueHolder holding a boolean, a block which evaluates to either true or false, a selector which returns either true or false or simply true or false.\ The value, true or false, specifies whether the respective field can be selected, a value of true, or not, a value of false.' +'This enabled field specifies the name of the aspect (-method or binding) +in your application, which returns a value holder holding a boolean, +a block which evaluates to either true or false, a selector which returns +either true or false or simply true or false. The value, true or false, +specifies whether the respective field can be selected, a value of true, +or not, a value of false.' #icon -'selector which returns the bitmap to be displayed.' +'Selector which returns an image to be displayed.' #iconAndLabel -'boolean flag to specify that both the bitmap and textual label shall be shown.' +'Boolean flag to specify that both image and textual label shall be shown.' #indication -'This indication field specifies the name of the aspect (-method or binding) in your application, a valueHolder holding a boolean, a block which evaluates to either true or false, a selector which returns either true or false or simply true or false.\ The value, true or false, specifies whether the shown indicator is switched on or off.' +'This indication field specifies the name of the aspect (-method or binding) +in your application, a value holder holding a boolean, a block which evaluates +to either true or false, a selector which returns either true or false or +simply true or false. The value, true or false, specifies whether the shown +indicator is switched on or off.' #label -'the label of the item. If the ''retriever/icon'' is set, and returns a bitmap image, the bitmap is used as the displayed label. Dependent on the state of the ''Icon & Label'' flag, both the bitmap and the label are shown.' +'The label of the item. If the ''retriever/selector'' is set, +and returns an image, the image is used as the displayed label. +Dependent on the state of the ''Image & Label'' flag, both +the image and the label are shown.' #menuSelector -'the name of the selector under which the generated menu should be installed and is accessable.' +'The name of the selector under which the generated +menu should be installed and is accessable.' #nameKey -'a unique identifier of the item (optional)' +'An unique identifier of the item (optional)' #retriever -'the name of the class, which implements the bitmap selector. This selector is specified by ''icon''. If no class is given, the current application should implement the specified bitmap selector.' +'The name of the class, which implements the image selector. +This selector is specified by ''selector''. If no class is given, +the current application should implement the specified image selector.' #seperatorList -'the list of valid separators' +'The list of valid separators' #shortcutKey -'the key to be pressed, to select the menu item from the keyboard (accelerator key).' +'The key to be pressed, to select the menu item from the keyboard (accelerator key).' #submenuChannel -'a value holder, which provides the submenu (Menu) to be opened if the item is selected. Useful if the items submenu is to be changed dynamically.' +'A value holder, which provides the submenu (Menu) to be opened +if the item is selected. Useful if the items submenu is to be +changed dynamically.' #value -'An action which can be either a block or a selector.\ Depending on the number of arguments to the action, the action will be called with the respective arguments. There can either zero, one or two arguments. The first argument to the action is the argument derived from the argument field and the second argument the selected item.' +'An action which can be either a block or a selector. Depending on the number +of arguments to the action, the action will be called with the respective arguments. +There can either zero, one or two arguments. The first argument to the action is the +argument derived from the argument field and the second argument the selected item.' ) ! ! @@ -168,23 +191,21 @@ !MenuEditor class methodsFor:'icons'! iconCreateItem - ^ Painter imageItem + ^ Painter menuItemImage ! iconCreateLink - ^ Painter imageMenuLink + ^ Painter linkSubmenuImage ! iconCreateMenu - ^ Painter imageMenu - - "Modified: 28.7.1997 / 10:02:21 / cg" + ^ Painter closedSubmenuImage ! iconCreateSep - ^ Painter imageSeparator + ^ Painter menuSeparatorImage ! @@ -219,10 +240,13 @@ #(#FullSpec #'window:' #(#WindowSpec - #'name:' 'ClassAndMethodSpec' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'Painter' - #'bounds:' #(#Rectangle 0 0 391 170) + #'name:' 'MenuEditor' + #'layout:' #(#LayoutFrame 197 0 172 0 552 0 258 0) + #'label:' 'MenuEditor' + #'min:' #(#Point 10 10) + #'max:' #(#Point 1152 900) + #'bounds:' #(#Rectangle 197 172 553 259) + #'usePreferredExtent:' false ) #'component:' #(#SpecCollection @@ -230,40 +254,33 @@ #( #(#LabelSpec #'name:' 'classLabel' - #'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) - #'label:' 'class:' + #'layout:' #(#LayoutFrame 0 0.0 4 0 150 0 21 0) + #'label:' 'Class for menu code:' #'adjust:' #right #'resizeForLabel:' true ) #(#LabelSpec #'name:' 'selectorLabel' - #'layout:' #(#AlignmentOrigin 45 0.11 74 0 1 0.5) - #'label:' 'selector:' + #'layout:' #(#LayoutFrame 0 0.0 29 0 150 0 46 0) + #'label:' 'Selector for menu code:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'methodNameField' - #'layout:' #(#LayoutFrame 47 0.11 64 0 0 1.0 86 0) + #'layout:' #(#LayoutFrame 155 0 27 0 0 1.0 49 0) #'tabable:' true #'model:' #methodNameChannel ) - #(#LabelSpec - #'name:' 'boxLabel' - #'layout:' #(#Point 5 10) - #'label:' 'class & selector for code:' - #'adjust:' #left - #'resizeForLabel:' true - ) #(#InputFieldSpec #'name:' 'classNameField' - #'layout:' #(#LayoutFrame 47 0.11 39 0 0 1.0 61 0) + #'layout:' #(#LayoutFrame 155 0 2 0 0 1.0 24 0) #'tabable:' true #'model:' #classNameChannel ) #(#HorizontalPanelViewSpec #'name:' 'commitPanel' - #'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) + #'layout:' #(#LayoutFrame 10 0.0 -29 1.0 -10 1.0 -5 1.0) #'component:' #(#SpecCollection #'collection:' @@ -273,15 +290,15 @@ #'label:' 'cancel' #'tabable:' true #'model:' #cancel - #'extent:' #(#Point 191 24) + #'extent:' #(#Point 163 24) ) #(#ActionButtonSpec #'name:' 'button2' #'label:' 'ok' #'tabable:' true + #'model:' #accept #'isDefault:' true - #'model:' #accept - #'extent:' #(#Point 191 24) + #'extent:' #(#Point 164 24) ) ) ) @@ -293,8 +310,6 @@ ) ) ) - - "Modified: 28.7.1997 / 15:40:15 / cg" ! classDefineSpec @@ -315,56 +330,52 @@ #(#FullSpec #'window:' #(#WindowSpec - #'name:' 'ClassDefineSpec' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'Painter' - #'bounds:' #(#Rectangle 0 0 383 128) + #'name:' 'MenuEditor' + #'layout:' #(#LayoutFrame 197 0 172 0 443 0 265 0) + #'label:' 'MenuEditor' + #'min:' #(#Point 10 10) + #'max:' #(#Point 1152 900) + #'bounds:' #(#Rectangle 197 172 444 266) + #'usePreferredExtent:' false ) #'component:' #(#SpecCollection #'collection:' #( #(#LabelSpec - #'name:' 'classLabel' - #'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5) - #'label:' 'class:' - #'adjust:' #right - #'resizeForLabel:' true - ) - #(#LabelSpec #'name:' 'boxLabel' - #'layout:' #(#Point 5 10) - #'label:' 'class for code:' + #'layout:' #(#LayoutFrame 0 0.0 4 0 0 1.0 24 0) + #'label:' 'Class for menu spec:' #'adjust:' #left #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'classNameField' - #'layout:' #(#LayoutFrame 47 0.11 39 0 0 1.0 61 0) + #'layout:' #(#LayoutFrame 0 0.0 27 0 0 1.0 49 0) #'tabable:' true #'model:' #classNameChannel ) #(#HorizontalPanelViewSpec #'name:' 'commitPanel' - #'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0) + #'layout:' #(#LayoutFrame 10 0.0 -29 1.0 -10 1.0 -5 1.0) #'component:' #(#SpecCollection #'collection:' #( #(#ActionButtonSpec #'name:' 'button1' - #'label:' 'cancel' + #'label:' 'Cancel' #'tabable:' true #'model:' #cancel - #'extent:' #(#Point 187 24) + #'extent:' #(#Point 109 24) ) #(#ActionButtonSpec #'name:' 'button2' - #'label:' 'ok' + #'label:' 'OK' #'tabable:' true + #'model:' #accept #'isDefault:' true - #'model:' #accept - #'extent:' #(#Point 187 24) + #'extent:' #(#Point 109 24) ) ) ) @@ -376,19 +387,17 @@ ) ) ) - - "Modified: 28.7.1997 / 15:40:39 / cg" ! -menuButtons +menu "this window spec was automatically generated by the ST/X MenuEditor" "do not manually edit this - the builder may not be able to handle the specification if its corrupted." " - MenuEditor new openOnClass:MenuEditor andSelector:#menuButtons - (Menu new fromLiteralArrayEncoding:(MenuEditor menuButtons)) startUp + MenuEditor new openOnClass:MenuEditor andSelector:#menu + (Menu new fromLiteralArrayEncoding:(MenuEditor menu)) startUp " @@ -399,79 +408,92 @@ #( #(#MenuItem - #'label:' 'createMenu' - #'value:' #doCreateMenu - #'enabled:' #hasAnySingleSelection - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateMenu - ) + #'label:' 'About' + #'accessCharacterPosition:' 1 + #'labelImage:' #(#ResourceRetriever nil #icon) + #'submenuChannel:' #menuAbout ) #(#MenuItem - #'label:' 'createLink' - #'value:' #doCreateLink - #'enabled:' #hasAnySingleSelection - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateLink - ) - ) - #(#MenuItem - #'label:' 'createItem' - #'value:' #doCreateItem - #'enabled:' #hasAnySingleSelection - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateItem - ) - ) - #(#MenuItem - #'label:' 'createSeparator' - #'value:' #doCreateSep - #'enabled:' #hasAnySingleSelection - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateSep + #'label:' 'File' + #'translateLabel:' true + #'value:' #file + #'accessCharacterPosition:' 1 + #'submenu:' + #(#Menu + + #( + #(#MenuItem + #'label:' 'New' + #'value:' #doNew + ) + #(#MenuItem + #'label:' 'Load From Class...' + #'translateLabel:' true + #'value:' #doFromClass + #'enabled:' #isStandAlone + ) + #(#MenuItem + #'label:' '-' + ) + #(#MenuItem + #'label:' 'Pick A Menu' + #'value:' #doPickAMenu + #'enabled:' #isStandAlone + ) + #(#MenuItem + #'label:' '-' + ) + #(#MenuItem + #'label:' 'Save' + #'value:' #doInstallSpec + ) + #(#MenuItem + #'label:' 'Save Help Spec' + #'value:' #doInstallHelp + #'enabled:' #isStandAlone + ) + #(#MenuItem + #'label:' '-' + ) + #(#MenuItem + #'label:' 'Define Class...' + #'value:' #doDefineClass + #'enabled:' #isStandAlone + ) + #(#MenuItem + #'label:' 'Browse Application Class' + #'value:' #doBrowseAppClass + ) + #(#MenuItem + #'label:' '-' + ) + #(#MenuItem + #'label:' 'Exit' + #'translateLabel:' true + #'value:' #closeRequest + ) + ) nil + nil ) ) #(#MenuItem - #'label:' '' + #'label:' 'Edit' + #'submenuChannel:' #menuPainter ) #(#MenuItem - #'label:' 'stepUp' - #'value:' #doStepUp - #'enabled:' #enabledStepOver - #'labelImage:' - #(#ResourceRetriever - #UIPainter #iconStepUp - ) + #'label:' 'Test' + #'accessCharacterPosition:' 1 + #'submenuChannel:' #submenuTest ) #(#MenuItem - #'label:' 'stepDown' - #'value:' #doStepDown - #'enabled:' #enabledStepOver - #'labelImage:' - #(#ResourceRetriever - #UIPainter #iconStepDown - ) + #'label:' 'History' + #'accessCharacterPosition:' 1 + #'submenuChannel:' #menuHistory ) #(#MenuItem - #'label:' 'stepIn' - #'value:' #doStepIn - #'enabled:' #enabledStepIn - #'labelImage:' - #(#ResourceRetriever - #UIPainter #iconStepIn - ) - ) - #(#MenuItem - #'label:' 'stepOut' - #'value:' #doStepOut - #'enabled:' #enabledStepOut - #'labelImage:' - #(#ResourceRetriever - #UIPainter #iconStepOut - ) + #'label:' 'Help' + #'accessCharacterPosition:' 1 + #'submenuChannel:' #menuHelp ) ) nil nil @@ -523,90 +545,63 @@ #( #(#MenuItem - #'label:' 'copy' + #'label:' 'Cut' + #'value:' #doCut + #'enabled:' #hasValidSelection + #'shortcutKeyCharacter:' #Cut + ) + #(#MenuItem + #'label:' 'Copy' #'value:' #doCopy #'enabled:' #hasValidSelection #'shortcutKeyCharacter:' #Copy ) #(#MenuItem - #'label:' 'cut' - #'value:' #doCut - #'enabled:' #hasValidSelection - #'shortcutKeyCharacter:' #Cut - ) - #(#MenuItem - #'label:' 'paste' + #'label:' 'Paste' #'value:' #doPaste #'enabled:' #hasAnySingleSelection #'shortcutKeyCharacter:' #Paste ) #(#MenuItem + #'label:' '=' + ) + #(#MenuItem + #'label:' 'Create Item' + #'value:' #doCreateItem + #'labelImage:' #(#ResourceRetriever #MenuEditor #iconCreateItem 'Create Item') + ) + #(#MenuItem + #'label:' 'Create Separator' + #'value:' #doCreateSep + #'labelImage:' #(#ResourceRetriever #MenuEditor #iconCreateSep 'Create Separator') + ) + #(#MenuItem #'label:' '-' ) #(#MenuItem - #'label:' 'create' - #'enabled:' #hasAnySingleSelection - #'submenu:' - #(#Menu - - #( - #(#MenuItem - #'label:' 'submenu static' - #'value:' #doCreateMenu - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateMenu - 'submenu static' - ) - ) - #(#MenuItem - #'label:' 'submenu dynamic' - #'value:' #doCreateLink - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateLink - 'submenu dynamic' - ) - ) - #(#MenuItem - #'label:' '-' - ) - #(#MenuItem - #'label:' 'item' - #'value:' #doCreateItem - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateItem - 'item' - ) - ) - #(#MenuItem - #'label:' 'separator' - #'value:' #doCreateSep - #'labelImage:' - #(#ResourceRetriever - #MenuEditor #iconCreateSep - 'separator' - ) - ) - ) nil - nil - ) + #'label:' 'Create Submenu Static' + #'value:' #doCreateMenu + #'labelImage:' #(#ResourceRetriever #MenuEditor #iconCreateMenu 'Create Submenu Static') + ) + #(#MenuItem + #'label:' 'Create Submenu Dynamic' + #'value:' #doCreateLink + #'labelImage:' #(#ResourceRetriever #MenuEditor #iconCreateLink 'Create Submenu Dynamic') ) ) nil nil ) ! -menuPullDown +menuToolbar "this window spec was automatically generated by the ST/X MenuEditor" "do not manually edit this - the builder may not be able to handle the specification if its corrupted." " - MenuEditor new openOnClass:MenuEditor andSelector:#menuPullDown - (Menu new fromLiteralArrayEncoding:(MenuEditor menuPullDown)) startUp + MenuEditor new openOnClass:MenuEditor andSelector:#menuToolbar + (Menu new fromLiteralArrayEncoding:(MenuEditor menuToolbar)) startUp " @@ -617,117 +612,91 @@ #( #(#MenuItem - #'label:' 'file' - #'value:' #file - #'submenu:' - #(#Menu - - #( - #(#MenuItem - #'label:' 'new' - #'value:' #doNew - ) - #(#MenuItem - #'label:' 'from class ...' - #'value:' #doFromClass - #'enabled:' #isStandAlone - ) - #(#MenuItem - #'label:' 'pick a menu' - #'value:' #doPickAMenu - #'enabled:' #isStandAlone - ) - #(#MenuItem - #'label:' '=' - ) - #(#MenuItem - #'label:' 'quit' - #'value:' #closeRequest - ) - ) nil - nil - ) + #'label:' 'New' + #'isButton:' true + #'value:' #doNew + #'labelImage:' #(#ResourceRetriever nil #newIcon) + ) + #(#MenuItem + #'label:' 'Load' + #'isButton:' true + #'value:' #doFromClass + #'labelImage:' #(#ResourceRetriever nil #loadIcon) + ) + #(#MenuItem + #'label:' 'Save' + #'isButton:' true + #'value:' #doInstallSpec + #'labelImage:' #(#ResourceRetriever nil #saveIcon) + ) + #(#MenuItem + #'label:' '-' + ) + #(#MenuItem + #'label:' 'createItem' + #'isButton:' true + #'value:' #doCreateItem + #'enabled:' #hasAnySingleSelection + #'labelImage:' #(#ResourceRetriever nil #iconCreateItem) + ) + #(#MenuItem + #'label:' 'createSeparator' + #'isButton:' true + #'value:' #doCreateSep + #'enabled:' #hasAnySingleSelection + #'labelImage:' #(#ResourceRetriever nil #iconCreateSep) + ) + #(#MenuItem + #'label:' '-' ) #(#MenuItem - #'label:' 'edit' - #'submenu:' - #(#Menu - - #( - #(#MenuItem - #'label:' 'cut' - #'value:' #doCut - ) - #(#MenuItem - #'label:' '=' - ) - #(#MenuItem - #'label:' 'create submenu static' - #'value:' #doCreateMenu - ) - #(#MenuItem - #'label:' 'create summenu dynamic' - #'value:' #doCreateLink - ) - #(#MenuItem - #'label:' '-' - ) - #(#MenuItem - #'label:' 'create item' - #'value:' #doCreateItem - ) - #(#MenuItem - #'label:' 'create separator' - #'value:' #doCreateSep - ) - ) nil - nil - ) + #'label:' 'createMenu' + #'isButton:' true + #'value:' #doCreateMenu + #'enabled:' #hasAnySingleSelection + #'labelImage:' #(#ResourceRetriever nil #iconCreateMenu) + ) + #(#MenuItem + #'label:' 'createLink' + #'isButton:' true + #'value:' #doCreateLink + #'enabled:' #hasAnySingleSelection + #'labelImage:' #(#ResourceRetriever nil #iconCreateLink) + ) + #(#MenuItem + #'label:' '-' ) #(#MenuItem - #'label:' 'code' - #'value:' #code - #'submenu:' - #(#Menu - - #( - #(#MenuItem - #'label:' 'class' - #'value:' #doDefineClass - #'enabled:' #isStandAlone - ) - #(#MenuItem - #'label:' '-' - ) - #(#MenuItem - #'label:' 'install menu spec.' - #'value:' #doInstallSpec - ) - #(#MenuItem - #'label:' 'install help spec.' - #'value:' #doInstallHelp - #'enabled:' #isStandAlone - ) - #(#MenuItem - #'label:' '=' - ) - #(#MenuItem - #'label:' 'browse application' - #'value:' #doBrowseAppClass - ) - ) nil - nil - ) + #'label:' 'stepUp' + #'isButton:' true + #'value:' #doStepUp + #'enabled:' #enabledStepOver + #'labelImage:' #(#ResourceRetriever nil #upIcon) ) #(#MenuItem - #'label:' 'test' - #'submenuChannel:' #submenuTest + #'label:' 'stepDown' + #'isButton:' true + #'value:' #doStepDown + #'enabled:' #enabledStepOver + #'labelImage:' #(#ResourceRetriever nil #downIcon) + ) + #(#MenuItem + #'label:' 'stepIn' + #'isButton:' true + #'value:' #doStepIn + #'enabled:' #enabledStepIn + #'labelImage:' #(#ResourceRetriever nil #downRightIcon) + ) + #(#MenuItem + #'label:' 'stepOut' + #'isButton:' true + #'value:' #doStepOut + #'enabled:' #enabledStepOut + #'labelImage:' #(#ResourceRetriever nil #leftDownIcon) ) ) nil nil ) - - "Modified: 28.7.1997 / 18:12:10 / cg" ! windowSpec @@ -749,73 +718,104 @@ #(#FullSpec #'window:' #(#WindowSpec - #'name:' 'MenuEditor' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'name:' 'Menu Builder' + #'layout:' #(#LayoutFrame 102 0 166 0 681 0 549 0) #'label:' 'Menu Builder' - #'bounds:' #(#Rectangle 0 0 580 384) + #'min:' #(#Point 10 10) + #'max:' #(#Point 1152 900) + #'bounds:' #(#Rectangle 102 166 682 550) + #'menu:' #menu + #'usePreferredExtent:' false ) #'component:' #(#SpecCollection #'collection:' #( - #(#ArbitraryComponentSpec - #'name:' 'painterView' - #'layout:' #(#LayoutFrame 0 0.0 57 0 0 0.5 0 1.0) - #'menu:' #menuPainter - #'hasHorizontalScrollBar:' true - #'hasVerticalScrollBar:' true - #'component:' #painter - #'hasBorder:' false + #(#MenuPanelSpec + #'name:' 'menuToolbarView' + #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 34 0) + #'menu:' #menuToolbar + #'showSeparatingLines:' true ) - #(#NoteBookViewSpec - #'name:' 'specificationView' - #'layout:' #(#LayoutFrame 0 0.5 0 0.0 0 1.0 -25 1.0) - #'tabable:' true - #'menu:' #tabList - #'model:' #tabModel - #'tabWidget:' #Window - #'useIndex:' true - #'canvas:' #noteBookView - ) - #(#HorizontalPanelViewSpec - #'name:' 'confirmationPanel' - #'layout:' #(#LayoutFrame 0 0.5 -24 1.0 0 1.0 0 1.0) + #(#VariableHorizontalPanelSpec + #'name:' 'variableHorizontalPanel1' + #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -22 1.0) #'component:' #(#SpecCollection #'collection:' #( - #(#ActionButtonSpec - #'name:' 'cancelButton' - #'label:' 'cancel' - #'model:' #cancel - #'enableChannel:' #modifiedChannel - #'extent:' #(#Point 140 24) + #(#ArbitraryComponentSpec + #'name:' 'painterView' + #'menu:' #menuPainter + #'hasHorizontalScrollBar:' true + #'hasVerticalScrollBar:' true + #'component:' #painter + #'hasBorder:' false ) - #(#ActionButtonSpec - #'name:' 'acceptButton' - #'label:' 'ok' - #'model:' #accept - #'enableChannel:' #modifiedChannel - #'extent:' #(#Point 141 24) + #(#ViewSpec + #'name:' 'view1' + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#NoteBookViewSpec + #'name:' 'specificationView' + #'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -26 1.0) + #'tabable:' true + #'model:' #tabModel + #'menu:' #tabList + #'useIndex:' true + #'canvas:' #noteBookView + ) + #(#HorizontalPanelViewSpec + #'name:' 'confirmationPanel' + #'layout:' #(#LayoutFrame 1 0.0 -24 1 0 1.0 0 1.0) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ActionButtonSpec + #'name:' 'cancelButton' + #'label:' 'Cancel' + #'model:' #cancel + #'enableChannel:' #modifiedChannel + #'extent:' #(#Point 171 24) + ) + #(#ActionButtonSpec + #'name:' 'acceptButton' + #'label:' 'OK' + #'model:' #accept + #'enableChannel:' #modifiedChannel + #'extent:' #(#Point 171 24) + ) + ) + ) + #'horizontalLayout:' #fitSpace + #'verticalLayout:' #fit + #'horizontalSpace:' 3 + #'verticalSpace:' 3 + ) + ) + ) + #'level:' -1 ) ) ) - #'horizontalLayout:' #fitSpace - #'verticalLayout:' #fit - #'horizontalSpace:' 3 - #'verticalSpace:' 3 + #'handles:' #(#Any 0.384483 1.0) ) - #(#MenuPanelSpec - #'name:' 'pullDownMenu' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 0.5 24 0) - #'tabable:' true - #'menu:' #menuPullDown + #(#LabelSpec + #'name:' 'infoLabel' + #'layout:' #(#LayoutFrame 0 0.0 -22 1 -65 1.0 0 1.0) + #'labelChannel:' #valueOfInfoLabel + #'level:' 1 + #'adjust:' #left ) - #(#MenuPanelSpec - #'name:' 'menuPanel1' - #'layout:' #(#LayoutFrame 0 0 28 0 0 0.5 53 0) - #'menu:' #menuButtons - #'showSeparatingLines:' true + #(#LabelSpec + #'name:' 'timeLabel' + #'layout:' #(#LayoutFrame -65 1 -22 1 0 1.0 0 1.0) + #'labelChannel:' #valueOfTimeLabel + #'level:' 1 + #'adjust:' #right ) ) ) @@ -828,7 +828,7 @@ ^#( (Basics basicsItemSpec) (Details detailsEditSpec) - (Misc miscEditSpec) + (Image imageEditSpec) ) ! @@ -837,7 +837,7 @@ ^#( (Basics basicsLinkSpec) (Details detailsEditSpec) - (Misc miscEditSpec) + (Image imageEditSpec) ) ! @@ -846,7 +846,7 @@ ^#( (Basics basicsMenuSpec) (Details detailsEditSpec) - (Misc miscEditSpec) + (Image imageEditSpec) ) ! @@ -886,11 +886,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 377 0 282 0 643 0 600 0) + #'layout:' #(#LayoutFrame 197 0 172 0 463 0 490 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1160 870) - #'bounds:' #(#Rectangle 377 282 644 601) + #'bounds:' #(#Rectangle 197 172 464 491) #'usePreferredExtent:' false ) #'component:' @@ -906,7 +906,7 @@ ) #(#InputFieldSpec #'name:' 'nameKeyField' - #'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #nameKey #'tabable:' true #'model:' #nameKey @@ -914,14 +914,14 @@ ) #(#LabelSpec #'name:' 'labelLabel' - #'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) - #'label:' 'Label' + #'layout:' #(#AlignmentOrigin 87 0 51 0 1 0.5) + #'label:' 'Label:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'labelField' - #'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) + #'layout:' #(#LayoutFrame 90 0 40 0 0 1.0 62 0) #'activeHelpKey:' #label #'tabable:' true #'model:' #label @@ -935,7 +935,7 @@ ) #(#InputFieldSpec #'name:' 'valueField' - #'layout:' #(#LayoutFrame 91 0 79 0 0 1.0 101 0) + #'layout:' #(#LayoutFrame 90 0 79 0 0 1.0 101 0) #'activeHelpKey:' #value #'tabable:' true #'model:' #value @@ -943,14 +943,14 @@ ) #(#LabelSpec #'name:' 'argumentLabel' - #'layout:' #(#AlignmentOrigin 87 0 116 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 115 0 1 0.5) #'label:' 'Argument:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'argumentField' - #'layout:' #(#LayoutFrame 91 0 105 0 0 1.0 127 0) + #'layout:' #(#LayoutFrame 90 0 104 0 0 1.0 126 0) #'activeHelpKey:' #argument #'tabable:' true #'model:' #argument @@ -958,19 +958,33 @@ ) #(#LabelSpec #'name:' 'indicationLabel' - #'layout:' #(#AlignmentOrigin 87 0 156 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 155 0 1 0.5) #'label:' 'Indication:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'indicationField' - #'layout:' #(#LayoutFrame 91 0 145 0 0 1.0 167 0) + #'layout:' #(#LayoutFrame 90 0 144 0 0 1.0 166 0) #'activeHelpKey:' #indication #'tabable:' true #'model:' #indication #'type:' #symbolOrNil ) + #(#CheckBoxSpec + #'name:' 'translateLabelCheckBox' + #'layout:' #(#Point 20 192) + #'activeHelpKey:' #translateLabel + #'model:' #translateLabel + #'label:' 'Translate Label' + ) + #(#CheckBoxSpec + #'name:' 'isButtonCheckBox' + #'layout:' #(#Point 20 221) + #'activeHelpKey:' #translateLabel + #'model:' #isButton + #'label:' 'Is Button' + ) ) ) ) @@ -995,11 +1009,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 219 0 193 0 485 0 511 0) + #'layout:' #(#LayoutFrame 197 0 172 0 463 0 490 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1280 1024) - #'bounds:' #(#Rectangle 219 193 486 512) + #'bounds:' #(#Rectangle 197 172 464 491) #'usePreferredExtent:' false ) #'component:' @@ -1016,7 +1030,7 @@ ) #(#InputFieldSpec #'name:' 'nameKeyField' - #'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #nameKey #'tabable:' true #'model:' #nameKey @@ -1024,20 +1038,20 @@ ) #(#LabelSpec #'name:' 'labelLabel' - #'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) - #'label:' 'Label' + #'layout:' #(#AlignmentOrigin 87 0 51 0 1 0.5) + #'label:' 'Label:' #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'labelField' - #'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) + #'layout:' #(#LayoutFrame 90 0 40 0 0 1.0 62 0) #'activeHelpKey:' #label #'tabable:' true #'model:' #label ) #(#InputFieldSpec #'name:' 'menuField' - #'layout:' #(#LayoutFrame 91 0 69 0 0 1.0 91 0) + #'layout:' #(#LayoutFrame 90 0 65 0 0 1.0 87 0) #'activeHelpKey:' #submenuChannel #'tabable:' true #'model:' #submenuChannel @@ -1045,7 +1059,7 @@ ) #(#LabelSpec #'name:' 'menuLabel' - #'layout:' #(#AlignmentOrigin 87 0 80 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 76 0 1 0.5) #'label:' 'Menu:' #'resizeForLabel:' true ) @@ -1073,11 +1087,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 219 0 193 0 485 0 511 0) + #'layout:' #(#LayoutFrame 197 0 172 0 463 0 490 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1280 1024) - #'bounds:' #(#Rectangle 219 193 486 512) + #'bounds:' #(#Rectangle 197 172 464 491) #'usePreferredExtent:' false ) #'component:' @@ -1093,7 +1107,7 @@ ) #(#InputFieldSpec #'name:' 'nameKeyField' - #'layout:' #(#LayoutFrame 91 0 15 0 0 1.0 37 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #nameKey #'tabable:' true #'model:' #nameKey @@ -1101,18 +1115,25 @@ ) #(#LabelSpec #'name:' 'labelLabel' - #'layout:' #(#AlignmentOrigin 87 0 53 0 1 0.5) - #'label:' 'Label' + #'layout:' #(#AlignmentOrigin 87 0 51 0 1 0.5) + #'label:' 'Label:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'labelField' - #'layout:' #(#LayoutFrame 91 0 42 0 0 1.0 64 0) + #'layout:' #(#LayoutFrame 90 0 40 0 0 1.0 62 0) #'activeHelpKey:' #label #'tabable:' true #'model:' #label ) + #(#CheckBoxSpec + #'name:' 'translateLabelCheckBox' + #'layout:' #(#Point 20 100) + #'activeHelpKey:' #translateLabel + #'model:' #translateLabel + #'label:' 'Translate Label' + ) ) ) ) @@ -1137,11 +1158,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 219 0 193 0 485 0 511 0) + #'layout:' #(#LayoutFrame 197 0 172 0 463 0 490 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1280 1024) - #'bounds:' #(#Rectangle 219 193 486 512) + #'bounds:' #(#Rectangle 197 172 464 491) #'usePreferredExtent:' false ) #'component:' @@ -1150,14 +1171,14 @@ #( #(#LabelSpec #'name:' 'selectorLabel' - #'layout:' #(#AlignmentOrigin 78 0 53 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) #'label:' 'Selector:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'selectorField' - #'layout:' #(#LayoutFrame 82 0 42 0 0 1.0 64 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #menuSelector #'tabable:' true #'model:' #label @@ -1186,11 +1207,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 219 0 193 0 485 0 511 0) + #'layout:' #(#LayoutFrame 197 0 172 0 463 0 490 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1160 870) - #'bounds:' #(#Rectangle 219 193 486 512) + #'bounds:' #(#Rectangle 197 172 464 491) #'usePreferredExtent:' false ) #'component:' @@ -1199,14 +1220,14 @@ #( #(#LabelSpec #'name:' 'separatorLabel' - #'layout:' #(#AlignmentOrigin 127 0 22 0 1 0.5) + #'layout:' #(#AlignmentOrigin 127 0 26 0 1 0.5) #'label:' 'Separator Type:' #'adjust:' #right #'resizeForLabel:' true ) #(#ComboListSpec #'name:' 'seperatorList' - #'layout:' #(#LayoutFrame 132 0 11 0 0 1.0 33 0) + #'layout:' #(#LayoutFrame 132 0 15 0 0 1.0 37 0) #'activeHelpKey:' #seperatorList #'model:' #seperatorSelection #'useIndex:' true @@ -1235,11 +1256,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 219 0 193 0 477 0 480 0) + #'layout:' #(#LayoutFrame 367 0 108 0 625 0 395 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1280 1024) - #'bounds:' #(#Rectangle 219 193 478 481) + #'bounds:' #(#Rectangle 367 108 626 396) #'usePreferredExtent:' false ) #'component:' @@ -1248,14 +1269,14 @@ #( #(#LabelSpec #'name:' 'shortcutKeyLabel' - #'layout:' #(#AlignmentOrigin 87 0 33 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) #'label:' 'Accelerator:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'shortcutKeyField' - #'layout:' #(#LayoutFrame 91 0 22 0 0 1.0 44 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #shortcutKey #'tabable:' true #'model:' #shortcutKey @@ -1263,14 +1284,14 @@ ) #(#LabelSpec #'name:' 'enabledLabel' - #'layout:' #(#AlignmentOrigin 87 0 59 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 51 0 1 0.5) #'label:' 'Enabled:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'enabledField' - #'layout:' #(#LayoutFrame 91 0 48 0 0 1.0 70 0) + #'layout:' #(#LayoutFrame 90 0 40 0 0 1.0 62 0) #'activeHelpKey:' #enbled #'tabable:' true #'model:' #enabled @@ -1278,14 +1299,14 @@ ) #(#LabelSpec #'name:' 'accessCharLabel' - #'layout:' #(#AlignmentOrigin 211 0 127 0 1 0.5) + #'layout:' #(#AlignmentOrigin 171 0 90 0 1 0.5) #'label:' 'Access Character Position:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'accessCharField' - #'layout:' #(#LayoutFrame 215 0 116 0 0 1.0 138 0) + #'layout:' #(#LayoutFrame 177 0 79 0 0 1.0 101 0) #'activeHelpKey:' #accessCharaterPos #'tabable:' true #'model:' #accessCharaterPos @@ -1296,15 +1317,15 @@ ) ! -miscEditSpec +imageEditSpec "this window spec was automatically generated by the ST/X UIPainter" "do not manually edit this - the painter/builder may not be able to handle the specification if its corrupted." " - UIPainter new openOnClass:MenuEditor andSelector:#miscEditSpec - MenuEditor new openInterface:#miscEditSpec + UIPainter new openOnClass:MenuEditor andSelector:#imageEditSpec + MenuEditor new openInterface:#imageEditSpec " @@ -1315,11 +1336,11 @@ #'window:' #(#WindowSpec #'name:' 'unnamed canvas' - #'layout:' #(#LayoutFrame 441 0 301 0 685 0 442 0) + #'layout:' #(#LayoutFrame 197 0 172 0 441 0 313 0) #'label:' 'unnamed canvas' #'min:' #(#Point 10 10) #'max:' #(#Point 1280 1024) - #'bounds:' #(#Rectangle 441 301 686 443) + #'bounds:' #(#Rectangle 197 172 442 314) #'usePreferredExtent:' false ) #'component:' @@ -1328,14 +1349,14 @@ #( #(#LabelSpec #'name:' 'retrieverLabel' - #'layout:' #(#AlignmentOrigin 77 0 26 0 1 0.5) + #'layout:' #(#AlignmentOrigin 87 0 26 0 1 0.5) #'label:' 'Retriever:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'retrieverField' - #'layout:' #(#LayoutFrame 81 0 15 0 0 1.0 37 0) + #'layout:' #(#LayoutFrame 90 0 15 0 0 1.0 37 0) #'activeHelpKey:' #retriever #'tabable:' true #'model:' #retriever @@ -1343,14 +1364,14 @@ ) #(#LabelSpec #'name:' 'iconLabel' - #'layout:' #(#AlignmentOrigin 77 0 50 0 1 0.5) - #'label:' 'Icon:' + #'layout:' #(#AlignmentOrigin 87 0 51 0 1 0.5) + #'label:' 'Selector:' #'adjust:' #right #'resizeForLabel:' true ) #(#InputFieldSpec #'name:' 'iconField' - #'layout:' #(#LayoutFrame 81 0 39 0 0 1.0 61 0) + #'layout:' #(#LayoutFrame 90 0 40 0 0 1.0 62 0) #'activeHelpKey:' #icon #'tabable:' true #'model:' #icon @@ -1358,15 +1379,15 @@ ) #(#CheckBoxSpec #'name:' 'iconAndLabel' - #'layout:' #(#LayoutOrigin 15 0 103 0) + #'layout:' #(#LayoutOrigin 20 0 104 0) #'activeHelpKey:' #iconAndLabel #'tabable:' true #'model:' #iconAndLabel - #'label:' 'Icon & Label' + #'label:' 'Image & Label' ) #(#ActionButtonSpec #'name:' 'imageEditorButton' - #'layout:' #(#LayoutFrame 81 0 65 0 0 1 87 0) + #'layout:' #(#LayoutFrame 90 0 66 0 0 1 90 0) #'label:' 'Image Editor' #'model:' #doEditImage ) @@ -1391,6 +1412,11 @@ !MenuEditor methodsFor:'accessing'! +isModified: aBoolean + + isModified := aBoolean +! + menuDefaultLink ^ self class menuDefaultLink ! @@ -1431,6 +1457,14 @@ !MenuEditor methodsFor:'accessing menu'! +menu + "this window spec was automatically generated by the UI Builder" + + ^ self class menu + + +! + menuButtons "this window spec was automatically generated by the ST/X MenuEditor" @@ -1453,6 +1487,14 @@ ^ self class menuPullDown +! + +menuToolbar + "this window spec was automatically generated by the UI Builder" + + ^ self class menuToolbar + + ! ! !MenuEditor methodsFor:'actions'! @@ -1786,17 +1828,43 @@ self helpTool helpSpecFrom:newClass ]. self painter buildFrom:newClass andSelector:aSelector. + + aClass notNil & aSelector notNil + ifTrue: + [ + |className message| + aClass isClass ifTrue: [className := aClass name]. + aClass isString ifTrue: [className := aClass]. + message := className, ' ', aSelector. + self addToHistory: message -> #loadFromMessage:. + self valueOfInfoLabel value: className, ' << ', aSelector + ]. + + +! + +checkModified + "check menu modification + " + isModified + ifTrue: + [ + ((YesNoBox title:'Menu was modified!!') + noText:'Cancel'; + yesText:'Waste it and proceed'; + showAtPointer; + accepted) ifFalse: [^false]. + isModified := false + ]. + ^true + + ! closeRequest "close request " - isModified ifTrue:[ - (self confirm:'quit without without saving your modifications ?') ifFalse:[ - ^ self - ] - ]. - super closeRequest. + self checkModified ifTrue: [super closeRequest] @@ -1822,6 +1890,8 @@ value nameKey indication + translateLabel + isButton shortcutKey retriever iconAndLabel @@ -1839,6 +1909,19 @@ ! +loadFromMessage: aMessage + + self checkModified ifTrue: + [ + |readStream aClass aSelector| + readStream := aMessage readStream. + aClass := Smalltalk at: (readStream upTo: $ ) asSymbol. + aSelector := readStream upToEnd asSymbol. + self buildFrom: aClass andSelector: aSelector. + self painter selection: nil + ] +! + openModalOnClass:aClass andSelector:aSelector specClass := Association key:aClass value:aSelector. super openInterfaceModal. @@ -1885,7 +1968,7 @@ cls notNil ifTrue:[ SystemBrowser openInClass:cls class selector:(self painter selectorName) ] ifFalse:[ - self information:'no valid class defined'. + self information:'No valid class defined!!'. ] ! @@ -1901,7 +1984,31 @@ doEditImage - ImageEditor open loadFromMessage: ((aspects at:#retriever) value ? specClass ? '') , ' ', ((aspects at:#icon) value ? '') + |cls resourceClass resourceSelector imageResourceMessage readStream| + + cls := self resolveName:(self specClass). + cls isNil ifTrue:[ + ^ self information:'No valid class defined!!'. + ]. + (aspects at:#retriever) value size > 0 + ifTrue: [resourceClass := (aspects at:#retriever) value] + ifFalse: [resourceClass := cls]. + (aspects at:#icon) value size > 0 + ifTrue: [resourceSelector := (aspects at:#icon) value] + ifFalse: [resourceSelector := #stxIcon]. + imageResourceMessage := ImageEditor openModalOnClass: resourceClass andSelector: resourceSelector. + readStream := imageResourceMessage readStream. + resourceClass := (readStream upTo: $ ) asSymbol. + resourceSelector := readStream upToEnd asSymbol. + resourceClass size > 0 ifTrue: [(aspects at:#retriever) value: resourceClass]. + resourceSelector size > 0 ifTrue: [(aspects at:#icon) value: resourceSelector]. + + (aspects at:#retriever) value = specClass + ifTrue: + [ + (aspects at:#retriever) value: nil + ] + ! doFromClass @@ -1929,14 +2036,14 @@ cls := self resolveName:(self specClass). cls isNil ifTrue:[ - ^ self information:'no valid class defined'. + ^ self information:'No valid class defined!!'. ]. painter := self painter. selector := painter selectorName. menu := painter asMenu. menu isNil ifTrue:[ - ^ self information:'no menu defined' + ^ self information:'No menu defined.' ]. menu := menu literalArrayEncoding. spec := WriteStream on:String new. @@ -1988,6 +2095,7 @@ ! doNew + self buildFrom:nil andSelector:(self painter selectorName) ! @@ -2009,22 +2117,38 @@ doStepDown "move selected child after next child " - self painter selectedNodeChangeSequenceOrder:1 + self painter selectedNodeChangeSequenceOrder:1. + isModified := true. + + + + ! doStepIn - self painter selectedNodeBecomeChildOfNext + "move selected child into next parent node + " + self painter selectedNodeBecomeChildOfNext. + isModified := true. + + + + ! doStepOut - self painter selectedNodeBecomeSisterOfParent + "move selected child out from parent node + " + self painter selectedNodeBecomeSisterOfParent. + isModified := true. ! doStepUp - "move selected child after next child + "move selected child before previous child " - self painter selectedNodeChangeSequenceOrder:-1 + self painter selectedNodeChangeSequenceOrder:-1. + isModified := true. ! ! !MenuEditor methodsFor:'values'! @@ -2133,7 +2257,7 @@ item := MenuItem labeled:label. - self isSeparator ifFalse:[ + self isSeparator ifFalse:[ item activeHelpKey:activeHelpKey. item enabled:enabled. item accessCharacterPosition:accessCharaterPos. @@ -2143,6 +2267,8 @@ item shortcutKeyCharacter:shortcutKey. item value:value. item indication:indication. + item translateLabel: translateLabel. + item isButton: isButton. icon notNil ifTrue:[ rcv := ResourceRetriever new. @@ -2175,6 +2301,8 @@ shortcutKey := (aspects at:#shortcutKey) value. accessCharaterPos := (aspects at:#accessCharaterPos) value. argument := (aspects at:#argument) value. + translateLabel := (aspects at:#translateLabel) value. + isButton := (aspects at:#isButton) value. argument isString ifTrue:[ argument size > 1 ifTrue:[ @@ -2216,6 +2344,8 @@ accessCharaterPos := anItem accessCharacterPosition. argument := anItem argument. submenuChannel := anItem submenuChannel. + translateLabel := anItem translateLabel. + isButton := anItem isButton. ( ((rtv := anItem adornment) notNil) and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever] @@ -2243,6 +2373,8 @@ (aspects at:#indication) value:indication. (aspects at:#shortcutKey) value:shortcutKey. (aspects at:#accessCharaterPos) value:accessCharaterPos. + (aspects at:#translateLabel) value:translateLabel. + (aspects at:#isButton) value:isButton. argument isSymbol ifTrue:[ (aspects at:#argument) value:'#', argument @@ -2264,57 +2396,6 @@ ^ self separatorType notNil ! ! -!MenuEditor::Painter class methodsFor:'constants'! - -imageItem - ^ self images at:#item -! - -imageMenu - ^ self images at:#menuOpen -! - -imageMenuLink - ^ self images at:#menuLink - -! - -imageSeparator - ^ self images at:#separator - -! - -images - "returns an IdentityDictionary containing a list of images and keys used - " - - - |image| - - Images notNil ifTrue:[ - ^ Images - ]. - - Images := IdentityDictionary new. - - #( - (#item 'ui_menuitem.xpm') - (#menuClosed 'ui_submenu.xpm') - (#menuOpen 'ui_submenu_open.xpm') - (#menuLink 'ui_submenulink.xpm') - (#separator 'ui_menusep.xpm') - - ) do:[:el | - image := Image fromFile:( el last ). - Images at:(el first) put:image. - ]. - - ^ Images - - - -! ! - !MenuEditor::Painter class methodsFor:'defaults'! defaultMenuMessage @@ -2343,6 +2424,54 @@ ! ! +!MenuEditor::Painter class methodsFor:'resources'! + +closedSubmenuImage + "ImageEditor openOnClass:self andSelector:#closedSubmenuImage" + + + ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 21 85 85 85 85 128 26 170 170 170 170 192 26 170 170 170 170 192 31 255 255 255 255 199 16 0 0 0 0 192 21 85 85 85 85 204 26 170 170 170 170 192 26 170 170 170 170 192 31 255 255 255 255 200 16 0 0 0 0 192 21 85 85 85 85 192 26 170 170 170 170 192 26 170 170 170 170 207 31 255 255 255 255 192 16 0 0 0 0 192 21 85 85 85 85 192 26 170 170 170 170 192 26 170 170 170 170 192 47 255 255 255 255 192 0 0 0 0 0 0 0 0 0 0 0 0]) ; colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; yourself); yourself! + +images + "returns an IdentityDictionary containing a list of images and keys used + " + ^ Images ? + (Images := IdentityDictionary new + at: #menuItemImage put: self menuItemImage; + at: #openedSubmenuImage put: self openedSubmenuImage; + at: #closedSubmenuImage put: self closedSubmenuImage; + at: #linkSubmenuImage put: self linkSubmenuImage; + at: #menuSeparatorImage put: self menuSeparatorImage; + yourself) + + + +! + +linkSubmenuImage + "ImageEditor openOnClass:self andSelector:#linkSubmenuImage" + + + ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 0 1 17 17 17 17 17 17 17 17 17 32 1 34 34 34 34 34 34 34 34 34 240 1 34 34 34 34 34 34 34 34 34 240 1 255 255 255 255 255 255 255 255 255 240 1 0 0 0 0 0 0 0 0 0 240 1 3 51 51 1 17 17 17 17 17 240 1 3 51 51 48 34 34 34 34 34 240 1 3 51 51 51 2 34 34 34 34 240 1 3 51 51 51 48 255 255 255 255 240 1 0 0 0 51 51 0 0 0 0 240 1 17 17 17 3 51 48 16 48 17 240 1 34 34 34 32 51 51 0 51 2 240 1 34 34 34 34 3 51 51 51 48 240 1 255 255 255 255 240 51 51 51 51 0 1 0 0 0 0 0 3 51 51 48 240 1 17 17 17 17 17 16 0 51 1 240 1 34 34 34 34 34 34 32 48 34 240 1 34 34 34 34 34 34 32 2 34 240 2 255 255 255 255 255 255 255 255 255 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:66.9978); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; yourself); yourself! + +menuItemImage + "ImageEditor openOnClass:self andSelector:#menuItemImage" + + + ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 81 85 85 85 85 85 80 85 85 85 85 85 95 85 85 85 85 85 80 85 85 85 85 85 80 0 0 0 0 0 0 21 85 85 85 85 129 26 170 170 170 170 200 27 175 235 235 174 192 27 171 171 171 254 192 27 171 171 235 174 192 27 171 171 171 174 192 27 171 171 235 174 192 26 170 170 170 170 196 47 255 255 255 255 193 0 0 0 0 0 0 85 85 85 85 85 80 85 85 85 85 85 88 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 88]) ; colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9977)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; yourself); yourself! + +menuSeparatorImage + "ImageEditor openOnClass:self andSelector:#menuSeparatorImage" + + + ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 82 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 0 0 0 0 0 0 21 85 85 85 85 128 26 170 170 170 170 196 26 170 170 170 170 195 27 255 255 255 250 192 27 0 0 0 6 192 26 85 85 85 86 200 26 170 170 170 170 192 26 170 170 170 170 192 47 255 255 255 255 206 0 0 0 0 0 8 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 87 85 85 85 85 85 88 85 85 85 85 85 80 85 85 85 85 85 80]) ; colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9977)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; yourself); yourself! + +openedSubmenuImage + "ImageEditor openOnClass:self andSelector:#openedSubmenuImage" + + + ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 13 21 85 85 85 85 128 26 170 170 170 170 192 26 170 170 170 170 192 31 255 255 255 255 192 16 0 0 0 0 192 21 85 85 85 85 192 26 170 170 170 170 200 26 170 170 170 170 192 31 255 255 255 255 192 16 0 0 0 0 192 21 85 85 85 85 200 26 170 170 170 170 192 26 170 170 170 170 200 31 255 255 255 255 192 16 0 0 0 0 192 21 85 85 85 85 192 26 170 170 170 170 192 26 170 170 170 170 192 47 255 255 255 255 192 0 0 0 0 0 0 0 0 0 0 0 0]) ; colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 255 255 252 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) ; yourself); yourself! ! + !MenuEditor::Painter methodsFor:'accessing'! selectorName @@ -2497,19 +2626,19 @@ item := aNode contents. item submenuChannel notNil ifTrue:[ - ^ images at:#menuLink + ^ images at:#linkSubmenuImage ]. item isSeparator ifTrue:[ - ^ images at:#separator + ^ images at:#menuSeparatorImage ]. - ^ images at:#item + ^ images at:#menuItemImage ]. aNode isExpandable ifTrue:[ - ^ images at:#menuClosed + ^ images at:#closedSubmenuImage ]. - ^ images at:#menuOpen + ^ images at:#openedSubmenuImage ! ! !MenuEditor::Painter methodsFor:'event handling'! @@ -2564,6 +2693,7 @@ !MenuEditor::Painter methodsFor:'menus'! doCopy + self hasSelection ifTrue:[ CopyBuffer := OrderedCollection new. self selectionDo:[:i| CopyBuffer add:((listOfNodes at:i) copy)] @@ -2571,7 +2701,9 @@ ! doCreateItem + self addElement:(self nodeLabel:'undefined') + ! doCreateLink @@ -2580,29 +2712,32 @@ node := self nodeLabel:'undefined'. item := node contents. item submenuChannel:#menuDefaultLink. - self addElement:node - + self addElement:node. + self setModified. ! doCreateMenu + |node| - node := self nodeLabel:'undefined'. node add:(self nodeLabel:'undefined'). self addElement:node - ! doCreateSep + self addElement:(self nodeLabel:nil) - ! doCut + self doCopy. self selectedNodesRemove. + self setModified. + + ! doPaste @@ -2617,11 +2752,17 @@ addElement:something "add something after selection " - self selectedNodeAdd:something + self selectedNodeAdd:something. + self setModified. ! nodeLabel:aLabel ^ TreeItem name:aLabel contents:(MenuEditor::Item new label:aLabel). +! + +setModified + + self topView application isModified: true ! ! !MenuEditor::Painter methodsFor:'selection'!