class: Tools::NewSystemBrowser
authorClaus Gittinger <cg@exept.de>
Tue, 09 Jul 2013 11:10:55 +0200
changeset 13134 5bc0289aec42
parent 13133 207c334d6f58
child 13135 6da72f8dbefa
class: Tools::NewSystemBrowser fixed owner colors (UserPreferences)
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Mon Jul 08 11:51:56 2013 +0200
+++ b/Tools__NewSystemBrowser.st	Tue Jul 09 11:10:55 2013 +0200
@@ -59104,6 +59104,23 @@
     The codeview does not really know that it is not dealing with non-text,
     as I mimicry some of the string protocol to make it happy.
     (duck typing is cool!!)
+
+    to show pre-assigned per-user colors, do something like:
+        UserPreferences current 
+            at:#preferredOwnerColorMapping
+            put:(
+                Dictionary new
+                    at:'cg' put:(Color green);
+                    at:'claus' put:(Color green);
+                    at:'sv' put:(Color blue);
+                    at:'ab' put:(Color orange);
+                    at:'ca' put:(Color cyan);
+                    at:'mb' put:(Color red);
+                    at:'sr' put:(Color yellow);
+                    at:'vrany' put:(Color orange lightened);
+                    yourself
+            )
+
 "
 ! !
 
@@ -59136,7 +59153,7 @@
 !
 
 generateFormFor:aGC
-    |maxNumLines xRun hGraph wCol colorsPerOwner colorsToUse
+    |maxNumLines xRun hGraph wCol colorsPerOwner colorsToUse preferredColors
      y yLine font sepAgenda lastInfo form 
      maxWRevString maxWAuthorString maxWDateString|
 
@@ -59146,6 +59163,8 @@
     colorsPerOwner := OrderedDictionary new.
     colorsToUse := self ownerColorsToUse copy.
 
+    preferredColors := UserPreferences current at:#preferredOwnerColorMapping ifAbsent:nil.
+
     hGraph := self graphHeight.
     wCol := self columnWidth.
     font := form font.
@@ -59168,6 +59187,29 @@
         maxWRevString := maxWRevString max:(font widthOf:rev).
         maxWAuthorString := maxWAuthorString max:(font widthOf:author).
         maxWDateString := maxWDateString max:(font widthOf:(date printStringFormat:self class dateFormat)).
+
+        "/ pre determine color here
+        colorsPerOwner 
+            at:author 
+            ifAbsentPut:[
+                |clr|
+
+                (preferredColors notNil 
+                and:[ (preferredColors includesKey:author) ]) ifTrue:[
+                    clr := preferredColors at:author.
+                    colorsToUse remove:clr ifAbsent:[].
+                ] ifFalse:[
+                    colorsToUse isEmpty ifTrue:[
+                        clr := Color 
+                                redByte:(Random nextIntegerBetween:0 and:255)
+                                greenByte:(Random nextIntegerBetween:0 and:255) 
+                                blueByte:(Random nextIntegerBetween:0 and:255). 
+                    ] ifFalse:[
+                        clr := colorsToUse removeFirst
+                    ]
+                ].
+                clr
+            ].
     ].
 
     ownershipInfo do:[:revInfo |
@@ -59329,23 +59371,21 @@
     colorsToUse add:(Color brown).
     colorsToUse add:(Color orange).
 
-    colorsToUse add:(Color green lightened).
-    colorsToUse add:(Color blue lightened).
-    colorsToUse add:(Color yellow lightened).
-    colorsToUse add:(Color red lightened).
-    colorsToUse add:(Color cyan lightened).
-    colorsToUse add:(Color magenta lightened).
+    colorsToUse add:(Color green lightened lightened).
+    colorsToUse add:(Color blue lightened lightened).
+    colorsToUse add:(Color yellow lightened lightened).
+    colorsToUse add:(Color red lightened lightened).
+    colorsToUse add:(Color cyan lightened lightened).
+    colorsToUse add:(Color magenta lightened lightened).
     colorsToUse add:(Color brown lightened).
     colorsToUse add:(Color orange lightened).
 
-    colorsToUse add:(Color green darkened).
-    colorsToUse add:(Color blue darkened).
-    colorsToUse add:(Color yellow darkened).
-    colorsToUse add:(Color red darkened).
-    colorsToUse add:(Color cyan darkened).
-    colorsToUse add:(Color magenta darkened).
-    colorsToUse add:(Color brown darkened).
-    colorsToUse add:(Color orange darkened).
+    colorsToUse add:(Color grey).
+    colorsToUse add:(Color darkGrey).
+    colorsToUse add:(Color lightGrey).
+    colorsToUse add:(Color veryLightGrey).
+    colorsToUse add:(Color red darkened lightened).
+    colorsToUse add:(Color blue darkened lightened).
 
     ^ colorsToUse 
 !
@@ -59405,15 +59445,15 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1933 2013-07-07 12:13:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1934 2013-07-09 09:10:55 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1933 2013-07-07 12:13:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1934 2013-07-09 09:10:55 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__NewSystemBrowser.st,v 1.1933 2013-07-07 12:13:58 cg Exp $'
+    ^ '$Id: Tools__NewSystemBrowser.st,v 1.1934 2013-07-09 09:10:55 cg Exp $'
 ! !