MenuEditor.st
changeset 1631 d7979e4253fd
parent 1629 a79dce7e7045
child 1632 1f0a0d241ff8
equal deleted inserted replaced
1630:d63d47fea8be 1631:d7979e4253fd
    26 	classVariableNames:''
    26 	classVariableNames:''
    27 	poolDictionaries:''
    27 	poolDictionaries:''
    28 	privateIn:MenuEditor
    28 	privateIn:MenuEditor
    29 !
    29 !
    30 
    30 
    31 MenuEditor::Item subclass:#ItemAction
    31 MenuEditor::Item subclass:#ActionItem
    32 	instanceVariableNames:''
    32 	instanceVariableNames:''
    33 	classVariableNames:''
    33 	classVariableNames:''
    34 	poolDictionaries:''
    34 	poolDictionaries:''
    35 	privateIn:MenuEditor
    35 	privateIn:MenuEditor
    36 !
    36 !
    37 
    37 
    38 MenuEditor::Item subclass:#ItemLinkedMenu
    38 MenuEditor::Item subclass:#LinkedMenuItem
    39 	instanceVariableNames:''
    39 	instanceVariableNames:''
    40 	classVariableNames:''
    40 	classVariableNames:''
    41 	poolDictionaries:''
    41 	poolDictionaries:''
    42 	privateIn:MenuEditor
    42 	privateIn:MenuEditor
    43 !
    43 !
    44 
    44 
    45 MenuEditor::Item subclass:#ItemMenu
    45 MenuEditor::Item subclass:#MenuItem
    46 	instanceVariableNames:''
       
    47 	classVariableNames:''
       
    48 	poolDictionaries:''
       
    49 	privateIn:MenuEditor
       
    50 !
       
    51 
       
    52 MenuEditor::ItemMenu subclass:#ItemRoot
       
    53 	instanceVariableNames:''
       
    54 	classVariableNames:''
       
    55 	poolDictionaries:''
       
    56 	privateIn:MenuEditor
       
    57 !
       
    58 
       
    59 MenuEditor::Item subclass:#ItemSeparator
       
    60 	instanceVariableNames:''
    46 	instanceVariableNames:''
    61 	classVariableNames:''
    47 	classVariableNames:''
    62 	poolDictionaries:''
    48 	poolDictionaries:''
    63 	privateIn:MenuEditor
    49 	privateIn:MenuEditor
    64 !
    50 !
    71 	privateIn:MenuEditor
    57 	privateIn:MenuEditor
    72 !
    58 !
    73 
    59 
    74 HierarchicalItem subclass:#ResourceEditorItem
    60 HierarchicalItem subclass:#ResourceEditorItem
    75 	instanceVariableNames:'selector icon'
    61 	instanceVariableNames:'selector icon'
       
    62 	classVariableNames:''
       
    63 	poolDictionaries:''
       
    64 	privateIn:MenuEditor
       
    65 !
       
    66 
       
    67 MenuEditor::MenuItem subclass:#RootItem
       
    68 	instanceVariableNames:''
       
    69 	classVariableNames:''
       
    70 	poolDictionaries:''
       
    71 	privateIn:MenuEditor
       
    72 !
       
    73 
       
    74 MenuEditor::Item subclass:#SeparatorItem
       
    75 	instanceVariableNames:''
    76 	classVariableNames:''
    76 	classVariableNames:''
    77 	poolDictionaries:''
    77 	poolDictionaries:''
    78 	privateIn:MenuEditor
    78 	privateIn:MenuEditor
    79 !
    79 !
    80 
    80 
   675 
   675 
   676     <resource: #menu>
   676     <resource: #menu>
   677 
   677 
   678     ^ 
   678     ^ 
   679      #(#Menu
   679      #(#Menu
   680 	#(
   680         #(
   681 	 #(#MenuItem
   681          #(#MenuItem
   682 	    #label: 'Cut'
   682             #label: 'Cut'
   683 	    #value: #doCut
   683             #translateLabel: true
   684 	    #activeHelpKey: #editCut
   684             #activeHelpKey: #editCut
   685 	    #enabled: #hasSelectionChannel
   685             #enabled: #hasSelectionChannel
   686 	  )
   686           )
   687 	 #(#MenuItem
   687          #(#MenuItem
   688 	    #label: 'Copy'
   688             #label: 'Copy'
   689 	    #value: #doCopy
   689             #translateLabel: true
   690 	    #activeHelpKey: #editCopy
   690             #activeHelpKey: #editCopy
   691 	    #enabled: #hasSelectionChannel
   691             #enabled: #hasSelectionChannel
   692 	  )
   692           )
   693 	 #(#MenuItem
   693          #(#MenuItem
   694 	    #label: 'Paste'
   694             #label: 'Paste'
   695 	    #value: #doPaste
   695             #translateLabel: true
   696 	    #activeHelpKey: #editPaste
   696             #activeHelpKey: #editPaste
   697 	    #enabled: #valueOfCanPaste
   697             #enabled: #valueOfCanPaste
   698 	  )
   698           )
   699 	 #(#MenuItem
   699          #(#MenuItem
   700 	    #label: 'Delete'
   700             #label: 'Delete'
   701 	    #value: #doDelete
   701             #translateLabel: true
   702 	    #activeHelpKey: #editDelete
   702             #isVisible: false
   703 	    #enabled: #hasSelectionChannel
   703             #activeHelpKey: #editDelete
   704 	  )
   704             #enabled: #hasSelectionChannel
   705 	 #(#MenuItem
   705           )
   706 	    #label: '-'
   706          #(#MenuItem
   707 	  )
   707             #label: '-'
   708 	 #(#MenuItem
   708           )
   709 	    #label: 'Move Up'
   709          #(#MenuItem
   710 	    #startGroup: #right
   710             #label: 'Move Up'
   711 	    #value: #doMoveUpOrDown:
   711             #translateLabel: true
   712 	    #activeHelpKey: #editMoveUp
   712             #startGroup: #right
   713 	    #enabled: #valueOfEnableMovingUpOrDown
   713             #activeHelpKey: #editMoveUp
   714 	    #argument: #up
   714             #enabled: #valueOfEnableMovingUpOrDown
   715 	    #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up')
   715             #argument: #up
   716 	  )
   716             #resourceRetriever: #(#ResourceRetriever #Icon #upIcon '')
   717 	 #(#MenuItem
   717           )
   718 	    #label: 'Move Down'
   718          #(#MenuItem
   719 	    #value: #doMoveUpOrDown:
   719             #label: 'Move Down'
   720 	    #activeHelpKey: #editMoveDown
   720             #translateLabel: true
   721 	    #enabled: #valueOfEnableMovingUpOrDown
   721             #activeHelpKey: #editMoveDown
   722 	    #argument: #down
   722             #enabled: #valueOfEnableMovingUpOrDown
   723 	    #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down')
   723             #argument: #down
   724 	  )
   724             #resourceRetriever: #(#ResourceRetriever #Icon #downIcon '')
   725 	 #(#MenuItem
   725           )
   726 	    #label: 'Move In'
   726          #(#MenuItem
   727 	    #value: #doMoveIn:
   727             #label: 'Move Into Next'
   728 	    #activeHelpKey: #editMoveIn
   728             #translateLabel: true
   729 	    #enabled: #valueOfEnableMovingIn
   729             #activeHelpKey: #editMoveIn
   730 	    #argument: #inNext
   730             #enabled: #valueOfEnableMovingIn
   731 	    #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Move In')
   731             #argument: #inNext
   732 	  )
   732             #resourceRetriever: #(#ResourceRetriever #Icon #downRightIcon '')
   733 	 #(#MenuItem
   733           )
   734 	    #label: 'Move In Above'
   734          #(#MenuItem
   735 	    #value: #doMoveIn:
   735             #label: 'Move Into Previous'
   736 	    #activeHelpKey: #editMoveInAbove
   736             #translateLabel: true
   737 	    #enabled: #valueOfEnableMovingInAbove
   737             #activeHelpKey: #editMoveInAbove
   738 	    #argument: #inPrev
   738             #enabled: #valueOfEnableMovingInAbove
   739 	    #labelImage: #(#ResourceRetriever #Icon #upRightIcon 'Move In Above')
   739             #argument: #inPrev
   740 	  )
   740             #resourceRetriever: #(#ResourceRetriever #Icon #upRightIcon '')
   741 	 #(#MenuItem
   741           )
   742 	    #label: 'Move Out'
   742          #(#MenuItem
   743 	    #value: #doMoveOut
   743             #label: 'Move Out'
   744 	    #activeHelpKey: #editMoveOut
   744             #translateLabel: true
   745 	    #enabled: #valueOfEnableMovingOut
   745             #activeHelpKey: #editMoveOut
   746 	    #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Move Out')
   746             #enabled: #valueOfEnableMovingOut
   747 	  )
   747             #resourceRetriever: #(#ResourceRetriever #Icon #leftDownIcon '')
   748 	 )
   748           )
   749 	nil
   749          )
   750 	nil
   750         nil
       
   751         nil
   751       )
   752       )
   752 !
   753 !
   753 
   754 
   754 fileMenu
   755 fileMenu
   755     "This resource specification was automatically generated
   756     "This resource specification was automatically generated
   854 
   855 
   855     ^ 
   856     ^ 
   856      #(#Menu
   857      #(#Menu
   857         #(
   858         #(
   858          #(#MenuItem
   859          #(#MenuItem
   859             #label: 'Redefine Aspect Methods'
       
   860             #hideMenuOnActivated: false
       
   861             #activeHelpKey: #settingsRedefineAspectMethods
       
   862             #enabled: #hasValidSpecClass
       
   863             #indication: #redefineAspectMethodsChannel
       
   864           )
       
   865          #(#MenuItem
       
   866             #label: 'Aspect Methods'
   860             #label: 'Aspect Methods'
   867             #value: #doGenerateAspectMethods
   861             #value: #doGenerateAspectMethods
   868             #activeHelpKey: #generateAspectMethods
   862             #activeHelpKey: #generateAspectMethods
   869             #enabled: #hasValidSpecClass
   863             #enabled: #hasValidSpecClass
   870           )
   864           )
   962             #activeHelpKey: #edit
   956             #activeHelpKey: #edit
   963             #submenuChannel: #editMenu
   957             #submenuChannel: #editMenu
   964             #keepLinkedMenu: true
   958             #keepLinkedMenu: true
   965           )
   959           )
   966          #(#MenuItem
   960          #(#MenuItem
   967             #label: 'Add'
   961             #label: 'Item'
   968             #translateLabel: true
   962             #translateLabel: true
   969             #activeHelpKey: #add
   963             #activeHelpKey: #add
   970             #enabled: #hasSingleSelectionChannel
   964             #enabled: #hasSingleSelectionChannel
   971             #submenuChannel: #addMenu
   965             #submenuChannel: #addMenu
   972             #keepLinkedMenu: true
   966             #keepLinkedMenu: true
   973           )
   967           )
   974          #(#MenuItem
   968          #(#MenuItem
   975             #label: 'Test'
       
   976             #translateLabel: true
       
   977             #activeHelpKey: #test
       
   978             #submenuChannel: #submenuTest
       
   979           )
       
   980          #(#MenuItem
       
   981             #label: 'History'
       
   982             #translateLabel: true
       
   983             #activeHelpKey: #history
       
   984             #submenuChannel: #menuHistory
       
   985           )
       
   986          #(#MenuItem
       
   987             #label: 'Generate'
   969             #label: 'Generate'
   988             #translateLabel: true
   970             #translateLabel: true
   989             #activeHelpKey: #generate
   971             #activeHelpKey: #generate
   990             #submenuChannel: #generateMenu
   972             #submenuChannel: #generateMenu
   991             #keepLinkedMenu: true
   973             #keepLinkedMenu: true
       
   974           )
       
   975          #(#MenuItem
       
   976             #label: 'Test'
       
   977             #translateLabel: true
       
   978             #activeHelpKey: #test
       
   979             #submenuChannel: #submenuTest
       
   980           )
       
   981          #(#MenuItem
       
   982             #label: 'Settings'
       
   983             #translateLabel: true
       
   984             #activeHelpKey: #settings
       
   985             #submenuChannel: #settingsMenu
       
   986             #keepLinkedMenu: true
       
   987           )
       
   988          #(#MenuItem
       
   989             #label: 'History'
       
   990             #translateLabel: true
       
   991             #activeHelpKey: #history
       
   992             #submenuChannel: #menuHistory
   992           )
   993           )
   993          #(#MenuItem
   994          #(#MenuItem
   994             #label: '&Help'
   995             #label: '&Help'
   995             #translateLabel: true
   996             #translateLabel: true
   996             #startGroup: #right
   997             #startGroup: #right
   997             #activeHelpKey: #help
   998             #activeHelpKey: #help
   998             #submenuChannel: #helpMenu
   999             #submenuChannel: #helpMenu
   999             #keepLinkedMenu: true
  1000             #keepLinkedMenu: true
       
  1001           )
       
  1002          )
       
  1003         nil
       
  1004         nil
       
  1005       )
       
  1006 !
       
  1007 
       
  1008 settingsMenu
       
  1009     "This resource specification was automatically generated
       
  1010      by the MenuEditor of ST/X."
       
  1011 
       
  1012     "Do not manually edit this!! If it is corrupted,
       
  1013      the MenuEditor may not be able to read the specification."
       
  1014 
       
  1015     "
       
  1016      MenuEditor new openOnClass:MenuEditor andSelector:#generateMenu
       
  1017      (Menu new fromLiteralArrayEncoding:(MenuEditor generateMenu)) startUp
       
  1018     "
       
  1019 
       
  1020     <resource: #menu>
       
  1021 
       
  1022     ^ 
       
  1023      #(#Menu
       
  1024         #(
       
  1025          #(#MenuItem
       
  1026             #label: 'Redefine Aspect Methods'
       
  1027             #translateLabel: true
       
  1028             #hideMenuOnActivated: false
       
  1029             #activeHelpKey: #settingsRedefineAspectMethods
       
  1030             #enabled: #hasValidSpecClass
       
  1031             #indication: #redefineAspectMethodsChannel
  1000           )
  1032           )
  1001          )
  1033          )
  1002         nil
  1034         nil
  1003         nil
  1035         nil
  1004       )
  1036       )
  2009     selectionHolder    := #() asValue.
  2041     selectionHolder    := #() asValue.
  2010     selectionHolder addDependent:self.
  2042     selectionHolder addDependent:self.
  2011 
  2043 
  2012     listOfItems := HierarchicalList new.
  2044     listOfItems := HierarchicalList new.
  2013     listOfItems application:self.
  2045     listOfItems application:self.
  2014     listOfItems root:(ItemRoot new).
  2046     listOfItems root:(RootItem new).
  2015 
  2047 
  2016     tabHolder := nil asValue.
  2048     tabHolder := nil asValue.
  2017     tabHolder addDependent:self.
  2049     tabHolder addDependent:self.
  2018 
  2050 
  2019     listOfTabs := List new.
  2051     listOfTabs := List new.
  2380     selectedItem ifNil:[^ self].
  2412     selectedItem ifNil:[^ self].
  2381 
  2413 
  2382     selectedItem canAddDelayedMenu      ifFalse:[ ^ self ].
  2414     selectedItem canAddDelayedMenu      ifFalse:[ ^ self ].
  2383     self askForItemModification ifFalse:[ ^ self ].
  2415     self askForItemModification ifFalse:[ ^ self ].
  2384 
  2416 
  2385     what == #menu ifTrue:[ delayedItem := ItemMenu new ]
  2417     what == #menu ifTrue:[ delayedItem := MenuItem new ]
  2386                  ifFalse:[ delayedItem := ItemLinkedMenu new ].
  2418                  ifFalse:[ delayedItem := LinkedMenuItem new ].
  2387 
  2419 
  2388     delayedItem setExpanded:true.
  2420     delayedItem setExpanded:true.
  2389     delayedItem := selectedItem add:delayedItem.
  2421     delayedItem := selectedItem add:delayedItem.
  2390 
  2422 
  2391     delayedItem ifNotNil:[
  2423     delayedItem ifNotNil:[
  2394 !
  2426 !
  2395 
  2427 
  2396 doCreateItem
  2428 doCreateItem
  2397     "create a new Item
  2429     "create a new Item
  2398     "
  2430     "
  2399     self addAndSelect:[ ItemAction new ].
  2431     self addAndSelect:[ ActionItem new translateLabel:true ].
  2400 !
  2432 !
  2401 
  2433 
  2402 doCreateLinkedMenu
  2434 doCreateLinkedMenu
  2403     "create a new Linked Menu
  2435     "create a new Linked Menu
  2404     "
  2436     "
  2405     self addAndSelect:[ ItemLinkedMenu new ].
  2437     self addAndSelect:[ LinkedMenuItem new ].
  2406 !
  2438 !
  2407 
  2439 
  2408 doCreateMenu
  2440 doCreateMenu
  2409     "create a new Menu
  2441     "create a new Menu
  2410     "
  2442     "
  2411     self addAndSelect:[ |item|
  2443     self addAndSelect:[ |item|
  2412 	item := ItemMenu new.
  2444         item := MenuItem new.
  2413 	item expand.
  2445         item expand.
  2414 	item
  2446         item
  2415     ].
  2447     ].
  2416 !
  2448 !
  2417 
  2449 
  2418 doCreateSep
  2450 doCreateSep
  2419     "create a new Separator Item
  2451     "create a new Separator Item
  2420     "
  2452     "
  2421     self addAndSelect:[ ItemSeparator new ].
  2453     self addAndSelect:[ SeparatorItem new ].
  2422 !
  2454 !
  2423 
  2455 
  2424 doCreateStandardEditMenu
  2456 doCreateStandardEditMenu
  2425     "create a standart edit menu
  2457     "create a standart edit menu
  2426     "
  2458     "
  2427     self addAndSelect:[
  2459     self addAndSelect:[
  2428 	ItemMenu menu:(self class standardEditMenu) labeled:'Edit'
  2460         MenuItem menu:(self class standardEditMenu) labeled:'Edit' translateLabel:true
  2429     ].
  2461     ].
  2430 !
  2462 !
  2431 
  2463 
  2432 doCreateStandardFileMenu
  2464 doCreateStandardFileMenu
  2433     "create a standart file menu
  2465     "create a standart file menu
  2434     "
  2466     "
  2435     self addAndSelect:[
  2467     self addAndSelect:[
  2436 	ItemMenu menu:(self class standardFileMenu) labeled:'File'
  2468         MenuItem menu:(self class standardFileMenu) labeled:'File' translateLabel:true
  2437     ].
  2469     ].
  2438 !
  2470 !
  2439 
  2471 
  2440 doCreateStandardHelpMenu
  2472 doCreateStandardHelpMenu
  2441     "create a standart help menu
  2473     "create a standart help menu
  2442     "
  2474     "
  2443     |item|
  2475     |item|
  2444 
  2476 
  2445     self addAndSelect:[
  2477     self addAndSelect:[
  2446 	item := ItemMenu menu:(self class standardHelpMenu) labeled:'Help'.
  2478         item := MenuItem menu:(self class standardHelpMenu) labeled:'Help' translateLabel:true.
  2447 	item aspectAt:#startGroup put:#right.
  2479         item aspectAt:#startGroup put:#right.
  2448 	item
  2480         item
  2449     ].
  2481     ].
  2450 ! !
  2482 ! !
  2451 
  2483 
  2452 !MenuEditor methodsFor:'user actions - editing'!
  2484 !MenuEditor methodsFor:'user actions - editing'!
  2453 
  2485 
  2764 
  2796 
  2765 !MenuEditor::Item class methodsFor:'instance creation'!
  2797 !MenuEditor::Item class methodsFor:'instance creation'!
  2766 
  2798 
  2767 classFor:aMenuItem
  2799 classFor:aMenuItem
  2768 
  2800 
  2769     aMenuItem ifNil:[ ^ nil ].
  2801     aMenuItem isNil ifTrue:[ ^ nil ].
  2770 
  2802 
  2771     aMenuItem value ifNil:[
  2803     aMenuItem itemValue isNil ifTrue:[
  2772 	aMenuItem submenu        ifNotNil:[ ^ MenuEditor::ItemMenu ].
  2804         aMenuItem submenu        notNil ifTrue:[ ^ MenuEditor::MenuItem ].
  2773 	aMenuItem submenuChannel ifNotNil:[ ^ MenuEditor::ItemLinkedMenu ].
  2805         aMenuItem submenuChannel notNil ifTrue:[ ^ MenuEditor::LinkedMenuItem ].
  2774 
  2806 
  2775 	(self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[
  2807         (self separatorTypeOf:(aMenuItem rawLabel)) notNil ifTrue:[
  2776 	    ^ MenuEditor::ItemSeparator
  2808             ^ MenuEditor::SeparatorItem
  2777 	]
  2809         ]
  2778     ].
  2810     ].
  2779     ^ MenuEditor::ItemAction
  2811     ^ MenuEditor::ActionItem
  2780 !
  2812 !
  2781 
  2813 
  2782 menuItem:aMenuItem
  2814 menuItem:aMenuItem
  2783     |item cls|
  2815     |item cls|
  2784 
  2816 
  3057 
  3089 
  3058 submenu
  3090 submenu
  3059     "returns the submenu (of class Menu) or nil
  3091     "returns the submenu (of class Menu) or nil
  3060     "
  3092     "
  3061     ^ nil
  3093     ^ nil
       
  3094 !
       
  3095 
       
  3096 translateLabel:aBoolean
       
  3097     menuItem translateLabel:aBoolean
  3062 ! !
  3098 ! !
  3063 
  3099 
  3064 !MenuEditor::Item methodsFor:'aspects'!
  3100 !MenuEditor::Item methodsFor:'aspects'!
  3065 
  3101 
  3066 aspectAt:aKey put:aValue
  3102 aspectAt:aKey put:aValue
  3253     "returns true if the item can change its vertical order in its sibling
  3289     "returns true if the item can change its vertical order in its sibling
  3254     "
  3290     "
  3255     ^ parent children size > 1
  3291     ^ parent children size > 1
  3256 ! !
  3292 ! !
  3257 
  3293 
  3258 !MenuEditor::ItemAction class methodsFor:'defaults'!
  3294 !MenuEditor::ActionItem class methodsFor:'defaults'!
  3259 
  3295 
  3260 defaultLabel
  3296 defaultLabel
  3261     ^ 'Action'
  3297     ^ 'Action'
  3262 ! !
  3298 ! !
  3263 
  3299 
  3264 !MenuEditor::ItemAction class methodsFor:'interface - editor'!
  3300 !MenuEditor::ActionItem class methodsFor:'interface - editor'!
  3265 
  3301 
  3266 addBindingsTo:aspects for:aMenuEditor
  3302 addBindingsTo:aspects for:aMenuEditor
  3267     "add additional bindings to the aspects
  3303     "add additional bindings to the aspects
  3268     "
  3304     "
  3269     aspects at:#indicationEnabled  ifAbsentPut:[
  3305     aspects at:#indicationEnabled  ifAbsentPut:[
  3280     aspects at:#hasNoDelayedMenuValue ifAbsentPut:[
  3316     aspects at:#hasNoDelayedMenuValue ifAbsentPut:[
  3281 	true asValue
  3317 	true asValue
  3282     ].
  3318     ].
  3283 ! !
  3319 ! !
  3284 
  3320 
  3285 !MenuEditor::ItemAction class methodsFor:'interface - specs'!
  3321 !MenuEditor::ActionItem class methodsFor:'interface - specs'!
  3286 
  3322 
  3287 basicsEditSpec
  3323 basicsEditSpec
  3288     "This resource specification was automatically generated
  3324     "This resource specification was automatically generated
  3289      by the UIPainter of ST/X."
  3325      by the UIPainter of ST/X."
  3290 
  3326 
  3530          
  3566          
  3531         )
  3567         )
  3532       )
  3568       )
  3533 ! !
  3569 ! !
  3534 
  3570 
  3535 !MenuEditor::ItemAction methodsFor:'accessing'!
  3571 !MenuEditor::ActionItem methodsFor:'accessing'!
  3536 
  3572 
  3537 menuItem
  3573 menuItem
  3538     |item|
  3574     |item|
  3539 
  3575 
  3540     item := super menuItem.
  3576     item := super menuItem.
  3554 
  3590 
  3555     super menuItem:anItem.
  3591     super menuItem:anItem.
  3556     submenu := anItem submenu.
  3592     submenu := anItem submenu.
  3557 
  3593 
  3558     submenu notNil ifTrue:[
  3594     submenu notNil ifTrue:[
  3559 	item := MenuEditor::ItemMenu new
  3595         item := MenuEditor::MenuItem new
  3560     ] ifFalse:[
  3596     ] ifFalse:[
  3561 	anItem submenuChannel ifNil:[
  3597         anItem submenuChannel isNil ifTrue:[
  3562 	    ^ self
  3598             ^ self
  3563 	].
  3599         ].
  3564 	item := MenuEditor::ItemLinkedMenu new
  3600         item := MenuEditor::LinkedMenuItem new
  3565     ].
  3601     ].
  3566     item getDelayedAttributesFrom:anItem.
  3602     item getDelayedAttributesFrom:anItem.
  3567     self add:item.
  3603     self add:item.
  3568 !
  3604 !
  3569 
  3605 
  3574 	    (Image    image  )
  3610 	    (Image    image  )
  3575 	    (Help     help)
  3611 	    (Help     help)
  3576        )
  3612        )
  3577 ! !
  3613 ! !
  3578 
  3614 
  3579 !MenuEditor::ItemAction methodsFor:'adding & removing'!
  3615 !MenuEditor::ActionItem methodsFor:'adding & removing'!
  3580 
  3616 
  3581 add:anItem
  3617 add:anItem
  3582     "add an item; test whether the item is a delayed menu and
  3618     "add an item; test whether the item is a delayed menu and
  3583      not already a delayed menu exists.
  3619      not already a delayed menu exists.
  3584     "
  3620     "
  3594     children := Array with:anItem.
  3630     children := Array with:anItem.
  3595     self expand.
  3631     self expand.
  3596   ^ anItem
  3632   ^ anItem
  3597 ! !
  3633 ! !
  3598 
  3634 
  3599 !MenuEditor::ItemAction methodsFor:'aspects'!
  3635 !MenuEditor::ActionItem methodsFor:'aspects'!
  3600 
  3636 
  3601 aspectAt:aKey put:aValue
  3637 aspectAt:aKey put:aValue
  3602     "pass the argument to the delayed menu if existant
  3638     "pass the argument to the delayed menu if existant
  3603     "
  3639     "
  3604     aKey == #argument ifTrue:[
  3640     aKey == #argument ifTrue:[
  3632     hasDelayedMenu ifTrue:[
  3668     hasDelayedMenu ifTrue:[
  3633         (aspects at:#triggerOnDown) value:false
  3669         (aspects at:#triggerOnDown) value:false
  3634     ].
  3670     ].
  3635 ! !
  3671 ! !
  3636 
  3672 
  3637 !MenuEditor::ItemAction methodsFor:'displaying'!
  3673 !MenuEditor::ActionItem methodsFor:'displaying'!
  3638 
  3674 
  3639 icon
  3675 icon
  3640     ^ self class iconItem
  3676     ^ self class iconItem
  3641 ! !
  3677 ! !
  3642 
  3678 
  3643 !MenuEditor::ItemAction methodsFor:'initialization'!
  3679 !MenuEditor::ActionItem methodsFor:'initialization'!
  3644 
  3680 
  3645 initialize
  3681 initialize
  3646     super initialize.
  3682     super initialize.
  3647     isExpanded := true.
  3683     isExpanded := true.
  3648 ! !
  3684 ! !
  3649 
  3685 
  3650 !MenuEditor::ItemAction methodsFor:'queries'!
  3686 !MenuEditor::ActionItem methodsFor:'queries'!
  3651 
  3687 
  3652 canCollapse
  3688 canCollapse
  3653     ^ false
  3689     ^ false
  3654 !
  3690 !
  3655 
  3691 
  3665 
  3701 
  3666 isAction
  3702 isAction
  3667     ^ true
  3703     ^ true
  3668 ! !
  3704 ! !
  3669 
  3705 
  3670 !MenuEditor::ItemAction methodsFor:'queries - operation'!
  3706 !MenuEditor::ActionItem methodsFor:'queries - operation'!
  3671 
  3707 
  3672 canAddDelayedMenu
  3708 canAddDelayedMenu
  3673     "returns true if a delayed menu can be added
  3709     "returns true if a delayed menu can be added
  3674     "
  3710     "
  3675     ^ self hasDelayedMenu not
  3711     ^ self hasDelayedMenu not
  3676 ! !
  3712 ! !
  3677 
  3713 
  3678 !MenuEditor::ItemLinkedMenu class methodsFor:'defaults'!
  3714 !MenuEditor::LinkedMenuItem class methodsFor:'defaults'!
  3679 
  3715 
  3680 defaultLabel
  3716 defaultLabel
  3681     ^ 'Linked Menu'
  3717     ^ 'Linked Menu'
  3682 ! !
  3718 ! !
  3683 
  3719 
  3684 !MenuEditor::ItemLinkedMenu class methodsFor:'interface - specs'!
  3720 !MenuEditor::LinkedMenuItem class methodsFor:'interface - specs'!
  3685 
  3721 
  3686 basicsEditSpec
  3722 basicsEditSpec
  3687     "This resource specification was automatically generated
  3723     "This resource specification was automatically generated
  3688      by the UIPainter of ST/X."
  3724      by the UIPainter of ST/X."
  3689 
  3725 
  3850          
  3886          
  3851         )
  3887         )
  3852       )
  3888       )
  3853 ! !
  3889 ! !
  3854 
  3890 
  3855 !MenuEditor::ItemLinkedMenu methodsFor:'accessing'!
  3891 !MenuEditor::LinkedMenuItem methodsFor:'accessing'!
  3856 
  3892 
  3857 argument:aValue
  3893 argument:aValue
  3858     menuItem argument:aValue.
  3894     menuItem argument:aValue.
  3859 !
  3895 !
  3860 
  3896 
  3889 
  3925 
  3890 submenuChannel:aValue
  3926 submenuChannel:aValue
  3891     menuItem submenuChannel:aValue.
  3927     menuItem submenuChannel:aValue.
  3892 ! !
  3928 ! !
  3893 
  3929 
  3894 !MenuEditor::ItemLinkedMenu methodsFor:'aspects'!
  3930 !MenuEditor::LinkedMenuItem methodsFor:'aspects'!
  3895 
  3931 
  3896 aspectAt:aKey put:aValue
  3932 aspectAt:aKey put:aValue
  3897     "set a specific aspect named aKey to the aValue
  3933     "set a specific aspect named aKey to the aValue
  3898     "
  3934     "
  3899     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  3935     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  3912     aMenuItem   submenuChannel:(self submenuChannel).
  3948     aMenuItem   submenuChannel:(self submenuChannel).
  3913     aMenuItem horizontalLayout:(menuItem horizontalLayout).
  3949     aMenuItem horizontalLayout:(menuItem horizontalLayout).
  3914     aMenuItem   keepLinkedMenu:(menuItem keepLinkedMenu).
  3950     aMenuItem   keepLinkedMenu:(menuItem keepLinkedMenu).
  3915 ! !
  3951 ! !
  3916 
  3952 
  3917 !MenuEditor::ItemLinkedMenu methodsFor:'displaying'!
  3953 !MenuEditor::LinkedMenuItem methodsFor:'displaying'!
  3918 
  3954 
  3919 displayLabel
  3955 displayLabel
  3920     "returns the label dependent on is delayed or not
  3956     "returns the label dependent on is delayed or not
  3921     "
  3957     "
  3922     self isDelayedMenu ifTrue:[ ^ self submenuChannel ].
  3958     self isDelayedMenu ifTrue:[ ^ self submenuChannel ].
  3926 icon
  3962 icon
  3927     self isDelayedMenu ifTrue:[ ^ self class iconDelayedLinkedMenu ].
  3963     self isDelayedMenu ifTrue:[ ^ self class iconDelayedLinkedMenu ].
  3928   ^ self class iconLinkedMenu
  3964   ^ self class iconLinkedMenu
  3929 ! !
  3965 ! !
  3930 
  3966 
  3931 !MenuEditor::ItemLinkedMenu methodsFor:'queries'!
  3967 !MenuEditor::LinkedMenuItem methodsFor:'queries'!
  3932 
  3968 
  3933 isKindOfMenu
  3969 isKindOfMenu
  3934     ^ true
  3970     ^ true
  3935 ! !
  3971 ! !
  3936 
  3972 
  3937 !MenuEditor::ItemMenu class methodsFor:'defaults'!
  3973 !MenuEditor::MenuItem class methodsFor:'defaults'!
  3938 
  3974 
  3939 defaultDelayedLabel
  3975 defaultDelayedLabel
  3940     ^ 'delayed'
  3976     ^ 'delayed'
  3941 !
  3977 !
  3942 
  3978 
  3943 defaultLabel
  3979 defaultLabel
  3944     ^ 'Menu'
  3980     ^ 'Menu'
  3945 ! !
  3981 ! !
  3946 
  3982 
  3947 !MenuEditor::ItemMenu class methodsFor:'instance creation'!
  3983 !MenuEditor::MenuItem class methodsFor:'instance creation'!
  3948 
  3984 
  3949 menu:aMenu labeled:aString
  3985 menu:aMenu labeled:aString
  3950     |item|
  3986     |item|
  3951 
  3987 
  3952     item := self new.
  3988     item := self new.
  3953     item menu:aMenu labeled:aString.
  3989     item menu:aMenu labeled:aString.
  3954   ^ item
  3990     ^ item
  3955 ! !
  3991 !
  3956 
  3992 
  3957 !MenuEditor::ItemMenu class methodsFor:'interface - specs'!
  3993 menu:aMenu labeled:aString translateLabel:translateLabel
       
  3994     |item|
       
  3995 
       
  3996     item := self new.
       
  3997     item menu:aMenu labeled:aString.
       
  3998     item translateLabel:translateLabel.
       
  3999     ^ item
       
  4000 ! !
       
  4001 
       
  4002 !MenuEditor::MenuItem class methodsFor:'interface - specs'!
  3958 
  4003 
  3959 basicsEditSpec
  4004 basicsEditSpec
  3960     "This resource specification was automatically generated
  4005     "This resource specification was automatically generated
  3961      by the UIPainter of ST/X."
  4006      by the UIPainter of ST/X."
  3962 
  4007 
  4065          
  4110          
  4066         )
  4111         )
  4067       )
  4112       )
  4068 ! !
  4113 ! !
  4069 
  4114 
  4070 !MenuEditor::ItemMenu methodsFor:'accessing'!
  4115 !MenuEditor::MenuItem methodsFor:'accessing'!
  4071 
  4116 
  4072 argument:aValue
  4117 argument:aValue
  4073     "/ ignorred.
  4118     "/ ignorred.
  4074 !
  4119 !
  4075 
  4120 
  4147 	children do:[:el| menu addItem:(el menuItem) ].
  4192 	children do:[:el| menu addItem:(el menuItem) ].
  4148     ].
  4193     ].
  4149     ^ menu
  4194     ^ menu
  4150 ! !
  4195 ! !
  4151 
  4196 
  4152 !MenuEditor::ItemMenu methodsFor:'aspects'!
  4197 !MenuEditor::MenuItem methodsFor:'aspects'!
  4153 
  4198 
  4154 getDelayedAttributesFrom:aMenuItem
  4199 getDelayedAttributesFrom:aMenuItem
  4155 
  4200 
  4156     self menu:(aMenuItem submenu) labeled:nil.
  4201     self menu:(aMenuItem submenu) labeled:nil.
  4157     menuItem horizontalLayout:(aMenuItem horizontalLayout).
  4202     menuItem horizontalLayout:(aMenuItem horizontalLayout).
  4160 setDelayedAttributesTo:aMenuItem
  4205 setDelayedAttributesTo:aMenuItem
  4161     aMenuItem          submenu:(self submenu).
  4206     aMenuItem          submenu:(self submenu).
  4162     aMenuItem horizontalLayout:(menuItem horizontalLayout).
  4207     aMenuItem horizontalLayout:(menuItem horizontalLayout).
  4163 ! !
  4208 ! !
  4164 
  4209 
  4165 !MenuEditor::ItemMenu methodsFor:'displaying'!
  4210 !MenuEditor::MenuItem methodsFor:'displaying'!
  4166 
  4211 
  4167 displayLabel
  4212 displayLabel
  4168     "returns the label dependent on is delayed or not
  4213     "returns the label dependent on is delayed or not
  4169     "
  4214     "
  4170     self isDelayedMenu ifTrue:[ ^ self class defaultDelayedLabel ].
  4215     self isDelayedMenu ifTrue:[ ^ self class defaultDelayedLabel ].
  4174 icon
  4219 icon
  4175     self isDelayedMenu ifTrue:[ ^ self class iconDelayedMenu ].
  4220     self isDelayedMenu ifTrue:[ ^ self class iconDelayedMenu ].
  4176   ^ self class iconMenu
  4221   ^ self class iconMenu
  4177 ! !
  4222 ! !
  4178 
  4223 
  4179 !MenuEditor::ItemMenu methodsFor:'queries'!
  4224 !MenuEditor::MenuItem methodsFor:'queries'!
  4180 
  4225 
  4181 canAddChildren
  4226 canAddChildren
  4182     "children can be added
  4227     "children can be added
  4183     "
  4228     "
  4184     ^ true
  4229     ^ true
  4194     ^ true
  4239     ^ true
  4195 !
  4240 !
  4196 
  4241 
  4197 isKindOfMenu
  4242 isKindOfMenu
  4198     ^ true
  4243     ^ true
  4199 ! !
       
  4200 
       
  4201 !MenuEditor::ItemRoot class methodsFor:'defaults'!
       
  4202 
       
  4203 defaultLabel
       
  4204     ^ MenuEditor resourceType
       
  4205 ! !
       
  4206 
       
  4207 !MenuEditor::ItemRoot class methodsFor:'interface - editor'!
       
  4208 
       
  4209 addBindingsTo:aspects for:aMenuEditor
       
  4210     "add additional bindings to the aspects
       
  4211     "
       
  4212 ! !
       
  4213 
       
  4214 !MenuEditor::ItemRoot class methodsFor:'interface - specs'!
       
  4215 
       
  4216 basicsEditSpec
       
  4217     "This resource specification was automatically generated
       
  4218      by the UIPainter of ST/X."
       
  4219 
       
  4220     "Do not manually edit this!! If it is corrupted,
       
  4221      the UIPainter may not be able to read the specification."
       
  4222 
       
  4223     "
       
  4224      UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec
       
  4225     "
       
  4226 
       
  4227     <resource: #canvas>
       
  4228 
       
  4229     ^ 
       
  4230      #(#FullSpec
       
  4231 	#name: #basicsEditSpec
       
  4232 	#window: 
       
  4233        #(#WindowSpec
       
  4234 	  #label: 'basicsEditSpec'
       
  4235 	  #name: 'basicsEditSpec'
       
  4236 	  #min: #(#Point 10 10)
       
  4237 	  #max: #(#Point 1280 1024)
       
  4238 	  #bounds: #(#Rectangle 644 547 904 593)
       
  4239 	)
       
  4240 	#component: 
       
  4241        #(#SpecCollection
       
  4242 	  #collection: #(
       
  4243 	   #(#LabelSpec
       
  4244 	      #label: 'Selector:'
       
  4245 	      #name: 'selectorLabel'
       
  4246 	      #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
       
  4247 	      #activeHelpKey: #basicsSelector
       
  4248 	      #resizeForLabel: true
       
  4249 	      #adjust: #right
       
  4250 	    )
       
  4251 	   #(#InputFieldSpec
       
  4252 	      #name: 'selectorField'
       
  4253 	      #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
       
  4254 	      #activeHelpKey: #basicsSelector
       
  4255 	      #tabable: true
       
  4256 	      #model: #rawLabel
       
  4257 	      #group: #inputGroup
       
  4258 	      #type: #string
       
  4259 	      #immediateAccept: false
       
  4260 	      #acceptOnReturn: true
       
  4261 	      #acceptOnTab: true
       
  4262 	      #acceptChannel: #acceptChannel
       
  4263 	      #modifiedChannel: #modifiedChannel
       
  4264 	      #acceptOnPointerLeave: false
       
  4265 	    )
       
  4266 	   )
       
  4267          
       
  4268 	)
       
  4269       )
       
  4270 ! !
       
  4271 
       
  4272 !MenuEditor::ItemRoot methodsFor:'accessing'!
       
  4273 
       
  4274 menuItem:aMenuItem
       
  4275     "rebuild self from a MenuItem
       
  4276     "
       
  4277     |submenu selector|
       
  4278 
       
  4279     aMenuItem notNil ifTrue:[
       
  4280 	submenu  := aMenuItem submenu.
       
  4281 	selector := aMenuItem rawLabel.
       
  4282     ] ifFalse:[
       
  4283 	selector := submenu := nil.
       
  4284     ].
       
  4285     self menu:submenu labeled:selector.
       
  4286 !
       
  4287 
       
  4288 rawLabel:aValue
       
  4289     "set the label assigned to the item
       
  4290     "
       
  4291     |value|
       
  4292 
       
  4293     aValue isString ifTrue:[
       
  4294         value := aValue withoutSeparators.
       
  4295 
       
  4296         (value notEmpty and:[value first isLetter]) ifTrue:[
       
  4297             menuItem rawLabel:(value asSymbol)
       
  4298         ].
       
  4299     ].
       
  4300 !
       
  4301 
       
  4302 slices
       
  4303     ^ #(
       
  4304 	    (Basics   basicsEditSpec)
       
  4305        )
       
  4306 ! !
       
  4307 
       
  4308 !MenuEditor::ItemRoot methodsFor:'adding & removing'!
       
  4309 
       
  4310 remove
       
  4311     "cannot remove the root item; delete all my children
       
  4312     "
       
  4313     self removeAll.
       
  4314 ! !
       
  4315 
       
  4316 !MenuEditor::ItemRoot methodsFor:'aspects'!
       
  4317 
       
  4318 aspectAt:aKey put:aValue
       
  4319     "discard all other than the rawLabel
       
  4320     "
       
  4321     aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
       
  4322 ! !
       
  4323 
       
  4324 !MenuEditor::ItemRoot methodsFor:'displaying'!
       
  4325 
       
  4326 heightOn:aGC
       
  4327     height ifNil:[ height := aGC font heightOn:aGC device ].
       
  4328   ^ height
       
  4329 ! !
       
  4330 
       
  4331 !MenuEditor::ItemRoot methodsFor:'initialization'!
       
  4332 
       
  4333 initialize
       
  4334     super initialize.
       
  4335     isExpanded := true.
       
  4336 ! !
       
  4337 
       
  4338 !MenuEditor::ItemRoot methodsFor:'queries'!
       
  4339 
       
  4340 canCollapse
       
  4341     ^ false
       
  4342 !
       
  4343 
       
  4344 hasIndicator
       
  4345     ^ false
       
  4346 !
       
  4347 
       
  4348 isDelayedMenu
       
  4349     ^ false
       
  4350 !
       
  4351 
       
  4352 isRootItem
       
  4353     ^ true
       
  4354 ! !
       
  4355 
       
  4356 !MenuEditor::ItemRoot methodsFor:'queries - editor'!
       
  4357 
       
  4358 actionSelectors
       
  4359     "returns my action selectors
       
  4360     "
       
  4361     ^ #()
       
  4362 !
       
  4363 
       
  4364 aspectSelectors
       
  4365     "returns my aspect selectors
       
  4366     "
       
  4367     ^ #()
       
  4368 ! !
       
  4369 
       
  4370 !MenuEditor::ItemRoot methodsFor:'queries - operation'!
       
  4371 
       
  4372 canMoveInAbove
       
  4373     ^ false
       
  4374 !
       
  4375 
       
  4376 canMoveInNext
       
  4377     ^ false
       
  4378 !
       
  4379 
       
  4380 canMoveOut
       
  4381     ^ false
       
  4382 !
       
  4383 
       
  4384 canMoveUpOrDown
       
  4385    ^ false
       
  4386 ! !
       
  4387 
       
  4388 !MenuEditor::ItemSeparator class methodsFor:'interface - editor'!
       
  4389 
       
  4390 addBindingsTo:aspects for:aMenuEditor
       
  4391     "add additional bindings to the aspects
       
  4392     "
       
  4393     |holder|
       
  4394 
       
  4395     aspects at:#seperatorList  ifAbsentPut:[
       
  4396 	self separatorSlices collect:[:el| el last ]
       
  4397     ].
       
  4398 
       
  4399     aspects at:#seperatorSelection ifAbsentPut:[
       
  4400 	holder := 0 asValue.
       
  4401 	holder addDependent:aMenuEditor.
       
  4402 	holder
       
  4403     ].
       
  4404 !
       
  4405 
       
  4406 defaultLabel
       
  4407     ^ '-'
       
  4408 !
       
  4409 
       
  4410 separatorSlices
       
  4411     "get the list of menu spec values of the corresponding separator types
       
  4412     "
       
  4413     ^ #(
       
  4414 	( #blank        ''      'blank' )
       
  4415 	( #single       '-'     'single line')
       
  4416 	( #double       '='     'double line')
       
  4417       )
       
  4418 ! !
       
  4419 
       
  4420 !MenuEditor::ItemSeparator class methodsFor:'interface - specs'!
       
  4421 
       
  4422 basicsEditSpec
       
  4423     "This resource specification was automatically generated
       
  4424      by the UIPainter of ST/X."
       
  4425 
       
  4426     "Do not manually edit this!! If it is corrupted,
       
  4427      the UIPainter may not be able to read the specification."
       
  4428 
       
  4429     "
       
  4430      UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec
       
  4431     "
       
  4432 
       
  4433     <resource: #canvas>
       
  4434 
       
  4435     ^ 
       
  4436      #(#FullSpec
       
  4437 	#name: #basicsEditSpec
       
  4438 	#window: 
       
  4439        #(#WindowSpec
       
  4440 	  #label: 'basicsEditSpec'
       
  4441 	  #name: 'basicsEditSpec'
       
  4442 	  #min: #(#Point 10 10)
       
  4443 	  #max: #(#Point 1160 870)
       
  4444 	  #bounds: #(#Rectangle 160 398 420 643)
       
  4445 	)
       
  4446 	#component: 
       
  4447        #(#SpecCollection
       
  4448 	  #collection: #(
       
  4449 	   #(#LabelSpec
       
  4450 	      #label: 'Separator:'
       
  4451 	      #name: 'separatorLabel'
       
  4452 	      #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
       
  4453 	      #resizeForLabel: true
       
  4454 	      #adjust: #right
       
  4455 	    )
       
  4456 	   #(#ComboListSpec
       
  4457 	      #name: 'seperatorList'
       
  4458 	      #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
       
  4459 	      #activeHelpKey: #basicsSeparatorType
       
  4460 	      #tabable: true
       
  4461 	      #model: #seperatorSelection
       
  4462 	      #comboList: #seperatorList
       
  4463 	      #useIndex: true
       
  4464 	    )
       
  4465 	   #(#LabelSpec
       
  4466 	      #label: 'Visibility:'
       
  4467 	      #name: 'visibilityLabel'
       
  4468 	      #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5)
       
  4469 	      #resizeForLabel: true
       
  4470 	      #adjust: #right
       
  4471 	    )
       
  4472 	   #(#InputFieldSpec
       
  4473 	      #name: 'visibilityInputField'
       
  4474 	      #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
       
  4475 	      #activeHelpKey: #detailsVisibility
       
  4476 	      #tabable: true
       
  4477 	      #model: #isVisible
       
  4478 	      #group: #inputGroup
       
  4479 	      #type: #symbolOrNil
       
  4480 	      #immediateAccept: false
       
  4481 	      #acceptOnReturn: true
       
  4482 	      #acceptOnTab: true
       
  4483 	      #acceptChannel: #acceptChannel
       
  4484 	      #modifiedChannel: #modifiedChannel
       
  4485 	      #acceptOnPointerLeave: false
       
  4486 	    )
       
  4487 	   #(#LabelSpec
       
  4488 	      #label: 'Start Group:'
       
  4489 	      #name: 'startGroupLabel'
       
  4490 	      #layout: #(#AlignmentOrigin 107 0 88 0 1 0.5)
       
  4491 	      #resizeForLabel: true
       
  4492 	      #adjust: #right
       
  4493 	    )
       
  4494 	   #(#PopUpListSpec
       
  4495 	      #label: 'left'
       
  4496 	      #name: 'startGroupPopUp'
       
  4497 	      #layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0)
       
  4498 	      #activeHelpKey: #detailsStartGroup
       
  4499 	      #tabable: true
       
  4500 	      #model: #startGroup
       
  4501 	      #menu: 
       
  4502 	     #(#left
       
  4503 		#right
       
  4504 	      )
       
  4505 	    )
       
  4506 	   )
       
  4507          
       
  4508 	)
       
  4509       )
       
  4510 ! !
       
  4511 
       
  4512 !MenuEditor::ItemSeparator methodsFor:'accessing'!
       
  4513 
       
  4514 icon
       
  4515     ^ self class iconSeparator
       
  4516 !
       
  4517 
       
  4518 rawLabel:aValue
       
  4519     |value|
       
  4520 
       
  4521     aValue isString ifTrue:[
       
  4522 	value := aValue withoutSeparators.
       
  4523 
       
  4524 	(self class separatorTypeOf:value) ifNotNil:[
       
  4525 	    menuItem rawLabel:value
       
  4526 	]
       
  4527     ].
       
  4528 !
       
  4529 
       
  4530 separatorType
       
  4531     ^ self class separatorTypeOf:(menuItem rawLabel).
       
  4532 !
       
  4533 
       
  4534 slices
       
  4535     ^ #(
       
  4536 	    (Basics   basicsEditSpec)
       
  4537        )
       
  4538 ! !
       
  4539 
       
  4540 !MenuEditor::ItemSeparator methodsFor:'aspects'!
       
  4541 
       
  4542 fromAspects:aspects
       
  4543     "put my values into the values of aspects
       
  4544     "
       
  4545     |index slice|
       
  4546 
       
  4547     index  := (aspects at:#seperatorSelection) value ? 0.
       
  4548     slice  := self class separatorSlices at:index ifAbsent:nil.
       
  4549 
       
  4550     slice ifNotNil:[ slice := slice at:2 ].
       
  4551 
       
  4552     (aspects at:#rawLabel) value:slice.
       
  4553   ^ super fromAspects:aspects.
       
  4554 !
       
  4555 
       
  4556 toAspects:aspects
       
  4557     "put my values into the values of aspects
       
  4558     "
       
  4559     |index type|
       
  4560 
       
  4561     type   := self separatorType.
       
  4562     index  := self class separatorSlices findFirst:[:el| el first == type ].
       
  4563 
       
  4564     (aspects at:#seperatorSelection) value:index.
       
  4565   ^ super  toAspects:aspects.
       
  4566 ! !
       
  4567 
       
  4568 !MenuEditor::ItemSeparator methodsFor:'displaying'!
       
  4569 
       
  4570 displayOn:aGC x:x y:y h:h
       
  4571     "draw the receiver in the graphicsContext, aGC.
       
  4572     "
       
  4573     |x1 y0 type|
       
  4574 
       
  4575     type := self separatorType.
       
  4576     type == #blank ifTrue:[ ^ self ].
       
  4577 
       
  4578     x1 := x + (self widthOn:aGC).
       
  4579     y0 := y + (h // 2) - 1.
       
  4580 
       
  4581     type == #double ifTrue:[
       
  4582 	y0 := y0 + 1.
       
  4583 	aGC displayLineFromX:x y:y0 toX:x1 y:y0.
       
  4584 	y0 := y0 - 2
       
  4585     ].
       
  4586     aGC displayLineFromX:x y:y0 toX:x1 y:y0
       
  4587 !
       
  4588 
       
  4589 widthOn:aGC
       
  4590     width ifNil:[ width := 60 ].
       
  4591   ^ width
       
  4592 ! !
  4244 ! !
  4593 
  4245 
  4594 !MenuEditor::ResourceEditor class methodsFor:'interface specs'!
  4246 !MenuEditor::ResourceEditor class methodsFor:'interface specs'!
  4595 
  4247 
  4596 windowSpec
  4248 windowSpec
  5033     parent ifNotNil:[
  4685     parent ifNotNil:[
  5034 	ImageEditor openOnClass:(parent selector) andSelector:selector
  4686 	ImageEditor openOnClass:(parent selector) andSelector:selector
  5035     ].
  4687     ].
  5036 ! !
  4688 ! !
  5037 
  4689 
       
  4690 !MenuEditor::RootItem class methodsFor:'defaults'!
       
  4691 
       
  4692 defaultLabel
       
  4693     ^ MenuEditor resourceType
       
  4694 ! !
       
  4695 
       
  4696 !MenuEditor::RootItem class methodsFor:'interface - editor'!
       
  4697 
       
  4698 addBindingsTo:aspects for:aMenuEditor
       
  4699     "add additional bindings to the aspects
       
  4700     "
       
  4701 ! !
       
  4702 
       
  4703 !MenuEditor::RootItem class methodsFor:'interface - specs'!
       
  4704 
       
  4705 basicsEditSpec
       
  4706     "This resource specification was automatically generated
       
  4707      by the UIPainter of ST/X."
       
  4708 
       
  4709     "Do not manually edit this!! If it is corrupted,
       
  4710      the UIPainter may not be able to read the specification."
       
  4711 
       
  4712     "
       
  4713      UIPainter new openOnClass:MenuEditor::ItemRoot andSelector:#basicsEditSpec
       
  4714     "
       
  4715 
       
  4716     <resource: #canvas>
       
  4717 
       
  4718     ^ 
       
  4719      #(#FullSpec
       
  4720 	#name: #basicsEditSpec
       
  4721 	#window: 
       
  4722        #(#WindowSpec
       
  4723 	  #label: 'basicsEditSpec'
       
  4724 	  #name: 'basicsEditSpec'
       
  4725 	  #min: #(#Point 10 10)
       
  4726 	  #max: #(#Point 1280 1024)
       
  4727 	  #bounds: #(#Rectangle 644 547 904 593)
       
  4728 	)
       
  4729 	#component: 
       
  4730        #(#SpecCollection
       
  4731 	  #collection: #(
       
  4732 	   #(#LabelSpec
       
  4733 	      #label: 'Selector:'
       
  4734 	      #name: 'selectorLabel'
       
  4735 	      #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
       
  4736 	      #activeHelpKey: #basicsSelector
       
  4737 	      #resizeForLabel: true
       
  4738 	      #adjust: #right
       
  4739 	    )
       
  4740 	   #(#InputFieldSpec
       
  4741 	      #name: 'selectorField'
       
  4742 	      #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
       
  4743 	      #activeHelpKey: #basicsSelector
       
  4744 	      #tabable: true
       
  4745 	      #model: #rawLabel
       
  4746 	      #group: #inputGroup
       
  4747 	      #type: #string
       
  4748 	      #immediateAccept: false
       
  4749 	      #acceptOnReturn: true
       
  4750 	      #acceptOnTab: true
       
  4751 	      #acceptChannel: #acceptChannel
       
  4752 	      #modifiedChannel: #modifiedChannel
       
  4753 	      #acceptOnPointerLeave: false
       
  4754 	    )
       
  4755 	   )
       
  4756          
       
  4757 	)
       
  4758       )
       
  4759 ! !
       
  4760 
       
  4761 !MenuEditor::RootItem methodsFor:'accessing'!
       
  4762 
       
  4763 menuItem:aMenuItem
       
  4764     "rebuild self from a MenuItem
       
  4765     "
       
  4766     |submenu selector|
       
  4767 
       
  4768     aMenuItem notNil ifTrue:[
       
  4769 	submenu  := aMenuItem submenu.
       
  4770 	selector := aMenuItem rawLabel.
       
  4771     ] ifFalse:[
       
  4772 	selector := submenu := nil.
       
  4773     ].
       
  4774     self menu:submenu labeled:selector.
       
  4775 !
       
  4776 
       
  4777 rawLabel:aValue
       
  4778     "set the label assigned to the item
       
  4779     "
       
  4780     |value|
       
  4781 
       
  4782     aValue isString ifTrue:[
       
  4783         value := aValue withoutSeparators.
       
  4784 
       
  4785         (value notEmpty and:[value first isLetter]) ifTrue:[
       
  4786             menuItem rawLabel:(value asSymbol)
       
  4787         ].
       
  4788     ].
       
  4789 !
       
  4790 
       
  4791 slices
       
  4792     ^ #(
       
  4793 	    (Basics   basicsEditSpec)
       
  4794        )
       
  4795 ! !
       
  4796 
       
  4797 !MenuEditor::RootItem methodsFor:'adding & removing'!
       
  4798 
       
  4799 remove
       
  4800     "cannot remove the root item; delete all my children
       
  4801     "
       
  4802     self removeAll.
       
  4803 ! !
       
  4804 
       
  4805 !MenuEditor::RootItem methodsFor:'aspects'!
       
  4806 
       
  4807 aspectAt:aKey put:aValue
       
  4808     "discard all other than the rawLabel
       
  4809     "
       
  4810     aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
       
  4811 ! !
       
  4812 
       
  4813 !MenuEditor::RootItem methodsFor:'displaying'!
       
  4814 
       
  4815 heightOn:aGC
       
  4816     height ifNil:[ height := aGC font heightOn:aGC device ].
       
  4817   ^ height
       
  4818 ! !
       
  4819 
       
  4820 !MenuEditor::RootItem methodsFor:'initialization'!
       
  4821 
       
  4822 initialize
       
  4823     super initialize.
       
  4824     isExpanded := true.
       
  4825 ! !
       
  4826 
       
  4827 !MenuEditor::RootItem methodsFor:'queries'!
       
  4828 
       
  4829 canCollapse
       
  4830     ^ false
       
  4831 !
       
  4832 
       
  4833 hasIndicator
       
  4834     ^ false
       
  4835 !
       
  4836 
       
  4837 isDelayedMenu
       
  4838     ^ false
       
  4839 !
       
  4840 
       
  4841 isRootItem
       
  4842     ^ true
       
  4843 ! !
       
  4844 
       
  4845 !MenuEditor::RootItem methodsFor:'queries - editor'!
       
  4846 
       
  4847 actionSelectors
       
  4848     "returns my action selectors
       
  4849     "
       
  4850     ^ #()
       
  4851 !
       
  4852 
       
  4853 aspectSelectors
       
  4854     "returns my aspect selectors
       
  4855     "
       
  4856     ^ #()
       
  4857 ! !
       
  4858 
       
  4859 !MenuEditor::RootItem methodsFor:'queries - operation'!
       
  4860 
       
  4861 canMoveInAbove
       
  4862     ^ false
       
  4863 !
       
  4864 
       
  4865 canMoveInNext
       
  4866     ^ false
       
  4867 !
       
  4868 
       
  4869 canMoveOut
       
  4870     ^ false
       
  4871 !
       
  4872 
       
  4873 canMoveUpOrDown
       
  4874    ^ false
       
  4875 ! !
       
  4876 
       
  4877 !MenuEditor::SeparatorItem class methodsFor:'interface - editor'!
       
  4878 
       
  4879 addBindingsTo:aspects for:aMenuEditor
       
  4880     "add additional bindings to the aspects
       
  4881     "
       
  4882     |holder|
       
  4883 
       
  4884     aspects at:#seperatorList  ifAbsentPut:[
       
  4885 	self separatorSlices collect:[:el| el last ]
       
  4886     ].
       
  4887 
       
  4888     aspects at:#seperatorSelection ifAbsentPut:[
       
  4889 	holder := 0 asValue.
       
  4890 	holder addDependent:aMenuEditor.
       
  4891 	holder
       
  4892     ].
       
  4893 !
       
  4894 
       
  4895 defaultLabel
       
  4896     ^ '-'
       
  4897 !
       
  4898 
       
  4899 separatorSlices
       
  4900     "get the list of menu spec values of the corresponding separator types
       
  4901     "
       
  4902     ^ #(
       
  4903 	( #blank        ''      'blank' )
       
  4904 	( #single       '-'     'single line')
       
  4905 	( #double       '='     'double line')
       
  4906       )
       
  4907 ! !
       
  4908 
       
  4909 !MenuEditor::SeparatorItem class methodsFor:'interface - specs'!
       
  4910 
       
  4911 basicsEditSpec
       
  4912     "This resource specification was automatically generated
       
  4913      by the UIPainter of ST/X."
       
  4914 
       
  4915     "Do not manually edit this!! If it is corrupted,
       
  4916      the UIPainter may not be able to read the specification."
       
  4917 
       
  4918     "
       
  4919      UIPainter new openOnClass:MenuEditor::ItemSeparator andSelector:#basicsEditSpec
       
  4920     "
       
  4921 
       
  4922     <resource: #canvas>
       
  4923 
       
  4924     ^ 
       
  4925      #(#FullSpec
       
  4926 	#name: #basicsEditSpec
       
  4927 	#window: 
       
  4928        #(#WindowSpec
       
  4929 	  #label: 'basicsEditSpec'
       
  4930 	  #name: 'basicsEditSpec'
       
  4931 	  #min: #(#Point 10 10)
       
  4932 	  #max: #(#Point 1160 870)
       
  4933 	  #bounds: #(#Rectangle 160 398 420 643)
       
  4934 	)
       
  4935 	#component: 
       
  4936        #(#SpecCollection
       
  4937 	  #collection: #(
       
  4938 	   #(#LabelSpec
       
  4939 	      #label: 'Separator:'
       
  4940 	      #name: 'separatorLabel'
       
  4941 	      #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
       
  4942 	      #resizeForLabel: true
       
  4943 	      #adjust: #right
       
  4944 	    )
       
  4945 	   #(#ComboListSpec
       
  4946 	      #name: 'seperatorList'
       
  4947 	      #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
       
  4948 	      #activeHelpKey: #basicsSeparatorType
       
  4949 	      #tabable: true
       
  4950 	      #model: #seperatorSelection
       
  4951 	      #comboList: #seperatorList
       
  4952 	      #useIndex: true
       
  4953 	    )
       
  4954 	   #(#LabelSpec
       
  4955 	      #label: 'Visibility:'
       
  4956 	      #name: 'visibilityLabel'
       
  4957 	      #layout: #(#AlignmentOrigin 107 0 51 0 1 0.5)
       
  4958 	      #resizeForLabel: true
       
  4959 	      #adjust: #right
       
  4960 	    )
       
  4961 	   #(#InputFieldSpec
       
  4962 	      #name: 'visibilityInputField'
       
  4963 	      #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
       
  4964 	      #activeHelpKey: #detailsVisibility
       
  4965 	      #tabable: true
       
  4966 	      #model: #isVisible
       
  4967 	      #group: #inputGroup
       
  4968 	      #type: #symbolOrNil
       
  4969 	      #immediateAccept: false
       
  4970 	      #acceptOnReturn: true
       
  4971 	      #acceptOnTab: true
       
  4972 	      #acceptChannel: #acceptChannel
       
  4973 	      #modifiedChannel: #modifiedChannel
       
  4974 	      #acceptOnPointerLeave: false
       
  4975 	    )
       
  4976 	   #(#LabelSpec
       
  4977 	      #label: 'Start Group:'
       
  4978 	      #name: 'startGroupLabel'
       
  4979 	      #layout: #(#AlignmentOrigin 107 0 88 0 1 0.5)
       
  4980 	      #resizeForLabel: true
       
  4981 	      #adjust: #right
       
  4982 	    )
       
  4983 	   #(#PopUpListSpec
       
  4984 	      #label: 'left'
       
  4985 	      #name: 'startGroupPopUp'
       
  4986 	      #layout: #(#LayoutFrame 110 0 77 0 -5 1.0 99 0)
       
  4987 	      #activeHelpKey: #detailsStartGroup
       
  4988 	      #tabable: true
       
  4989 	      #model: #startGroup
       
  4990 	      #menu: 
       
  4991 	     #(#left
       
  4992 		#right
       
  4993 	      )
       
  4994 	    )
       
  4995 	   )
       
  4996          
       
  4997 	)
       
  4998       )
       
  4999 ! !
       
  5000 
       
  5001 !MenuEditor::SeparatorItem methodsFor:'accessing'!
       
  5002 
       
  5003 icon
       
  5004     ^ self class iconSeparator
       
  5005 !
       
  5006 
       
  5007 rawLabel:aValue
       
  5008     |value|
       
  5009 
       
  5010     aValue isString ifTrue:[
       
  5011 	value := aValue withoutSeparators.
       
  5012 
       
  5013 	(self class separatorTypeOf:value) ifNotNil:[
       
  5014 	    menuItem rawLabel:value
       
  5015 	]
       
  5016     ].
       
  5017 !
       
  5018 
       
  5019 separatorType
       
  5020     ^ self class separatorTypeOf:(menuItem rawLabel).
       
  5021 !
       
  5022 
       
  5023 slices
       
  5024     ^ #(
       
  5025 	    (Basics   basicsEditSpec)
       
  5026        )
       
  5027 ! !
       
  5028 
       
  5029 !MenuEditor::SeparatorItem methodsFor:'aspects'!
       
  5030 
       
  5031 fromAspects:aspects
       
  5032     "put my values into the values of aspects
       
  5033     "
       
  5034     |index slice|
       
  5035 
       
  5036     index  := (aspects at:#seperatorSelection) value ? 0.
       
  5037     slice  := self class separatorSlices at:index ifAbsent:nil.
       
  5038 
       
  5039     slice ifNotNil:[ slice := slice at:2 ].
       
  5040 
       
  5041     (aspects at:#rawLabel) value:slice.
       
  5042   ^ super fromAspects:aspects.
       
  5043 !
       
  5044 
       
  5045 toAspects:aspects
       
  5046     "put my values into the values of aspects
       
  5047     "
       
  5048     |index type|
       
  5049 
       
  5050     type   := self separatorType.
       
  5051     index  := self class separatorSlices findFirst:[:el| el first == type ].
       
  5052 
       
  5053     (aspects at:#seperatorSelection) value:index.
       
  5054   ^ super  toAspects:aspects.
       
  5055 ! !
       
  5056 
       
  5057 !MenuEditor::SeparatorItem methodsFor:'displaying'!
       
  5058 
       
  5059 displayOn:aGC x:x y:y h:h
       
  5060     "draw the receiver in the graphicsContext, aGC.
       
  5061     "
       
  5062     |x1 y0 type|
       
  5063 
       
  5064     type := self separatorType.
       
  5065     type == #blank ifTrue:[ ^ self ].
       
  5066 
       
  5067     x1 := x + (self widthOn:aGC).
       
  5068     y0 := y + (h // 2) - 1.
       
  5069 
       
  5070     type == #double ifTrue:[
       
  5071 	y0 := y0 + 1.
       
  5072 	aGC displayLineFromX:x y:y0 toX:x1 y:y0.
       
  5073 	y0 := y0 - 2
       
  5074     ].
       
  5075     aGC displayLineFromX:x y:y0 toX:x1 y:y0
       
  5076 !
       
  5077 
       
  5078 widthOn:aGC
       
  5079     width ifNil:[ width := 60 ].
       
  5080   ^ width
       
  5081 ! !
       
  5082 
  5038 !MenuEditor class methodsFor:'documentation'!
  5083 !MenuEditor class methodsFor:'documentation'!
  5039 
  5084 
  5040 version
  5085 version
  5041     ^ '$Header$'
  5086     ^ '$Header$'
  5042 ! !
  5087 ! !