class: Tools::TagsBrowser
authorClaus Gittinger <cg@exept.de>
Wed, 07 Aug 2013 09:24:26 +0200
changeset 13302 43e8996fe190
parent 13301 02dcd0e97dff
child 13303 d9c8bf92e007
class: Tools::TagsBrowser fixed drawing (do not draw blue on blue in the selection)
Tools__TagsBrowser.st
--- a/Tools__TagsBrowser.st	Wed Aug 07 03:25:30 2013 +0000
+++ b/Tools__TagsBrowser.st	Wed Aug 07 09:24:26 2013 +0200
@@ -2417,32 +2417,37 @@
     "draw the label at position x/y without clearing the background
     "
     |item label typeIdentifier
-     y0 "{ Class: SmallInteger }"
-     widthOfTypeIdentifier inset
-    |
+     y0 widthOfTypeIdentifier inset inSelection lineNrString|
+
     item := list at:anIndex ifAbsent:nil.
     item isNil ifTrue:[^ self].
 
-    self paint:fgColor on:bgColor.
-
     label := item printString.
-    label := label asText , ((' [ %1 ]' bindWith:item lineNumber) colorizeAllWith:Color darkGrey).
-
-    y0    := y - (((font height)  + 1 - h) // 2) + font ascent.
-
-    inset := TypeInset.
-
-    typeIdentifier  := item typeIdentifierInList.
-    typeIdentifier notNil ifTrue:[
+    (inSelection := self isInSelection:anIndex) ifTrue:[
+        self paint:hilightFgColor on:hilightBgColor.
+        label := label string.   "/ to avoid printing blue on blue
+    ] ifFalse:[
+        self paint:fgColor on:bgColor.
+    ].
+
+    lineNrString := ' [ %1 ]' bindWith:item lineNumber.
+    inSelection ifFalse:[
+        lineNrString := lineNrString colorizeAllWith:Color darkGrey.
+    ].
+    label := label asText , lineNrString.
+
+    y0 := y - (((font height) + 1 - h) // 2) + font ascent.
+
+    typeIdentifier := item typeIdentifierInList.
+    typeIdentifier isNil ifTrue:[
+        widthOfTypeIdentifier := 0
+    ] ifFalse:[
         typeIdentifier := Text string:typeIdentifier emphasis:#bold.
         typeIdentifier displayOn:self x:x y:y0.
         widthOfTypeIdentifier := self font widthOf:typeIdentifier.
-        inset := inset max:widthOfTypeIdentifier.
     ].
-
-    (self isInSelection:anIndex) ifTrue:[
-        self paint:hilightFgColor on:hilightBgColor
-    ].
+    inset := TypeInset max:widthOfTypeIdentifier.
+
     label displayOn:self x:(x + inset) y:y0
 
     "Modified: / 17-03-2012 / 11:15:27 / cg"
@@ -2471,7 +2476,7 @@
     y1 := self yVisibleOfLine:(lnNr + 1).
     hL := y1 - y0.
 
-    x0 := textStartLeft - viewOrigin x + TypeInset - 4.
+    x0 := textStartLeft - viewOrigin x "+ TypeInset - 4".
     x1 := (self widthOfContents - viewOrigin x) max:(width - margin).
     wL := x1 - x0.
 
@@ -2575,11 +2580,11 @@
     "
     |task|
 
-
     (task := process) notNil ifTrue:[
         process := nil.
 
         Exception handle:[:ex|
+            Transcript showCR:('cought exception during tag-process termination: ',ex description).
         ] do:[
             task terminateWithAllSubprocessesInGroup.
             task waitUntilTerminated.
@@ -2608,32 +2613,29 @@
 
 !TagsBrowser::TagView methodsFor:'protocol'!
 
-heightOfLineAt:aLineNr
-    "returns the total height for a line at an index( including lineSpacing ... )
-    "
+heightOfLineAt:aLineNr 
+    "returns the total height for a line at an index (including lineSpacing)"
+    
     ^ lineSpacing + font height
 !
 
-widthOfWidestLineBetween:firstLine and:lastLine
-    "return the width in pixels of the widest line in a range
-    "
-    |width|
-
-    width := super widthOfWidestLineBetween:firstLine and:lastLine.
-  ^ width + TypeInset
+widthOfWidestLineBetween:firstLine and:lastLine 
+    "return the width in pixels of the widest line in a range"
+    
+    ^ TypeInset + (super widthOfWidestLineBetween:firstLine and:lastLine)
 ! !
 
 !TagsBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
+    ^ '$Id: Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
 ! !