#UI_ENHANCEMENT by cg cvs_MAIN
authorClaus Gittinger <cg@exept.de>
Mon, 16 May 2016 23:47:57 +0200
branchcvs_MAIN
changeset 965 b6f6cde0739f
parent 964 bb8ca4cf3892
child 966 25bb5ab6275e
#UI_ENHANCEMENT by cg class: SmallSense::SmalltalkLintService added: #drawLine:in:atX:y:width:height:ascent:from:to:with:and: removed: #drawLine:in:atX:y:width:height:from:to:with:and: comment/format in: #annotationAtLine: changed: #process: #rehighlight: #sourceChanged: category of: #process:
SmallSense__SmalltalkLintService.st
--- a/SmallSense__SmalltalkLintService.st	Sat May 14 16:26:50 2016 +0200
+++ b/SmallSense__SmalltalkLintService.st	Mon May 16 23:47:57 2016 +0200
@@ -98,7 +98,7 @@
 !SmalltalkLintService methodsFor:'accessing'!
 
 annotationAtLine: lineNo
-    | anns |
+    | anns bbb |
 
     (anns := self annotations) notNil ifTrue:[
         ^ annotationsPerLine at: lineNo ifAbsent:[nil].
@@ -190,7 +190,9 @@
 
     rules isNil ifTrue:[ ^ self ].
     rules resetResult.
-    ((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ].
+    
+    "/ why this? - if there are rules and annotations, any reason to not show them?
+    "/ ((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ].
 
     super sourceChanged:force.
 
@@ -293,8 +295,47 @@
     "Created: / 24-01-2012 / 12:43:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+rehighlight: delayed
+    | service |
+
+    service := self service: SmallSense::CodeHighlightingService name.
+    service isNil ifTrue:[
+        service := self service: Tools::CodeHighlightingService name
+    ].
+    service notNil ifTrue:[
+        "/ let the code-hghlighter do the drawing
+        service sourceChanged: true.
+        codeView updateScrollersViewBackground.
+    ].
+
+    "Created: / 27-01-2012 / 17:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 15-12-2014 / 19:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+showInfoWindowForLine: lineNo
+    | ann |
+
+    ann := self annotationAtLine: lineNo.
+    ann isNil ifTrue:[ ^ false ].
+
+    codeView topView beMaster.
+
+    CriticsWindow new
+	rule: ann rule;
+	codeView: codeView;
+	allButOpen;
+	"/ openWindowAt: (Screen current pointerPosition - (20@20)).
+	openWindowAs:#popUp at: (Screen current pointerPosition - (20@20)).
+
+    ^true
+
+    "Created: / 30-01-2012 / 21:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SmalltalkLintService methodsFor:'processing'!
+
 process: delayed
-    "Do the real source processing. If delayed is true, actuall data update must
+    "Do the real source processing. If delayed is true, actual data update must
      be done within the event queue using #pushUserEvent:...
     "
     |lang cls env oldCodeList oldCode |
@@ -302,8 +343,9 @@
     rules isNil ifTrue:[ ^ self ].
 
     codeView codeAspect ~~ #method ifTrue:[ ^ self ].
-    (lang := codeView language) isNil ifTrue: [ ^ self ].
-    lang isSmalltalk ifFalse: [ ^ self ].
+    "/ why this - 
+    "/ (lang := codeView language) isNil ifTrue: [ ^ self ].
+    "/ lang isSmalltalk ifFalse: [ ^ self ].
     done := false.
     modified := false.
 
@@ -342,15 +384,15 @@
                                 ex pass.
                             ].
 
-"/                            Transcript topView raiseDeiconified.
-"/                            Transcript showCR:'ParseError: ', ex description.
+                            "/ Transcript topView raiseDeiconified.
+                            "/ Transcript showCR:'ParseError: ', ex description.
                             errMsg := ex description asStringCollection first asString.
                             self showInfo:(('Smalltalk Lint: ',errMsg) withColor:Color red).
                         ] do:[
                             env := (SmallSense::SmalltalkUnacceptedMethodEnvironment onClass:cls methodSource: oldCode).
                             rules rejectRules:[:rule | SmalltalkChecker isRuleDisabled:rule class].
-"/ Transcript showCR:rules.
-"/ Transcript showCR:rules rules.
+                            "/ Transcript showCR:rules.
+                            "/ Transcript showCR:rules rules.
                             SmalltalkChecker runRule: rules onEnvironment: env
                         ].
                         delayed ifTrue:[
@@ -366,65 +408,25 @@
 
     "Created: / 24-01-2012 / 12:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 16-10-2014 / 01:10:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-rehighlight: delayed
-    | service |
-
-    service := self service: SmallSense::CodeHighlightingService name.
-    service isNil ifTrue:[
-	service := self service: Tools::CodeHighlightingService name
-    ].
-    service notNil ifTrue:[
-	service sourceChanged: true.
-    ]
-
-    "Created: / 27-01-2012 / 17:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (format): / 15-12-2014 / 19:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-showInfoWindowForLine: lineNo
-    | ann |
-
-    ann := self annotationAtLine: lineNo.
-    ann isNil ifTrue:[ ^ false ].
-
-    codeView topView beMaster.
-
-    CriticsWindow new
-	rule: ann rule;
-	codeView: codeView;
-	allButOpen;
-	"/ openWindowAt: (Screen current pointerPosition - (20@20)).
-	openWindowAs:#popUp at: (Screen current pointerPosition - (20@20)).
-
-    ^true
-
-    "Created: / 30-01-2012 / 21:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkLintService methodsFor:'redrawing'!
 
-drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg
+drawLine:lineNo in:view atX:x y:yBaseline width:w height:hFont ascent:aFont 
+    from:startCol to:endColOrNil with:fg and:bg
     "Called by both gutterView and textView (well, not yet) to
      allow services to draw custom things on text view.
      Ask JV what the args means if unsure (I'm lazy to document
      them, now it is just an experiment...)"
 
-    | lang annotation |
-
+    "/ | lang |
     "/ ((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ].
 
     (UserPreferences current smallSenseBackgroundLintEnabled == true) ifFalse:[ ^ self ].
 
-    annotation :=  self annotationAtLine: lineNo.
-    annotation notNil ifTrue:[
-	self drawAnnotationIcon: (ToolbarIconLibrary smalllintWarning16x16)
-		atX: x y: y  width: w height: h.
-    ].
-
-    "Created: / 30-01-2012 / 15:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 15-12-2014 / 15:28:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    self drawAnnotationInLine:lineNo 
+         in:view atX:x y:yBaseline width:w height:hFont ascent:aFont 
+         from:startCol to:endColOrNil with:fg and:bg
 ! !
 
 !SmalltalkLintService methodsFor:'registering'!