[longomatch] Customise drawing of CameraLabelObject.



commit 68a42d171a70279c93c351833a1e45cc4a1b2b6c
Author: Julien Moutte <julien fluendo com>
Date:   Wed Mar 11 23:25:34 2015 +0100

    Customise drawing of CameraLabelObject.
    
    We don't need the MediaFile anymore, just use the name property. This allows us to reuse that object for 
Periods label as well.

 LongoMatch.Drawing/CanvasObjects/LabelObject.cs |   32 +++++++++++++++++-----
 1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/LabelObject.cs b/LongoMatch.Drawing/CanvasObjects/LabelObject.cs
index 302b5c0..9506784 100644
--- a/LongoMatch.Drawing/CanvasObjects/LabelObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/LabelObject.cs
@@ -161,18 +161,34 @@ namespace LongoMatch.Drawing.CanvasObjects
        }
 
        public class CameraLabelObject: LabelObject {
-               MediaFile mediaFile;
-
-               public CameraLabelObject (MediaFile mediaFile, double width, double height, double offsetY):
+               public CameraLabelObject (double width, double height, double offsetY):
                base (width, height, offsetY)
                {
-                       this.mediaFile = mediaFile;
                }
 
-               public override string Name {
-                       get {
-                               return mediaFile.Name;
-                       }
+               public override void Draw (IDrawingToolkit tk, Area area)
+               {
+                       double y = OffsetY - Math.Floor (Scroll);
+
+                       // Draw background
+                       tk.Begin ();
+                       tk.FillColor = BackgroundColor;
+                       tk.StrokeColor = BackgroundColor;
+                       tk.LineWidth = 0;
+                       tk.DrawRectangle (new Point (0, y), Width, Height);
+                       tk.LineWidth = 1;
+                       tk.StrokeColor = Config.Style.PaletteWidgets;
+                       tk.DrawLine (new Point (0, y + Height), new Point (Width, y + Height));
+
+                       /* Draw category name */
+                       tk.FontSlant = FontSlant.Normal;
+                       tk.FontWeight = FontWeight.Bold;
+                       tk.FontSize = StyleConf.TimelineCameraFontSize;
+                       tk.FillColor = Config.Style.PaletteWidgets;
+                       tk.FontAlignment = FontAlignment.Right;
+                       tk.StrokeColor = Config.Style.PaletteWidgets;
+                       tk.DrawText (new Point (0, y), Width - StyleConf.TimelineLabelHSpacing, Height, Name);
+                       tk.End ();
                }
        }
 }


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