--- a/Tools__CodeView2.st Mon Oct 03 15:15:56 2016 +0100
+++ b/Tools__CodeView2.st Sun Oct 09 22:55:02 2016 +0100
@@ -42,7 +42,7 @@
!
AbstractBackground subclass:#AnnotationShowingScrollerBackground
- instanceVariableNames:'annotations textView'
+ instanceVariableNames:'annotations breakpoints textView'
classVariableNames:''
poolDictionaries:''
privateIn:CodeView2
@@ -1094,24 +1094,42 @@
"this changes the scroller's background, to show the positions of
warnings, for easy location of interesting spots"
- |allAnnotations scroller newBackground|
+ |allAnnotations allBreakpoints scroller newBackground verticalScrollBar|
allAnnotations := OrderedCollection new.
+ allBreakpoints := OrderedCollection new.
services do:[:eachService |
- allAnnotations addAll:(eachService annotations ? #())
+ allAnnotations addAll:(eachService annotations ? #()).
+ eachService isBreakpointService ifTrue:[
+ allBreakpoints addAll:(eachService breakpoints ? #()).
+ ].
].
- scroller := textViewScroller verticalScrollBar thumb.
- allAnnotations isEmptyOrNil ifTrue:[
+ verticalScrollBar := textViewScroller verticalScrollBar.
+ verticalScrollBar notNil ifTrue:[
+ scroller := verticalScrollBar thumb.
+ ].
+
+ (allAnnotations isEmpty and:[allBreakpoints isEmpty]) ifTrue:[
"/ nothing special to show
- scroller viewBackground isColor ifTrue:[^ self].
- scroller initStyle
+ scroller notNil ifTrue:[
+ scroller viewBackground isColor ifTrue:[^ self].
+ scroller initStyle
+ ].
] ifFalse:[
"/ yep, there are some annotations
- newBackground := (AnnotationShowingScrollerBackground new annotations:allAnnotations; textView:textView; yourself ).
- scroller viewBackground:newBackground.
+ newBackground := AnnotationShowingScrollerBackground new.
+ newBackground textView:textView.
+ newBackground annotations:allAnnotations; breakpoints:allBreakpoints.
+
+ scroller notNil ifTrue:[
+ scroller viewBackground:newBackground.
+ ].
].
- scroller invalidate.
+
+ scroller notNil ifTrue:[
+ scroller invalidate.
+ ].
! !
!CodeView2 methodsFor:'channels'!
@@ -2292,8 +2310,12 @@
!CodeView2::AnnotationShowingScrollerBackground methodsFor:'accessing'!
-annotations:something
- annotations := something.
+annotations:aCollectionOfAnnotations
+ annotations := aCollectionOfAnnotations.
+!
+
+breakpoints:aCollectionOfBreakpoints
+ breakpoints := aCollectionOfBreakpoints.
!
textView:something
@@ -2306,38 +2328,65 @@
"I am asked to draw the background of aScroller.
If any annotation is in that range, draw it"
- |overAllHeight|
-
- annotations isEmptyOrNil ifTrue:[^ self ].
-
+ |overAllHeight drawRect scrollerHeight|
+
+ annotations isEmptyOrNil ifTrue:[
+ breakpoints isEmptyOrNil ifTrue:[
+ ^ self
+ ].
+ ].
+
+ scrollerHeight := aScroller height.
+ drawRect :=
+ [:lineNr :clrInside |
+ |clrBorder yThumb|
+
+ yThumb := (scrollerHeight * (lineNr / overAllHeight)) rounded.
+ (yThumb between:y-5 and:(y + h + 5)) ifTrue:[
+ clrBorder := clrInside darkened.
+ aScroller paint:clrInside.
+ aScroller fillRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:8.
+ aScroller paint:clrBorder.
+ aScroller displayRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:9.
+ ].
+ ].
+
overAllHeight := textView numberOfLines.
overAllHeight = 0 ifTrue:[ ^ self ].
- annotations do:[:eachAnnotation |
- |lineNr yThumb baseColor clr1 clr2 severity|
-
- (lineNr := eachAnnotation line) notNil ifTrue:[
- yThumb := (aScroller height * (lineNr / overAllHeight)) rounded.
- (yThumb between:y-5 and:(y + h + 5)) ifTrue:[
+ annotations notEmptyOrNil ifTrue:[
+ annotations do:[:eachAnnotation |
+ |lineNr severityColor severity|
+
+ (lineNr := eachAnnotation line) notNil ifTrue:[
severity := eachAnnotation rule severity.
severity == #error ifTrue:[
- baseColor := Color red.
+ severityColor := Color red.
] ifFalse:[
severity == #warning ifTrue:[
- baseColor := Color yellow.
+ severityColor := Color yellow.
] ifFalse:[
- baseColor := Color blue.
+ severityColor := Color blue.
].
].
- clr1 := baseColor lightened lightened.
- clr2 := clr1 darkened.
- aScroller paint:clr1.
- aScroller fillRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:8.
- aScroller paint:clr2.
- aScroller displayRectangleX:3 y:(yThumb-5 max:0) width:aScroller width-5 height:9.
+ drawRect value:lineNr value:severityColor lightened.
].
].
- ]
+ ].
+ breakpoints notEmptyOrNil ifTrue:[
+ breakpoints do:[:eachBreakpoint |
+ (eachBreakpoint isVisible and:[eachBreakpoint isEnabled]) ifTrue:[
+ |lineNr bpntColor|
+
+ (lineNr := eachBreakpoint line) notNil ifTrue:[
+ bpntColor := eachBreakpoint isTracepoint
+ ifTrue:[ Color blue lightened]
+ ifFalse:[ Color red ].
+ drawRect value:lineNr value:bpntColor.
+ ].
+ ].
+ ].
+ ].
! !
!CodeView2::AnnotationShowingScrollerBackground methodsFor:'ignored conversion'!