#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Fri, 20 Jan 2017 18:52:10 +0100
changeset 6031 01fbf7320331
parent 6030 06928de3213b
child 6032 3f1c88d62afd
#REFACTORING by cg class: EditTextView changed: #basicInsert:atLine:col: (send #clippingBounds: instead of #clippingRectangle:, send #clippingBoundsOrNil instead of #clippingRectangleOrNil) #drawCursor:with:and: (send #clippingBounds: instead of #clippingRectangle:, send #clippingBoundsOrNil instead of #clippingRectangleOrNil) #undrawCursor (send #clippingBounds: instead of #clippingRectangle:, send #clippingBoundsOrNil instead of #clippingRectangleOrNil)
EditTextView.st
--- a/EditTextView.st	Fri Jan 20 18:51:30 2017 +0100
+++ b/EditTextView.st	Fri Jan 20 18:52:10 2017 +0100
@@ -2511,84 +2511,84 @@
     "draw a cursor; the argument cursorType specifies what type
      of cursor should be drawn.
      Currently, supported are: #none,
-			       #block, #frame, #ibeam, #caret, #solidCaret
-			       #bigCaret and #bigSolidCaret"
+                               #block, #frame, #ibeam, #caret, #solidCaret
+                               #bigCaret and #bigSolidCaret"
 
     |x y w char y2 x1 x2 oldPaint oldClip|
 
     self hasSelection ifTrue:[
-	"
-	 hide cursor, if there is a selection
-	"
-	^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
+        "
+         hide cursor, if there is a selection
+        "
+        ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
     ].
 
     cursorType == #none ifTrue:[
-	^ self
+        ^ self
     ].
 
     cursorType == #block ifTrue:[
-	super drawVisibleLine:cursorVisibleLine col:cursorCol with:fgColor and:bgColor.
-	^ self
+        super drawVisibleLine:cursorVisibleLine col:cursorCol with:fgColor and:bgColor.
+        ^ self
     ].
     x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
     y := self yOfVisibleLine:cursorVisibleLine.
 
     oldPaint := self paint. "/ do not clobber GC
     cursorType == #frame ifTrue:[
-	super redrawVisibleLine:cursorVisibleLine col:cursorCol.
-
-	char := self characterUnderCursor asString.
-	self paint:bgColor.
-	self displayRectangleX:x y:y width:(gc font widthOf:char) height:fontHeight-2.
+        super redrawVisibleLine:cursorVisibleLine col:cursorCol.
+
+        char := self characterUnderCursor asString.
+        self paint:bgColor.
+        self displayRectangleX:x y:y width:(gc font widthOf:char) height:fontHeight-2.
     ] ifFalse:[
-	self paint:bgColor.
-	cursorType == #ibeam ifTrue:[
-	    x1 := x - 1.
-	    y2 := y + fontHeight - lineSpacing - 1.
-	    self displayLineFromX:x1 y:y toX:x1 y:y2.
-	    self displayLineFromX:x y:y toX:x y:y2.
-	    ^ self
-	].
-
-	cursorType == #Ibeam ifTrue:[
-	    x1 := x - 1.
-	    y := y + 1.
-	    y2 := y + fontHeight - lineSpacing - 1.
-	    self displayLineFromX:x1 y:y toX:x1 y:y2.
-	    self displayLineFromX:x y:y toX:x y:y2.
-	    self displayLineFromX:x1-2 y:y toX:x+2 y:y.
-	    self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
-	    ^ self
-	].
-
-	y := y + fontHeight - 3.
-	((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
-	    w := (fontWidth * 2 // 3) max:4.
-	    y2 := y + w + (w//2).
-	] ifFalse:[
-	    w := (fontWidth // 2) max:4.
-	    y2 := y + w.
-	].
-	x1 := x - w.
-	x2 := x + w.
-
-	oldClip := self clippingRectangleOrNil.
-	self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)).
-
-	cursorType == #caret ifTrue:[
-	    self lineWidth:2.
-	    self displayLineFromX:x1 y:y2 toX:x y:y.
-	    self displayLineFromX:x y:y toX:x2 y:y2.
-	] ifFalse:[
-	    "anything else: solidCaret"
-
-	    self fillPolygon:(Array with:(x1 @ y2)
-				    with:(x @ y)
-				    with:(x2 @ y2))
-	].
-
-	self clippingRectangle:oldClip
+        self paint:bgColor.
+        cursorType == #ibeam ifTrue:[
+            x1 := x - 1.
+            y2 := y + fontHeight - lineSpacing - 1.
+            self displayLineFromX:x1 y:y toX:x1 y:y2.
+            self displayLineFromX:x y:y toX:x y:y2.
+            ^ self
+        ].
+
+        cursorType == #Ibeam ifTrue:[
+            x1 := x - 1.
+            y := y + 1.
+            y2 := y + fontHeight - lineSpacing - 1.
+            self displayLineFromX:x1 y:y toX:x1 y:y2.
+            self displayLineFromX:x y:y toX:x y:y2.
+            self displayLineFromX:x1-2 y:y toX:x+2 y:y.
+            self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
+            ^ self
+        ].
+
+        y := y + fontHeight - 3.
+        ((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
+            w := (fontWidth * 2 // 3) max:4.
+            y2 := y + w + (w//2).
+        ] ifFalse:[
+            w := (fontWidth // 2) max:4.
+            y2 := y + w.
+        ].
+        x1 := x - w.
+        x2 := x + w.
+
+        oldClip := self clippingBoundsOrNil.
+        self clippingBounds:(margin@margin extent:(width-margin) @ (height-margin)).
+
+        cursorType == #caret ifTrue:[
+            self lineWidth:2.
+            self displayLineFromX:x1 y:y2 toX:x y:y.
+            self displayLineFromX:x y:y toX:x2 y:y2.
+        ] ifFalse:[
+            "anything else: solidCaret"
+
+            self fillPolygon:(Array with:(x1 @ y2)
+                                    with:(x @ y)
+                                    with:(x2 @ y2))
+        ].
+
+        self clippingBounds:oldClip
     ].
     self paint:oldPaint.
 
@@ -2784,78 +2784,78 @@
     |prevCol line oldClip x y e1 e2 e3|
 
     cursorVisibleLine notNil ifTrue:[
-	prevCol := cursorCol - 1.
-
-	"/ if there is any italic stuff in the cursor line,
-	"/ redraw it completely (because characters overlap).
-	cursorCol > 1 ifTrue:[
-	    (line := self listAt:cursorLine) notNil ifTrue:[
-		line hasChangeOfEmphasis ifTrue:[
-		    line size >= (cursorCol-1) ifTrue:[
-			e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1).
-			line size >= (cursorCol) ifTrue:[
-			    e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol).
-			    line size >= (cursorCol+1) ifTrue:[
-				e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1)
-			    ].
-			].
-		    ].
-		    (e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[
-			^ super redrawVisibleLine:cursorVisibleLine
-		    ]
-		]
-	    ]
-	].
-
-	((cursorType == #caret)
-	 or:[cursorType == #solidCaret
-	 or:[cursorType == #bigSolidCaret
-	 or:[cursorType == #bigCaret
-	 or:[cursorType == #Ibeam]]]]) ifTrue:[
-	    "caret-cursor touches 4 characters"
-	    ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
-		super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol.
-		super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
-		super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
-	    ] ifFalse:[
-		"care for left margin"
-		super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
-	    ].
-	    ^ self
-	].
-
-	cursorType == #ibeam ifTrue:[
-	    "ibeam-cursor touches 2 characters"
-	    cursorCol > 1 ifTrue:[
-		super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
-	    ] ifFalse:[
-		"care for left margin"
-		super redrawVisibleLine:cursorVisibleLine.
-	    ].
-	    ^ self
-	].
-
-	"block cursor is simple - just one character under cursor"
-
-	"/ however, if italic characters are involved, we must care
-	"/ for the chars before/after the cursor.
-	"/ We redraw the part of the previous character which got
-	"/ detroyed by the block cursor.
-	"/ (must change the clip, to avoid destroying the prev-prev character)
-
-	line := self visibleAt:cursorVisibleLine.
-	(line notNil and:[line isText]) ifTrue:[
-	    cursorCol > 1 ifTrue:[
-		oldClip := self clippingRectangleOrNil.
-		x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
-		y := self yOfVisibleLine:cursorVisibleLine.
-		self clippingRectangle:(x@y extent:((gc font width * 2) @ fontHeight)).
-		super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol.
-		self clippingRectangle:oldClip.
-		^ self.
-	    ].
-	].
-	super redrawVisibleLine:cursorVisibleLine col:cursorCol
+        prevCol := cursorCol - 1.
+
+        "/ if there is any italic stuff in the cursor line,
+        "/ redraw it completely (because characters overlap).
+        cursorCol > 1 ifTrue:[
+            (line := self listAt:cursorLine) notNil ifTrue:[
+                line hasChangeOfEmphasis ifTrue:[
+                    line size >= (cursorCol-1) ifTrue:[
+                        e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1).
+                        line size >= (cursorCol) ifTrue:[
+                            e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol).
+                            line size >= (cursorCol+1) ifTrue:[
+                                e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1)
+                            ].
+                        ].
+                    ].
+                    (e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[
+                        ^ super redrawVisibleLine:cursorVisibleLine
+                    ]
+                ]
+            ]
+        ].
+
+        ((cursorType == #caret)
+         or:[cursorType == #solidCaret
+         or:[cursorType == #bigSolidCaret
+         or:[cursorType == #bigCaret
+         or:[cursorType == #Ibeam]]]]) ifTrue:[
+            "caret-cursor touches 4 characters"
+            ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
+                super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol.
+                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
+                super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
+            ] ifFalse:[
+                "care for left margin"
+                super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
+            ].
+            ^ self
+        ].
+
+        cursorType == #ibeam ifTrue:[
+            "ibeam-cursor touches 2 characters"
+            cursorCol > 1 ifTrue:[
+                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
+            ] ifFalse:[
+                "care for left margin"
+                super redrawVisibleLine:cursorVisibleLine.
+            ].
+            ^ self
+        ].
+
+        "block cursor is simple - just one character under cursor"
+
+        "/ however, if italic characters are involved, we must care
+        "/ for the chars before/after the cursor.
+        "/ We redraw the part of the previous character which got
+        "/ detroyed by the block cursor.
+        "/ (must change the clip, to avoid destroying the prev-prev character)
+
+        line := self visibleAt:cursorVisibleLine.
+        (line notNil and:[line isText]) ifTrue:[
+            cursorCol > 1 ifTrue:[
+                oldClip := self clippingBoundsOrNil.
+                x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
+                y := self yOfVisibleLine:cursorVisibleLine.
+                self clippingBounds:(x@y extent:((gc font width * 2) @ fontHeight)).
+                super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol.
+                self clippingBounds:oldClip.
+                ^ self.
+            ].
+        ].
+        super redrawVisibleLine:cursorVisibleLine col:cursorCol
     ]
 
     "Modified: / 15.12.1999 / 22:25:59 / cg"
@@ -4716,7 +4716,7 @@
         (newLine notNil and:[newLine isText]) ifTrue:[
             colNr > 1 ifTrue:[
                 cursorVisibleLine notNil ifTrue:[
-                    oldClip := self clippingRectangleOrNil.
+                    oldClip := self clippingBoundsOrNil.
                     x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x.
                     y := self yOfVisibleLine:cursorVisibleLine.
 
@@ -4724,13 +4724,13 @@
                         self invalidateLine:lineNr.
                     ] ifFalse:[
                         drawCharacterOnly ifTrue:[
-                            self clippingRectangle:(x@y extent:((gc font width * 2) @ fontHeight)).
+                            self clippingBounds:(x@y extent:((gc font width * 2) @ fontHeight)).
                             self redrawLine:lineNr from:colNr-1 to:colNr
                         ] ifFalse:[
-                            self clippingRectangle:(x@y extent:((width - x) @ fontHeight)).
+                            self clippingBounds:(x@y extent:((width - x) @ fontHeight)).
                             self redrawLine:lineNr from:colNr-1
                         ].
-                        self clippingRectangle:oldClip.
+                        self clippingBounds:oldClip.
                     ].
                 ].
                 ^ self.