Tools__TagsBrowser.st
changeset 13302 43e8996fe190
parent 13076 254581d2fafc
child 13303 d9c8bf92e007
equal deleted inserted replaced
13301:02dcd0e97dff 13302:43e8996fe190
  2415 
  2415 
  2416 drawLabelAt:anIndex x:x y:y h:h
  2416 drawLabelAt:anIndex x:x y:y h:h
  2417     "draw the label at position x/y without clearing the background
  2417     "draw the label at position x/y without clearing the background
  2418     "
  2418     "
  2419     |item label typeIdentifier
  2419     |item label typeIdentifier
  2420      y0 "{ Class: SmallInteger }"
  2420      y0 widthOfTypeIdentifier inset inSelection lineNrString|
  2421      widthOfTypeIdentifier inset
  2421 
  2422     |
       
  2423     item := list at:anIndex ifAbsent:nil.
  2422     item := list at:anIndex ifAbsent:nil.
  2424     item isNil ifTrue:[^ self].
  2423     item isNil ifTrue:[^ self].
  2425 
  2424 
  2426     self paint:fgColor on:bgColor.
       
  2427 
       
  2428     label := item printString.
  2425     label := item printString.
  2429     label := label asText , ((' [ %1 ]' bindWith:item lineNumber) colorizeAllWith:Color darkGrey).
  2426     (inSelection := self isInSelection:anIndex) ifTrue:[
  2430 
  2427         self paint:hilightFgColor on:hilightBgColor.
  2431     y0    := y - (((font height)  + 1 - h) // 2) + font ascent.
  2428         label := label string.   "/ to avoid printing blue on blue
  2432 
  2429     ] ifFalse:[
  2433     inset := TypeInset.
  2430         self paint:fgColor on:bgColor.
  2434 
  2431     ].
  2435     typeIdentifier  := item typeIdentifierInList.
  2432 
  2436     typeIdentifier notNil ifTrue:[
  2433     lineNrString := ' [ %1 ]' bindWith:item lineNumber.
       
  2434     inSelection ifFalse:[
       
  2435         lineNrString := lineNrString colorizeAllWith:Color darkGrey.
       
  2436     ].
       
  2437     label := label asText , lineNrString.
       
  2438 
       
  2439     y0 := y - (((font height) + 1 - h) // 2) + font ascent.
       
  2440 
       
  2441     typeIdentifier := item typeIdentifierInList.
       
  2442     typeIdentifier isNil ifTrue:[
       
  2443         widthOfTypeIdentifier := 0
       
  2444     ] ifFalse:[
  2437         typeIdentifier := Text string:typeIdentifier emphasis:#bold.
  2445         typeIdentifier := Text string:typeIdentifier emphasis:#bold.
  2438         typeIdentifier displayOn:self x:x y:y0.
  2446         typeIdentifier displayOn:self x:x y:y0.
  2439         widthOfTypeIdentifier := self font widthOf:typeIdentifier.
  2447         widthOfTypeIdentifier := self font widthOf:typeIdentifier.
  2440         inset := inset max:widthOfTypeIdentifier.
  2448     ].
  2441     ].
  2449     inset := TypeInset max:widthOfTypeIdentifier.
  2442 
  2450 
  2443     (self isInSelection:anIndex) ifTrue:[
       
  2444         self paint:hilightFgColor on:hilightBgColor
       
  2445     ].
       
  2446     label displayOn:self x:(x + inset) y:y0
  2451     label displayOn:self x:(x + inset) y:y0
  2447 
  2452 
  2448     "Modified: / 17-03-2012 / 11:15:27 / cg"
  2453     "Modified: / 17-03-2012 / 11:15:27 / cg"
  2449 !
  2454 !
  2450 
  2455 
  2469 
  2474 
  2470     y0 := self yVisibleOfLine:lnNr.
  2475     y0 := self yVisibleOfLine:lnNr.
  2471     y1 := self yVisibleOfLine:(lnNr + 1).
  2476     y1 := self yVisibleOfLine:(lnNr + 1).
  2472     hL := y1 - y0.
  2477     hL := y1 - y0.
  2473 
  2478 
  2474     x0 := textStartLeft - viewOrigin x + TypeInset - 4.
  2479     x0 := textStartLeft - viewOrigin x "+ TypeInset - 4".
  2475     x1 := (self widthOfContents - viewOrigin x) max:(width - margin).
  2480     x1 := (self widthOfContents - viewOrigin x) max:(width - margin).
  2476     wL := x1 - x0.
  2481     wL := x1 - x0.
  2477 
  2482 
  2478     wL > 0 ifFalse:[^ self].
  2483     wL > 0 ifFalse:[^ self].
  2479 
  2484 
  2573 stopGeneratingTags
  2578 stopGeneratingTags
  2574     "stop the process which generates the tags
  2579     "stop the process which generates the tags
  2575     "
  2580     "
  2576     |task|
  2581     |task|
  2577 
  2582 
  2578 
       
  2579     (task := process) notNil ifTrue:[
  2583     (task := process) notNil ifTrue:[
  2580         process := nil.
  2584         process := nil.
  2581 
  2585 
  2582         Exception handle:[:ex|
  2586         Exception handle:[:ex|
       
  2587             Transcript showCR:('cought exception during tag-process termination: ',ex description).
  2583         ] do:[
  2588         ] do:[
  2584             task terminateWithAllSubprocessesInGroup.
  2589             task terminateWithAllSubprocessesInGroup.
  2585             task waitUntilTerminated.
  2590             task waitUntilTerminated.
  2586         ]
  2591         ]
  2587     ].
  2592     ].
  2606     highlightMode := #line.
  2611     highlightMode := #line.
  2607 ! !
  2612 ! !
  2608 
  2613 
  2609 !TagsBrowser::TagView methodsFor:'protocol'!
  2614 !TagsBrowser::TagView methodsFor:'protocol'!
  2610 
  2615 
  2611 heightOfLineAt:aLineNr
  2616 heightOfLineAt:aLineNr 
  2612     "returns the total height for a line at an index( including lineSpacing ... )
  2617     "returns the total height for a line at an index (including lineSpacing)"
  2613     "
  2618     
  2614     ^ lineSpacing + font height
  2619     ^ lineSpacing + font height
  2615 !
  2620 !
  2616 
  2621 
  2617 widthOfWidestLineBetween:firstLine and:lastLine
  2622 widthOfWidestLineBetween:firstLine and:lastLine 
  2618     "return the width in pixels of the widest line in a range
  2623     "return the width in pixels of the widest line in a range"
  2619     "
  2624     
  2620     |width|
  2625     ^ TypeInset + (super widthOfWidestLineBetween:firstLine and:lastLine)
  2621 
       
  2622     width := super widthOfWidestLineBetween:firstLine and:lastLine.
       
  2623   ^ width + TypeInset
       
  2624 ! !
  2626 ! !
  2625 
  2627 
  2626 !TagsBrowser class methodsFor:'documentation'!
  2628 !TagsBrowser class methodsFor:'documentation'!
  2627 
  2629 
  2628 version
  2630 version
  2629     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
  2631     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
  2630 !
  2632 !
  2631 
  2633 
  2632 version_CVS
  2634 version_CVS
  2633     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
  2635     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
  2634 !
  2636 !
  2635 
  2637 
  2636 version_SVN
  2638 version_SVN
  2637     ^ '$Id: Tools__TagsBrowser.st,v 1.35 2013-06-30 20:06:12 cg Exp $'
  2639     ^ '$Id: Tools__TagsBrowser.st,v 1.36 2013-08-07 07:24:26 cg Exp $'
  2638 ! !
  2640 ! !
  2639 
  2641