[longomatch] Differenciate teams in the timeline using colors



commit 2710797c785131958e2faf33fd269f348418b9c5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Oct 9 22:43:31 2013 +0200

    Differenciate teams in the timeline using colors

 LongoMatch.GUI/Gui/Base/TimeScaleBase.cs |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs b/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
index 70b8bfb..c82c92d 100644
--- a/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
+++ b/LongoMatch.GUI/Gui/Base/TimeScaleBase.cs
@@ -46,7 +46,7 @@ namespace LongoMatch.Gui.Base
                uint frames;
                uint pixelRatio=10;
 
-               Cairo.Color color;
+               Cairo.Color aColor, bColor, cColor;
                List<T> list;
                PlaysFilter filter;
 
@@ -68,8 +68,12 @@ namespace LongoMatch.Gui.Base
                        this.frames = frames;
                        this.list = list;
                        this.filter = filter;
-                       this.color = new Cairo.Color(0, 0, 1);
-                       this.color.A = ALPHA;
+                       this.aColor = new Cairo.Color(0, 0, 1);
+                       this.aColor.A = ALPHA;
+                       this.bColor = new Cairo.Color(1, 0, 0);
+                       this.bColor.A = ALPHA;
+                       this.cColor = new Cairo.Color(0, 1, 0);
+                       this.cColor.A = ALPHA;
                        HeightRequest= SECTION_HEIGHT;
                        Size((int)(frames/pixelRatio),SECTION_HEIGHT);
                        Events = EventMask.PointerMotionMask | EventMask.ButtonPressMask | 
EventMask.ButtonReleaseMask ;
@@ -185,6 +189,20 @@ namespace LongoMatch.Gui.Base
                        return menusDict;
                }
                
+               Cairo.Color GetColor (ITimelineNode tn) {
+                       if (tn is Play) {
+                               Play play = tn as Play;
+                               if (play.Team == Team.LOCAL) {
+                                       return aColor;
+                               } else if (play.Team == Team.VISITOR) {
+                                       return bColor;
+                               } else if (play.Team == Team.BOTH) {
+                                       return cColor;
+                               }
+                       }
+                       return aColor;
+               }
+               
                void DrawTimeNodes(Gdk.Window win) {
                        bool hasSelectedTimeNode=false;
                        
@@ -203,7 +221,8 @@ namespace LongoMatch.Gui.Base
                                        }
                                        
                                        if(!tn.Equals(selected)) {
-                                               Cairo.Color borderColor = new Cairo.Color(color.R+0.1, 
color.G+0.1,color.B+0.1, 1);
+                                               Cairo.Color color = GetColor (tn);
+                                               Cairo.Color borderColor = new Cairo.Color(color.R+0.1, 
color.G+0.1, color.B+0.1, 1);
                                                CairoUtils.DrawRoundedRectangle(g,tn.StartFrame/pixelRatio,3,
                                                        tn.TotalFrames/pixelRatio,height-6,
                                                        SECTION_HEIGHT/7, color, borderColor);
@@ -214,6 +233,7 @@ namespace LongoMatch.Gui.Base
                                }
                                //Then we draw the selected TimeNode over the others
                                if(hasSelectedTimeNode) {
+                                       Cairo.Color color = GetColor (selected);
                                        Cairo.Color borderColor = new Cairo.Color(0, 0, 0, 1);
                                        CairoUtils.DrawRoundedRectangle(g,selected.StartFrame/pixelRatio,3,
                                                selected.TotalFrames/pixelRatio,height-6,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]