# HG changeset patch # User Claus Gittinger # Date 1322562531 -3600 # Node ID eac49c3e168e47d171fe83b1ccc0b9eb91b42ea6 # Parent b8c6e02e60a181bfc2029c074b761ad69e7a2893 changed:7 methods diff -r b8c6e02e60a1 -r eac49c3e168e MenuEditor.st --- a/MenuEditor.st Tue Oct 18 15:34:27 2011 +0200 +++ b/MenuEditor.st Tue Nov 29 11:28:51 2011 +0100 @@ -1672,7 +1672,7 @@ selectedItem := self selectedItem. - selectedItem ifNotNil:[ + selectedItem notNil ifTrue:[ self withoutNotifyDo:[ rscRetrHolder := aspects at:#resourceRetriever. helpKeyHolder := aspects at:#activeHelpKey. @@ -1706,7 +1706,7 @@ self enablingCommitButtonsHolder value:false. - "Modified: / 05-09-2006 / 18:43:30 / cg" + "Modified: / 29-11-2011 / 11:28:02 / cg" ! cancel @@ -1723,12 +1723,14 @@ |item| item := listOfItems at:atLine ifAbsent:nil. - item ifNotNil:[ - item toggleExpand. - self hasSelection ifFalse:[ - self selectedItem:item - ] + item notNil ifTrue:[ + item toggleExpand. + self hasSelection ifFalse:[ + self selectedItem:item + ] ]. + + "Modified: / 29-11-2011 / 11:28:20 / cg" ! ! !MenuEditor methodsFor:'aspects'! @@ -1884,29 +1886,31 @@ " |selection size root| - selectedSuperItems ifNotNil:[ ^ selectedSuperItems ]. + selectedSuperItems notNil ifTrue:[ ^ selectedSuperItems ]. selection := selectionHolder value. size := selection size. size <= 1 ifTrue:[ - selectedSuperItems := selection ? #(). + selectedSuperItems := selection ? #(). ^ selectedSuperItems ]. root := listOfItems root. (selection includesIdentical:root) ifTrue:[ - selectedSuperItems := Array with:root. + selectedSuperItems := Array with:root. ^ selectedSuperItems ]. selectedSuperItems := OrderedCollection new. selection do:[:anItem| - anItem parentsDetect:[:el| selection includesIdentical:el ] - ifNone:[ selectedSuperItems add:anItem ]. + anItem parentsDetect:[:el| selection includesIdentical:el ] + ifNone:[ selectedSuperItems add:anItem ]. ]. ^ selectedSuperItems + + "Modified: / 29-11-2011 / 11:28:23 / cg" ! selectionChanged @@ -2156,20 +2160,20 @@ lnNr := listOfItemsView yVisibleToLineNr:(aDropContext targetPoint y). item := nil. - lnNr ifNotNil:[ - item := listOfItems at:lnNr ifAbsent:nil. - item ifNotNil:[ - (item isAction and:[item hasDelayedMenu]) ifTrue:[ - item := nil - ] - ] + lnNr notNil ifTrue:[ + item := listOfItems at:lnNr ifAbsent:nil. + item notNil ifTrue:[ + (item isAction and:[item hasDelayedMenu]) ifTrue:[ + item := nil + ] + ] ]. item isNil ifTrue:[ lnNr := 0 ]. "/ not dropable for item "/ redraw drop indication self changeDropLineTo:lnNr in:aDropContext. - "Modified: / 13-10-2006 / 16:04:05 / cg" + "Modified: / 29-11-2011 / 11:28:17 / cg" ! ! !MenuEditor methodsFor:'event processing'! @@ -2370,31 +2374,33 @@ index := 1. (intoItem canAddChildren and:[intoItem isExpanded]) ifFalse:[ - intoItem parent notNil ifTrue:[ - [ intoItem parent canAddChildren ] whileFalse:[ - intoItem := intoItem parent. - ]. - index := intoItem parent identityIndexOf:intoItem. - index := index + 1. - intoItem := intoItem parent. - ]. + intoItem parent notNil ifTrue:[ + [ intoItem parent canAddChildren ] whileFalse:[ + intoItem := intoItem parent. + ]. + index := intoItem parent identityIndexOf:intoItem. + index := index + 1. + intoItem := intoItem parent. + ]. ]. newItem := aBlockOrItem value. - newItem ifNotNil:[ - selectionHolder setValue:nil. - intoItem expand. - - newItem isCollection ifTrue:[ - intoItem addAll:newItem beforeIndex:index. - selectionHolder value:newItem. - ] ifFalse:[ - intoItem add:newItem beforeIndex:index. - selectionHolder value:(Array with:newItem). - ]. - self setModified. + newItem notNil ifTrue:[ + selectionHolder setValue:nil. + intoItem expand. + + newItem isCollection ifTrue:[ + intoItem addAll:newItem beforeIndex:index. + selectionHolder value:newItem. + ] ifFalse:[ + intoItem add:newItem beforeIndex:index. + selectionHolder value:(Array with:newItem). + ]. + self setModified. ]. ^ newItem + + "Modified: / 29-11-2011 / 11:28:06 / cg" ! clearModified @@ -2812,9 +2818,11 @@ code := self generateMenuSpecString. - code ifNotNil:[ + code notNil ifTrue:[ CodeView openWith:code title: 'Menu Spec' ]. + + "Modified: / 29-11-2011 / 11:28:12 / cg" ! save @@ -2833,14 +2841,16 @@ self askForItemModification ifFalse:[ ^ self ]. what == #menu ifTrue:[ delayedItem := RegularMenuItem new ] - ifFalse:[ delayedItem := LinkedMenuItem new ]. + ifFalse:[ delayedItem := LinkedMenuItem new ]. delayedItem setExpanded:true. delayedItem := selectedItem add:delayedItem. - delayedItem ifNotNil:[ - self selectedItem:delayedItem. + delayedItem notNil ifTrue:[ + self selectedItem:delayedItem. ]. + + "Modified: / 29-11-2011 / 11:28:09 / cg" ! doCreateItem @@ -4287,14 +4297,14 @@ aModel == imageHolder ifTrue:[ item := imageHolder value. - item ifNotNil:[ + item notNil ifTrue:[ selectorHolder value:(item label) ]. ^ self ]. super update:what with:aPara from:aModel - "Modified: / 03-08-2011 / 10:58:37 / cg" + "Modified: / 29-11-2011 / 11:28:26 / cg" ! updateImageList @@ -4346,7 +4356,7 @@ ]. imageHolder value:nil. - item ifNotNil:[ + item notNil ifTrue:[ line := imageList identityIndexOf:item. line ~~ 0 ifTrue:[ "/ imageListView scrollToLine:line @@ -5618,7 +5628,7 @@ menu := nil ]. ]. - menu ifNotNil:[ + menu notNil ifTrue:[ isExpanded := false. "/ discard change notifications children := OrderedCollection new. @@ -5633,7 +5643,7 @@ ]. self changed - "Modified: / 27-03-2007 / 08:43:07 / cg" + "Modified: / 29-11-2011 / 11:28:33 / cg" ! menuItem @@ -6062,12 +6072,14 @@ |value| aValue isString ifTrue:[ - value := aValue withoutSeparators. - - (self class separatorTypeOf:value) ifNotNil:[ - menuItem rawLabel:value - ] + value := aValue withoutSeparators. + + (self class separatorTypeOf:value) notNil ifTrue:[ + menuItem rawLabel:value + ] ]. + + "Modified: / 29-11-2011 / 11:28:39 / cg" ! separatorType @@ -6090,10 +6102,12 @@ index := (aspects at:#seperatorSelection) value ? 0. slice := self class separatorSlices at:index ifAbsent:nil. - slice ifNotNil:[ slice := slice at:2 ]. + slice notNil ifTrue:[ slice := slice at:2 ]. (aspects at:#rawLabel) value:slice. ^ super fromAspects:aspects. + + "Modified: / 29-11-2011 / 11:28:36 / cg" ! toAspects:aspects