--- a/NewLauncher.st Fri Feb 12 17:06:24 1999 +0100
+++ b/NewLauncher.st Sat Feb 13 12:05:22 1999 +0100
@@ -2033,6 +2033,9 @@
!NewLauncher methodsFor:'aspects'!
canDoTerminal
+ "return a 'valueHolder', which returns true if the terminal application
+ is available. For now, this is true if we run under unix"
+
^ [OperatingSystem isUNIXlike]
"Created: / 27.7.1998 / 12:47:54 / cg"
@@ -2048,6 +2051,9 @@
!
javaSupportPresent
+ "return a 'valueHolder', which returns true if the java support
+ is available."
+
^ [JavaVM notNil and:[JavaVM isBehavior and:[JavaVM isLoaded]]]
"Created: / 13.2.1998 / 14:25:59 / cg"
@@ -2115,6 +2121,113 @@
! !
+!NewLauncher methodsFor:'menu configuration'!
+
+addUserTool: toolName action: action icon: icon
+ "adds a menu item labeled toolName, and action and icon both to the
+ sub menu 'Tools' and the tool bar.
+ This can be invoked by a classes #initialize method, to add an item
+ for itself to the toolbar.
+ "
+
+ self addUserTool: toolName action: action in: nil icon: icon space: true
+
+!
+
+addUserTool: toolName action: action in: what icon: icon space: space
+ "adds a menu item labeled toolName, and action and icon;
+ for what == #menu menu item is added at the end of the sub menu 'Tools',
+ for what == #toolbar menu item is added at the end of the tool bar,
+ This can be invoked by a classes #initialize method, to add an item
+ for itself to the toolbar or menu.
+ "
+
+ |menuPanel freeMenuIndex|
+
+ (what isNil or: [what == #toolbar])
+ ifTrue:
+ [
+ menuPanel := builder namedComponents at: #menuToolbarView.
+
+ (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0
+ ifTrue:
+ [
+ freeMenuIndex := menuPanel numberOfItems + 1.
+ space
+ ifTrue:
+ [
+ (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '').
+ freeMenuIndex := freeMenuIndex + 1.
+ ].
+
+ (menuPanel createAtIndex: freeMenuIndex) menuItem:
+ (MenuItem new
+ label: toolName;
+ value: action;
+ isButton: true;
+ labelImage: icon;
+ activeHelpKey: toolName)
+ ].
+ ].
+ (what isNil or: [what== #menu])
+ ifTrue:
+ [
+ menuPanel := ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu.
+
+ (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0
+ ifTrue:
+ [
+ freeMenuIndex := menuPanel numberOfItems + 1.
+ space
+ ifTrue:
+ [
+ (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '-').
+ freeMenuIndex := freeMenuIndex + 1.
+ ].
+
+ (menuPanel createAtIndex: freeMenuIndex) menuItem:
+ (MenuItem new
+ label: toolName;
+ value: action;
+ labelImage: (LabelAndIcon icon: icon string: toolName);
+ activeHelpKey: toolName)
+ ].
+ ].
+
+ UserAddedTools isNil ifTrue: [UserAddedTools := Dictionary new].
+ UserAddedTools at: toolName put: (Array with: action with: what with: icon with: space)
+!
+
+removeUserTool: toolName
+ "removes a menu item labeled toolName
+ This can be invoked by a classes #deinitialize method,
+ to remove its item from the toolbar or menu.
+ "
+
+ |userTool space menuIndex removeInMenuBlock|
+
+ UserAddedTools isNil ifTrue: [^nil].
+ userTool := UserAddedTools at: toolName ifAbsent: [^nil].
+ space := userTool at: 4.
+
+ removeInMenuBlock :=
+ [:menuPanel|
+ (menuIndex := menuPanel findFirst: [:i| i activeHelpKey = toolName]) ~~ 0
+ ifTrue:
+ [
+ menuPanel remove: menuIndex.
+ space ifTrue: [menuPanel remove: menuIndex - 1].
+ ].
+ ].
+
+ removeInMenuBlock value: (builder namedComponents at: #menuToolbarView).
+ removeInMenuBlock value: ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu.
+
+
+ UserAddedTools removeKey: toolName
+
+! !
+
!NewLauncher methodsFor:'private'!
menuClassHistory
@@ -2462,111 +2575,12 @@
!NewLauncher methodsFor:'user actions - tools'!
-addUserTool: toolName action: action icon: icon
- "adds a menu item labeled toolName, and action and icon both to the
- sub menu 'Tools' and the tool bar.
- "
-
- self addUserTool: toolName action: action in: nil icon: icon space: true
-
-!
-
-addUserTool: toolName action: action in: what icon: icon space: space
- "adds a menu item labeled toolName, and action and icon;
- for what == #menu menu item is added at the end of the sub menu 'Tools',
- for what == #toolbar menu item is added at the end of the tool bar,
- "
-
- |menuPanel freeMenuIndex|
-
- (what isNil or: [what == #toolbar])
- ifTrue:
- [
- menuPanel := builder namedComponents at: #menuToolbarView.
-
- (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0
- ifTrue:
- [
- freeMenuIndex := menuPanel numberOfItems + 1.
- space
- ifTrue:
- [
- (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '').
- freeMenuIndex := freeMenuIndex + 1.
- ].
-
- (menuPanel createAtIndex: freeMenuIndex) menuItem:
- (MenuItem new
- label: toolName;
- value: action;
- isButton: true;
- labelImage: icon;
- activeHelpKey: toolName)
- ].
- ].
- (what isNil or: [what== #menu])
- ifTrue:
- [
- menuPanel := ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu.
-
- (menuPanel findFirst: [:i| i activeHelpKey = toolName]) == 0
- ifTrue:
- [
- freeMenuIndex := menuPanel numberOfItems + 1.
- space
- ifTrue:
- [
- (menuPanel createAtIndex: freeMenuIndex) menuItem: (MenuItem labeled: '-').
- freeMenuIndex := freeMenuIndex + 1.
- ].
-
- (menuPanel createAtIndex: freeMenuIndex) menuItem:
- (MenuItem new
- label: toolName;
- value: action;
- labelImage: (LabelAndIcon icon: icon string: toolName);
- activeHelpKey: toolName)
- ].
- ].
-
- UserAddedTools isNil ifTrue: [UserAddedTools := Dictionary new].
- UserAddedTools at: toolName put: (Array with: action with: what with: icon with: space)
-!
-
openTerminal
VT100TerminalView open
"Created: / 27.7.1998 / 12:48:30 / cg"
!
-removeUserTool: toolName
- "removes a menu item labeled toolName
- "
-
- |userTool space menuIndex removeInMenuBlock|
-
- UserAddedTools isNil ifTrue: [^nil].
- userTool := UserAddedTools at: toolName ifAbsent: [^nil].
- space := userTool at: 4.
-
- removeInMenuBlock :=
- [:menuPanel|
- (menuIndex := menuPanel findFirst: [:i| i activeHelpKey = toolName]) ~~ 0
- ifTrue:
- [
- menuPanel remove: menuIndex.
- space ifTrue: [menuPanel remove: menuIndex - 1].
- ].
- ].
-
- removeInMenuBlock value: (builder namedComponents at: #menuToolbarView).
- removeInMenuBlock value: ((self builder window subViews at: 1 ifAbsent: [^self]) itemAt: 4) submenu.
-
-
- UserAddedTools removeKey: toolName
-
-!
-
startOldChangesBrowser
"opens the old changeBrowser"
@@ -2613,5 +2627,5 @@
!NewLauncher class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.122 1999-02-11 12:45:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.123 1999-02-13 11:05:22 cg Exp $'
! !