[longomatch/stop: 2/2] Initial support for store drawings in plays and recall them when the player reaches the same instant



commit 4823ecd7b602554f80302c183ed61db35bee64fb
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Oct 4 03:37:30 2009 +0200

    Initial support for store drawings in plays and recall them when the player reaches the same instant

 CesarPlayer/Gui/PlayerBin.cs                       |   34 ++++-
 CesarPlayer/Handlers/Handlers.cs                   |    2 +-
 CesarPlayer/Player/GstPlayer.cs                    |   20 +++-
 CesarPlayer/Player/IPlayer.cs                      |   12 ++
 CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs    |   36 +++---
 CesarPlayer/gtk-gui/objects.xml                    |    3 +-
 LongoMatch/DB/DataBase.cs                          |    1 +
 LongoMatch/Gui/Component/DrawingWidget.cs          |    3 +
 LongoMatch/Gui/Dialog/DrawingTool.cs               |   21 +++-
 LongoMatch/Gui/MainWindow.cs                       |    7 +
 LongoMatch/Handlers/EventsManager.cs               |   10 +-
 LongoMatch/Handlers/VideoDrawingsManager.cs        |  156 ++++++++++++++++++++
 LongoMatch/LongoMatch.mdp                          |    2 +
 LongoMatch/Main.cs                                 |   10 +-
 LongoMatch/Time/Drawing.cs                         |   51 +++++++
 LongoMatch/Time/MediaTimeNode.cs                   |   31 ++++
 LongoMatch/Time/TimeNode.cs                        |    5 +-
 .../gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs   |   93 +++++++++---
 LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs    |   11 +-
 LongoMatch/gtk-gui/gui.stetic                      |   41 ++++--
 libcesarplayer/src/bacon-video-widget-gst-0.10.c   |   39 +++++-
 libcesarplayer/src/bacon-video-widget.h            |    7 +
 22 files changed, 513 insertions(+), 82 deletions(-)
---
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index bd3c1e4..3bb942a 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -38,10 +38,12 @@ namespace LongoMatch.Gui
 		public event SegmentClosedHandler SegmentClosedEvent;
 		public event TickHandler Tick;
 		public event ErrorHandler Error;
+		public event StateChangeHandler StateChanged;
 		public event NextButtonClickedHandler Next;
 		public event PrevButtonClickedHandler Prev;
 		public event DrawFrameHandler DrawFrame;
-		
+		public event EventHandler SeekEvent;
+			
 		private const int THUMBNAIL_WIDTH = 50;
 		private TickHandler tickHandler;
 		private IPlayer player;
@@ -121,10 +123,21 @@ namespace LongoMatch.Gui
 			}
 		}
 		
-		public bool LogoMode {
-			get{return player.LogoMode;}
+		public Pixbuf LogoPixbuf{
+			set{player.LogoPixbuf = value;}
+		}
+		
+		public bool DrawingMode {
+			set{player.DrawingMode= value;}
+		}
+		
+		public Pixbuf DrawingPixbuf {
+			set{player.DrawingPixbuf=value;}
+		}
+		
+		public bool LogoMode{
 			set{player.LogoMode = value;}
-		}		
+		}
 		
 		public bool ExpandLogo {
 			get{return player.ExpandLogo;}
@@ -204,20 +217,27 @@ namespace LongoMatch.Gui
 		
 		public void SeekTo(long time, bool accurate){
 			player.SeekTime(time,1,accurate);
+			if (SeekEvent != null)
+				SeekEvent(this,null);
 		}
 		
 		public void SeekInSegment(long pos){
 			player.SeekInSegment(pos, GetRateFromScale());
+			SeekEvent(this,null);
 		}
 		
 		public void SeekToNextFrame(bool in_segment){
-			if (segmentStopTime==0 | player.CurrentTime < segmentStopTime)
+			if (segmentStopTime==0 | player.CurrentTime < segmentStopTime){
 				player.SeekToNextFrame( GetRateFromScale(), in_segment);
+				SeekEvent(this,null);
+			}
+			
 		}
 		
 		public void SeekToPreviousFrame(bool in_segment){
 			if (player.CurrentTime > segmentStartTime){
 				player.SeekToPreviousFrame( GetRateFromScale(),in_segment);
+				SeekEvent(this,null);
 			}
 		}
 		
@@ -316,6 +336,8 @@ namespace LongoMatch.Gui
 				playbutton.Show();
 				pausebutton.Hide();
 			}
+			if (StateChanged != null)
+				StateChanged(this,args);
 		}
 		
 		protected void OnReadyToSeek(object o, EventArgs args){
@@ -502,7 +524,7 @@ namespace LongoMatch.Gui
 		protected virtual void OnDrawButtonClicked (object sender, System.EventArgs e)
 		{
 			if (DrawFrame != null)
-				DrawFrame(CurrentFrame);
+				DrawFrame(CurrentFrame,(int)AccurateCurrentTime);
 		}
 		
 
diff --git a/CesarPlayer/Handlers/Handlers.cs b/CesarPlayer/Handlers/Handlers.cs
index 972c0e9..48fe2d5 100644
--- a/CesarPlayer/Handlers/Handlers.cs
+++ b/CesarPlayer/Handlers/Handlers.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Video.Handlers
 	public delegate void PrevButtonClickedHandler ();
 	public delegate void ProgressHandler (float progress);
 	public delegate void FramesProgressHandler (int actual, int total,Pixbuf frame);
-	public delegate void DrawFrameHandler (Pixbuf frame);
+	public delegate void DrawFrameHandler (Pixbuf frame,int time);
 
 	
 	
diff --git a/CesarPlayer/Player/GstPlayer.cs b/CesarPlayer/Player/GstPlayer.cs
index 6d0d029..1bb08e3 100644
--- a/CesarPlayer/Player/GstPlayer.cs
+++ b/CesarPlayer/Player/GstPlayer.cs
@@ -70,7 +70,7 @@ namespace LongoMatch.Video.Player {
 			set  {
 				bacon_video_widget_set_logo_mode(Handle, value);
 			}
-		}
+		}			
 		
 		[GLib.Property ("expand_logo")]
 		public bool ExpandLogo {
@@ -1074,6 +1074,24 @@ namespace LongoMatch.Video.Player {
 				bacon_video_widget_set_logo_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
 			}
 		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void bacon_video_widget_set_drawing_pixbuf(IntPtr raw, IntPtr drawing_mode);
+
+		public Gdk.Pixbuf DrawingPixbuf {
+			set  {
+				bacon_video_widget_set_drawing_pixbuf(Handle, value == null ? IntPtr.Zero : value.Handle);
+			}
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void bacon_video_widget_set_drawing_mode(IntPtr raw, bool drawing_mode);
+
+		public bool DrawingMode {
+			set  {
+				bacon_video_widget_set_drawing_mode(Handle, value);
+			}
+		}
 
 		/*[DllImport("libcesarplayer.dll")]
 		static extern void bacon_video_widget_set_visuals_quality(IntPtr raw, int quality);
diff --git a/CesarPlayer/Player/IPlayer.cs b/CesarPlayer/Player/IPlayer.cs
index 2f1d6d8..1abf1b2 100644
--- a/CesarPlayer/Player/IPlayer.cs
+++ b/CesarPlayer/Player/IPlayer.cs
@@ -65,6 +65,14 @@ namespace LongoMatch.Video.Player
 			set;
 		}
 		
+		bool DrawingMode {
+			set;
+		}
+		
+		Pixbuf DrawingPixbuf {
+			set;
+		}
+		
 		bool ExpandLogo{
 			get;
 			set;
@@ -83,6 +91,10 @@ namespace LongoMatch.Video.Player
 			set;
 		}
 		
+		Pixbuf LogoPixbuf{
+			set;
+		}
+		
 		long AccurateCurrentTime{
 			get;
 		}
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index 614fc41..7dd32e8 100644
--- a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -106,14 +106,14 @@ namespace LongoMatch.Gui {
             this.drawbutton.UseUnderline = true;
             // Container child drawbutton.Gtk.Container+ContainerChild
             Gtk.Alignment w11 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment1.Gtk.Container+ContainerChild
             Gtk.HBox w12 = new Gtk.HBox();
             w12.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Image w13 = new Gtk.Image();
             w13.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-select-color", Gtk.IconSize.Menu, 16);
             w12.Add(w13);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Label w15 = new Gtk.Label();
             w12.Add(w15);
             w11.Add(w12);
@@ -131,14 +131,14 @@ namespace LongoMatch.Gui {
             this.playbutton.Relief = ((Gtk.ReliefStyle)(2));
             // Container child playbutton.Gtk.Container+ContainerChild
             Gtk.Alignment w20 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment2.Gtk.Container+ContainerChild
             Gtk.HBox w21 = new Gtk.HBox();
             w21.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Image w22 = new Gtk.Image();
             w22.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-play", Gtk.IconSize.Button, 20);
             w21.Add(w22);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Label w24 = new Gtk.Label();
             w21.Add(w24);
             w20.Add(w21);
@@ -156,14 +156,14 @@ namespace LongoMatch.Gui {
             this.pausebutton.Relief = ((Gtk.ReliefStyle)(2));
             // Container child pausebutton.Gtk.Container+ContainerChild
             Gtk.Alignment w29 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment3.Gtk.Container+ContainerChild
             Gtk.HBox w30 = new Gtk.HBox();
             w30.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Image w31 = new Gtk.Image();
             w31.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-pause", Gtk.IconSize.Button, 20);
             w30.Add(w31);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Label w33 = new Gtk.Label();
             w30.Add(w33);
             w29.Add(w30);
@@ -181,14 +181,14 @@ namespace LongoMatch.Gui {
             this.prevbutton.Relief = ((Gtk.ReliefStyle)(2));
             // Container child prevbutton.Gtk.Container+ContainerChild
             Gtk.Alignment w38 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment4.Gtk.Container+ContainerChild
             Gtk.HBox w39 = new Gtk.HBox();
             w39.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox4.Gtk.Container+ContainerChild
             Gtk.Image w40 = new Gtk.Image();
             w40.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-previous", Gtk.IconSize.Button, 20);
             w39.Add(w40);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox4.Gtk.Container+ContainerChild
             Gtk.Label w42 = new Gtk.Label();
             w39.Add(w42);
             w38.Add(w39);
@@ -207,14 +207,14 @@ namespace LongoMatch.Gui {
             this.nextbutton.Relief = ((Gtk.ReliefStyle)(2));
             // Container child nextbutton.Gtk.Container+ContainerChild
             Gtk.Alignment w47 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment5.Gtk.Container+ContainerChild
             Gtk.HBox w48 = new Gtk.HBox();
             w48.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox5.Gtk.Container+ContainerChild
             Gtk.Image w49 = new Gtk.Image();
             w49.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-media-next", Gtk.IconSize.Button, 20);
             w48.Add(w49);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox5.Gtk.Container+ContainerChild
             Gtk.Label w51 = new Gtk.Label();
             w48.Add(w51);
             w47.Add(w48);
@@ -267,14 +267,14 @@ namespace LongoMatch.Gui {
             this.volumebutton.Relief = ((Gtk.ReliefStyle)(2));
             // Container child volumebutton.Gtk.Container+ContainerChild
             Gtk.Alignment w60 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment6.Gtk.Container+ContainerChild
             Gtk.HBox w61 = new Gtk.HBox();
             w61.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox6.Gtk.Container+ContainerChild
             Gtk.Image w62 = new Gtk.Image();
             w62.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_volume", Gtk.IconSize.Button, 20);
             w61.Add(w62);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox6.Gtk.Container+ContainerChild
             Gtk.Label w64 = new Gtk.Label();
             w61.Add(w64);
             w60.Add(w61);
diff --git a/CesarPlayer/gtk-gui/objects.xml b/CesarPlayer/gtk-gui/objects.xml
index c75d338..13e8c72 100644
--- a/CesarPlayer/gtk-gui/objects.xml
+++ b/CesarPlayer/gtk-gui/objects.xml
@@ -7,7 +7,6 @@
     <itemgroups>
       <itemgroup label="PlayerBin Properties">
         <property name="Rate" />
-        <property name="LogoMode" />
         <property name="ExpandLogo" />
       </itemgroup>
     </itemgroups>
@@ -16,9 +15,11 @@
         <signal name="SegmentClosedEvent" />
         <signal name="Tick" />
         <signal name="Error" />
+        <signal name="StateChanged" />
         <signal name="Next" />
         <signal name="Prev" />
         <signal name="DrawFrame" />
+        <signal name="SeekEvent" />
       </itemgroup>
     </signals>
   </object>
diff --git a/LongoMatch/DB/DataBase.cs b/LongoMatch/DB/DataBase.cs
index 230f4ca..e071359 100644
--- a/LongoMatch/DB/DataBase.cs
+++ b/LongoMatch/DB/DataBase.cs
@@ -223,6 +223,7 @@ namespace LongoMatch.DB
 			Db4oFactory.Configure().ObjectClass(typeof(Team)).CascadeOnDelete(true);
 			Db4oFactory.Configure().ObjectClass(typeof(HotKey)).CascadeOnDelete(true);
 			Db4oFactory.Configure().ObjectClass(typeof(TeamTemplate)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Drawing)).CascadeOnDelete(true);
 		}
 		
 		private bool Exists(string filename){
diff --git a/LongoMatch/Gui/Component/DrawingWidget.cs b/LongoMatch/Gui/Component/DrawingWidget.cs
index 9c653b8..af37ae6 100644
--- a/LongoMatch/Gui/Component/DrawingWidget.cs
+++ b/LongoMatch/Gui/Component/DrawingWidget.cs
@@ -156,6 +156,9 @@ namespace LongoMatch.Gui.Component
 			Save(filename,true,true);
 		}
 		
+		public void SaveDrawings(string filename){
+			Save(filename,false,true);
+		}
 		
 		private void Save(string filename,bool bSource,bool bDrawings){
 			Surface pngSurface = new ImageSurface (Format.ARGB32,sourceWidth,sourceHeight);
diff --git a/LongoMatch/Gui/Dialog/DrawingTool.cs b/LongoMatch/Gui/Dialog/DrawingTool.cs
index 5480279..af045a8 100644
--- a/LongoMatch/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch/Gui/Dialog/DrawingTool.cs
@@ -21,6 +21,7 @@ using Gdk;
 using Gtk;
 using Mono.Unix;
 using LongoMatch.Gui.Component;
+using LongoMatch.TimeNodes;
 
 namespace LongoMatch.Gui.Dialog
 {
@@ -28,6 +29,8 @@ namespace LongoMatch.Gui.Dialog
 	
 	public partial class DrawingTool : Gtk.Dialog
 	{
+		private MediaTimeNode play;
+		private int stopTime;
 		
 		public DrawingTool()
 		{
@@ -39,9 +42,13 @@ namespace LongoMatch.Gui.Dialog
 		}
 		
 		public Pixbuf Image{
-			set{
-				drawingwidget1.SourceImage = value;			
-			}
+			set{drawingwidget1.SourceImage = value;}
+		}
+		
+		public void SetPlay(MediaTimeNode play,int stopTime){
+			this.play = play;
+			this.stopTime = stopTime;
+			savetoprojectbutton.Visible = true;			
 		}
 
 		protected virtual void OnDrawingtoolbox1LineWidthChanged (int width)
@@ -99,5 +106,13 @@ namespace LongoMatch.Gui.Dialog
 			}
 			fChooser.Destroy();		
 		}
+
+		protected virtual void OnSavetoprojectbuttonClicked (object sender, System.EventArgs e)
+		{
+			string tempFile = System.IO.Path.GetTempFileName();
+			drawingwidget1.SaveDrawings(tempFile);
+			Pixbuf frame = new Pixbuf(tempFile);
+			play.AddDrawing(new Drawing(frame,new Time(stopTime)));
+		}
 	}
 }
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index d1b3c90..178a2e3 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -396,6 +396,13 @@ namespace LongoMatch.Gui
 					else
 						playerbin1.SeekToNextFrame(true);
 				}
+				if (key == Gdk.Key.q){
+					playerbin1.LogoMode=true;
+				}
+				if (key == Gdk.Key.r){
+					playerbin1.LogoMode=false;
+				}
+				
 			}
 			return base.OnKeyPressEvent (evnt);
 		}
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index 6f48eb7..e28b700 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -50,6 +50,7 @@ namespace LongoMatch
 		private NotesWidget notes;
 		private FramesSeriesCapturer fsc;
 		private FramesCaptureProgressDialog fcpd;
+		private VideoDrawingsManager drawingManager;
 		
 		// Current play loaded. null if no play is loaded
 		private TimeNode selectedTimeNode=null;
@@ -69,6 +70,7 @@ namespace LongoMatch
 			this.timeline = timeline;	
 			this.videoprogressbar = videoprogressbar;
 			this.notes = notes;
+			this.drawingManager = new VideoDrawingsManager(player);
 			
 			ConnectSignals();
 		}
@@ -190,6 +192,8 @@ namespace LongoMatch
 			player.SetStartStop(tNode.Start.MSeconds,tNode.Stop.MSeconds);		
 			notes.Visible = true;
 			notes.Play= tNode;
+			drawingManager.SetDrawings(tNode.DrawingsList,tNode.Start.MSeconds);
+			drawingManager.StartClock();
 		}
 		
 		
@@ -260,6 +264,7 @@ namespace LongoMatch
 			selectedTimeNode = null;
 			timeline.SelectedTimeNode = null;
 			notes.Visible = false;
+			drawingManager.StopClock();
 		}
 		
 		protected virtual void OnSnapshotSeries(MediaTimeNode tNode){
@@ -321,10 +326,13 @@ namespace LongoMatch
 			plNode.Rate = player.Rate;
 		}
 		
-		protected virtual void OnDrawFrame (Pixbuf pixbuf){
+		protected virtual void OnDrawFrame (Pixbuf pixbuf,int time){
 			DrawingTool dialog = new DrawingTool();
 			dialog.TransientFor = (Gtk.Window)player.Toplevel;
 			dialog.Image = pixbuf;
+			if (selectedTimeNode != null)
+				dialog.SetPlay((selectedTimeNode as MediaTimeNode),
+				                time);
 			dialog.Run();
 			dialog.Destroy();
 			pixbuf.Dispose();
diff --git a/LongoMatch/Handlers/VideoDrawingsManager.cs b/LongoMatch/Handlers/VideoDrawingsManager.cs
new file mode 100644
index 0000000..38184aa
--- /dev/null
+++ b/LongoMatch/Handlers/VideoDrawingsManager.cs
@@ -0,0 +1,156 @@
+// 
+//  Copyright (C) 2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// 
+
+using System;
+using System.Collections.Generic;
+using Gdk;
+using LongoMatch.TimeNodes;
+using LongoMatch.Gui;
+using LongoMatch.Video.Handlers;
+
+
+
+namespace LongoMatch.Handlers
+{
+	
+	
+	public class VideoDrawingsManager
+	{
+		private PlayerBin player;
+		private uint timeout;
+		private SortedDictionary<int,Drawing> drawingsList;
+		private List<int> stopTimes;
+		private int nextStopTimeIndex;
+		//Monitorize the drawings list to recalculate the stop time;
+		private int previousDrawingsListSize; 
+		//False when the user is seeking using the scale
+		private bool canStop;
+		private object locker;
+			
+		public VideoDrawingsManager(PlayerBin player)
+		{
+			this.player = player;
+			canStop = true;
+			timeout = 0;
+			locker = new Object();
+			stopTimes = new List<int>();
+			player.StateChanged += OnStateChanged;
+			player.SeekEvent += OnSeekEvent;
+		}
+		
+		~ VideoDrawingsManager(){
+			StopClock();
+		}
+		
+		public void SetDrawings(SortedDictionary<int,Drawing> drawings,int startTime){
+			drawingsList = drawings;
+			previousDrawingsListSize = drawingsList.Count;
+			RebuildStopTimes(startTime);					
+		}
+		
+		public void StartClock(){
+			timeout = GLib.Timeout.Add (20,CheckStopTime);
+		}
+		
+		public void StopClock(){
+			if (timeout != 0){
+				GLib.Source.Remove(timeout);
+				timeout = 0;
+			}
+		}
+		
+		private void RebuildStopTimes(int currentTime){
+			stopTimes.Clear();
+			foreach(KeyValuePair<int,Drawing> pair in drawingsList){
+				stopTimes.Add(pair.Key);
+				Console.WriteLine("Added stoptime value:"+pair.Key);
+			}
+			RecalculateNextStopTime(currentTime);
+			previousDrawingsListSize=drawingsList.Count;
+		}
+		
+		private void RecalculateNextStopTime (int currentTime){
+			nextStopTimeIndex = 0;
+			foreach (int time in stopTimes){
+				if (time >= currentTime){
+					Console.WriteLine("Next Stop Time is :"+stopTimes[nextStopTimeIndex]);
+					return;
+				}
+				nextStopTimeIndex++;
+			}
+		}
+		
+		private void PrintDrawings(){
+			Pixbuf frame;
+			Drawing drawing;
+			int key = stopTimes[nextStopTimeIndex];			
+			
+			player.Pause();
+			frame = player.CurrentFrame;
+			if (!drawingsList.TryGetValue(key,out drawing)){
+				return;
+			}
+			
+			player.LogoPixbuf = frame;
+			frame.Dispose();
+			player.DrawingPixbuf = drawing.Pixbuf;
+			player.LogoMode = true;
+			player.DrawingMode = true;			
+		}
+		
+		private void ResetPlayerWindow(){
+			player.LogoMode = false;
+			player.DrawingMode = false;
+			player.SetLogo(System.IO.Path.Combine(MainClass.ImagesDir(),"background.png"));
+		}
+		
+		private bool CheckStopTime(){
+			int currentTime = (int)player.AccurateCurrentTime;
+			//If size has changed, we need to recalculate the
+			//the next stop time
+			if (drawingsList.Count != previousDrawingsListSize){
+				lock (locker){
+					RebuildStopTimes(currentTime);
+				}
+			}
+			//If we are in middle of seek or we don't have any drawings don't draw anything
+			if (!canStop || stopTimes.Count == 0)
+				return true;
+			if ((currentTime-10)>stopTimes[nextStopTimeIndex]){
+				StopClock();
+				PrintDrawings();
+				if (stopTimes.Count-1 != nextStopTimeIndex)
+					nextStopTimeIndex++;
+			}
+			return true;	
+		}
+		
+		protected virtual void OnStateChanged (object sender, StateChangeArgs args){
+			if (args.Playing)
+				ResetPlayerWindow();
+		}
+		
+		protected virtual void OnSeekEvent (object sender, EventArgs args){
+			ResetPlayerWindow();
+			lock (locker){
+				RecalculateNextStopTime ((int)player.AccurateCurrentTime);
+			}
+		}
+		
+	}
+}
diff --git a/LongoMatch/LongoMatch.mdp b/LongoMatch/LongoMatch.mdp
index f84406d..3140d2f 100644
--- a/LongoMatch/LongoMatch.mdp
+++ b/LongoMatch/LongoMatch.mdp
@@ -159,6 +159,8 @@
     <File name="Gui/Component/DrawingWidget.cs" subtype="Code" buildaction="Compile" />
     <File name="Gui/Dialog/DrawingTool.cs" subtype="Code" buildaction="Compile" />
     <File name="gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs" subtype="Code" buildaction="Compile" />
+    <File name="Time/Drawing.cs" subtype="Code" buildaction="Compile" />
+    <File name="Handlers/VideoDrawingsManager.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index cc9b760..7b61ebb 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -61,7 +61,7 @@ namespace LongoMatch
 			//Iniciamos la aplicación
 			Application.Init ();
 			
-			GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
+			//GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
 				
 			LongoMatch.Video.Player.GstPlayer.InitBackend("");
 			
@@ -77,14 +77,14 @@ namespace LongoMatch
 			//Check for previous database
 			CheckOldFiles();
 			
-			try {
+			//try {
 				MainWindow win = new MainWindow ();
 				win.Show ();			
 				Application.Run ();
-			}
-			catch (Exception ex){
+			//}
+			/*catch (Exception ex){
 				ProcessExecutionError(ex);				
-			}			
+			}*/			
 		}
 		
 		public static string RelativeToPrefix(string relativePath){
diff --git a/LongoMatch/Time/Drawing.cs b/LongoMatch/Time/Drawing.cs
new file mode 100644
index 0000000..bc72d74
--- /dev/null
+++ b/LongoMatch/Time/Drawing.cs
@@ -0,0 +1,51 @@
+// 
+//  Copyright (C) 2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// 
+
+using System;
+using Gdk;
+
+namespace LongoMatch.TimeNodes
+{
+	
+	public class Drawing
+	{
+		private byte[] drawingBuf;
+		private Time stopTime;
+		
+		public Drawing(Pixbuf drawing,Time stopTime)
+		{
+			Pixbuf = drawing;
+			this.stopTime = stopTime;
+		}
+		
+		public Pixbuf Pixbuf{
+			get{ 
+				if (drawingBuf != null)
+					return new Pixbuf(drawingBuf);
+				else return null;
+			}
+			set {
+				drawingBuf = value.SaveToBuffer("png");
+			}
+		}	
+		
+		public Time StopTime{
+			get{return stopTime;}
+		}
+	}
+}
diff --git a/LongoMatch/Time/MediaTimeNode.cs b/LongoMatch/Time/MediaTimeNode.cs
index eae13fc..579bf48 100644
--- a/LongoMatch/Time/MediaTimeNode.cs
+++ b/LongoMatch/Time/MediaTimeNode.cs
@@ -56,6 +56,8 @@ namespace LongoMatch.TimeNodes
 		private List<int> localPlayersList; //Used to multitag: one play and several players
 											// We use the int index of the player in the template,		
 		private List<int> visitorPlayersList;// because it's the only unmutable variable
+		
+		private SortedDictionary<int,Drawing> drawingsList; 
 
 		
 #region Constructors	
@@ -67,6 +69,7 @@ namespace LongoMatch.TimeNodes
 			this.stopFrame = (uint) this.Stop.MSeconds*fps/1000;
 			localPlayersList = new List<int>();
 			visitorPlayersList = new List<int>();
+			drawingsList = new SortedDictionary<int, Drawing>();
 		}
 		#endregion
 		
@@ -126,6 +129,17 @@ namespace LongoMatch.TimeNodes
 			get{return visitorPlayersList;}
 		}
 		
+		public SortedDictionary<int,Drawing> DrawingsList{
+			set { drawingsList = value;}
+			get {
+				//Maintain compatibility with previous DB version where this list does not exists
+				if (drawingsList == null){                
+					drawingsList = new SortedDictionary<int, Drawing>();  
+				}
+				return drawingsList;
+			}
+		}
+		
 		
 		#endregion
 		
@@ -151,6 +165,23 @@ namespace LongoMatch.TimeNodes
 			visitorPlayersList.Remove(index);			
 		}
 		
+		public void AddDrawing (Drawing drawing){
+			//Maintain compatibility with previous DB version where this list does not exists
+			if (drawingsList == null){               
+				drawingsList = new SortedDictionary<int, Drawing>();  
+			}
+			if (drawingsList.ContainsKey(drawing.StopTime.MSeconds)){
+				drawingsList.Remove(drawing.StopTime.MSeconds);				
+			}
+			drawingsList.Add(drawing.StopTime.MSeconds,drawing);
+		}
+		
+		public void RemoveDrawing (Drawing drawing){
+			try{
+				drawingsList.Remove(drawing.StopTime.MSeconds);
+			}catch{}//Fallback sillently
+		}
+		
 		#endregion
 	}
 		
diff --git a/LongoMatch/Time/TimeNode.cs b/LongoMatch/Time/TimeNode.cs
index 6b26f64..3139d3f 100644
--- a/LongoMatch/Time/TimeNode.cs
+++ b/LongoMatch/Time/TimeNode.cs
@@ -19,6 +19,8 @@
 //
 
 using System;
+using System.Collections.Generic;
+using LongoMatch.TimeNodes;
 
 namespace LongoMatch.TimeNodes
 {
@@ -35,8 +37,7 @@ namespace LongoMatch.TimeNodes
 		//Stores the stop time
 		private Time stop;
 		
-		
-		
+
 		public TimeNode(){
 		}
 		
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs
index 76e58b1..2db3cd7 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.DrawingTool.cs
@@ -19,6 +19,8 @@ namespace LongoMatch.Gui.Dialog {
         
         private LongoMatch.Gui.Component.DrawingToolBox drawingtoolbox1;
         
+        private Gtk.Button savetoprojectbutton;
+        
         private Gtk.Button savebutton;
         
         private LongoMatch.Gui.Component.DrawingWidget drawingwidget1;
@@ -59,39 +61,80 @@ namespace LongoMatch.Gui.Dialog {
             w2.Expand = false;
             w2.Fill = false;
             // Container child vbox2.Gtk.Box+BoxChild
+            this.savetoprojectbutton = new Gtk.Button();
+            this.savetoprojectbutton.CanFocus = true;
+            this.savetoprojectbutton.Name = "savetoprojectbutton";
+            this.savetoprojectbutton.UseUnderline = true;
+            // Container child savetoprojectbutton.Gtk.Container+ContainerChild
+            Gtk.Alignment w3 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment2.Gtk.Container+ContainerChild
+            Gtk.HBox w4 = new Gtk.HBox();
+            w4.Spacing = 2;
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
+            Gtk.Image w5 = new Gtk.Image();
+            w5.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-save", Gtk.IconSize.Menu, 16);
+            w4.Add(w5);
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
+            Gtk.Label w7 = new Gtk.Label();
+            w7.LabelProp = Mono.Unix.Catalog.GetString("Save to Project");
+            w7.UseUnderline = true;
+            w4.Add(w7);
+            w3.Add(w4);
+            this.savetoprojectbutton.Add(w3);
+            this.vbox2.Add(this.savetoprojectbutton);
+            Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.savetoprojectbutton]));
+            w11.PackType = ((Gtk.PackType)(1));
+            w11.Position = 1;
+            w11.Expand = false;
+            w11.Fill = false;
+            // Container child vbox2.Gtk.Box+BoxChild
             this.savebutton = new Gtk.Button();
             this.savebutton.CanFocus = true;
             this.savebutton.Name = "savebutton";
-            this.savebutton.UseStock = true;
             this.savebutton.UseUnderline = true;
-            this.savebutton.Label = "gtk-save";
+            // Container child savebutton.Gtk.Container+ContainerChild
+            Gtk.Alignment w12 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment1.Gtk.Container+ContainerChild
+            Gtk.HBox w13 = new Gtk.HBox();
+            w13.Spacing = 2;
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
+            Gtk.Image w14 = new Gtk.Image();
+            w14.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-save", Gtk.IconSize.Menu, 16);
+            w13.Add(w14);
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
+            Gtk.Label w16 = new Gtk.Label();
+            w16.LabelProp = Mono.Unix.Catalog.GetString("Save to File");
+            w16.UseUnderline = true;
+            w13.Add(w16);
+            w12.Add(w13);
+            this.savebutton.Add(w12);
             this.vbox2.Add(this.savebutton);
-            Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.savebutton]));
-            w3.PackType = ((Gtk.PackType)(1));
-            w3.Position = 1;
-            w3.Expand = false;
-            w3.Fill = false;
+            Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.vbox2[this.savebutton]));
+            w20.PackType = ((Gtk.PackType)(1));
+            w20.Position = 2;
+            w20.Expand = false;
+            w20.Fill = false;
             this.hbox1.Add(this.vbox2);
-            Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox1[this.vbox2]));
-            w4.Position = 0;
-            w4.Expand = false;
-            w4.Fill = false;
+            Gtk.Box.BoxChild w21 = ((Gtk.Box.BoxChild)(this.hbox1[this.vbox2]));
+            w21.Position = 0;
+            w21.Expand = false;
+            w21.Fill = false;
             // Container child hbox1.Gtk.Box+BoxChild
             this.drawingwidget1 = new LongoMatch.Gui.Component.DrawingWidget();
             this.drawingwidget1.Events = ((Gdk.EventMask)(256));
             this.drawingwidget1.Name = "drawingwidget1";
             this.hbox1.Add(this.drawingwidget1);
-            Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox1[this.drawingwidget1]));
-            w5.Position = 1;
+            Gtk.Box.BoxChild w22 = ((Gtk.Box.BoxChild)(this.hbox1[this.drawingwidget1]));
+            w22.Position = 1;
             w1.Add(this.hbox1);
-            Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(w1[this.hbox1]));
-            w6.Position = 0;
+            Gtk.Box.BoxChild w23 = ((Gtk.Box.BoxChild)(w1[this.hbox1]));
+            w23.Position = 0;
             // Internal child LongoMatch.Gui.Dialog.DrawingTool.ActionArea
-            Gtk.HButtonBox w7 = this.ActionArea;
-            w7.Name = "dialog1_ActionArea";
-            w7.Spacing = 6;
-            w7.BorderWidth = ((uint)(5));
-            w7.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
+            Gtk.HButtonBox w24 = this.ActionArea;
+            w24.Name = "dialog1_ActionArea";
+            w24.Spacing = 6;
+            w24.BorderWidth = ((uint)(5));
+            w24.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
             // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
             this.button271 = new Gtk.Button();
             this.button271.CanFocus = true;
@@ -99,14 +142,15 @@ namespace LongoMatch.Gui.Dialog {
             this.button271.UseUnderline = true;
             this.button271.Label = Mono.Unix.Catalog.GetString("button271");
             this.AddActionWidget(this.button271, 0);
-            Gtk.ButtonBox.ButtonBoxChild w8 = ((Gtk.ButtonBox.ButtonBoxChild)(w7[this.button271]));
-            w8.Expand = false;
-            w8.Fill = false;
+            Gtk.ButtonBox.ButtonBoxChild w25 = ((Gtk.ButtonBox.ButtonBoxChild)(w24[this.button271]));
+            w25.Expand = false;
+            w25.Fill = false;
             if ((this.Child != null)) {
                 this.Child.ShowAll();
             }
             this.DefaultWidth = 600;
-            this.DefaultHeight = 521;
+            this.DefaultHeight = 549;
+            this.savetoprojectbutton.Hide();
             this.button271.Hide();
             this.Show();
             this.drawingtoolbox1.LineWidthChanged += new LongoMatch.Handlers.LineWidthChangedHandler(this.OnDrawingtoolbox1LineWidthChanged);
@@ -114,6 +158,7 @@ namespace LongoMatch.Gui.Dialog {
             this.drawingtoolbox1.VisibilityChanged += new LongoMatch.Handlers.VisibilityChangedHandler(this.OnDrawingtoolbox1VisibilityChanged);
             this.drawingtoolbox1.ClearDrawing += new LongoMatch.Handlers.ClearDrawingHandler(this.OnDrawingtoolbox1ClearDrawing);
             this.savebutton.Clicked += new System.EventHandler(this.OnSavebuttonClicked);
+            this.savetoprojectbutton.Clicked += new System.EventHandler(this.OnSavetoprojectbuttonClicked);
         }
     }
 }
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
index f6ea97a..20f09b4 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -214,7 +214,7 @@ namespace LongoMatch.Gui {
             this.hpaned = new Gtk.HPaned();
             this.hpaned.CanFocus = true;
             this.hpaned.Name = "hpaned";
-            this.hpaned.Position = 318;
+            this.hpaned.Position = 295;
             // Container child hpaned.Gtk.Paned+PanedChild
             this.leftbox = new Gtk.VBox();
             this.leftbox.Name = "leftbox";
@@ -272,7 +272,7 @@ namespace LongoMatch.Gui {
             this.hpaned1 = new Gtk.HPaned();
             this.hpaned1.CanFocus = true;
             this.hpaned1.Name = "hpaned1";
-            this.hpaned1.Position = 760;
+            this.hpaned1.Position = 795;
             // Container child hpaned1.Gtk.Paned+PanedChild
             this.vbox5 = new Gtk.VBox();
             this.vbox5.Name = "vbox5";
@@ -294,9 +294,8 @@ namespace LongoMatch.Gui {
             this.playerbin1 = new LongoMatch.Gui.PlayerBin();
             this.playerbin1.Events = ((Gdk.EventMask)(256));
             this.playerbin1.Name = "playerbin1";
-            this.playerbin1.Rate = 0F;
-            this.playerbin1.LogoMode = false;
-            this.playerbin1.ExpandLogo = false;
+            this.playerbin1.Rate = 1F;
+            this.playerbin1.ExpandLogo = true;
             this.hbox1.Add(this.playerbin1);
             Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.hbox1[this.playerbin1]));
             w10.Position = 1;
@@ -379,7 +378,7 @@ namespace LongoMatch.Gui {
                 this.Child.ShowAll();
             }
             this.DefaultWidth = 1259;
-            this.DefaultHeight = 590;
+            this.DefaultHeight = 761;
             this.leftbox.Hide();
             this.drawingtoolbox1.Hide();
             this.timelinewidget1.Hide();
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index f69ab6c..8701b21 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -1433,7 +1433,7 @@
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Window" id="LongoMatch.Gui.MainWindow" design-size="1259 590">
+  <widget class="Gtk.Window" id="LongoMatch.Gui.MainWindow" design-size="1259 761">
     <action-group name="Default">
       <action id="FileAction">
         <property name="Type">Action</property>
@@ -1656,7 +1656,7 @@
           <widget class="Gtk.HPaned" id="hpaned">
             <property name="MemberName" />
             <property name="CanFocus">True</property>
-            <property name="Position">318</property>
+            <property name="Position">295</property>
             <child>
               <widget class="Gtk.VBox" id="leftbox">
                 <property name="MemberName" />
@@ -1735,7 +1735,7 @@
               <widget class="Gtk.HPaned" id="hpaned1">
                 <property name="MemberName" />
                 <property name="CanFocus">True</property>
-                <property name="Position">760</property>
+                <property name="Position">795</property>
                 <child>
                   <widget class="Gtk.VBox" id="vbox5">
                     <property name="MemberName" />
@@ -1761,8 +1761,8 @@
                           <widget class="LongoMatch.Gui.PlayerBin" id="playerbin1">
                             <property name="MemberName" />
                             <property name="Events">ButtonPressMask</property>
-                            <property name="Rate">0</property>
-                            <property name="LogoMode">False</property>
+                            <property name="Rate">1</property>
+                            <property name="ExpandLogo">True</property>
                             <signal name="Error" handler="OnPlayerbin1Error" />
                             <signal name="SegmentClosedEvent" handler="OnSegmentClosedEvent" />
                           </widget>
@@ -4737,7 +4737,7 @@ Show-&gt;&lt;b&gt; S&lt;/b&gt;
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.DrawingTool" design-size="600 521">
+  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.DrawingTool" design-size="600 549">
     <property name="MemberName" />
     <property name="Title" translatable="yes">Drawing Tool</property>
     <property name="Icon">resource:longomatch.png</property>
@@ -4778,18 +4778,37 @@ Show-&gt;&lt;b&gt; S&lt;/b&gt;
                   </packing>
                 </child>
                 <child>
+                  <widget class="Gtk.Button" id="savetoprojectbutton">
+                    <property name="MemberName" />
+                    <property name="Visible">False</property>
+                    <property name="CanFocus">True</property>
+                    <property name="Type">TextAndIcon</property>
+                    <property name="Icon">stock:gtk-save Menu</property>
+                    <property name="Label" translatable="yes">Save to Project</property>
+                    <property name="UseUnderline">True</property>
+                    <signal name="Clicked" handler="OnSavetoprojectbuttonClicked" />
+                  </widget>
+                  <packing>
+                    <property name="PackType">End</property>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
                   <widget class="Gtk.Button" id="savebutton">
                     <property name="MemberName" />
                     <property name="CanFocus">True</property>
-                    <property name="UseStock">True</property>
-                    <property name="Type">StockItem</property>
-                    <property name="StockId">gtk-save</property>
+                    <property name="Type">TextAndIcon</property>
+                    <property name="Icon">stock:gtk-save Menu</property>
+                    <property name="Label" translatable="yes">Save to File</property>
+                    <property name="UseUnderline">True</property>
                     <signal name="Clicked" handler="OnSavebuttonClicked" />
-                    <property name="label">gtk-save</property>
                   </widget>
                   <packing>
                     <property name="PackType">End</property>
-                    <property name="Position">1</property>
+                    <property name="Position">2</property>
                     <property name="AutoSize">True</property>
                     <property name="Expand">False</property>
                     <property name="Fill">False</property>
diff --git a/libcesarplayer/src/bacon-video-widget-gst-0.10.c b/libcesarplayer/src/bacon-video-widget-gst-0.10.c
index 1cd1158..7fc6560 100644
--- a/libcesarplayer/src/bacon-video-widget-gst-0.10.c
+++ b/libcesarplayer/src/bacon-video-widget-gst-0.10.c
@@ -149,6 +149,7 @@ struct BaconVideoWidgetPrivate
   guint                        update_id;
 
   GdkPixbuf                   *logo_pixbuf;
+  GdkPixbuf					  *drawing_pixbuf;
 
   gboolean                     media_has_video;
   gboolean                     media_has_audio;
@@ -171,6 +172,7 @@ struct BaconVideoWidgetPrivate
 
   /* Other stuff */
   gboolean                     logo_mode;
+  gboolean					   drawing_mode;
   gboolean					   expand_logo;
   gboolean                     cursor_shown;
   gboolean                     fullscreen_mode;
@@ -674,6 +676,7 @@ bacon_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
   if (bvw->priv->logo_mode || draw_logo) {
     if (bvw->priv->logo_pixbuf != NULL) {
 	  GdkPixbuf *frame;
+	  GdkPixbuf *drawing;
       guchar *pixels;
       int rowstride;
       gint width, height, alloc_width, alloc_height, logo_x, logo_y;
@@ -702,7 +705,7 @@ bacon_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
 
  		/* Drawing our frame */
       
-      if (bvw->priv->expand_logo){
+      if (bvw->priv->expand_logo && !bvw->priv->drawing_mode){
       /* Scaling to available space */
       
       	frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
@@ -742,11 +745,19 @@ bacon_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
 
     	frame = gdk_pixbuf_scale_simple (bvw->priv->logo_pixbuf,
           	width, height, GDK_INTERP_BILINEAR);
-
       	gdk_draw_pixbuf (win, gtk_widget_get_style (widget)->fg_gc[0], frame,
           0, 0, logo_x, logo_y,
           width, height, GDK_RGB_DITHER_NONE, 0, 0);
           
+        if(bvw->priv->drawing_mode && bvw->priv->drawing_pixbuf != NULL){ 
+          drawing = gdk_pixbuf_scale_simple (bvw->priv->drawing_pixbuf,
+          	width, height, GDK_INTERP_BILINEAR);
+          gdk_draw_pixbuf (win, gtk_widget_get_style (widget)->fg_gc[0], drawing,
+            0, 0, logo_x, logo_y,
+            width, height, GDK_RGB_DITHER_NONE, 0, 0);
+          g_object_unref (drawing);
+        }
+          
       	g_object_unref (frame);
       }
     } else if (win) {
@@ -1147,7 +1158,6 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
   priv->audiotags = NULL;
   priv->videotags = NULL;
   priv->zoom = 1.0;
-  priv->expand_logo=TRUE;
   priv->lock = g_mutex_new ();
 
   bvw->priv->missing_plugins = NULL;
@@ -3659,6 +3669,29 @@ bacon_video_widget_get_logo_mode (BaconVideoWidget * bvw)
   return bvw->priv->logo_mode;
 }
 
+void
+bacon_video_widget_set_drawing_pixbuf (BaconVideoWidget * bvw, GdkPixbuf *drawing)
+{
+  g_return_if_fail (bvw != NULL);
+  g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+  g_return_if_fail (drawing != NULL);
+
+  if (bvw->priv->drawing_pixbuf != NULL)
+    g_object_unref (bvw->priv->drawing_pixbuf);
+
+  g_object_ref (drawing);
+  bvw->priv->drawing_pixbuf = drawing;
+}
+
+void
+bacon_video_widget_set_drawing_mode (BaconVideoWidget * bvw, gboolean drawing_mode)
+{
+  g_return_if_fail (bvw != NULL);
+  g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+
+  bvw->priv->drawing_mode = drawing_mode;
+}
+
 /**
  * bacon_video_widget_pause:
  * @bvw: a #BaconVideoWidget
diff --git a/libcesarplayer/src/bacon-video-widget.h b/libcesarplayer/src/bacon-video-widget.h
index fe6413f..50c1534 100644
--- a/libcesarplayer/src/bacon-video-widget.h
+++ b/libcesarplayer/src/bacon-video-widget.h
@@ -212,6 +212,13 @@ EXPORT void bacon_video_widget_set_volume               (BaconVideoWidget *bvw,
 						  double volume);
 EXPORT double bacon_video_widget_get_volume             (BaconVideoWidget *bvw);
 
+/*Drawings Overlay*/
+EXPORT void bacon_video_widget_set_drawing_pixbuf		 (BaconVideoWidget *bvw,
+						  GdkPixbuf *drawing);
+EXPORT void bacon_video_widget_set_drawing_mode		 (BaconVideoWidget *bvw,
+						  gboolean drawing_mode);
+						  
+
 /* Properties */
 EXPORT void bacon_video_widget_set_logo		 (BaconVideoWidget *bvw,
 						  char *filename);



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