Tools__CodeNavigationService.st
changeset 12986 145d28bf105e
parent 12930 658aaa9b2245
child 12994 0899f74ec3ce
--- a/Tools__CodeNavigationService.st	Mon Jun 24 15:43:05 2013 +0200
+++ b/Tools__CodeNavigationService.st	Mon Jun 24 16:20:38 2013 +0200
@@ -28,9 +28,11 @@
 "{ NameSpace: Tools }"
 
 CodeViewService subclass:#CodeNavigationService
-	instanceVariableNames:'selectorEmphasis variableEmphasis currentEmphasis linesToRedraw
-		menuShown'
-	classVariableNames:'DefaultVariableEmphasis DefaultSelectorEmphasis'
+	instanceVariableNames:'selectorEmphasis variableEmphasis currentEmphasis
+		currentEmphasisForAssign linesToRedraw menuShown
+		assignmentEmphasis'
+	classVariableNames:'DefaultVariableEmphasis DefaultSelectorEmphasis
+		DefaultAssignmentEmphasis'
 	poolDictionaries:''
 	category:'Interface-CodeView'
 !
@@ -85,6 +87,13 @@
 
 !CodeNavigationService class methodsFor:'accessing - defaults'!
 
+defaultAssignmentEmphasis
+    DefaultAssignmentEmphasis isNil ifTrue:[
+        ^ Array with:(#backgroundColor -> (UserPreferences current assignmentBackgroundColorForNavigationService))
+    ].
+    ^ DefaultAssignmentEmphasis
+!
+
 defaultSelectorEmphasis
     DefaultSelectorEmphasis isNil ifTrue:[
         ^ Array with:(#backgroundColor -> (UserPreferences current selectorBackgroundColorForNavigationService))
@@ -387,6 +396,7 @@
     super initialize.
     selectorEmphasis := self class defaultSelectorEmphasis.
     variableEmphasis := self class defaultVariableEmphasis.
+    assignmentEmphasis := self class defaultAssignmentEmphasis.
     linesToRedraw := OrderedCollection new.
 
     "Created: / 25-06-2010 / 14:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -482,6 +492,11 @@
             (line hasEmphasis: currentEmphasis) ifTrue:[
                 line emphasisAllRemove:currentEmphasis.
                 linesToRedraw add: lineNo.
+            ] ifFalse:[
+                (currentEmphasisForAssign notNil and:[line hasEmphasis: currentEmphasisForAssign]) ifTrue:[
+                    line emphasisAllRemove:currentEmphasisForAssign.
+                    linesToRedraw add: lineNo.
+                ]
             ]
         ] 
     ].
@@ -495,19 +510,30 @@
 !
 
 highlightElement:element 
-    |e|
+    |e savedEmphasis|
 
     codeView syntaxElementSelection == element ifTrue:[ ^ self ]. "/ no change
     codeView syntaxElementSelection notNil ifTrue:[
         self highlightClear: false.
     ].
 
-    currentEmphasis := self highlighEmphasisFor:element.
+    currentEmphasis := savedEmphasis := self highlighEmphasisFor:element.
+    currentEmphasisForAssign := nil.
+
     element notNil ifTrue:[ 
         codeView syntaxElementSelection:element.
         e := element firstElementInChain.
         [ e notNil ] whileTrue:[ 
-            self highlightWithoutClearFrom:e start to:e stop.
+            e assigned ifTrue:[
+                [
+                    currentEmphasis := currentEmphasisForAssign := assignmentEmphasis.
+                    self highlightWithoutClearFrom:e start to:e stop.
+                ] ensure:[
+                    currentEmphasis := savedEmphasis.
+                ].
+            ] ifFalse:[
+                self highlightWithoutClearFrom:e start to:e stop.
+            ].
             e := e nextElement 
         ].
     ].
@@ -657,14 +683,14 @@
 !CodeNavigationService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.25 2013-06-19 11:18:22 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.26 2013-06-24 14:20:38 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.25 2013-06-19 11:18:22 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.26 2013-06-24 14:20:38 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__CodeNavigationService.st,v 1.25 2013-06-19 11:18:22 stefan Exp $'
+    ^ '$Id: Tools__CodeNavigationService.st,v 1.26 2013-06-24 14:20:38 cg Exp $'
 ! !