1786 " |
1786 " |
1787 |tab selector item canvas wizardHolder| |
1787 |tab selector item canvas wizardHolder| |
1788 |
1788 |
1789 wizardHolder := self wizardHolder. |
1789 wizardHolder := self wizardHolder. |
1790 item := self selectedItem. |
1790 item := self selectedItem. |
1791 item ifNil:[ ^ wizardHolder value:nil ]. |
1791 item isNil ifTrue:[ ^ wizardHolder value:nil ]. |
1792 |
1792 |
1793 tab := tabHolder value. |
1793 tab := tabHolder value. |
1794 |
1794 |
1795 tab notNil ifTrue:[ |
1795 tab notNil ifTrue:[ |
1796 tab := item slices detect:[:el| el first = tab ] ifNone:nil. |
1796 tab := item slices detect:[:el| el first = tab ] ifNone:nil. |
2023 doDrop:aDropContext |
2023 doDrop:aDropContext |
2024 "drop the dropContext into the hierachical list of items |
2024 "drop the dropContext into the hierachical list of items |
2025 " |
2025 " |
2026 |done item| |
2026 |done item| |
2027 |
2027 |
2028 dropOverLine ifNil:[^ false ]. "/ context not valid to me ... |
2028 dropOverLine isNil ifTrue:[^ false ]. "/ context not valid to me ... |
2029 |
2029 |
2030 item := listOfItems at:dropOverLine ifAbsent:nil. |
2030 item := listOfItems at:dropOverLine ifAbsent:nil. |
2031 self dropLeave:aDropContext. |
2031 self dropLeave:aDropContext. |
2032 item ifNil:[^ false]. |
2032 item isNil ifTrue:[^ false]. |
2033 |
2033 |
2034 selectionHolder setValue:(Array with:item). |
2034 selectionHolder setValue:(Array with:item). |
2035 |
2035 |
2036 done := false. |
2036 done := false. |
2037 |
2037 |
2108 (item isAction and:[item hasDelayedMenu]) ifTrue:[ |
2108 (item isAction and:[item hasDelayedMenu]) ifTrue:[ |
2109 item := nil |
2109 item := nil |
2110 ] |
2110 ] |
2111 ] |
2111 ] |
2112 ]. |
2112 ]. |
2113 item ifNil:[ lnNr := 0 ]. "/ not dropable for item |
2113 item isNil ifTrue:[ lnNr := 0 ]. "/ not dropable for item |
2114 |
2114 |
2115 "/ redraw drop indication |
2115 "/ redraw drop indication |
2116 self changeDropLineTo:lnNr in:aDropContext. |
2116 self changeDropLineTo:lnNr in:aDropContext. |
2117 |
2117 |
2118 "Modified: / 13-10-2006 / 16:04:05 / cg" |
2118 "Modified: / 13-10-2006 / 16:04:05 / cg" |
2127 |evView inView rawKey key| |
2127 |evView inView rawKey key| |
2128 |
2128 |
2129 anEvent isKeyPressEvent ifFalse:[ ^ false]. |
2129 anEvent isKeyPressEvent ifFalse:[ ^ false]. |
2130 |
2130 |
2131 evView := anEvent targetView. |
2131 evView := anEvent targetView. |
2132 evView ifNil:[ ^ false ]. |
2132 evView isNil ifTrue:[ ^ false ]. |
2133 |
2133 |
2134 inView := evView isSameOrComponentOf:listOfItemsView. |
2134 inView := evView isSameOrComponentOf:listOfItemsView. |
2135 inView ifFalse:[^ false]. |
2135 inView ifFalse:[^ false]. |
2136 |
2136 |
2137 key := anEvent key. |
2137 key := anEvent key. |
2252 is enabled. On success the new item(s) are returned otherwise nil. |
2252 is enabled. On success the new item(s) are returned otherwise nil. |
2253 " |
2253 " |
2254 |intoItem index newItem| |
2254 |intoItem index newItem| |
2255 |
2255 |
2256 intoItem := self selectedItem. |
2256 intoItem := self selectedItem. |
2257 intoItem ifNil:[ ^ nil]. |
2257 intoItem isNil ifTrue:[ ^ nil]. |
2258 |
2258 |
2259 self askForItemModification ifFalse:[ ^ nil ]. |
2259 self askForItemModification ifFalse:[ ^ nil ]. |
2260 |
2260 |
2261 index := 1. |
2261 index := 1. |
2262 |
2262 |
2300 "generate and returns the current menu spec or nil |
2300 "generate and returns the current menu spec or nil |
2301 " |
2301 " |
2302 |menu spec| |
2302 |menu spec| |
2303 |
2303 |
2304 menu := listOfItems root submenu. |
2304 menu := listOfItems root submenu. |
2305 menu ifNil:[^ nil]. |
2305 menu isNil ifTrue:[^ nil]. |
2306 menu := menu literalArrayEncoding. |
2306 menu := menu literalArrayEncoding. |
2307 spec := WriteStream on:String new. |
2307 spec := WriteStream on:String new. |
2308 UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
2308 UISpecification prettyPrintSpecArray:menu on:spec indent:5. |
2309 ^ spec contents. |
2309 ^ spec contents. |
2310 ! |
2310 ! |
2311 |
2311 |
2312 submenuTest |
2312 submenuTest |
2313 "returns a menu on the current editing menu |
2313 "returns a menu on the current editing menu |
2314 " |
2314 " |
2315 |menu indication choice submenu retriever| |
2315 |menu indication choice submenu retriever| |
2316 |
2316 |
2317 menu := listOfItems root submenu. |
2317 menu := listOfItems root submenu. |
2318 menu ifNil:[^ nil ]. |
2318 menu isNil ifTrue:[^ nil ]. |
2319 |
2319 |
2320 menu allItemsDo:[:anItem| |
2320 menu allItemsDo:[:anItem| |
2321 anItem isVisible:true. |
2321 anItem isVisible:true. |
2322 anItem enabled:true. |
2322 anItem enabled:true. |
2323 anItem translateLabel:false. |
2323 anItem translateLabel:false. |
2393 |
2393 |
2394 self enablingCommitButtonsHolder value ifFalse:[ |
2394 self enablingCommitButtonsHolder value ifFalse:[ |
2395 ^ true |
2395 ^ true |
2396 ]. |
2396 ]. |
2397 oldSelectedItem := self selectedItem. |
2397 oldSelectedItem := self selectedItem. |
2398 oldSelectedItem ifNil:[^ true]. |
2398 oldSelectedItem isNil ifTrue:[^ true]. |
2399 |
2399 |
2400 newSelectedItem := listOfItems at:anIndex ifAbsent:nil. |
2400 newSelectedItem := listOfItems at:anIndex ifAbsent:nil. |
2401 oldSelectedItem == newSelectedItem ifTrue:[ |
2401 oldSelectedItem == newSelectedItem ifTrue:[ |
2402 ^ true |
2402 ^ true |
2403 ]. |
2403 ]. |
2467 doGenerateAspectMethods |
2467 doGenerateAspectMethods |
2468 "compile aspect and action methods" |
2468 "compile aspect and action methods" |
2469 |
2469 |
2470 |cls redefineAspectMethods category| |
2470 |cls redefineAspectMethods category| |
2471 |
2471 |
2472 specClass ifNil:[ |
2472 specClass isNil ifTrue:[ |
2473 self warn:'Define the class first !!'. |
2473 self warn:'Define the class first !!'. |
2474 ^ self |
2474 ^ self |
2475 ]. |
2475 ]. |
2476 redefineAspectMethods := self redefineAspectMethodsChannel value. |
2476 redefineAspectMethods := self redefineAspectMethodsChannel value. |
2477 |
2477 |
2478 cls := self resolveName:specClass. |
2478 cls := self resolveName:specClass. |
2479 cls ifNil:[ |
2479 cls isNil ifTrue:[ |
2480 self warn:'Class ', specClass asString, ' does not exist!!'. |
2480 self warn:'Class ', specClass asString, ' does not exist!!'. |
2481 ^ self |
2481 ^ self |
2482 ]. |
2482 ]. |
2483 |
2483 |
2484 category := UserPreferences current categoryForMenuActionsMethods. |
2484 category := UserPreferences current categoryForMenuActionsMethods. |
2530 " |
2530 " |
2531 |cls spec mthd category code excla| |
2531 |cls spec mthd category code excla| |
2532 |
2532 |
2533 super doSave ifFalse: [^nil]. |
2533 super doSave ifFalse: [^nil]. |
2534 spec := self generateMenuSpec. |
2534 spec := self generateMenuSpec. |
2535 spec ifNil:[^ nil]. |
2535 spec isNil ifTrue:[^ nil]. |
2536 |
2536 |
2537 cls := self resolveName:specClass. |
2537 cls := self resolveName:specClass. |
2538 |
2538 |
2539 "/ if that method already exists, do not overwrite the category |
2539 "/ if that method already exists, do not overwrite the category |
2540 |
2540 |
2605 |
2605 |
2606 doCreateDelayedMenu:what |
2606 doCreateDelayedMenu:what |
2607 |selectedItem delayedItem| |
2607 |selectedItem delayedItem| |
2608 |
2608 |
2609 selectedItem := self selectedItem. |
2609 selectedItem := self selectedItem. |
2610 selectedItem ifNil:[^ self]. |
2610 selectedItem isNil ifTrue:[^ self]. |
2611 |
2611 |
2612 selectedItem canAddDelayedMenu ifFalse:[ ^ self ]. |
2612 selectedItem canAddDelayedMenu ifFalse:[ ^ self ]. |
2613 self askForItemModification ifFalse:[ ^ self ]. |
2613 self askForItemModification ifFalse:[ ^ self ]. |
2614 |
2614 |
2615 what == #menu ifTrue:[ delayedItem := RegularMenuItem new ] |
2615 what == #menu ifTrue:[ delayedItem := RegularMenuItem new ] |
2765 |item loMenuItems| |
2765 |item loMenuItems| |
2766 |
2766 |
2767 aCollection size == 0 ifTrue:[ ^ self ]. |
2767 aCollection size == 0 ifTrue:[ ^ self ]. |
2768 |
2768 |
2769 item := self selectedItem. |
2769 item := self selectedItem. |
2770 item ifNil:[ ^ self ]. |
2770 item isNil ifTrue:[ ^ self ]. |
2771 |
2771 |
2772 loMenuItems := OrderedCollection new. |
2772 loMenuItems := OrderedCollection new. |
2773 aCollection do:[:el| |
2773 aCollection do:[:el| |
2774 (el askFor:#isMenuItem) ifTrue:[ loMenuItems add:el ]. |
2774 (el askFor:#isMenuItem) ifTrue:[ loMenuItems add:el ]. |
2775 ]. |
2775 ]. |
2792 "move selected item into the next (#inNext) or previous (#inPrev) item |
2792 "move selected item into the next (#inNext) or previous (#inPrev) item |
2793 " |
2793 " |
2794 |item idx parent toParent| |
2794 |item idx parent toParent| |
2795 |
2795 |
2796 item := self selectedItem. |
2796 item := self selectedItem. |
2797 item ifNil:[^ self]. |
2797 item isNil ifTrue:[^ self]. |
2798 |
2798 |
2799 aDirection == #inNext ifTrue:[ item canMoveInNext ifFalse:[^ self] ] |
2799 aDirection == #inNext ifTrue:[ item canMoveInNext ifFalse:[^ self] ] |
2800 ifFalse:[ item canMoveInAbove ifFalse:[^ self] ]. |
2800 ifFalse:[ item canMoveInAbove ifFalse:[^ self] ]. |
2801 |
2801 |
2802 self askForItemModification ifFalse:[ ^ self ]. |
2802 self askForItemModification ifFalse:[ ^ self ]. |
2835 "move selected item out of current item |
2835 "move selected item out of current item |
2836 " |
2836 " |
2837 |item parent grandParent index| |
2837 |item parent grandParent index| |
2838 |
2838 |
2839 item := self selectedItem. |
2839 item := self selectedItem. |
2840 item ifNil:[^ self]. |
2840 item isNil ifTrue:[^ self]. |
2841 item canMoveOut ifFalse:[^ self]. |
2841 item canMoveOut ifFalse:[^ self]. |
2842 |
2842 |
2843 self askForItemModification ifFalse:[ ^ self ]. |
2843 self askForItemModification ifFalse:[ ^ self ]. |
2844 |
2844 |
2845 parent := item parent. |
2845 parent := item parent. |
2866 "move selected item up (#up) or down (#down) |
2866 "move selected item up (#up) or down (#down) |
2867 " |
2867 " |
2868 |item index parent children| |
2868 |item index parent children| |
2869 |
2869 |
2870 item := self selectedItem. |
2870 item := self selectedItem. |
2871 item ifNil:[^ self]. |
2871 item isNil ifTrue:[^ self]. |
2872 item canMoveUpOrDown ifFalse:[^ self]. |
2872 item canMoveUpOrDown ifFalse:[^ self]. |
2873 |
2873 |
2874 self askForItemModification ifFalse:[ ^ self ]. |
2874 self askForItemModification ifFalse:[ ^ self ]. |
2875 |
2875 |
2876 self withoutNotifyDo:[ |
2876 self withoutNotifyDo:[ |
3573 siblings size > 1 ifFalse:[ ^ false ]. |
3573 siblings size > 1 ifFalse:[ ^ false ]. |
3574 |
3574 |
3575 index := siblings identityIndexOf:self. |
3575 index := siblings identityIndexOf:self. |
3576 nextItem := siblings at:(index - 1) ifAbsent:nil. |
3576 nextItem := siblings at:(index - 1) ifAbsent:nil. |
3577 |
3577 |
3578 nextItem ifNil:[^ false]. |
3578 nextItem isNil ifTrue:[^ false]. |
3579 ^ nextItem canAddChildren |
3579 ^ nextItem canAddChildren |
3580 ! |
3580 ! |
3581 |
3581 |
3582 canMoveInNext |
3582 canMoveInNext |
3583 "returns true if the item can become a child of its next sibling |
3583 "returns true if the item can become a child of its next sibling |
3584 " |
3584 " |
3588 siblings size > 1 ifFalse:[ ^ false ]. |
3588 siblings size > 1 ifFalse:[ ^ false ]. |
3589 |
3589 |
3590 index := siblings identityIndexOf:self. |
3590 index := siblings identityIndexOf:self. |
3591 nextItem := siblings at:(index + 1) ifAbsent:nil. |
3591 nextItem := siblings at:(index + 1) ifAbsent:nil. |
3592 |
3592 |
3593 nextItem ifNil:[^ false]. |
3593 nextItem isNil ifTrue:[^ false]. |
3594 ^ nextItem canAddChildren |
3594 ^ nextItem canAddChildren |
3595 ! |
3595 ! |
3596 |
3596 |
3597 canMoveOut |
3597 canMoveOut |
3598 "returns true if the item can be moved out from its current parent |
3598 "returns true if the item can be moved out from its current parent |
3599 " |
3599 " |