[longomatch] Introduce new widget to draw the list of cameras and periods.



commit bf3383c779a7e039ef69a4429ea71f4d450f2a54
Author: Julien Moutte <julien fluendo com>
Date:   Wed Mar 11 23:31:33 2015 +0100

    Introduce new widget to draw the list of cameras and periods.

 LongoMatch.Drawing/LongoMatch.Drawing.csproj |    1 +
 LongoMatch.Drawing/Makefile.am               |    1 +
 LongoMatch.Drawing/Widgets/CamerasLabels.cs  |  104 ++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Drawing/LongoMatch.Drawing.csproj b/LongoMatch.Drawing/LongoMatch.Drawing.csproj
index 87aa27c..e1d725f 100644
--- a/LongoMatch.Drawing/LongoMatch.Drawing.csproj
+++ b/LongoMatch.Drawing/LongoMatch.Drawing.csproj
@@ -69,6 +69,7 @@
     <Compile Include="CanvasObjects\NeedleObject.cs" />
     <Compile Include="CanvasObjects\CameraObject.cs" />
     <Compile Include="Widgets\CamerasTimeline.cs" />
+    <Compile Include="Widgets\CamerasLabels.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
diff --git a/LongoMatch.Drawing/Makefile.am b/LongoMatch.Drawing/Makefile.am
index 07510cc..30ee684 100644
--- a/LongoMatch.Drawing/Makefile.am
+++ b/LongoMatch.Drawing/Makefile.am
@@ -35,6 +35,7 @@ SOURCES = Canvas.cs \
        PlayslistCellRenderer.cs \
        Utils.cs \
        Widgets/Blackboard.cs \
+       Widgets/CamerasLabels.cs \
        Widgets/CamerasTimeline.cs \
        Widgets/DashboardCanvas.cs \
        Widgets/PlaysTimeline.cs \
diff --git a/LongoMatch.Drawing/Widgets/CamerasLabels.cs b/LongoMatch.Drawing/Widgets/CamerasLabels.cs
new file mode 100644
index 0000000..9931d28
--- /dev/null
+++ b/LongoMatch.Drawing/Widgets/CamerasLabels.cs
@@ -0,0 +1,104 @@
+//
+//  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 System.Collections.Generic;
+using LongoMatch.Core.Store;
+using LongoMatch.Core.Interfaces.Drawing;
+using LongoMatch.Core.Common;
+using LongoMatch.Drawing.CanvasObjects;
+using Mono.Unix;
+
+namespace LongoMatch.Drawing.Widgets
+{
+       public class CamerasLabels: Canvas
+       {
+               MediaFileSet fileSet;
+
+               public CamerasLabels (IWidget widget): base (widget)
+               {
+               }
+
+               public double Scroll {
+                       set {
+                               foreach (var o in Objects) {
+                                       LabelObject cl = o as LabelObject;
+                                       cl.Scroll = value; 
+                               }
+                       }
+               }
+
+               public void Load (MediaFileSet fileSet)
+               {
+                       ClearObjects ();
+                       this.fileSet = fileSet;
+                       FillCanvas ();
+                       widget.ReDraw ();
+               }
+
+               void AddLabel (LabelObject label)
+               {
+                       Objects.Add (label);
+               }
+
+               void FillCanvas ()
+               {
+                       LabelObject l;
+                       int i = 0, w, h;
+                       double requiredWidth;
+
+                       w = StyleConf.TimelineLabelsWidth * 2;
+                       h = StyleConf.TimelineCameraHeight;
+                       widget.Width = w;
+
+                       // Main camera
+                       l = new CameraLabelObject (w, h, i * h) { Name = fileSet[0].Name, BackgroundColor = 
Config.Style.PaletteBackgroundLight };
+                       AddLabel (l);
+                       i++;
+
+                       // Periods
+                       l = new CameraLabelObject (w, h, i * h) { Name = Catalog.GetString ("Periods"), 
BackgroundColor = Config.Style.PaletteBackgroundLight };
+                       AddLabel (l);
+                       i++;
+
+                       // Secondary cams
+                       for (int j = 1; j < fileSet.Count; j++) {
+                               l = new CameraLabelObject (w, h, i * h) { Name = fileSet[j].Name, 
BackgroundColor = Config.Style.PaletteBackground };
+                               AddLabel (l);
+                               i++;
+                       }
+
+                       requiredWidth = Objects.Max (la => (la as LabelObject).RequiredWidth);
+                       foreach (LabelObject label in Objects) {
+                               label.Width = requiredWidth;
+                       }
+                       widget.Width = requiredWidth;
+               }
+
+               public override void Draw (IContext context, Area area)
+               {
+                       tk.Context = context;
+                       tk.Begin ();
+                       tk.Clear (Config.Style.PaletteBackground);
+                       tk.End ();
+
+                       base.Draw (context, area);
+               }
+       }
+}
+


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