--- a/EditTextView.st Mon Dec 19 11:04:05 2016 +0000
+++ b/EditTextView.st Mon Dec 26 10:26:48 2016 +0000
@@ -1792,6 +1792,192 @@
"Modified: / 1.2.1998 / 13:15:55 / cg"
! !
+!EditTextView methodsFor:'commenting'!
+
+commentFrom:line1 to:line2 commentStrings:commentStrings
+ "helper function to comment out a block.
+ All lines from line1 to line2 get an end-of-line comment
+ in the first col
+ (if no eol comment is available, a bracketing comment is used)."
+
+ |eolComment opening closing|
+
+ eolComment := commentStrings at:1.
+ eolComment isNil ifTrue:[
+ opening := (commentStrings at:2) at:1.
+ closing := (commentStrings at:2) at:2.
+ (opening isNil or:[closing isNil]) ifTrue:[^ self].
+ ].
+
+ line1 to:line2 do:[:lineNr |
+ |l|
+
+ l := self listAt:lineNr.
+ l isNil ifTrue:[l := ''].
+ eolComment notNil ifTrue:[
+ l := eolComment , l
+ ] ifFalse:[
+ l := opening , l , closing
+ ].
+ self replaceLine:lineNr with:l.
+ widthOfWidestLine notNil ifTrue:[
+ widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:l).
+ ].
+ ].
+ self textChanged.
+
+ "Created: / 09-11-1997 / 01:05:35 / cg"
+ "Modified: / 09-10-2006 / 10:46:44 / cg"
+!
+
+commentSelection:commentStrings
+ "convenient function to comment out a block.
+ All lines from line1 to line2 get an end-of-line comment
+ in the first col."
+
+ |e commentPair opening closing|
+
+ (self checkModificationsAllowed) ifFalse:[ ^ self].
+ commentStrings isNil ifTrue:[ self beep. ^ self].
+
+ self
+ undoableDo:[
+ selectionStartLine isNil ifTrue:[
+ self commentFrom:cursorLine to:cursorLine commentStrings:commentStrings
+ ] ifFalse:[
+ (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
+ self commentFrom:selectionStartLine to:selectionEndLine-1 commentStrings:commentStrings
+ ] ifFalse:[
+ commentPair := commentStrings at:2 ifAbsent:nil.
+ commentPair isNil ifTrue:[
+ self beep.
+ ] ifFalse:[
+ opening := commentPair at:1.
+ closing := commentPair at:2.
+ (opening isNil or:[closing isNil]) ifTrue:[^ self].
+
+ e := selectionEndCol.
+
+ self insertString:closing atLine:selectionEndLine col:e+1.
+ self insertString:opening atLine:selectionStartLine col:selectionStartCol.
+
+ selectionStartLine == selectionEndLine ifTrue:[e := e + opening size].
+ self selectFromLine:selectionStartLine col:selectionStartCol
+ toLine:selectionEndLine col:e+closing size.
+ ]
+ ]
+ ].
+ ]
+ info:'Comment'.
+
+ "Created: / 9.11.1997 / 01:05:40 / cg"
+ "Modified: / 5.4.1998 / 16:52:23 / cg"
+!
+
+uncommentFrom:line1 to:line2 commentStrings:commentStrings
+ "helper function to comment out a block.
+ All lines from line1 to line2 get an end-of-line comment
+ in the first col.
+ (if no eol comment is available, a bracketing comment is removed)."
+
+ |eolComment opening closing rest|
+
+ eolComment := commentStrings at:1.
+ eolComment isNil ifTrue:[
+ opening := (commentStrings at:2) at:1.
+ closing := (commentStrings at:2) at:2.
+ (opening isNil or:[closing isNil]) ifTrue:[^ self].
+ ] ifFalse:[
+ rest := eolComment size + 1.
+ ].
+
+ line1 to:line2 do:[:lineNr |
+ |l|
+
+ l := self listAt:lineNr.
+ l notNil ifTrue:[
+ eolComment notNil ifTrue:[
+ (l startsWith:eolComment) ifTrue:[
+ l := l copyFrom:rest
+ ] ifFalse:[
+ (l withoutLeadingSeparators startsWith:eolComment) ifTrue:[
+ "/ only for single lines?
+ true "line1 = line2" ifTrue:[
+ |numSpaces|
+
+ numSpaces := l indexOfNonSeparator - 1.
+ l := l copyFrom:numSpaces+1+rest.
+ l := (String new:numSpaces),l
+ ].
+ ].
+ ]
+ ] ifFalse:[
+ ((l startsWith:opening) and:[l endsWith:closing]) ifTrue:[
+ l := l copyFrom:opening size + 1.
+ l := l copyButLast:closing size.
+ ].
+ ].
+ self replaceLine:lineNr with:l.
+ ]
+ ].
+
+ widthOfWidestLine := nil. "/ i.e. unknown
+ self textChanged.
+!
+
+uncommentSelection:commentStrings
+ "convenient function to comment out a block.
+ All lines from line1 to line2 get an end-of-line comment
+ in the first col."
+
+ |e commentPair opening closing sz1 sz2 l1 l2 c1 c2|
+
+ (self checkModificationsAllowed) ifFalse:[ ^ self].
+ commentStrings isNil ifTrue:[ self beep. ^ self].
+
+ self
+ undoableDo:[
+ selectionStartLine isNil ifTrue:[
+ self uncommentFrom:cursorLine to:cursorLine commentStrings:commentStrings
+ ] ifFalse:[
+ (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
+ self uncommentFrom:selectionStartLine to:selectionEndLine-1 commentStrings:commentStrings
+ ] ifFalse:[
+ commentPair := commentStrings at:2.
+ opening := commentPair at:1.
+ closing := commentPair at:2.
+ (opening isNil or:[closing isNil]) ifTrue:[^ self].
+
+ sz1 := opening size.
+ sz2 := closing size.
+
+ ((self
+ stringAtLine:selectionStartLine
+ from:selectionStartCol
+ to:selectionStartCol+sz1 - 1) = opening
+ and:[(self
+ stringAtLine:selectionEndLine
+ from:selectionEndCol - sz2 + 1
+ to:selectionEndCol) = closing ]) ifTrue:[
+
+ l2 := selectionEndLine. c2 := selectionEndCol.
+ l1 := selectionStartLine. c1 := selectionStartCol.
+ self deleteCharsAtLine:l2 fromCol:c2-sz2+1 toCol:c2.
+ self deleteCharsAtLine:l1 fromCol:c1 toCol:c1+sz1-1.
+
+ e := c2 - sz2.
+ l1 == l2 ifTrue:[e := e - sz1].
+ self selectFromLine:l1 col:c1 toLine:l2 col:e.
+ ]
+ ]
+ ].
+ ]
+ info:'Uncomment'.
+
+ "Modified: / 7.1.1997 / 20:13:32 / cg"
+ "Created: / 9.11.1997 / 01:05:46 / cg"
+! !
+
!EditTextView methodsFor:'cursor handling'!
basicCursorReturn
--- a/GenericToolbarIconLibrary.st Mon Dec 19 11:04:05 2016 +0000
+++ b/GenericToolbarIconLibrary.st Mon Dec 26 10:26:48 2016 +0000
@@ -5996,6 +5996,34 @@
]
!
+doItMultiple20x20Icon
+ "This resource specification was automatically generated
+ by the ImageEditor of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the ImageEditor may not be able to read the specification."
+
+ "
+ self doItMultiple20x20Icon inspect
+ ImageEditor openOnClass:self andSelector:#doItMultiple20x20Icon
+ Icon flushCachedIcons
+ "
+
+ <resource: #image>
+
+ ^Icon
+ constantNamed:'GenericToolbarIconLibrary class doItMultiple20x20Icon'
+ ifAbsentPut:[(Depth2Image width:20 height:20) bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@D@P@@@A@D@@@@TAP@@@E0@@@@A_VMX@@W5#V@@@AXE @@@F@X@@@@ B@@@@H@ @@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@a')
+ colorMapFromArray:#[0 0 0 248 252 128 208 220 0 255 255 255]
+ mask:((ImageMask width:20 height:20) bits:(ByteArray fromPackedString:'
+@@@@@@@@@AB@@CF@@FL@@N\@@\8@@=8@A?? C??@G?>@O?<@@=8@@90@A3 @A#@@CF@@BD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a'); yourself); yourself]
+!
+
documents20x20Icon
<resource: #image>
"This resource specification was automatically generated
@@ -13114,6 +13142,12 @@
^ self doIt20x20Icon
!
+doItMultipleIcon
+ <resource: #programImage>
+
+ ^ self doItMultiple20x20Icon
+!
+
downIcon
<resource:#programImage>
^ self down22x22Icon
--- a/Workspace.st Mon Dec 19 11:04:05 2016 +0000
+++ b/Workspace.st Mon Dec 26 10:26:48 2016 +0000
@@ -1304,31 +1304,7 @@
in the first col
(if no eol comment is available, a bracketing comment is used)."
- |eolComment opening closing|
-
- eolComment := commentStrings at:1.
- eolComment isNil ifTrue:[
- opening := (commentStrings at:2) at:1.
- closing := (commentStrings at:2) at:2.
- (opening isNil or:[closing isNil]) ifTrue:[^ self].
- ].
-
- line1 to:line2 do:[:lineNr |
- |l|
-
- l := self listAt:lineNr.
- l isNil ifTrue:[l := ''].
- eolComment notNil ifTrue:[
- l := eolComment , l
- ] ifFalse:[
- l := opening , l , closing
- ].
- self replaceLine:lineNr with:l.
- widthOfWidestLine notNil ifTrue:[
- widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:l).
- ].
- ].
- self textChanged.
+ self commentFrom:line1 to:line2 commentStrings:commentStrings.
"Created: / 09-11-1997 / 01:05:35 / cg"
"Modified: / 09-10-2006 / 10:46:44 / cg"
@@ -1339,44 +1315,7 @@
All lines from line1 to line2 get an end-of-line comment
in the first col."
- |e commentPair opening closing|
-
- (self checkModificationsAllowed) ifFalse:[ ^ self].
- commentStrings isNil ifTrue:[ self beep. ^ self].
-
- selectionStartLine isNil ifTrue:[
- self
- undoableDo:[ self commentFrom:cursorLine to:cursorLine ]
- info:'Comment'.
- ^ self
- ].
-
- self
- undoableDo:
- [
- (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
- self commentFrom:selectionStartLine to:selectionEndLine-1
- ] ifFalse:[
- commentPair := commentStrings at:2 ifAbsent:nil.
- commentPair isNil ifTrue:[
- self beep.
- ] ifFalse:[
- opening := commentPair at:1.
- closing := commentPair at:2.
- (opening isNil or:[closing isNil]) ifTrue:[^ self].
-
- e := selectionEndCol.
-
- self insertString:closing atLine:selectionEndLine col:e+1.
- self insertString:opening atLine:selectionStartLine col:selectionStartCol.
-
- selectionStartLine == selectionEndLine ifTrue:[e := e + opening size].
- self selectFromLine:selectionStartLine col:selectionStartCol
- toLine:selectionEndLine col:e+closing size.
- ]
- ]
- ]
- info:'comment'
+ self commentSelection:commentStrings
"Created: / 9.11.1997 / 01:05:40 / cg"
"Modified: / 5.4.1998 / 16:52:23 / cg"
@@ -1388,38 +1327,7 @@
in the first col.
(if no eol comment is available, a bracketing comment is removed)"
- |eolComment opening closing rest|
-
- eolComment := commentStrings at:1.
- eolComment isNil ifTrue:[
- opening := (commentStrings at:2) at:1.
- closing := (commentStrings at:2) at:2.
- (opening isNil or:[closing isNil]) ifTrue:[^ self].
- ] ifFalse:[
- rest := eolComment size + 1.
- ].
-
- line1 to:line2 do:[:lineNr |
- |l|
-
- l := self listAt:lineNr.
- l notNil ifTrue:[
- eolComment notNil ifTrue:[
- (l startsWith:eolComment) ifTrue:[
- l := l copyFrom:rest
- ]
- ] ifFalse:[
- ((l startsWith:opening)
- and:[l endsWith:closing]) ifTrue:[
- l := l copyFrom:opening size + 1.
- l := l copyButLast:closing size.
- ]
- ].
- self replaceLine:lineNr with:l.
- ]
- ].
- widthOfWidestLine := nil.
- self textChanged.
+ self uncommentFrom:line1 to:line2 commentStrings:commentStrings.
"Created: / 09-11-1997 / 01:05:43 / cg"
"Modified: / 09-10-2006 / 10:46:59 / cg"
@@ -1430,53 +1338,7 @@
All lines from line1 to line2 get an end-of-line comment
in the first col."
- |e commentPair opening closing sz1 sz2 l1 l2 c1 c2|
-
- (self checkModificationsAllowed) ifFalse:[ ^ self].
- selectionStartLine isNil ifTrue:[
- self
- undoableDo:[
- self uncommentFrom:cursorLine to:cursorLine
- ]
- info:'Uncomment'.
- ^ self
- ].
-
- self
- undoableDo:
- [
- (selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[
- self uncommentFrom:selectionStartLine to:selectionEndLine-1
- ] ifFalse:[
- commentPair := commentStrings at:2.
- opening := commentPair at:1.
- closing := commentPair at:2.
- (opening isNil or:[closing isNil]) ifTrue:[^ self].
-
- sz1 := opening size.
- sz2 := closing size.
-
- ((self
- stringAtLine:selectionStartLine
- from:selectionStartCol
- to:selectionStartCol+sz1 - 1) = opening
- and:[(self
- stringAtLine:selectionEndLine
- from:selectionEndCol - sz2 + 1
- to:selectionEndCol) = closing ]) ifTrue:[
-
- l2 := selectionEndLine. c2 := selectionEndCol.
- l1 := selectionStartLine. c1 := selectionStartCol.
- self deleteCharsAtLine:l2 fromCol:c2-sz2+1 toCol:c2.
- self deleteCharsAtLine:l1 fromCol:c1 toCol:c1+sz1-1.
-
- e := c2 - sz2.
- l1 == l2 ifTrue:[e := e - sz1].
- self selectFromLine:l1 col:c1 toLine:l2 col:e.
- ]
- ]
- ]
- info:'uncomment'
+ self uncommentSelection:commentStrings
"Modified: / 7.1.1997 / 20:13:32 / cg"
"Created: / 9.11.1997 / 01:05:46 / cg"