2110 !NewLauncher methodsFor:'help'! |
2116 !NewLauncher methodsFor:'help'! |
2111 |
2117 |
2112 defaultInfoLabel |
2118 defaultInfoLabel |
2113 |
2119 |
2114 ^self updateInfo |
2120 ^self updateInfo |
|
2121 |
|
2122 ! ! |
|
2123 |
|
2124 !NewLauncher methodsFor:'menu configuration'! |
|
2125 |
|
2126 addUserTool: toolName action: action icon: icon |
|
2127 "adds a menu item labeled toolName, and action and icon both to the |
|
2128 sub menu 'Tools' and the tool bar. |
|
2129 This can be invoked by a classes #initialize method, to add an item |
|
2130 for itself to the toolbar. |
|
2131 " |
|
2132 |
|
2133 self addUserTool: toolName action: action in: nil icon: icon space: true |
|
2134 |
|
2135 ! |
|
2136 |
|
2137 addUserTool: toolName action: action in: what icon: icon space: space |
|
2138 "adds a menu item labeled toolName, and action and icon; |
|
2139 for what == #menu menu item is added at the end of the sub menu 'Tools', |
|
2140 for what == #toolbar menu item is added at the end of the tool bar, |
|
2141 This can be invoked by a classes #initialize method, to add an item |
|
2142 for itself to the toolbar or menu. |
|
2143 " |
|
2144 |
|
2145 |menuPanel freeMenuIndex| |
|
2146 |
|
2147 (what isNil or: [what == #toolbar]) |
|
2148 ifTrue: |
|
2149 [ |
|
2150 menuPanel := builder namedComponents at: #menuToolbarView. |
|
2151 |
|
2152 (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0 |
|
2153 ifTrue: |
|
2154 [ |
|
2155 freeMenuIndex := menuPanel numberOfItems + 1. |
|
2156 space |
|
2157 ifTrue: |
|
2158 [ |
|
2159 (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: ''). |
|
2160 freeMenuIndex := freeMenuIndex + 1. |
|
2161 ]. |
|
2162 |
|
2163 (menuPanel createAtIndex: freeMenuIndex) menuItem: |
|
2164 (MenuItem new |
|
2165 label: toolName; |
|
2166 value: action; |
|
2167 isButton: true; |
|
2168 labelImage: icon; |
|
2169 activeHelpKey: toolName) |
|
2170 ]. |
|
2171 ]. |
|
2172 (what isNil or: [what== #menu]) |
|
2173 ifTrue: |
|
2174 [ |
|
2175 menuPanel := ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu. |
|
2176 |
|
2177 (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0 |
|
2178 ifTrue: |
|
2179 [ |
|
2180 freeMenuIndex := menuPanel numberOfItems + 1. |
|
2181 space |
|
2182 ifTrue: |
|
2183 [ |
|
2184 (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '-'). |
|
2185 freeMenuIndex := freeMenuIndex + 1. |
|
2186 ]. |
|
2187 |
|
2188 (menuPanel createAtIndex: freeMenuIndex) menuItem: |
|
2189 (MenuItem new |
|
2190 label: toolName; |
|
2191 value: action; |
|
2192 labelImage: (LabelAndIcon icon: icon string: toolName); |
|
2193 activeHelpKey: toolName) |
|
2194 ]. |
|
2195 ]. |
|
2196 |
|
2197 UserAddedTools isNil ifTrue: [UserAddedTools := Dictionary new]. |
|
2198 UserAddedTools at: toolName put: (Array with: action with: what with: icon with: space) |
|
2199 ! |
|
2200 |
|
2201 removeUserTool: toolName |
|
2202 "removes a menu item labeled toolName |
|
2203 This can be invoked by a classes #deinitialize method, |
|
2204 to remove its item from the toolbar or menu. |
|
2205 " |
|
2206 |
|
2207 |userTool space menuIndex removeInMenuBlock| |
|
2208 |
|
2209 UserAddedTools isNil ifTrue: [^nil]. |
|
2210 userTool := UserAddedTools at: toolName ifAbsent: [^nil]. |
|
2211 space := userTool at: 4. |
|
2212 |
|
2213 removeInMenuBlock := |
|
2214 [:menuPanel| |
|
2215 (menuIndex := menuPanel findFirst: [:i| i activeHelpKey = toolName]) ~~ 0 |
|
2216 ifTrue: |
|
2217 [ |
|
2218 menuPanel remove: menuIndex. |
|
2219 space ifTrue: [menuPanel remove: menuIndex - 1]. |
|
2220 ]. |
|
2221 ]. |
|
2222 |
|
2223 removeInMenuBlock value: (builder namedComponents at: #menuToolbarView). |
|
2224 removeInMenuBlock value: ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu. |
|
2225 |
|
2226 |
|
2227 UserAddedTools removeKey: toolName |
2115 |
2228 |
2116 ! ! |
2229 ! ! |
2117 |
2230 |
2118 !NewLauncher methodsFor:'private'! |
2231 !NewLauncher methodsFor:'private'! |
2119 |
2232 |
2460 |
2573 |
2461 ! ! |
2574 ! ! |
2462 |
2575 |
2463 !NewLauncher methodsFor:'user actions - tools'! |
2576 !NewLauncher methodsFor:'user actions - tools'! |
2464 |
2577 |
2465 addUserTool: toolName action: action icon: icon |
|
2466 "adds a menu item labeled toolName, and action and icon both to the |
|
2467 sub menu 'Tools' and the tool bar. |
|
2468 " |
|
2469 |
|
2470 self addUserTool: toolName action: action in: nil icon: icon space: true |
|
2471 |
|
2472 ! |
|
2473 |
|
2474 addUserTool: toolName action: action in: what icon: icon space: space |
|
2475 "adds a menu item labeled toolName, and action and icon; |
|
2476 for what == #menu menu item is added at the end of the sub menu 'Tools', |
|
2477 for what == #toolbar menu item is added at the end of the tool bar, |
|
2478 " |
|
2479 |
|
2480 |menuPanel freeMenuIndex| |
|
2481 |
|
2482 (what isNil or: [what == #toolbar]) |
|
2483 ifTrue: |
|
2484 [ |
|
2485 menuPanel := builder namedComponents at: #menuToolbarView. |
|
2486 |
|
2487 (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0 |
|
2488 ifTrue: |
|
2489 [ |
|
2490 freeMenuIndex := menuPanel numberOfItems + 1. |
|
2491 space |
|
2492 ifTrue: |
|
2493 [ |
|
2494 (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: ''). |
|
2495 freeMenuIndex := freeMenuIndex + 1. |
|
2496 ]. |
|
2497 |
|
2498 (menuPanel createAtIndex: freeMenuIndex) menuItem: |
|
2499 (MenuItem new |
|
2500 label: toolName; |
|
2501 value: action; |
|
2502 isButton: true; |
|
2503 labelImage: icon; |
|
2504 activeHelpKey: toolName) |
|
2505 ]. |
|
2506 ]. |
|
2507 (what isNil or: [what== #menu]) |
|
2508 ifTrue: |
|
2509 [ |
|
2510 menuPanel := ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu. |
|
2511 |
|
2512 (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0 |
|
2513 ifTrue: |
|
2514 [ |
|
2515 freeMenuIndex := menuPanel numberOfItems + 1. |
|
2516 space |
|
2517 ifTrue: |
|
2518 [ |
|
2519 (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '-'). |
|
2520 freeMenuIndex := freeMenuIndex + 1. |
|
2521 ]. |
|
2522 |
|
2523 (menuPanel createAtIndex: freeMenuIndex) menuItem: |
|
2524 (MenuItem new |
|
2525 label: toolName; |
|
2526 value: action; |
|
2527 labelImage: (LabelAndIcon icon: icon string: toolName); |
|
2528 activeHelpKey: toolName) |
|
2529 ]. |
|
2530 ]. |
|
2531 |
|
2532 UserAddedTools isNil ifTrue: [UserAddedTools := Dictionary new]. |
|
2533 UserAddedTools at: toolName put: (Array with: action with: what with: icon with: space) |
|
2534 ! |
|
2535 |
|
2536 openTerminal |
2578 openTerminal |
2537 VT100TerminalView open |
2579 VT100TerminalView open |
2538 |
2580 |
2539 "Created: / 27.7.1998 / 12:48:30 / cg" |
2581 "Created: / 27.7.1998 / 12:48:30 / cg" |
2540 ! |
|
2541 |
|
2542 removeUserTool: toolName |
|
2543 "removes a menu item labeled toolName |
|
2544 " |
|
2545 |
|
2546 |userTool space menuIndex removeInMenuBlock| |
|
2547 |
|
2548 UserAddedTools isNil ifTrue: [^nil]. |
|
2549 userTool := UserAddedTools at: toolName ifAbsent: [^nil]. |
|
2550 space := userTool at: 4. |
|
2551 |
|
2552 removeInMenuBlock := |
|
2553 [:menuPanel| |
|
2554 (menuIndex := menuPanel findFirst: [:i| i activeHelpKey = toolName]) ~~ 0 |
|
2555 ifTrue: |
|
2556 [ |
|
2557 menuPanel remove: menuIndex. |
|
2558 space ifTrue: [menuPanel remove: menuIndex - 1]. |
|
2559 ]. |
|
2560 ]. |
|
2561 |
|
2562 removeInMenuBlock value: (builder namedComponents at: #menuToolbarView). |
|
2563 removeInMenuBlock value: ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu. |
|
2564 |
|
2565 |
|
2566 UserAddedTools removeKey: toolName |
|
2567 |
|
2568 ! |
2582 ! |
2569 |
2583 |
2570 startOldChangesBrowser |
2584 startOldChangesBrowser |
2571 "opens the old changeBrowser" |
2585 "opens the old changeBrowser" |
2572 |
2586 |