MenuEditor.st
changeset 2075 f7f1cfb3da29
parent 2070 d8d3bdf3c90e
child 2113 8e2be2823f9e
equal deleted inserted replaced
2074:e641cebacc5c 2075:f7f1cfb3da29
  1534             helpTool     helpKey:(helpKeyHolder value).
  1534             helpTool     helpKey:(helpKeyHolder value).
  1535             imageTool    resourceRetriever:(rscRetrHolder value).
  1535             imageTool    resourceRetriever:(rscRetrHolder value).
  1536         ]
  1536         ]
  1537     ].
  1537     ].
  1538     self updateChannels.
  1538     self updateChannels.
  1539     self clearModified.
  1539 "/    self clearModified.
       
  1540     self clearModifiedFlag.
       
  1541 
       
  1542     self enablingCommitButtonsHolder value:false.
       
  1543 
       
  1544     "Modified: / 05-09-2006 / 18:43:30 / cg"
  1540 !
  1545 !
  1541 
  1546 
  1542 cancel
  1547 cancel
  1543     "reload aspects from current selected item; reset modification flag"
  1548     "reload aspects from current selected item; reset modification flag"
  1544 
  1549 
  1560         ]
  1565         ]
  1561     ].
  1566     ].
  1562 ! !
  1567 ! !
  1563 
  1568 
  1564 !MenuEditor methodsFor:'aspects'!
  1569 !MenuEditor methodsFor:'aspects'!
  1565 
       
  1566 autoAcceptOnSelectionChange
       
  1567     ^ builder valueAspectFor:#autoAcceptOnSelectionChange initialValue:true
       
  1568 !
       
  1569 
  1570 
  1570 canCreateDelayedMenuChannel
  1571 canCreateDelayedMenuChannel
  1571     "boolean holder, true if the current selected item accepts a delayed menu
  1572     "boolean holder, true if the current selected item accepts a delayed menu
  1572     "
  1573     "
  1573     ^ builder booleanValueAspectFor:#canCreateDelayedMenuChannel
  1574     ^ builder booleanValueAspectFor:#canCreateDelayedMenuChannel
  2140 !MenuEditor methodsFor:'initialization & release'!
  2141 !MenuEditor methodsFor:'initialization & release'!
  2141 
  2142 
  2142 closeRequest
  2143 closeRequest
  2143     "asks for permission before closing"
  2144     "asks for permission before closing"
  2144 
  2145 
  2145     self enablingCommitButtonsHolder value ifTrue:[
  2146     self askForModification ifFalse:[^self].
  2146         self setModified.
  2147 
  2147         self askForListModification.
  2148 "/    self enablingCommitButtonsHolder value ifTrue:[
  2148         modified ifTrue:[^ self].
  2149 "/        self setModified.
  2149         self clearModified.
  2150 "/        self askForListModification.
  2150     ].
  2151 "/        modified ifTrue:[^ self].
       
  2152 "/        self clearModified.
       
  2153 "/    ].
  2151     super closeRequest
  2154     super closeRequest
       
  2155 
       
  2156     "Modified: / 05-09-2006 / 18:44:15 / cg"
  2152 !
  2157 !
  2153 
  2158 
  2154 commonPostBuild
  2159 commonPostBuild
  2155     self autoAcceptOnSelectionChange addDependent:self.
  2160     self autoAcceptOnSelectionChange addDependent:self.
  2156     self autoAcceptOnSelectionChange value ifTrue:[
  2161     self autoAcceptOnSelectionChange value ifTrue:[
  3360 ! !
  3365 ! !
  3361 
  3366 
  3362 !MenuEditor::Item methodsFor:'aspects'!
  3367 !MenuEditor::Item methodsFor:'aspects'!
  3363 
  3368 
  3364 aspectAt:aKey put:aValue
  3369 aspectAt:aKey put:aValue
  3365     "set a specific aspect named aKey to the aValue
  3370     "set a specific aspect named aKey to the aValue"
  3366     "
  3371 
  3367     aKey == #rawLabel       ifTrue:[ ^ self rawLabel:aValue ].
  3372     aKey == #rawLabel       ifTrue:[ ^ self rawLabel:aValue ].
  3368     aKey == #submenuChannel ifTrue:[ ^ self ].
  3373     aKey == #submenuChannel ifTrue:[ ^ self ].
  3369     menuItem perform:((aKey, ':') asSymbol) with:aValue.
  3374     menuItem perform:((aKey, ':') asSymbol) with:aValue.
       
  3375 
       
  3376     "Modified: / 05-09-2006 / 17:47:19 / cg"
  3370 !
  3377 !
  3371 
  3378 
  3372 fromAspects:aspects
  3379 fromAspects:aspects
  3373     "read values from aspects
  3380     "read values from aspects
  3374     "
  3381     "
  3909        )
  3916        )
  3910 ! !
  3917 ! !
  3911 
  3918 
  3912 !MenuEditor::ActionItem methodsFor:'adding & removing'!
  3919 !MenuEditor::ActionItem methodsFor:'adding & removing'!
  3913 
  3920 
  3914 add:anItem
  3921 add:anItem 
  3915     "add an item; test whether the item is a delayed menu and
  3922     "add an item; test whether the item is a delayed menu and
  3916      not already a delayed menu exists.
  3923      not already a delayed menu exists."
  3917     "
  3924     
  3918     (anItem isKindOfMenu and:[self canAddDelayedMenu]) ifFalse:[
  3925     (anItem isKindOfMenu and:[ self canAddDelayedMenu ]) ifFalse:[
  3919         ^ nil
  3926         ^ nil
  3920     ].
  3927     ].
  3921     "/ reset values not setable if a delayed menu is configured
  3928     
  3922     menuItem triggerOnDown:false.
  3929     menuItem triggerOnDown:false.
  3923     anItem        argument:(menuItem argument).
  3930     anItem argument:(menuItem argument).
  3924 
       
  3925     isExpanded := false.
  3931     isExpanded := false.
  3926     anItem parent:self.
  3932     anItem parent:self.
  3927     children := Array with:anItem.
  3933     children := Array with:anItem.
  3928     self expand.
  3934     self expand.
  3929   ^ anItem
  3935     ^ anItem
       
  3936 
       
  3937     "Modified: / 05-09-2006 / 17:49:57 / cg"
  3930 ! !
  3938 ! !
  3931 
  3939 
  3932 !MenuEditor::ActionItem methodsFor:'aspects'!
  3940 !MenuEditor::ActionItem methodsFor:'aspects'!
  3933 
  3941 
  3934 aspectAt:aKey put:aValue
  3942 aspectAt:aKey put:aValue
  3935     "pass the argument to the delayed menu if existent
  3943     "set a specific aspect named aKey to the aValue"
  3936     "
  3944 
  3937     aKey == #argument ifTrue:[
  3945     aKey == #argument ifTrue:[
  3938         self hasDelayedMenu ifTrue:[
  3946         self hasDelayedMenu ifTrue:[
  3939             children first argument:aValue
  3947             children first argument:aValue
  3940         ].
  3948         ].
  3941         menuItem argument:aValue.
  3949         menuItem argument:aValue.
  3942         ^ self
  3950         ^ self
  3943     ].
  3951     ].
  3944 
  3952 
  3945     aKey == #triggerOnDown ifTrue:[
  3953     aKey == #triggerOnDown ifTrue:[
       
  3954         |triggerOnDown|
       
  3955 
  3946         self hasDelayedMenu ifTrue:[
  3956         self hasDelayedMenu ifTrue:[
  3947             menuItem triggerOnDown:false
  3957             triggerOnDown := false
  3948         ] ifFalse:[
  3958         ] ifFalse:[
  3949             menuItem triggerOnDown:aValue
  3959             triggerOnDown := aValue
  3950         ].
  3960         ].
       
  3961         menuItem triggerOnDown:triggerOnDown.
  3951         ^ self.
  3962         ^ self.
  3952     ].
  3963     ].
  3953     super aspectAt:aKey put:aValue.
  3964     super aspectAt:aKey put:aValue.
  3954 
  3965 
  3955     "Modified: / 16-07-2006 / 10:18:51 / cg"
  3966     "Modified: / 05-09-2006 / 17:47:24 / cg"
  3956 !
  3967 !
  3957 
  3968 
  3958 toAspects:aspects
  3969 toAspects:aspects
  3959     "write values to aspects
  3970     "write values to aspects
  3960     "
  3971     "
  4234 ! !
  4245 ! !
  4235 
  4246 
  4236 !MenuEditor::LinkedMenuItem methodsFor:'aspects'!
  4247 !MenuEditor::LinkedMenuItem methodsFor:'aspects'!
  4237 
  4248 
  4238 aspectAt:aKey put:aValue
  4249 aspectAt:aKey put:aValue
  4239     "set a specific aspect named aKey to the aValue
  4250     "set a specific aspect named aKey to the aValue"
  4240     "
  4251 
  4241     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  4252     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  4242     super aspectAt:aKey put:aValue.
  4253     super aspectAt:aKey put:aValue.
       
  4254 
       
  4255     "Modified: / 05-09-2006 / 17:47:39 / cg"
  4243 !
  4256 !
  4244 
  4257 
  4245 getDelayedAttributesFrom:anItem
  4258 getDelayedAttributesFrom:anItem
  4246 
  4259 
  4247     menuItem rawLabel:'Delayed'.
  4260     menuItem rawLabel:'Delayed'.
  4462 argument:aValue
  4475 argument:aValue
  4463     menuItem argument:aValue.
  4476     menuItem argument:aValue.
  4464 !
  4477 !
  4465 
  4478 
  4466 aspectAt:aKey put:aValue
  4479 aspectAt:aKey put:aValue
  4467     "set a specific aspect named aKey to the aValue
  4480     "set a specific aspect named aKey to the aValue"
  4468     "
  4481 
  4469     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  4482     aKey == #submenuChannel ifTrue:[ ^ self submenuChannel:aValue ].
  4470     aKey == #isSliceMenu    ifTrue:[ ^ self ].
  4483     aKey == #isSliceMenu    ifTrue:[ ^ self ].
  4471 
  4484 
  4472     super aspectAt:aKey put:aValue.
  4485     super aspectAt:aKey put:aValue.
       
  4486 
       
  4487     "Modified: / 05-09-2006 / 17:47:42 / cg"
  4473 !
  4488 !
  4474 
  4489 
  4475 submenuChannel
  4490 submenuChannel
  4476     ^ menuItem submenuChannel ? #unspecified
  4491     ^ menuItem submenuChannel ? #unspecified
  4477 !
  4492 !
  5355 ! !
  5370 ! !
  5356 
  5371 
  5357 !MenuEditor::RootItem methodsFor:'aspects'!
  5372 !MenuEditor::RootItem methodsFor:'aspects'!
  5358 
  5373 
  5359 aspectAt:aKey put:aValue
  5374 aspectAt:aKey put:aValue
  5360     "discard all other than the rawLabel
  5375     "ignore all aspects other than the rawLabel"
  5361     "
  5376 
  5362     aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
  5377     aKey == #rawLabel ifTrue:[ self rawLabel:aValue ].
       
  5378 
       
  5379     "Modified: / 05-09-2006 / 17:48:01 / cg"
  5363 ! !
  5380 ! !
  5364 
  5381 
  5365 !MenuEditor::RootItem methodsFor:'displaying'!
  5382 !MenuEditor::RootItem methodsFor:'displaying'!
  5366 
  5383 
  5367 heightOn:aGC
  5384 heightOn:aGC