--- a/EditTextView.st Fri Sep 26 12:25:34 2014 +0200
+++ b/EditTextView.st Sat Nov 22 11:38:13 2014 +0100
@@ -9,6 +9,8 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+'From Smalltalk/X, Version:6.2.5.0 on 22-11-2014 at 11:33:39' !
+
"{ Package: 'stx:libwidg' }"
TextView subclass:#EditTextView
@@ -1310,6 +1312,20 @@
]) asStringWithCRs
!
+contentsAsStringWithTabs
+ "return the contents as a String (i.e. without emphasis)
+ and with leading spaces replaced by tab characters
+ (i.e. as would be written to a file)"
+
+ list isNil ifTrue:[^ ''].
+ self removeTrailingBlankLines.
+ ^ (list collect:[:each |
+ each isNil
+ ifTrue:['']
+ ifFalse:[each string withTabs]
+ ]) asStringWithCRs
+!
+
cursorCol
"return the cursors col (1..).
This is the absolute col; NOT the visible col"
@@ -1395,6 +1411,39 @@
!EditTextView methodsFor:'accessing-dimensions'!
+absoluteXOfPosition:positionInText
+ |accumulatedX container|
+
+ accumulatedX := 0.
+ container := self.
+ [ container notNil ] whileTrue:[
+ accumulatedX := accumulatedX + container origin x.
+ container := container isTopView ifFalse:[
+ container container
+ ] ifTrue:[ nil ].
+ ].
+ ^ (self xOfPosition:positionInText) + accumulatedX
+
+ "Created: / 16-02-2010 / 10:05:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+absoluteYOfCursor
+ | accumulatedY container |
+
+ accumulatedY := 0.
+ container := self.
+ [ container notNil ] whileTrue:[
+ accumulatedY := accumulatedY + container origin y.
+ container := container isTopView
+ ifFalse:[container container]
+ ifTrue:[nil].
+ ].
+ ^ (self yOfCursor) + accumulatedY
+
+ "Created: / 27-05-2005 / 07:45:53 / janfrog"
+ "Modified: / 27-05-2005 / 23:03:40 / janfrog"
+!
+
xOfCursor
|point|
@@ -1419,6 +1468,34 @@
^self xOfCol:cursorCol inVisibleLine:cursorVisibleLine.
"Created: / 27-05-2005 / 07:43:41 / janfrog"
+!
+
+xOfPosition: positionInText
+
+ | line col |
+ line := self lineOfCharacterPosition: positionInText.
+ col := positionInText - (self characterPositionOfLine:line col:1) + 1.
+ ^
+ (self xOfCol:col inVisibleLine:(self listLineToVisibleLine: line))
+ - viewOrigin x.
+
+ "Created: / 16-02-2010 / 10:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+yOfCursor
+
+ ^self yOfVisibleLine:cursorVisibleLine.
+
+ "Created: / 27-05-2005 / 07:43:41 / janfrog"
+!
+
+yOfPosition: positionInText
+
+ | line |
+ line := self lineOfCharacterPosition: positionInText.
+ ^self yOfVisibleLine:(self listLineToVisibleLine: line)
+
+ "Created: / 16-02-2010 / 10:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!EditTextView methodsFor:'accessing-look'!
@@ -1738,6 +1815,37 @@
"Modified: / 20.6.1998 / 18:19:06 / cg"
!
+cursorLine:line col:col makeVisible:makeVisibleBoolean
+ "this positions onto physical - not visible - line"
+
+ |wasOn newCol|
+
+ ((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self].
+
+ wasOn := self hideCursor.
+ self setValidatedCursorLine:line.
+
+ (col < 1) ifTrue:[
+ newCol := 1
+ ] ifFalse:[
+ newCol := col.
+ ].
+ self st80EditMode ifTrue:[
+ (cursorLine == list size
+ and:[cursorLine ~~ line]) ifTrue:[
+ newCol := (self listAt:(list size)) size + 1.
+ ]
+ ].
+ self setValidatedCursorCol:newCol.
+ makeVisibleBoolean ifTrue:[
+ self makeCursorVisibleAndShowCursor:wasOn.
+ ] ifFalse:[
+ wasOn ifTrue:[self showCursor]
+ ].
+
+ "Modified: / 20.6.1998 / 18:19:06 / cg"
+!
+
cursorMovementAllowed
"return true, if the user may move the cursor around
(via button-click, or cursor-key with selection).
@@ -3861,6 +3969,14 @@
self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr+1 col2:0 info:'split').
!
+withAutoIndent:aBoolean do:aBlock
+ |sav|
+
+ sav := autoIndent.
+ autoIndent := aBoolean.
+ aBlock ensure:[ autoIndent := sav ].
+!
+
withoutRedrawAt:lineNr put:aString
"replace a line at lineNr"
@@ -5556,6 +5672,32 @@
"Modified: / 06-04-2011 / 18:52:40 / cg"
!
+indentBy8
+ self indentBy:8. "/ self executekeyboardMacroNamed:#IndentBy4.
+
+ "Modified: / 06-04-2011 / 18:52:40 / cg"
+!
+
+indentBy:n
+ |line1 line2|
+
+ line1 := self selectionStartLine.
+ line2 := self selectionEndLine.
+ line1 isNil ifTrue:[
+ line1 := self cursorLine.
+ line1 notNil ifTrue:[
+ line2 := line1+1
+ ]
+ ].
+ line1 notNil ifTrue:[
+ self indentFromLine:line1 toLine:line2 by:n.
+ ]
+!
+
+indentByTab
+ self indentBy:((tabPositions == self class tab4Positions) ifTrue:4 ifFalse:8)
+!
+
indentFromLine:start toLine:end
"indent a line-range - this is done by searching for the
last non-empty line before start, and change the indent
@@ -5655,6 +5797,20 @@
self executekeyboardMacroNamed:#UndentBy4.
"Modified: / 06-04-2011 / 18:52:49 / cg"
+!
+
+undentBy8
+ self undentBy:8. "/ self executekeyboardMacroNamed:#UndentBy4.
+
+ "Modified: / 06-04-2011 / 18:52:49 / cg"
+!
+
+undentBy:n
+ self indentBy:(n negated)
+!
+
+undentByTab
+ self undentBy:((tabPositions == self class tab4Positions) ifTrue:4 ifFalse:8).
! !
!EditTextView methodsFor:'initialization'!
@@ -8547,10 +8703,10 @@
!EditTextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.2 2014-09-26 10:25:16 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.3 2014-11-22 10:38:13 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.2 2014-09-26 10:25:16 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604.2.3 2014-11-22 10:38:13 stefan Exp $'
! !
--- a/ListView.st Fri Sep 26 12:25:34 2014 +0200
+++ b/ListView.st Sat Nov 22 11:38:13 2014 +0100
@@ -9,6 +9,8 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+'From Smalltalk/X, Version:6.2.5.0 on 22-11-2014 at 11:34:28' !
+
"{ Package: 'stx:libwidg' }"
View subclass:#ListView
@@ -36,7 +38,8 @@
!
Object subclass:#SearchSpec
- instanceVariableNames:'pattern match ignoreCase variable fullWord forward'
+ instanceVariableNames:'pattern match ignoreCase variable fullWord forward
+ atBeginOfLineOnly'
classVariableNames:''
poolDictionaries:''
privateIn:ListView
@@ -5197,6 +5200,14 @@
!ListView::SearchSpec methodsFor:'accessing'!
+atBeginOfLineOnly
+ ^ atBeginOfLineOnly ? false
+!
+
+atBeginOfLineOnly:something
+ atBeginOfLineOnly := something.
+!
+
forward
^ forward ? true
!
@@ -5256,6 +5267,18 @@
forward := forwardBoolean
!
+pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen
+ fullWord:fullWordBoolen forward:forwardBoolean
+ atBeginOfLineOnly:atBeginOfLineOnlyArg
+ pattern := patternString.
+ ignoreCase := ignoredCaseBoolean.
+ match := matchBoolean.
+ variable := variableBoolen.
+ fullWord := fullWordBoolen.
+ forward := forwardBoolean.
+ atBeginOfLineOnly := atBeginOfLineOnlyArg
+!
+
variable
^ variable
!
@@ -5267,10 +5290,10 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.2 2014-09-26 10:25:34 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.3 2014-11-22 10:38:13 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.2 2014-09-26 10:25:34 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.3 2014-11-22 10:38:13 stefan Exp $'
! !