[longomatch] Split Utils and Constants



commit 3310874f92c36c204cba78c5e8dae36197be1034
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Jun 30 20:20:55 2014 +0200

    Split Utils and Constants

 .../LongoMatch.Drawing.Cairo.mdp                   |    2 +-
 LongoMatch.Drawing/CanvasObject/CanvasObject.cs    |    8 +-
 LongoMatch.Drawing/CanvasObject/CategoryLabel.cs   |    4 +-
 LongoMatch.Drawing/CanvasObject/PlayObject.cs      |    6 +-
 LongoMatch.Drawing/CanvasObject/PlayerObject.cs    |    4 +-
 LongoMatch.Drawing/CanvasObject/PositionObject.cs  |    6 +-
 LongoMatch.Drawing/CanvasObject/TimeNodeObject.cs  |   28 ++++----
 LongoMatch.Drawing/CanvasObject/TimelineObject.cs  |   14 ++--
 LongoMatch.Drawing/{Common.cs => Constants.cs}     |   10 +---
 LongoMatch.Drawing/LongoMatch.Drawing.mdp          |    3 +-
 LongoMatch.Drawing/Utils.cs                        |   66 ++++++++++++++++++++
 LongoMatch.Drawing/Widgets/CategoriesLabels.cs     |   10 ++--
 LongoMatch.Drawing/Widgets/PlaysTimeline.cs        |   12 ++--
 LongoMatch.Drawing/Widgets/PositionTagger.cs       |    2 +-
 LongoMatch.Drawing/Widgets/TeamTagger.cs           |    4 +-
 LongoMatch.Drawing/Widgets/TimersTimeline.cs       |    6 +-
 LongoMatch.Drawing/Widgets/Timerule.cs             |   12 ++--
 LongoMatch.GUI/Gui/Component/ProjectPeriods.cs     |    4 +-
 LongoMatch.GUI/Gui/Component/Timeline.cs           |    6 +-
 19 files changed, 134 insertions(+), 73 deletions(-)
---
diff --git a/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp 
b/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
index 311eb29..e756939 100644
--- a/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
+++ b/LongoMatch.Drawing.Cairo/LongoMatch.Drawing.Cairo.mdp
@@ -26,7 +26,7 @@
     <File subtype="Code" buildaction="Compile" name="Surface.cs" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/draw-eraser.png" 
resource_id="eraser" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/draw-cross.png" 
resource_id="cross" />
-    <File subtype="Code" buildaction="Compile" name="Context.cs" />
+    <File subtype="Code" buildaction="Compile" name="CairoContext.cs" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Drawing/CanvasObject/CanvasObject.cs b/LongoMatch.Drawing/CanvasObject/CanvasObject.cs
index ecd90c1..ed67d7c 100644
--- a/LongoMatch.Drawing/CanvasObject/CanvasObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/CanvasObject.cs
@@ -90,14 +90,14 @@ namespace LongoMatch.Drawing.CanvasObject
 
                protected void DrawCornerSelection (IDrawingToolkit tk, Point p)
                {
-                       tk.StrokeColor = tk.FillColor = Common.SELECTION_INDICATOR_COLOR;
+                       tk.StrokeColor = tk.FillColor = Constants.SELECTION_INDICATOR_COLOR;
                        tk.LineStyle = LineStyle.Normal;
                        tk.DrawRectangle (new Point (p.X - 3, p.Y - 3), 6, 6);
                }
 
                protected void DrawCenterSelection (IDrawingToolkit tk, Point p)
                {
-                       tk.StrokeColor = tk.FillColor = Common.SELECTION_INDICATOR_COLOR;
+                       tk.StrokeColor = tk.FillColor = Constants.SELECTION_INDICATOR_COLOR;
                        tk.LineStyle = LineStyle.Normal;
                        tk.DrawCircle (p, 3);
                }
@@ -109,8 +109,8 @@ namespace LongoMatch.Drawing.CanvasObject
                        if (!Selected || area == null) {
                                return;
                        }
-                       tk.StrokeColor = Common.SELECTION_INDICATOR_COLOR;
-                       tk.StrokeColor = Common.SELECTION_AREA_COLOR;
+                       tk.StrokeColor = Constants.SELECTION_INDICATOR_COLOR;
+                       tk.StrokeColor = Constants.SELECTION_AREA_COLOR;
                        tk.FillColor = null;
                        tk.LineStyle = LineStyle.Dashed;
                        tk.LineWidth = 1;
diff --git a/LongoMatch.Drawing/CanvasObject/CategoryLabel.cs 
b/LongoMatch.Drawing/CanvasObject/CategoryLabel.cs
index 87d63c4..970858a 100644
--- a/LongoMatch.Drawing/CanvasObject/CategoryLabel.cs
+++ b/LongoMatch.Drawing/CanvasObject/CategoryLabel.cs
@@ -57,8 +57,8 @@ namespace LongoMatch.Drawing.CanvasObject
                        tk.FontSlant = FontSlant.Normal;
                        tk.FontSize = 12;
                        tk.DrawRoundedRectangle (new Point(0, y + 1), width, height - 1, 3);  
-                       tk.FillColor = Common.TEXT_COLOR;
-                       tk.StrokeColor = Common.TEXT_COLOR;
+                       tk.FillColor = Constants.TEXT_COLOR;
+                       tk.StrokeColor = Constants.TEXT_COLOR;
                        tk.DrawText (new Point (0, y), width, height,
                                     category.Name);
                        tk.End();
diff --git a/LongoMatch.Drawing/CanvasObject/PlayObject.cs b/LongoMatch.Drawing/CanvasObject/PlayObject.cs
index 64ce320..322416d 100644
--- a/LongoMatch.Drawing/CanvasObject/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/PlayObject.cs
@@ -47,14 +47,14 @@ namespace LongoMatch.Drawing.CanvasObject
                        tk.Begin ();
                        tk.FillColor = new Color (c.R, c.G, c.B, (byte) (0.8 * byte.MaxValue));
                        if (Selected) {
-                               tk.StrokeColor = Common.PLAY_OBJECT_SELECTED_COLOR;
+                               tk.StrokeColor = Constants.PLAY_OBJECT_SELECTED_COLOR;
                        } else {
                                tk.StrokeColor = Play.Category.Color;
                        }
                        tk.LineWidth = 2;
                        tk.DrawRoundedRectangle (new Point (StartX, OffsetY),
-                                         Common.TimeToPos (Play.Duration, SecondsPerPixel),
-                                         Common.CATEGORY_HEIGHT, 2);
+                                         Utils.TimeToPos (Play.Duration, SecondsPerPixel),
+                                         Constants.CATEGORY_HEIGHT, 2);
                        tk.End ();
                }
        }
diff --git a/LongoMatch.Drawing/CanvasObject/PlayerObject.cs b/LongoMatch.Drawing/CanvasObject/PlayerObject.cs
index 804ecb7..dcf9ccc 100644
--- a/LongoMatch.Drawing/CanvasObject/PlayerObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/PlayerObject.cs
@@ -32,8 +32,8 @@ namespace LongoMatch.Drawing.CanvasObject
                        Player = player;
                        Position = position;
                        DrawPhoto = true;
-                       SelectedColor = Common.PLAYER_SELECTED_COLOR;
-                       UnSelectedColor = Common.PLAYER_UNSELECTED_COLOR;
+                       SelectedColor = Constants.PLAYER_SELECTED_COLOR;
+                       UnSelectedColor = Constants.PLAYER_UNSELECTED_COLOR;
                        IconSize = PlayersIconSize.Medium;
                }
                
diff --git a/LongoMatch.Drawing/CanvasObject/PositionObject.cs 
b/LongoMatch.Drawing/CanvasObject/PositionObject.cs
index e0b4cb7..05e9e66 100644
--- a/LongoMatch.Drawing/CanvasObject/PositionObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/PositionObject.cs
@@ -118,13 +118,13 @@ namespace LongoMatch.Drawing.CanvasObject
                        if (Play != null) {
                                color = Play.Category.Color;
                        } else {
-                               color = Common.TAGGER_POINT_COLOR;
+                               color = Constants.TAGGER_POINT_COLOR;
                        }
                        scolor = color;
                        
                        if (Selected) {
-                               scolor = Common.TAGGER_SELECTION_COLOR;
-                               color = Common.TAGGER_SELECTION_COLOR;
+                               scolor = Constants.TAGGER_SELECTION_COLOR;
+                               color = Constants.TAGGER_SELECTION_COLOR;
                        }
                        tk.FillColor = color;
                        tk.StrokeColor = scolor;
diff --git a/LongoMatch.Drawing/CanvasObject/TimeNodeObject.cs 
b/LongoMatch.Drawing/CanvasObject/TimeNodeObject.cs
index 42d3c33..850a0f7 100644
--- a/LongoMatch.Drawing/CanvasObject/TimeNodeObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/TimeNodeObject.cs
@@ -61,26 +61,26 @@ namespace LongoMatch.Drawing.CanvasObject
                
                protected double StartX {
                        get {
-                               return Common.TimeToPos (TimeNode.Start, SecondsPerPixel);
+                               return Utils.TimeToPos (TimeNode.Start, SecondsPerPixel);
                        }
                }
                
                protected double StopX {
                        get {
-                               return Common.TimeToPos (TimeNode.Stop, SecondsPerPixel);
+                               return Utils.TimeToPos (TimeNode.Stop, SecondsPerPixel);
                        }
                }
                
                protected double CenterX {
                        get {
-                               return Common.TimeToPos (TimeNode.Start + TimeNode.Duration / 2,
-                                                        SecondsPerPixel);
+                               return Utils.TimeToPos (TimeNode.Start + TimeNode.Duration / 2,
+                                                       SecondsPerPixel);
                        }
                }
                
                public Selection GetSelection (Point point, double precision) {
                        double accuracy;
-                       if (point.Y >= OffsetY && point.Y < OffsetY + Common.CATEGORY_HEIGHT) {
+                       if (point.Y >= OffsetY && point.Y < OffsetY + Constants.CATEGORY_HEIGHT) {
                                if (Drawable.MatchAxis (point.X, StartX, precision, out accuracy)) {
                                        return new Selection (this, SelectionPosition.Left, accuracy);
                                } else if (Drawable.MatchAxis (point.X, StopX, precision, out accuracy)) {
@@ -94,14 +94,14 @@ namespace LongoMatch.Drawing.CanvasObject
                }
                
                public void Move (Selection sel, Point p, Point start) {
-                       Time newTime = Common.PosToTime (p, SecondsPerPixel);
+                       Time newTime = Utils.PosToTime (p, SecondsPerPixel);
 
                        if (p.X < 0) {
                                p.X = 0;
                        } else if (newTime > MaxTime) {
-                               p.X = Common.TimeToPos (MaxTime, SecondsPerPixel);
+                               p.X = Utils.TimeToPos (MaxTime, SecondsPerPixel);
                        }
-                       newTime = Common.PosToTime (p, SecondsPerPixel);
+                       newTime = Utils.PosToTime (p, SecondsPerPixel);
 
                        switch (sel.Position) {
                        case SelectionPosition.Left: {
@@ -129,17 +129,17 @@ namespace LongoMatch.Drawing.CanvasObject
 
                        tk.Begin ();
                        if (Selected) {
-                               c = Common.TIMER_SELECTED_COLOR;
+                               c = Constants.TIMER_SELECTED_COLOR;
                        } else {
-                               c = Common.TIMER_UNSELECTED_COLOR;
+                               c = Constants.TIMER_UNSELECTED_COLOR;
                        }
                        tk.FillColor = c;
                        tk.StrokeColor = c;
                        tk.LineWidth = 4;
                        
-                       mid = OffsetY + Common.CATEGORY_HEIGHT / 2;
-                       bottom = OffsetY + Common.CATEGORY_HEIGHT;
-                       stop = Common.TimeToPos (TimeNode.Stop, SecondsPerPixel);
+                       mid = OffsetY + Constants.CATEGORY_HEIGHT / 2;
+                       bottom = OffsetY + Constants.CATEGORY_HEIGHT;
+                       stop = Utils.TimeToPos (TimeNode.Stop, SecondsPerPixel);
                        
                        tk.DrawLine (new Point (StartX, OffsetY),
                                     new Point (StartX, bottom));
@@ -149,7 +149,7 @@ namespace LongoMatch.Drawing.CanvasObject
                                     new Point (stop, bottom));
                        tk.FontSize = 20;
                        tk.DrawText (new Point (StartX, OffsetY), stop - StartX,
-                                    Common.CATEGORY_HEIGHT - 4, TimeNode.Name);
+                                    Constants.CATEGORY_HEIGHT - 4, TimeNode.Name);
                                     
                        tk.End ();
                }
diff --git a/LongoMatch.Drawing/CanvasObject/TimelineObject.cs 
b/LongoMatch.Drawing/CanvasObject/TimelineObject.cs
index 7d06f2e..4c79a95 100644
--- a/LongoMatch.Drawing/CanvasObject/TimelineObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/TimelineObject.cs
@@ -89,7 +89,7 @@ namespace LongoMatch.Drawing.CanvasObject
                        tk.StrokeColor = background;
                        tk.LineWidth = 1;
                        tk.DrawRectangle (new Point (0, OffsetY), Width,
-                                         Common.CATEGORY_HEIGHT);
+                                         Constants.CATEGORY_HEIGHT);
                        foreach (TimeNodeObject p in nodes) {
                                if (p.Selected) {
                                        selected.Add (p);
@@ -101,12 +101,12 @@ namespace LongoMatch.Drawing.CanvasObject
                                p.Draw (tk, area);
                        }
                        
-                       tk.FillColor = Common.TIMELINE_LINE_COLOR;
-                       tk.StrokeColor = Common.TIMELINE_LINE_COLOR;
-                       tk.LineWidth = Common.TIMELINE_LINE_WIDTH;
-                       position = Common.TimeToPos (CurrentTime, secondsPerPixel);
+                       tk.FillColor = Constants.TIMELINE_LINE_COLOR;
+                       tk.StrokeColor = Constants.TIMELINE_LINE_COLOR;
+                       tk.LineWidth = Constants.TIMELINE_LINE_WIDTH;
+                       position = Utils.TimeToPos (CurrentTime, secondsPerPixel);
                        tk.DrawLine (new Point (position, OffsetY),
-                                    new Point (position, OffsetY + Common.CATEGORY_HEIGHT));
+                                    new Point (position, OffsetY + Constants.CATEGORY_HEIGHT));
                        
                        tk.End();
                }
@@ -114,7 +114,7 @@ namespace LongoMatch.Drawing.CanvasObject
                public Selection GetSelection (Point point, double precision) {
                        Selection selection = null;
 
-                       if (point.Y >= OffsetY && point.Y < OffsetY + Common.CATEGORY_HEIGHT) {
+                       if (point.Y >= OffsetY && point.Y < OffsetY + Constants.CATEGORY_HEIGHT) {
                                foreach (TimeNodeObject po in nodes) {
                                        Selection tmp;
                                        tmp = po.GetSelection (point, precision);
diff --git a/LongoMatch.Drawing/Common.cs b/LongoMatch.Drawing/Constants.cs
similarity index 88%
rename from LongoMatch.Drawing/Common.cs
rename to LongoMatch.Drawing/Constants.cs
index 369e832..61d8d83 100644
--- a/LongoMatch.Drawing/Common.cs
+++ b/LongoMatch.Drawing/Constants.cs
@@ -18,10 +18,11 @@
 using System;
 using LongoMatch.Store;
 using LongoMatch.Common;
+using LongoMatch.Interfaces.Drawing;
 
 namespace LongoMatch.Drawing
 {
-       public class Common
+       public class Constants
        {
                public const int CATEGORY_HEIGHT = 20;
                public const int CATEGORY_WIDTH = 150;
@@ -51,13 +52,6 @@ namespace LongoMatch.Drawing
 
                public const int TIMELINE_LINE_WIDTH = 1;
                
-               public static double TimeToPos (Time time, double secondsPerPixel) {
-                       return (double)time.MSeconds / 1000 / secondsPerPixel;
-               }
-               
-               public static Time PosToTime (Point p, double secondsPerPixel) {
-                       return new Time ((int) (p.X * 1000 * secondsPerPixel));
-               }
        }
 }
 
diff --git a/LongoMatch.Drawing/LongoMatch.Drawing.mdp b/LongoMatch.Drawing/LongoMatch.Drawing.mdp
index 493b9b3..27d410f 100644
--- a/LongoMatch.Drawing/LongoMatch.Drawing.mdp
+++ b/LongoMatch.Drawing/LongoMatch.Drawing.mdp
@@ -23,7 +23,7 @@
     <File subtype="Code" buildaction="Compile" name="Widgets/Timerule.cs" />
     <File subtype="Code" buildaction="Compile" name="Widgets/CategoriesLabels.cs" />
     <File subtype="Code" buildaction="Compile" name="CanvasObject/PlayObject.cs" />
-    <File subtype="Code" buildaction="Compile" name="Common.cs" />
+    <File subtype="Code" buildaction="Compile" name="Constants.cs" />
     <File subtype="Code" buildaction="Compile" name="Widgets/PlaysTimeline.cs" />
     <File subtype="Code" buildaction="Compile" name="CanvasObject/TimelineObject.cs" />
     <File subtype="Code" buildaction="Compile" name="CanvasObject/CanvasObject.cs" />
@@ -42,6 +42,7 @@
     <File subtype="Code" buildaction="Compile" name="CanvasObject/EllipseObject.cs" />
     <File subtype="Code" buildaction="Compile" name="CanvasObject/TextObject.cs" />
     <File subtype="Code" buildaction="Compile" name="CanvasObject/CounterObject.cs" />
+    <File subtype="Code" buildaction="Compile" name="Utils.cs" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Drawing/Utils.cs b/LongoMatch.Drawing/Utils.cs
new file mode 100644
index 0000000..5a5b059
--- /dev/null
+++ b/LongoMatch.Drawing/Utils.cs
@@ -0,0 +1,66 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Linq;
+using LongoMatch.Store;
+using LongoMatch.Common;
+using LongoMatch.Interfaces.Drawing;
+using System.Runtime.Remoting;
+using LongoMatch.Store.Drawables;
+
+namespace LongoMatch.Drawing
+{
+       public class Utils
+       {
+               public static double TimeToPos (Time time, double secondsPerPixel) {
+                       return (double)time.MSeconds / 1000 / secondsPerPixel;
+               }
+               
+               public static Time PosToTime (Point p, double secondsPerPixel) {
+                       return new Time ((int) (p.X * 1000 * secondsPerPixel));
+               }
+               
+               public static ICanvasSelectableObject CanvasFromDrawableObject (IBlackboardObject drawable) {
+                       string objecttype = String.Format ("LongoMatch.Drawing.CanvasObject.{0}Object",
+                                                          drawable.GetType().ToString().Split('.').Last());
+                       ObjectHandle handle = Activator.CreateInstance(null, objecttype);
+                       ICanvasDrawableObject d = (ICanvasDrawableObject) handle.Unwrap();
+                       d.IDrawableObject = drawable;
+                       return d;
+               }
+
+               public static Image RenderFrameDrawingToImage (IDrawingToolkit tk, Image image, FrameDrawing 
fd) {
+                       Image img;
+                       ISurface surface;
+                       
+                       surface = tk.CreateSurface (image.Width, image.Height, image);
+                       using (IContext c = surface.Context) {
+                               tk.Context = c;
+                               foreach (Drawable d in fd.Drawables) {
+                                       ICanvasSelectableObject obj = CanvasFromDrawableObject (d);
+                                       obj.Draw (tk, null);
+                               }
+                               tk.DrawImage (fd.Freehand);
+                       }
+                       img = surface.Copy ();
+                       surface.Dispose ();
+                       return img;
+               }
+       }
+}
+
diff --git a/LongoMatch.Drawing/Widgets/CategoriesLabels.cs b/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
index 535d961..a196f0e 100644
--- a/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
+++ b/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
@@ -58,16 +58,16 @@ namespace LongoMatch.Drawing.Widgets
                void FillCanvas () {
                        int i = 0;
                        
-                       widget.Width = Common.CATEGORY_WIDTH;
+                       widget.Width = Constants.CATEGORY_WIDTH;
                        
                        /* Start from bottom to top  with categories */
                        foreach (Category cat in project.Categories.List) {
                                CategoryLabel l;
                                
                                /* Add the category label */
-                               l = new CategoryLabel (cat, Common.CATEGORY_WIDTH,
-                                                      Common.CATEGORY_HEIGHT,
-                                                      i * Common.CATEGORY_HEIGHT);
+                               l = new CategoryLabel (cat, Constants.CATEGORY_WIDTH,
+                                                      Constants.CATEGORY_HEIGHT,
+                                                      i * Constants.CATEGORY_HEIGHT);
                                categories[cat] = l;
                                Objects.Add (l);
                                i++;
@@ -81,7 +81,7 @@ namespace LongoMatch.Drawing.Widgets
                                CategoryLabel label = categories[cat];
 
                                if (filter.VisibleCategories.Contains (cat)) {
-                                       label.OffsetY = i * Common.CATEGORY_HEIGHT;
+                                       label.OffsetY = i * Constants.CATEGORY_HEIGHT;
                                        label.Visible = true;
                                        i++;
                                } else {
diff --git a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
index 23fbfc6..56caf17 100644
--- a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
@@ -43,7 +43,7 @@ namespace LongoMatch.Drawing.Widgets
                {
                        categories = new Dictionary<Category, CategoryTimeline> ();
                        secondsPerPixel = 0.1;
-                       Accuracy = Common.TIMELINE_ACCURACY;
+                       Accuracy = Constants.TIMELINE_ACCURACY;
                        SelectionMode = MultiSelectionMode.MultipleWithModifier;
                        widget.ShowTooltipEvent += HandleShowTooltipEvent;
                }
@@ -53,7 +53,7 @@ namespace LongoMatch.Drawing.Widgets
                        Objects.Clear();
                        categories.Clear();
                        duration = project.Description.File.Duration;
-                       widget.Height = project.Categories.List.Count * Common.CATEGORY_HEIGHT;
+                       widget.Height = project.Categories.List.Count * Constants.CATEGORY_HEIGHT;
                        playsFilter = filter;
                        FillCanvas ();
                        filter.FilterUpdated += UpdateVisibleCategories;
@@ -111,7 +111,7 @@ namespace LongoMatch.Drawing.Widgets
                                
                                cat = project.Categories.List[i];
                                tl = new CategoryTimeline (project.PlaysInCategory (cat),
-                                                          duration, i * Common.CATEGORY_HEIGHT, c);
+                                                          duration, i * Constants.CATEGORY_HEIGHT, c);
                                categories[cat] = tl;
                                Objects.Add (tl);
                        }
@@ -124,7 +124,7 @@ namespace LongoMatch.Drawing.Widgets
                        foreach (Category cat in categories.Keys) {
                                TimelineObject timeline = categories[cat];
                                if (playsFilter.VisibleCategories.Contains (cat)) {
-                                       timeline.OffsetY = i * Common.CATEGORY_HEIGHT;
+                                       timeline.OffsetY = i * Constants.CATEGORY_HEIGHT;
                                        timeline.Visible = true;
                                        i++;
                                } else {
@@ -173,7 +173,7 @@ namespace LongoMatch.Drawing.Widgets
                                TimelineObject tl = categories[c];
                                if (!tl.Visible)
                                        continue;
-                               if (coords.Y >= tl.OffsetY && coords.Y < tl.OffsetY + Common.CATEGORY_HEIGHT) 
{
+                               if (coords.Y >= tl.OffsetY && coords.Y < tl.OffsetY + 
Constants.CATEGORY_HEIGHT) {
                                        cat = c;
                                        break;
                                }
@@ -181,7 +181,7 @@ namespace LongoMatch.Drawing.Widgets
                        
                        if (cat != null && ShowMenuEvent != null) {
                                ShowMenuEvent (plays, cat,
-                                         Common.PosToTime (coords, SecondsPerPixel));
+                                         Utils.PosToTime (coords, SecondsPerPixel));
                        }
                }
                
diff --git a/LongoMatch.Drawing/Widgets/PositionTagger.cs b/LongoMatch.Drawing/Widgets/PositionTagger.cs
index 60cd37f..4ce5202 100644
--- a/LongoMatch.Drawing/Widgets/PositionTagger.cs
+++ b/LongoMatch.Drawing/Widgets/PositionTagger.cs
@@ -35,7 +35,7 @@ namespace LongoMatch.Drawing.Widgets
 
                public PositionTagger (IWidget widget): base (widget)
                {
-                       Accuracy = Common.TAGGER_POINT_SIZE + 3;
+                       Accuracy = Constants.TAGGER_POINT_SIZE + 3;
                        EmitSignals = true;
                        SelectionMode = MultiSelectionMode.MultipleWithModifier;
                }
diff --git a/LongoMatch.Drawing/Widgets/TeamTagger.cs b/LongoMatch.Drawing/Widgets/TeamTagger.cs
index 28299f4..4519f47 100644
--- a/LongoMatch.Drawing/Widgets/TeamTagger.cs
+++ b/LongoMatch.Drawing/Widgets/TeamTagger.cs
@@ -48,8 +48,8 @@ namespace LongoMatch.Drawing.Widgets
                        Accuracy = 0;
                        SelectionMode = MultiSelectionMode.MultipleWithModifier;
                        SubstitutionsMode = false;
-                       HomeColor = Common.PLAYER_UNSELECTED_COLOR;
-                       AwayColor = Common.PLAYER_UNSELECTED_COLOR;
+                       HomeColor = Constants.PLAYER_UNSELECTED_COLOR;
+                       AwayColor = Constants.PLAYER_UNSELECTED_COLOR;
                        PlayersPorRowInBench = 2;
                        BenchIconSize = PlayersIconSize.Small;
                }
diff --git a/LongoMatch.Drawing/Widgets/TimersTimeline.cs b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
index 2f9224a..93b7a8d 100644
--- a/LongoMatch.Drawing/Widgets/TimersTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
@@ -23,7 +23,7 @@ namespace LongoMatch.Drawing.Widgets
                public TimersTimeline (IWidget widget): base(widget)
                {
                        secondsPerPixel = 0.1;
-                       Accuracy = Common.TIMELINE_ACCURACY;
+                       Accuracy = Constants.TIMELINE_ACCURACY;
                        SelectionMode = MultiSelectionMode.MultipleWithModifier;
                }
 
@@ -71,14 +71,14 @@ namespace LongoMatch.Drawing.Widgets
                
                void FillCanvas (List<Timer> timers, bool splitTimers) {
                        if (!splitTimers) {
-                               widget.Height = Common.TIMER_HEIGHT;
+                               widget.Height = Constants.TIMER_HEIGHT;
                                TimerTimeline tl = new TimerTimeline (timers, duration, 0, Color.White);
                                foreach (Timer t in timers) {
                                        this.timers[t] = tl;
                                }
                                Objects.Add (tl);
                        } else {
-                               widget.Height = timers.Count * Common.TIMER_HEIGHT;
+                               widget.Height = timers.Count * Constants.TIMER_HEIGHT;
                        }
                        Update ();
                }
diff --git a/LongoMatch.Drawing/Widgets/Timerule.cs b/LongoMatch.Drawing/Widgets/Timerule.cs
index c99fe95..7a553ce 100644
--- a/LongoMatch.Drawing/Widgets/Timerule.cs
+++ b/LongoMatch.Drawing/Widgets/Timerule.cs
@@ -68,12 +68,12 @@ namespace LongoMatch.Drawing.Widgets
 
                        tk.Context = context;
                        tk.Begin ();
-                       tk.FillColor = Common.TIMERULE_BACKGROUND;
-                       tk.StrokeColor = Common.TIMERULE_BACKGROUND;
+                       tk.FillColor = Constants.TIMERULE_BACKGROUND;
+                       tk.StrokeColor = Constants.TIMERULE_BACKGROUND;
                        tk.DrawRectangle (new Point(0, 0), width, height);
                        
-                       tk.StrokeColor = Common.TIMELINE_LINE_COLOR;
-                       tk.LineWidth = Common.TIMELINE_LINE_WIDTH;
+                       tk.StrokeColor = Constants.TIMELINE_LINE_COLOR;
+                       tk.LineWidth = Constants.TIMELINE_LINE_WIDTH;
                        tk.FontSlant = FontSlant.Normal;
                        tk.FontSize = 12;
                        tk.DrawLine (new Point (0, height), new Point (width, height));
@@ -100,9 +100,9 @@ namespace LongoMatch.Drawing.Widgets
                        }
                        
                        /* Draw position triangle */
-                       tpos = Common.TimeToPos (CurrentTime, SecondsPerPixel);
+                       tpos = Utils.TimeToPos (CurrentTime, SecondsPerPixel);
                        tpos -= Scroll;
-                       tk.FillColor = Common.TIMELINE_LINE_COLOR;
+                       tk.FillColor = Constants.TIMELINE_LINE_COLOR;
                        tk.DrawTriangle (new Point (tpos, widget.Height), 8,
                                         BIG_LINE_HEIGHT, SelectionPosition.Bottom);
 
diff --git a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
index 573f078..69235e7 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
@@ -40,8 +40,8 @@ namespace LongoMatch.Gui.Component
                        playerbin2.ShowControls = false;
                        timerule = new Timerule (new WidgetWrapper (drawingarea1));
                        timersTimenline = new TimersTimeline (new WidgetWrapper (drawingarea2));
-                       drawingarea1.HeightRequest = LongoMatch.Drawing.Common.TIMERULE_HEIGHT;
-                       drawingarea2.HeightRequest = LongoMatch.Drawing.Common.TIMER_HEIGHT;
+                       drawingarea1.HeightRequest = LongoMatch.Drawing.Constants.TIMERULE_HEIGHT;
+                       drawingarea2.HeightRequest = LongoMatch.Drawing.Constants.TIMER_HEIGHT;
                        timersTimenline.TimeNodeChanged += HandleTimeNodeChanged;
                        scrolledwindow2.Hadjustment.ValueChanged += HandleValueChanged;
                        synclabel.Markup = String.Format ("{0} {1} {2}", "<b>⬇  ",
diff --git a/LongoMatch.GUI/Gui/Component/Timeline.cs b/LongoMatch.GUI/Gui/Component/Timeline.cs
index b4dd9e8..41f1384 100644
--- a/LongoMatch.GUI/Gui/Component/Timeline.cs
+++ b/LongoMatch.GUI/Gui/Component/Timeline.cs
@@ -56,9 +56,9 @@ namespace LongoMatch.Gui.Component
                        focusscale.Adjustment.Lower = 0;
                        focusscale.Adjustment.Upper = 12;
                        focusscale.ValueChanged += HandleValueChanged;
-                       timerulearea.HeightRequest = LongoMatch.Drawing.Common.TIMERULE_HEIGHT;
-                       labelsarea.WidthRequest = LongoMatch.Drawing.Common.CATEGORY_WIDTH;
-                       hbox1.HeightRequest = LongoMatch.Drawing.Common.TIMERULE_HEIGHT;
+                       timerulearea.HeightRequest = LongoMatch.Drawing.Constants.TIMERULE_HEIGHT;
+                       labelsarea.WidthRequest = LongoMatch.Drawing.Constants.CATEGORY_WIDTH;
+                       hbox1.HeightRequest = LongoMatch.Drawing.Constants.TIMERULE_HEIGHT;
                        scrolledwindow1.Vadjustment.ValueChanged += HandleScrollEvent;
                        scrolledwindow1.Hadjustment.ValueChanged += HandleScrollEvent;
                        timeoutID = 0;


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