--- a/Button.st Tue Feb 28 22:52:21 1995 +0100
+++ b/Button.st Mon Mar 06 20:29:54 1995 +0100
@@ -39,7 +39,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Button.st,v 1.17 1995-02-27 10:38:01 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Button.st,v 1.18 1995-03-06 19:27:48 claus Exp $
'!
!Button class methodsFor:'documentation'!
@@ -60,7 +60,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Button.st,v 1.17 1995-02-27 10:38:01 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Button.st,v 1.18 1995-03-06 19:27:48 claus Exp $
"
!
@@ -915,12 +915,10 @@
|extra|
logo notNil ifTrue:[
- extra := (onLevel abs max:offLevel abs) * 2.
+ extra := (onLevel abs max:offLevel abs) + ViewSpacing * 2.
self is3D ifFalse:[
-"/ (logo isKindOf:Form) ifFalse:[
- "add space for a frame around"
- extra := extra + 2.
-"/ ]
+ "add space for a frame around"
+ extra := extra + 2.
].
^ (labelWidth + extra) @ (labelHeight + extra)
].
--- a/ButtonC.st Tue Feb 28 22:52:21 1995 +0100
+++ b/ButtonC.st Mon Mar 06 20:29:54 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/ButtonC.st,v 1.4 1995-02-27 10:38:07 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/ButtonC.st,v 1.5 1995-03-06 19:27:54 claus Exp $
"
!
@@ -256,7 +256,9 @@
triggerOnDown ifTrue:[
"the ST-80 way of doing things"
- view sendChangeMessageWith:true
+ view notNil ifTrue:[
+ view sendChangeMessageWith:true
+ ]
].
active := false.
@@ -306,7 +308,9 @@
].
triggerOnDown ifFalse:[
"the ST-80 way of doing things"
- view sendChangeMessageWith:false.
+ view notNil ifTrue:[
+ view sendChangeMessageWith:false.
+ ].
].
active := false.
@@ -404,4 +408,3 @@
]
]
! !
-
--- a/ButtonController.st Tue Feb 28 22:52:21 1995 +0100
+++ b/ButtonController.st Mon Mar 06 20:29:54 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.4 1995-02-27 10:38:07 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.5 1995-03-06 19:27:54 claus Exp $
"
!
@@ -256,7 +256,9 @@
triggerOnDown ifTrue:[
"the ST-80 way of doing things"
- view sendChangeMessageWith:true
+ view notNil ifTrue:[
+ view sendChangeMessageWith:true
+ ]
].
active := false.
@@ -306,7 +308,9 @@
].
triggerOnDown ifFalse:[
"the ST-80 way of doing things"
- view sendChangeMessageWith:false.
+ view notNil ifTrue:[
+ view sendChangeMessageWith:false.
+ ].
].
active := false.
@@ -404,4 +408,3 @@
]
]
! !
-
--- a/CodeView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/CodeView.st Mon Mar 06 20:29:54 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.12 1995-02-27 10:38:14 claus Exp $
+$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.13 1995-03-06 19:28:05 claus Exp $
'!
!CodeView class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.12 1995-02-27 10:38:14 claus Exp $
+$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.13 1995-03-06 19:28:05 claus Exp $
"
!
@@ -59,30 +59,34 @@
!CodeView methodsFor:'initialization'!
-initializeMiddleButtonMenu
- |sub idx|
+editMenu
+ |m sub idx|
- super initializeMiddleButtonMenu.
+ m := super editMenu.
"
codeViews do support #accept
"
- idx := middleButtonMenu indexOf:#inspectIt.
+ idx := m indexOf:#inspectIt.
idx ~~ 0 ifTrue:[
- middleButtonMenu addLabel:'-' selector:nil after:idx.
- middleButtonMenu addLabel:(resources string:'accept') selector:#accept after:idx + 1.
+ m addLabel:'-' selector:nil after:idx.
+ m addLabel:(resources string:'accept') selector:#accept after:idx + 1.
].
"
and explain in the extra menu
"
- sub := middleButtonMenu subMenuAt:#others.
+ sub := m subMenuAt:#others.
sub notNil ifTrue:[
idx := sub indexOf:#gotoLine.
sub addLabel:'-' selector:nil after:idx.
sub addLabel:(resources string:'explain') selector:#explain after:idx + 1.
+ self hasSelection ifFalse:[
+ sub disable:#explain
+ ].
].
- self enableOrDisableSelectionMenuEntries
+
+ ^ m.
! !
!CodeView methodsFor:'accessing'!
@@ -105,26 +109,6 @@
explainAction := aBlock
! !
-!CodeView methodsFor:'selections'!
-
-disableSelectionMenuEntries
- "disable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- super disableSelectionMenuEntries.
- middleButtonMenu disable:#explain
- ]
-!
-
-enableSelectionMenuEntries
- "enable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- super enableSelectionMenuEntries.
- middleButtonMenu enable:#explain
- ]
-! !
-
!CodeView methodsFor:'user actions'!
accept
--- a/DialogBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/DialogBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -25,7 +25,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.3 1995-02-27 10:38:18 claus Exp $
+$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.4 1995-03-06 19:28:11 claus Exp $
"
!
@@ -127,14 +127,15 @@
preferedExtent
"return my prefered extent"
- |w h|
+ |w h p|
okButton isNil ifTrue:[
^ super preferedExtent
].
- w := buttonPanel preferedExtent x.
+ p := buttonPanel preferedExtent.
+ w := p x.
h := ViewSpacing
- + okButton preferedExtent y
+ + "okButton preferedExtent" p y
+ ViewSpacing.
^ w @ h
@@ -258,7 +259,7 @@
okButton label:aString.
okButton resize.
okButton extent ~= oldSize ifTrue:[
- self resize
+ shown ifTrue:[self resize]
]
]
!
@@ -285,7 +286,7 @@
abortButton label:aString.
abortButton resize.
abortButton extent ~= oldSize ifTrue:[
- self resize
+ shown ifTrue:[self resize]
]
]
!
@@ -299,7 +300,6 @@
abortButton label:abortString.
okButton resize.
abortButton resize.
- self resize
+ shown ifTrue:[self resize]
]
! !
-
--- a/ETxtView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/ETxtView.st Mon Mar 06 20:29:54 1995 +0100
@@ -32,7 +32,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.21 1995-02-22 01:20:41 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.22 1995-03-06 19:28:18 claus Exp $
'!
!EditTextView class methodsFor:'documentation'!
@@ -53,7 +53,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.21 1995-02-22 01:20:41 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/ETxtView.st,v 1.22 1995-03-06 19:28:18 claus Exp $
"
!
@@ -141,68 +141,83 @@
self enableEnterLeaveEvents
!
-initializeMiddleButtonMenu
- "initialize the views middleButtonMenu"
-
- |labels|
-
- labels := resources array:#(
-"/ 'undo'
- 'again'
- '-'
- 'copy'
- 'cut'
- 'paste'
- '-'
- 'accept'
- '='
- 'others'
- ).
-
- self middleButtonMenu:(PopUpMenu
- labels:labels
- selectors:#(
-"/ undo
- again
- nil
- copySelection
- cut
- paste
- nil
- accept
- nil
- others
- )
- receiver:self
- for:self).
-
- middleButtonMenu subMenuAt:#others put:(PopUpMenu
- labels:(resources array:#(
- 'search ...'
- 'goto ...'
- '-'
- 'font ...'
- '-'
- 'indent'
- '-'
- 'save as ...'
- 'print'
- ))
- selectors:#(
- search
- gotoLine
- nil
- changeFont
- nil
- indent
- nil
- save
- print
- )
- receiver:self
- for:self).
-
- self enableOrDisableSelectionMenuEntries
+editMenu
+ "return the views middleButtonMenu"
+
+ |labels selectors m sub|
+
+ labels := #(
+"/ 'undo'
+ 'again'
+ '-'
+ 'copy'
+ 'cut'
+ 'paste'
+ '-'
+ 'accept'
+ '='
+ 'others'
+ ).
+
+ selectors := #(
+"/ undo
+ again
+ nil
+ copySelection
+ cut
+ paste
+ nil
+ accept
+ nil
+ others
+ ).
+
+ m := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors.
+
+ labels := #(
+ 'search ...'
+ 'goto ...'
+ '-'
+ 'font ...'
+ '-'
+ 'indent'
+ '-'
+ 'save as ...'
+ 'print'
+ ).
+
+ selectors := #(
+ search
+ gotoLine
+ nil
+ changeFont
+ nil
+ indent
+ nil
+ save
+ print
+ ).
+
+ sub := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors
+ receiver:model.
+
+ m subMenuAt:#others put:sub.
+
+ readOnly ifTrue:[
+ m disable:#paste
+ ].
+ self hasSelection not ifTrue:[
+ m disable:#copySelection.
+ ].
+ (self hasSelection not or:[readOnly]) ifTrue:[
+ m disable:#cut.
+ sub disable:#indent.
+ ].
+ ^ m.
!
realize
@@ -256,10 +271,7 @@
readOnly
"make the text readonly"
- readOnly ifFalse:[
- readOnly := true.
- self enableOrDisableSelectionMenuEntries
- ]
+ readOnly := true
!
fixedSize
@@ -353,7 +365,7 @@
|line lineSize leftRest rightRest visLine w
srcY "{ Class: SmallInteger }" |
-
+
list isNil ifFalse:[
lineNr > (list size) ifFalse:[
(colNr == 1) ifTrue:[
@@ -393,7 +405,8 @@
self redrawLine:lineNr.
self redrawLine:(lineNr + 1).
self waitForExpose
- ]
+ ].
+ self contentsChanged.
]
]
!
@@ -437,7 +450,6 @@
"
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr.
list at:lineNr put:line.
- self contentsChanged
!
insertLine:aString before:lineNr
@@ -449,6 +461,7 @@
visLine := self listLineToVisibleLine:lineNr.
(shown not or:[visLine isNil]) ifTrue:[
self withoutRedrawInsertLine:aString before:lineNr.
+ self contentsChanged.
^ self
].
@@ -462,7 +475,8 @@
width:w
height:((nLinesShown - visLine "- 1") * fontHeight).
self redrawVisibleLine:visLine.
- self waitForExpose
+ self waitForExpose.
+ self contentsChanged.
!
insertLines:someText from:start to:end before:lineNr
@@ -480,6 +494,7 @@
self withoutRedrawInsertLines:someText
from:start to:end
before:lineNr.
+ self contentsChanged.
^ self
].
@@ -508,7 +523,8 @@
height:(height - dstY).
self redrawFromVisibleLine:visLine to:(visLine + nLines - 1).
self waitForExpose
- ]
+ ].
+ self contentsChanged.
!
insert:aCharacter atLine:lineNr col:colNr
@@ -611,7 +627,6 @@
"
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr.
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start.
- self contentsChanged
!
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
@@ -2017,37 +2032,6 @@
!EditTextView methodsFor:'selections'!
-disableSelectionMenuEntries
- "disable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- super disableSelectionMenuEntries.
- middleButtonMenu disable:#cut.
- middleButtonMenu disable:#replace.
- middleButtonMenu disable:#indent
- ]
-!
-
-enableSelectionMenuEntries
- "enable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- "if readonly, never enable destructive functions"
- readOnly ifTrue:[
- super enableSelectionMenuEntries.
- middleButtonMenu disable:#cut.
- middleButtonMenu disable:#replace.
- middleButtonMenu disable:#indent.
- middleButtonMenu disable:#paste.
- ] ifFalse:[
- super enableSelectionMenuEntries.
- middleButtonMenu enable:#cut.
- middleButtonMenu enable:#replace.
- middleButtonMenu enable:#indent.
- ]
- ]
-!
-
unselect
"forget and unhilight selection - must take care of cursor here"
--- a/EditField.st Tue Feb 28 22:52:21 1995 +0100
+++ b/EditField.st Mon Mar 06 20:29:54 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1990 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.12 1995-02-06 00:52:10 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.13 1995-03-06 19:28:26 claus Exp $
'!
!EditField class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.12 1995-02-06 00:52:10 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.13 1995-03-06 19:28:26 claus Exp $
"
!
@@ -106,34 +106,41 @@
]
!
-initializeMiddleButtonMenu
- |labels|
+editMenu
+ |labels selectors m|
- labels := resources array:#(
- 'copy'
- 'cut'
- 'paste'
+ labels := #(
+ 'copy'
+ 'cut'
+ 'paste'
"
- 'replace'
+ 'replace'
"
- '-'
- 'accept'
- ).
+ '-'
+ 'accept'
+ ).
- self middleButtonMenu:(PopUpMenu
- labels:labels
- selectors:#(
- copySelection
- cut
- paste
+ selectors := #(
+ copySelection
+ cut
+ paste
+"
+ replace
"
- replace
-"
- nil
- accept
- )
- receiver:self
- for:self)
+ nil
+ accept
+ ).
+
+ m := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors.
+
+ self hasSelection ifFalse:[
+ m disable:#copySelection.
+ m disable:#cut
+ ].
+
+ ^ m
! !
!EditField methodsFor:'realization'!
--- a/EditTextView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/EditTextView.st Mon Mar 06 20:29:54 1995 +0100
@@ -32,7 +32,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.21 1995-02-22 01:20:41 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.22 1995-03-06 19:28:18 claus Exp $
'!
!EditTextView class methodsFor:'documentation'!
@@ -53,7 +53,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.21 1995-02-22 01:20:41 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.22 1995-03-06 19:28:18 claus Exp $
"
!
@@ -141,68 +141,83 @@
self enableEnterLeaveEvents
!
-initializeMiddleButtonMenu
- "initialize the views middleButtonMenu"
-
- |labels|
-
- labels := resources array:#(
-"/ 'undo'
- 'again'
- '-'
- 'copy'
- 'cut'
- 'paste'
- '-'
- 'accept'
- '='
- 'others'
- ).
-
- self middleButtonMenu:(PopUpMenu
- labels:labels
- selectors:#(
-"/ undo
- again
- nil
- copySelection
- cut
- paste
- nil
- accept
- nil
- others
- )
- receiver:self
- for:self).
-
- middleButtonMenu subMenuAt:#others put:(PopUpMenu
- labels:(resources array:#(
- 'search ...'
- 'goto ...'
- '-'
- 'font ...'
- '-'
- 'indent'
- '-'
- 'save as ...'
- 'print'
- ))
- selectors:#(
- search
- gotoLine
- nil
- changeFont
- nil
- indent
- nil
- save
- print
- )
- receiver:self
- for:self).
-
- self enableOrDisableSelectionMenuEntries
+editMenu
+ "return the views middleButtonMenu"
+
+ |labels selectors m sub|
+
+ labels := #(
+"/ 'undo'
+ 'again'
+ '-'
+ 'copy'
+ 'cut'
+ 'paste'
+ '-'
+ 'accept'
+ '='
+ 'others'
+ ).
+
+ selectors := #(
+"/ undo
+ again
+ nil
+ copySelection
+ cut
+ paste
+ nil
+ accept
+ nil
+ others
+ ).
+
+ m := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors.
+
+ labels := #(
+ 'search ...'
+ 'goto ...'
+ '-'
+ 'font ...'
+ '-'
+ 'indent'
+ '-'
+ 'save as ...'
+ 'print'
+ ).
+
+ selectors := #(
+ search
+ gotoLine
+ nil
+ changeFont
+ nil
+ indent
+ nil
+ save
+ print
+ ).
+
+ sub := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors
+ receiver:model.
+
+ m subMenuAt:#others put:sub.
+
+ readOnly ifTrue:[
+ m disable:#paste
+ ].
+ self hasSelection not ifTrue:[
+ m disable:#copySelection.
+ ].
+ (self hasSelection not or:[readOnly]) ifTrue:[
+ m disable:#cut.
+ sub disable:#indent.
+ ].
+ ^ m.
!
realize
@@ -256,10 +271,7 @@
readOnly
"make the text readonly"
- readOnly ifFalse:[
- readOnly := true.
- self enableOrDisableSelectionMenuEntries
- ]
+ readOnly := true
!
fixedSize
@@ -353,7 +365,7 @@
|line lineSize leftRest rightRest visLine w
srcY "{ Class: SmallInteger }" |
-
+
list isNil ifFalse:[
lineNr > (list size) ifFalse:[
(colNr == 1) ifTrue:[
@@ -393,7 +405,8 @@
self redrawLine:lineNr.
self redrawLine:(lineNr + 1).
self waitForExpose
- ]
+ ].
+ self contentsChanged.
]
]
!
@@ -437,7 +450,6 @@
"
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr.
list at:lineNr put:line.
- self contentsChanged
!
insertLine:aString before:lineNr
@@ -449,6 +461,7 @@
visLine := self listLineToVisibleLine:lineNr.
(shown not or:[visLine isNil]) ifTrue:[
self withoutRedrawInsertLine:aString before:lineNr.
+ self contentsChanged.
^ self
].
@@ -462,7 +475,8 @@
width:w
height:((nLinesShown - visLine "- 1") * fontHeight).
self redrawVisibleLine:visLine.
- self waitForExpose
+ self waitForExpose.
+ self contentsChanged.
!
insertLines:someText from:start to:end before:lineNr
@@ -480,6 +494,7 @@
self withoutRedrawInsertLines:someText
from:start to:end
before:lineNr.
+ self contentsChanged.
^ self
].
@@ -508,7 +523,8 @@
height:(height - dstY).
self redrawFromVisibleLine:visLine to:(visLine + nLines - 1).
self waitForExpose
- ]
+ ].
+ self contentsChanged.
!
insert:aCharacter atLine:lineNr col:colNr
@@ -611,7 +627,6 @@
"
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr.
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start.
- self contentsChanged
!
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
@@ -2017,37 +2032,6 @@
!EditTextView methodsFor:'selections'!
-disableSelectionMenuEntries
- "disable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- super disableSelectionMenuEntries.
- middleButtonMenu disable:#cut.
- middleButtonMenu disable:#replace.
- middleButtonMenu disable:#indent
- ]
-!
-
-enableSelectionMenuEntries
- "enable relevant menu entries for a selection"
-
- middleButtonMenu notNil ifTrue:[
- "if readonly, never enable destructive functions"
- readOnly ifTrue:[
- super enableSelectionMenuEntries.
- middleButtonMenu disable:#cut.
- middleButtonMenu disable:#replace.
- middleButtonMenu disable:#indent.
- middleButtonMenu disable:#paste.
- ] ifFalse:[
- super enableSelectionMenuEntries.
- middleButtonMenu enable:#cut.
- middleButtonMenu enable:#replace.
- middleButtonMenu enable:#indent.
- ]
- ]
-!
-
unselect
"forget and unhilight selection - must take care of cursor here"
--- a/EnterBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/EnterBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.15 1995-02-18 20:14:04 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EnterBox.st,v 1.16 1995-03-06 19:28:30 claus Exp $
"
!
@@ -208,7 +208,7 @@
labelField resize.
labelField extent ~= oldSize ifTrue:[
- self resize
+ shown ifTrue:[self resize]
]
]
!
@@ -228,7 +228,7 @@
okButton resize.
labelField label:titleString.
labelField resize.
- self resize.
+ shown ifTrue:[self resize].
]
!
@@ -244,7 +244,7 @@
abortButton resize.
labelField label:titleString.
labelField resize.
- self resize.
+ shown ifTrue:[self resize].
]
! !
@@ -311,7 +311,7 @@
changedObject == enterField ifTrue:[
something == #preferedExtent ifTrue:[
- self resize
+ shown ifTrue:[self resize]
]
]
! !
@@ -379,4 +379,3 @@
self title:title.
^ self request
! !
-
--- a/EnterBox2.st Tue Feb 28 22:52:21 1995 +0100
+++ b/EnterBox2.st Mon Mar 06 20:29:54 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.10 1995-02-27 10:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.11 1995-03-06 19:28:35 claus Exp $
'!
!EnterBox2 class methodsFor:'documentation '!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.10 1995-02-27 10:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.11 1995-03-06 19:28:35 claus Exp $
"
!
@@ -85,7 +85,6 @@
"
okButton isReturnButton:false.
- self resize.
enterField leaveAction:[:key | self ok2Pressed]
!
@@ -120,7 +119,7 @@
aString ~= okButton2 label ifTrue:[
okButton2 label:aString.
okButton2 resize.
- self resize
+ shown ifTrue:[self resize]
]
!
--- a/InfoBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/InfoBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -25,7 +25,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.11 1995-02-06 00:52:28 claus Exp $
+$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.12 1995-03-06 19:28:49 claus Exp $
"
!
@@ -187,7 +187,7 @@
formLabel form:aForm.
formLabel resize.
- self resize
+ shown ifTrue:[self resize]
!
formLabel
@@ -202,7 +202,7 @@
aString ~= textLabel label ifTrue:[
textLabel label:aString.
textLabel resize.
- self resize
+ shown ifTrue:[self resize]
]
!
@@ -283,4 +283,3 @@
b open
"
! !
-
--- a/Label.st Tue Feb 28 22:52:21 1995 +0100
+++ b/Label.st Mon Mar 06 20:29:54 1995 +0100
@@ -26,7 +26,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Label.st,v 1.16 1995-02-16 16:31:42 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Label.st,v 1.17 1995-03-06 19:28:54 claus Exp $
'!
!Label class methodsFor:'documentation'!
@@ -47,7 +47,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Label.st,v 1.16 1995-02-16 16:31:42 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Label.st,v 1.17 1995-03-06 19:28:54 claus Exp $
"
!
@@ -499,7 +499,8 @@
update:something
"the MVC way of changing the label ..."
- (something == aspectSymbol) ifTrue:[
+ (aspectSymbol notNil
+ and:[something == aspectSymbol]) ifTrue:[
model notNil ifTrue:[
self label:(model perform: aspectSymbol) printString.
].
--- a/MenuView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/MenuView.st Mon Mar 06 20:29:54 1995 +0100
@@ -32,7 +32,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.18 1995-02-27 10:39:33 claus Exp $
+$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.19 1995-03-06 19:29:00 claus Exp $
'!
!MenuView class methodsFor:'documentation'!
@@ -53,7 +53,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.18 1995-02-27 10:39:33 claus Exp $
+$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.19 1995-03-06 19:29:00 claus Exp $
"
!
@@ -430,7 +430,7 @@
enableFlags := Array new:(list size) withAll:true.
onOffFlags := Array new:(list size).
text keysAndValuesDo:[:index :line |
- (line includes:$\) ifTrue:[
+ (line notNil and:[line includes:$\ ]) ifTrue:[
onOffFlags at:index put:false
].
].
@@ -1004,7 +1004,7 @@
line := self visibleAt:visLineNr.
- isSpecial := line includes:$\.
+ isSpecial := line notNil and:[line includes:$\].
isSpecial ifFalse:[
"
a normal entry
@@ -1219,10 +1219,12 @@
[current <= stop] whileTrue:[
line := self visibleAt:current.
- special := (line = '-')
- or:[(line = '')
- or:[(line at:1) == $\
- or:[(line = '=')]]].
+ special := line notNil and:[
+ (line = '-')
+ or:[(line = '')
+ or:[(line at:1) == $\
+ or:[(line = '=')]]]].
+
(special
or:[(enableFlags at:index) not]) ifTrue:[
"a special case"
--- a/OptBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/OptBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Attic/OptBox.st,v 1.13 1995-02-27 10:40:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/OptBox.st,v 1.14 1995-03-06 19:29:08 claus Exp $
'!
!OptionBox class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/OptBox.st,v 1.13 1995-02-27 10:40:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/OptBox.st,v 1.14 1995-03-06 19:29:08 claus Exp $
"
!
@@ -51,9 +51,9 @@
OptionBoxes are like YesNoBoxes but with as many buttons as you like;
this will finally be a superclass of WarnBox and YesNoBox - or maybe merged
all into DialogBox..
- Used for multiway questions.
+ Use them for multiway questions.
For a consistent user interface, the rightmost button is the default return
- button.
+ button (i.e. pressing return in the box performs this buttons function).
examples:
@@ -63,10 +63,37 @@
box showAtPointer
+
|box|
box := OptionBox title:'hello' numberOfOptions:3.
box buttonTitles:#('one' 'two' 'three').
box showAtPointer
+
+
+ performing an action:
+
+ |box|
+ box := OptionBox title:'hello' numberOfOptions:3.
+ box buttonTitles:#('one' 'two' 'three').
+ box action:[:which | Transcript show:'button ';
+ show: which;
+ showCr:' was pressed'].
+ box showAtPointer
+
+
+ returning a value:
+
+ |what|
+ what := OptionBox
+ request:('text has not been accepted.\\Your modifications will be lost when continuing.') withCRs
+ label:' Attention'
+ form:(WarningBox iconBitmap)
+ buttonLabels:#('abort' 'accept' 'continue')
+ values:#(#abort #accept #continue).
+
+ ...
+ someObject perform:what.
+ ...
"
! !
@@ -86,7 +113,7 @@
^ nil
"
- OptionBox request:'select'
+ OptionBox request:'please select'
label:'select any'
form:(WarningBox iconBitmap)
buttonLabels:#('one' 'two' 'three')
@@ -110,27 +137,24 @@
!OptionBox methodsFor:'accessing'!
-title:aString numberOfOptions:nOptions
- "set the boxes title and number of options"
-
- aString ~= textLabel label ifTrue:[
- textLabel label:aString.
- textLabel resize.
- ].
- buttons grow:nOptions.
- actions grow:nOptions
-!
-
title:aString
"set the boxes title"
aString ~= textLabel label ifTrue:[
textLabel label:aString withoutSeparators.
textLabel resize.
- self resize
+ shown ifTrue:[self resize]
]
!
+title:aString numberOfOptions:nOptions
+ "set the boxes title and number of options"
+
+ self title:aString.
+ buttons grow:nOptions.
+ actions grow:nOptions
+!
+
formLabel
"return the label-view which displays a bitmap"
@@ -165,17 +189,13 @@
buttonTitles:titles
"set the button titles"
- |index|
+ titles keysAndValuesDo:[:index :aString |
+ |b|
- index := 1.
- titles do:[:aString |
- (buttons at:index) label:aString.
- (buttons at:index) resize.
- index := index + 1
+ (b := buttons at:index) label:aString.
+ b resize.
].
- shown ifTrue:[
- self resize
- ]
+ shown ifTrue:[self resize]
!
actions:actionBlocks
@@ -188,12 +208,9 @@
"define a single the action for all buttons.
The action will be evaluated with the button index as argument."
- 1 to:buttons size do:[:index |
- |button|
-
- button := buttons at:index.
+ buttons keysAndValuesDo:[:index :button |
button action:[
- (buttons at:index) turnOffWithoutRedraw.
+ button turnOffWithoutRedraw.
self hide.
actionBlock value:index
]
@@ -205,9 +222,6 @@
self buttonTitles:titles.
actions := actionBlocks.
- shown ifTrue:[
- self resize
- ]
! !
!OptionBox methodsFor:'initializing'!
@@ -292,10 +306,11 @@
prefPanel := buttonPanel preferedExtent.
w := w1 max:prefPanel x.
- maxH := 0.
- buttons do:[:button |
- maxH := maxH max:(button preferedExtent y)
- ].
+"/ maxH := 0.
+"/ buttons do:[:button |
+"/ maxH := maxH max:(button preferedExtent y)
+"/ ].
+ maxH := prefPanel y.
h := ViewSpacing
+ ((formLabel height) max:(textLabel height))
--- a/OptionBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/OptionBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/OptionBox.st,v 1.13 1995-02-27 10:40:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/OptionBox.st,v 1.14 1995-03-06 19:29:08 claus Exp $
'!
!OptionBox class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/OptionBox.st,v 1.13 1995-02-27 10:40:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/OptionBox.st,v 1.14 1995-03-06 19:29:08 claus Exp $
"
!
@@ -51,9 +51,9 @@
OptionBoxes are like YesNoBoxes but with as many buttons as you like;
this will finally be a superclass of WarnBox and YesNoBox - or maybe merged
all into DialogBox..
- Used for multiway questions.
+ Use them for multiway questions.
For a consistent user interface, the rightmost button is the default return
- button.
+ button (i.e. pressing return in the box performs this buttons function).
examples:
@@ -63,10 +63,37 @@
box showAtPointer
+
|box|
box := OptionBox title:'hello' numberOfOptions:3.
box buttonTitles:#('one' 'two' 'three').
box showAtPointer
+
+
+ performing an action:
+
+ |box|
+ box := OptionBox title:'hello' numberOfOptions:3.
+ box buttonTitles:#('one' 'two' 'three').
+ box action:[:which | Transcript show:'button ';
+ show: which;
+ showCr:' was pressed'].
+ box showAtPointer
+
+
+ returning a value:
+
+ |what|
+ what := OptionBox
+ request:('text has not been accepted.\\Your modifications will be lost when continuing.') withCRs
+ label:' Attention'
+ form:(WarningBox iconBitmap)
+ buttonLabels:#('abort' 'accept' 'continue')
+ values:#(#abort #accept #continue).
+
+ ...
+ someObject perform:what.
+ ...
"
! !
@@ -86,7 +113,7 @@
^ nil
"
- OptionBox request:'select'
+ OptionBox request:'please select'
label:'select any'
form:(WarningBox iconBitmap)
buttonLabels:#('one' 'two' 'three')
@@ -110,27 +137,24 @@
!OptionBox methodsFor:'accessing'!
-title:aString numberOfOptions:nOptions
- "set the boxes title and number of options"
-
- aString ~= textLabel label ifTrue:[
- textLabel label:aString.
- textLabel resize.
- ].
- buttons grow:nOptions.
- actions grow:nOptions
-!
-
title:aString
"set the boxes title"
aString ~= textLabel label ifTrue:[
textLabel label:aString withoutSeparators.
textLabel resize.
- self resize
+ shown ifTrue:[self resize]
]
!
+title:aString numberOfOptions:nOptions
+ "set the boxes title and number of options"
+
+ self title:aString.
+ buttons grow:nOptions.
+ actions grow:nOptions
+!
+
formLabel
"return the label-view which displays a bitmap"
@@ -165,17 +189,13 @@
buttonTitles:titles
"set the button titles"
- |index|
+ titles keysAndValuesDo:[:index :aString |
+ |b|
- index := 1.
- titles do:[:aString |
- (buttons at:index) label:aString.
- (buttons at:index) resize.
- index := index + 1
+ (b := buttons at:index) label:aString.
+ b resize.
].
- shown ifTrue:[
- self resize
- ]
+ shown ifTrue:[self resize]
!
actions:actionBlocks
@@ -188,12 +208,9 @@
"define a single the action for all buttons.
The action will be evaluated with the button index as argument."
- 1 to:buttons size do:[:index |
- |button|
-
- button := buttons at:index.
+ buttons keysAndValuesDo:[:index :button |
button action:[
- (buttons at:index) turnOffWithoutRedraw.
+ button turnOffWithoutRedraw.
self hide.
actionBlock value:index
]
@@ -205,9 +222,6 @@
self buttonTitles:titles.
actions := actionBlocks.
- shown ifTrue:[
- self resize
- ]
! !
!OptionBox methodsFor:'initializing'!
@@ -292,10 +306,11 @@
prefPanel := buttonPanel preferedExtent.
w := w1 max:prefPanel x.
- maxH := 0.
- buttons do:[:button |
- maxH := maxH max:(button preferedExtent y)
- ].
+"/ maxH := 0.
+"/ buttons do:[:button |
+"/ maxH := maxH max:(button preferedExtent y)
+"/ ].
+ maxH := prefPanel y.
h := ViewSpacing
+ ((formLabel height) max:(textLabel height))
--- a/SelListV.st Tue Feb 28 22:52:21 1995 +0100
+++ b/SelListV.st Mon Mar 06 20:29:54 1995 +0100
@@ -38,7 +38,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.23 1995-02-27 10:41:04 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.24 1995-03-06 19:29:23 claus Exp $
'!
!SelectionInListView class methodsFor:'documentation'!
@@ -59,7 +59,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.23 1995-02-27 10:41:04 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.24 1995-03-06 19:29:23 claus Exp $
"
!
@@ -1808,11 +1808,13 @@
|newList|
changedObject == model ifTrue:[
- (something == initialSelectionSymbol) ifTrue:[
+ (initialSelectionSymbol notNil
+ and:[something == initialSelectionSymbol]) ifTrue:[
self selectElement:(model perform:initialSelectionSymbol).
^ self
].
- (something == aspectSymbol) ifTrue:[
+ (aspectSymbol notNil
+ and:[something == aspectSymbol]) ifTrue:[
newList := (model perform:listSymbol) asStringCollection.
(newList = list) ifFalse:[
self list:newList
--- a/SelectionInListView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/SelectionInListView.st Mon Mar 06 20:29:54 1995 +0100
@@ -38,7 +38,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.23 1995-02-27 10:41:04 claus Exp $
+$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.24 1995-03-06 19:29:23 claus Exp $
'!
!SelectionInListView class methodsFor:'documentation'!
@@ -59,7 +59,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.23 1995-02-27 10:41:04 claus Exp $
+$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.24 1995-03-06 19:29:23 claus Exp $
"
!
@@ -1808,11 +1808,13 @@
|newList|
changedObject == model ifTrue:[
- (something == initialSelectionSymbol) ifTrue:[
+ (initialSelectionSymbol notNil
+ and:[something == initialSelectionSymbol]) ifTrue:[
self selectElement:(model perform:initialSelectionSymbol).
^ self
].
- (something == aspectSymbol) ifTrue:[
+ (aspectSymbol notNil
+ and:[something == aspectSymbol]) ifTrue:[
newList := (model perform:listSymbol) asStringCollection.
(newList = list) ifFalse:[
self list:newList
--- a/TextColl.st Tue Feb 28 22:52:21 1995 +0100
+++ b/TextColl.st Mon Mar 06 20:29:54 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.14 1995-02-08 03:19:20 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.15 1995-03-06 19:29:31 claus Exp $
'!
!TextCollector class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.14 1995-02-08 03:19:20 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.15 1995-03-06 19:29:31 claus Exp $
"
!
@@ -164,22 +164,23 @@
entryStream nextPutAllBlock:[:something | self nextPutAll:something]
!
-initializeMiddleButtonMenu
- |idx|
+editMenu
+ |m idx|
- super initializeMiddleButtonMenu.
+ m := super editMenu.
"
textcollectors do not support #accept
remove it from the menu (and the preceeding separating line)
"
- idx := middleButtonMenu indexOf:#accept.
+ idx := m indexOf:#accept.
idx ~~ 0 ifTrue:[
- middleButtonMenu remove:idx.
- (middleButtonMenu labels at:(idx - 1)) = '-' ifTrue:[
- middleButtonMenu remove:idx - 1
+ m remove:idx.
+ (m labels at:(idx - 1)) = '-' ifTrue:[
+ m remove:idx - 1
].
].
+ ^ m
!
reinitialize
--- a/TextCollector.st Tue Feb 28 22:52:21 1995 +0100
+++ b/TextCollector.st Mon Mar 06 20:29:54 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.14 1995-02-08 03:19:20 claus Exp $
+$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.15 1995-03-06 19:29:31 claus Exp $
'!
!TextCollector class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.14 1995-02-08 03:19:20 claus Exp $
+$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.15 1995-03-06 19:29:31 claus Exp $
"
!
@@ -164,22 +164,23 @@
entryStream nextPutAllBlock:[:something | self nextPutAll:something]
!
-initializeMiddleButtonMenu
- |idx|
+editMenu
+ |m idx|
- super initializeMiddleButtonMenu.
+ m := super editMenu.
"
textcollectors do not support #accept
remove it from the menu (and the preceeding separating line)
"
- idx := middleButtonMenu indexOf:#accept.
+ idx := m indexOf:#accept.
idx ~~ 0 ifTrue:[
- middleButtonMenu remove:idx.
- (middleButtonMenu labels at:(idx - 1)) = '-' ifTrue:[
- middleButtonMenu remove:idx - 1
+ m remove:idx.
+ (m labels at:(idx - 1)) = '-' ifTrue:[
+ m remove:idx - 1
].
].
+ ^ m
!
reinitialize
--- a/TextView.st Tue Feb 28 22:52:21 1995 +0100
+++ b/TextView.st Mon Mar 06 20:29:54 1995 +0100
@@ -34,7 +34,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.17 1995-02-27 10:41:21 claus Exp $
+$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.18 1995-03-06 19:29:37 claus Exp $
'!
!TextView class methodsFor:'documentation'!
@@ -55,7 +55,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.17 1995-02-27 10:41:21 claus Exp $
+$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.18 1995-03-06 19:29:37 claus Exp $
"
!
@@ -174,6 +174,7 @@
initialize
super initialize.
contentsWasSaved := false.
+ self model:self; menu:#editMenu.
!
initStyle
@@ -205,37 +206,6 @@
].
!
-initializeMiddleButtonMenu
- |labels|
-
- labels := resources array:#(
- 'copy'
- '-'
- 'font ...'
- '-'
- 'search ...'
- 'goto ...'
- '-'
- 'save as ...'
- 'print').
-
- self middleButtonMenu:(PopUpMenu
- labels:labels
- selectors:#(copySelection
- nil
- changeFont
- nil
- search
- gotoLine
- nil
- save
- print)
- receiver:self
- for:self).
-
- self enableOrDisableSelectionMenuEntries
-!
-
destroy
fileBox notNil ifTrue:[
fileBox destroy.
@@ -350,8 +320,8 @@
nLines := list size.
[startNr <= nLines] whileTrue:[
string := list asStringWithCRsFrom:startNr
- to:((startNr + 1000) min:nLines)
- compressTabs:compressTabs.
+ to:((startNr + 1000) min:nLines)
+ compressTabs:compressTabs.
aStream nextPutAll:string.
startNr := startNr + 1000 + 1.
].
@@ -360,7 +330,7 @@
"/
"/ list do:[:aLine |
"/ aLine notNil ifTrue:[
-"/ aStream nextPutAll:aLine.
+"/ aStream nextPutAll:aLine.
"/ ].
"/ aStream cr
"/ ]
@@ -466,6 +436,43 @@
!TextView methodsFor:'menu actions'!
+editMenu
+ |labels selectors m|
+
+ labels := #(
+ 'copy'
+ '-'
+ 'font ...'
+ '-'
+ 'search ...'
+ 'goto ...'
+ '-'
+ 'save as ...'
+ 'print'
+ ).
+
+ selectors := #(
+ copySelection
+ nil
+ changeFont
+ nil
+ search
+ gotoLine
+ nil
+ save
+ print
+ ).
+
+ m := PopUpMenu
+ labels:(resources array:labels)
+ selectors:selectors.
+
+ self hasSelection ifFalse:[
+ m disable:#copySelection.
+ ].
+ ^ m
+!
+
print
"print the contents on the printer"
@@ -586,44 +593,12 @@
!TextView methodsFor:'selections'!
-enableOrDisableSelectionMenuEntries
- "sent internally, whenever selection status changes to
- update menu entries"
-
- self hasSelection ifFalse:[
- self disableSelectionMenuEntries
- ] ifTrue:[
- self enableSelectionMenuEntries
- ]
-!
-
-disableSelectionMenuEntries
- "disable relevant menu entries when no selection is
- available - redefined in subclasses to disable more,
- but do NOT forget a super disableSelectionMenuEntries there."
-
- middleButtonMenu notNil ifTrue:[
- middleButtonMenu disable:#copySelection
- ]
-!
-
-enableSelectionMenuEntries
- "disable relevant menu entries when a selection is
- available - redefined in subclasses to enable more,
- but do NOT forget a super enableSelectionMenuEntries there."
-
- middleButtonMenu notNil ifTrue:[
- middleButtonMenu enable:#copySelection
- ]
-!
-
unselectWithoutRedraw
"forget selection but do not redraw the selection area
- can be done when selected area is redrawn anyway or
known to be invisible."
selectionStartLine := nil.
- self disableSelectionMenuEntries
!
unselect
@@ -690,7 +665,6 @@
]
].
selectStyle := nil.
- self enableSelectionMenuEntries
]
!
@@ -1595,7 +1569,6 @@
autoScrollBlock notNil ifTrue:[
self stopScrollSelect
].
- self enableOrDisableSelectionMenuEntries.
] ifFalse:[
super buttonRelease:button x:x y:y
]
--- a/Workspace.st Tue Feb 28 22:52:21 1995 +0100
+++ b/Workspace.st Mon Mar 06 20:29:54 1995 +0100
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.16 1995-02-27 10:41:52 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.17 1995-03-06 19:29:50 claus Exp $
'!
!Workspace class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.16 1995-02-27 10:41:52 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.17 1995-03-06 19:29:50 claus Exp $
"
!
@@ -134,30 +134,31 @@
].
!
-initializeMiddleButtonMenu
- |idx|
+editMenu
+ |m idx|
- super initializeMiddleButtonMenu.
+ m := super editMenu.
"
workspaces support #doIt, #printIt and #inspectIt
add them after paste.
"
- idx := middleButtonMenu indexOf:#paste.
- middleButtonMenu addLabel:'-'
- selector:nil
- after:idx.
- middleButtonMenu addLabel:(resources string:'doIt')
- selector:#doIt
- after:idx + 1.
- middleButtonMenu addLabel:(resources string:'printIt')
- selector:#printIt
- after:idx + 2.
- middleButtonMenu addLabel:(resources string:'inspectIt')
- selector:#inspectIt
- after:idx + 3.
+ idx := m indexOf:#paste.
+ m addLabel:'-' selector:nil after:idx.
+ m addLabel:(resources string:'doIt') selector:#doIt after:idx + 1.
+ m addLabel:(resources string:'printIt') selector:#printIt after:idx + 2.
+ m addLabel:(resources string:'inspectIt') selector:#inspectIt after:idx + 3.
- self enableOrDisableSelectionMenuEntries
+ self hasSelection ifFalse:[
+ m disable:#doIt.
+ m disable:#printIt.
+ m disable:#inspectIt.
+ ].
+ readOnly ifTrue:[
+ m disable:#printIt.
+ ].
+
+ ^ m.
!
initializeDoITAction
@@ -176,37 +177,6 @@
].
! !
-!Workspace methodsFor:'selections'!
-
-disableSelectionMenuEntries
- "disable relevant menu entries for a selection"
-
- super disableSelectionMenuEntries.
- middleButtonMenu notNil ifTrue:[
- middleButtonMenu disable:#doIt.
- middleButtonMenu disable:#printIt.
- middleButtonMenu disable:#inspectIt
- ]
-!
-
-enableSelectionMenuEntries
- "enable relevant menu entries for a selection"
-
- super enableSelectionMenuEntries.
- middleButtonMenu notNil ifTrue:[
- middleButtonMenu enable:#doIt.
- "
- printit not allowed if readonly, since it pastes its result
- "
- readOnly ifTrue:[
- middleButtonMenu disable:#printIt.
- ] ifFalse:[
- middleButtonMenu enable:#printIt.
- ].
- middleButtonMenu enable:#inspectIt
- ]
-! !
-
!Workspace methodsFor:'accessing'!
doItAction:aBlock
@@ -365,6 +335,9 @@
cCol := cursorCol.
cLine := cursorLine.
+ "
+ cleanup: restore previous selection and cursor positions
+ "
cleanUp := [
self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
cLine notNil ifTrue:[
@@ -372,14 +345,24 @@
].
].
+ "
+ perform the action.
+ Be careful to release the reference to the value;
+ otherwise, we could keep lots of garbage from being freed
+ until the view gets closed
+ "
self topView withCursor:Cursor execute do:[
- Object abortSignal catch:[
- [
+ [
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
value := doItAction value:code asString.
- cleanUp value.
+ cleanUp value. cleanUp := nil.
aBlock value:value.
- value := nil.
- ] valueOnUnwindDo:cleanUp
+ ]
+ ] valueNowOrOnUnwindDo:[
+ cleanUp notNil ifTrue:[cleanUp value. cleanUp := nil].
+ value := nil
]
].
]
--- a/YesNoBox.st Tue Feb 28 22:52:21 1995 +0100
+++ b/YesNoBox.st Mon Mar 06 20:29:54 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.10 1995-02-27 10:41:57 claus Exp $
+$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.11 1995-03-06 19:29:54 claus Exp $
'!
!YesNoBox class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.10 1995-02-27 10:41:57 claus Exp $
+$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.11 1995-03-06 19:29:54 claus Exp $
"
!
@@ -170,7 +170,6 @@
noButton label:(resources at:'no').
noButton height:(okButton height).
noButton model:self; change:#noPressed.
- self resize.
!
focusSequence
@@ -251,7 +250,7 @@
aString ~= noButton label ifTrue:[
noButton label:aString.
noButton resize.
- self resize
+ shown ifTrue:[self resize]
]
!
@@ -269,7 +268,7 @@
noButton label:noString.
okButton resize.
noButton resize.
- self resize
+ shown ifTrue:[self resize]
]
!