[longomatch/redesign2: 75/140] Fix file format with dos2unix



commit aed9d151f6062f8f1f7093f4b3ade8bdaca16835
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Feb 10 00:35:14 2011 +0100

    Fix file format with dos2unix

 CesarPlayer/Capturer/GstCameraCapturer.cs          |  978 ++++++++--------
 CesarPlayer/Capturer/ICapturer.cs                  |  186 ++--
 CesarPlayer/Capturer/ObjectManager.cs              |   78 +-
 CesarPlayer/Editor/GstVideoSplitter.cs             |  866 +++++++-------
 CesarPlayer/Editor/IVideoEditor.cs                 |  166 ++--
 CesarPlayer/Gui/CapturerBin.cs                     |  708 ++++++------
 CesarPlayer/Gui/PlayerBin.cs                       | 1238 ++++++++++----------
 CesarPlayer/Gui/VolumeWindow.cs                    |   34 +-
 CesarPlayer/MultimediaFactory.cs                   |  214 ++--
 CesarPlayer/Player/IPlayer.cs                      |   32 +-
 CesarPlayer/Utils/TimeString.cs                    |   34 +-
 LongoMatch/Common/Constants.cs                     |   12 +-
 LongoMatch/DB/DataBase.cs                          |  772 ++++++------
 LongoMatch/Gui/Component/PlayListWidget.cs         |  660 ++++++------
 LongoMatch/Gui/Component/PlaysListTreeWidget.cs    |  362 +++---
 LongoMatch/Gui/Component/ProjectDetailsWidget.cs   | 1200 ++++++++++----------
 LongoMatch/Gui/Component/TimeLineWidget.cs         |  492 ++++----
 LongoMatch/Gui/Component/TimeReferenceWidget.cs    |  322 +++---
 LongoMatch/Gui/Component/TimeScale.cs              |  734 ++++++------
 .../Gui/Dialog/FramesCaptureProgressDialog.cs      |  136 ++--
 LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs      |  158 ++--
 LongoMatch/Gui/Dialog/OpenProjectDialog.cs         |  108 +-
 LongoMatch/Gui/Dialog/ProjectsManager.cs           |  240 ++--
 LongoMatch/Gui/Dialog/TemplatesEditor.cs           |    2 +-
 LongoMatch/Gui/Dialog/VideoEditionProperties.cs    |  402 ++++----
 LongoMatch/Gui/MainWindow.cs                       | 1245 ++++++++++----------
 LongoMatch/Gui/Popup/CalendarPopup.cs              |   66 +-
 LongoMatch/Gui/TreeView/PlayListTreeView.cs        |  316 +++---
 LongoMatch/Handlers/EventsManager.cs               |  956 ++++++++--------
 LongoMatch/IO/CSVExport.cs                         |  368 +++---
 LongoMatch/IO/XMLReader.cs                         |  176 ++--
 LongoMatch/Main.cs                                 |  502 ++++----
 LongoMatch/Playlist/IPlayList.cs                   |  112 +-
 LongoMatch/Playlist/PlayList.cs                    |  338 +++---
 LongoMatch/Store/Category.cs                       |  320 +++---
 LongoMatch/Store/PixbufTimeNode.cs                 |  154 ++--
 LongoMatch/Store/Play.cs                           |  418 ++++----
 LongoMatch/Store/PlayListPlay.cs                   |  150 ++--
 LongoMatch/Store/Player.cs                         |  240 ++--
 LongoMatch/Store/Project.cs                        |  594 +++++-----
 LongoMatch/Store/Time.cs                           |  312 +++---
 LongoMatch/Updates/Updater.cs                      |  204 ++--
 LongoMatch/Updates/XmlUpdateParser.cs              |  148 ++--
 .../LongoMatch.Gui.Component.CategoryProperties.cs |    2 +-
 .../LongoMatch.Gui.Component.PlayerProperties.cs   |    6 +-
 ...ongoMatch.Gui.Component.ProjectDetailsWidget.cs |   12 +-
 .../LongoMatch.Gui.Component.ProjectListWidget.cs  |    2 +-
 .../LongoMatch.Gui.Component.TaggerWidget.cs       |    2 +-
 .../gtk-gui/LongoMatch.Gui.Dialog.EntryDialog.cs   |    2 +-
 .../LongoMatch.Gui.Dialog.SnapshotsDialog.cs       |    2 +-
 ...LongoMatch.Gui.Dialog.VideoEditionProperties.cs |    2 +-
 51 files changed, 8391 insertions(+), 8392 deletions(-)
---
diff --git a/CesarPlayer/Capturer/GstCameraCapturer.cs b/CesarPlayer/Capturer/GstCameraCapturer.cs
index 7f6b0d5..4d1709c 100644
--- a/CesarPlayer/Capturer/GstCameraCapturer.cs
+++ b/CesarPlayer/Capturer/GstCameraCapturer.cs
@@ -1,489 +1,489 @@
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-namespace LongoMatch.Video.Capturer {
-
-	using System;
-	using System.Collections;
-	using System.Runtime.InteropServices;
-	using LongoMatch.Video.Common;
-
-#region Autogenerated code
-	public  class GstCameraCapturer : Gtk.HBox, LongoMatch.Video.Capturer.ICapturer {
-		
-		public event EllpasedTimeHandler EllapsedTime;
-		
-		private LiveSourceTimer timer;
-
-		[Obsolete]
-		protected GstCameraCapturer(GLib.GType gtype) : base(gtype) {}
-		public GstCameraCapturer(IntPtr raw) : base(raw) {}
-
-		[DllImport("libcesarplayer.dll")]
-		static extern unsafe IntPtr gst_camera_capturer_new(IntPtr filename, out IntPtr err);
-
-		public unsafe GstCameraCapturer (string filename) : base (IntPtr.Zero)
-		{
-			if (GetType () != typeof (GstCameraCapturer)) {
-				throw new InvalidOperationException ("Can't override this constructor.");
-			}
-			IntPtr error = IntPtr.Zero;
-			Raw = gst_camera_capturer_new(GLib.Marshaller.StringToPtrGStrdup(filename), out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			
-			timer = new LiveSourceTimer();	
-			timer.EllapsedTime += delegate(int ellapsedTime) {
-				if (EllapsedTime!= null)
-					EllapsedTime(ellapsedTime);
-			};			
-		}
-
-		[GLib.Property ("output_height")]
-		public uint OutputHeight {
-			get {
-				GLib.Value val = GetProperty ("output_height");
-				uint ret = (uint) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("output_height", val);
-				val.Dispose ();
-			}
-		}
-
-		[GLib.Property ("output_width")]
-		public uint OutputWidth {
-			get {
-				GLib.Value val = GetProperty ("output_width");
-				uint ret = (uint) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("output_width", val);
-				val.Dispose ();
-			}
-		}
-
-		[GLib.Property ("video_bitrate")]
-		public uint VideoBitrate {
-			get {
-				GLib.Value val = GetProperty ("video_bitrate");
-				uint ret = (uint) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("video_bitrate", val);
-				val.Dispose ();
-			}
-		}
-
-		[GLib.Property ("output_file")]
-		public string OutputFile {
-			get {
-				GLib.Value val = GetProperty ("output_file");
-				string ret = (string) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("output_file", val);
-				val.Dispose ();
-			}
-		}
-
-		[GLib.Property ("audio_bitrate")]
-		public uint AudioBitrate {
-			get {
-				GLib.Value val = GetProperty ("audio_bitrate");
-				uint ret = (uint) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("audio_bitrate", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("device_id")]
-		public string DeviceID {
-			get {
-				GLib.Value val = GetProperty ("device_id");
-				string ret = (string) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("device_id", val);
-				val.Dispose ();
-			}
-		}
-		
-#pragma warning disable 0169
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void ErrorSignalDelegate (IntPtr arg0, IntPtr arg1, IntPtr gch);
-
-		static void ErrorSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr gch)
-		{
-			ErrorArgs args = new ErrorArgs ();
-			try {
-				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
-				if (sig == null)
-					throw new Exception("Unknown signal GC handle received " + gch);
-
-				args.Args = new object[1];
-				args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg1);
-				ErrorHandler handler = (ErrorHandler) sig.Handler;
-				handler (GLib.Object.GetObject (arg0), args);
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void ErrorVMDelegate (IntPtr gcc, IntPtr message);
-
-		static ErrorVMDelegate ErrorVMCallback;
-
-		static void error_cb (IntPtr gcc, IntPtr message)
-		{
-			try {
-				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
-				gcc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		private static void OverrideError (GLib.GType gtype)
-		{
-			if (ErrorVMCallback == null)
-				ErrorVMCallback = new ErrorVMDelegate (error_cb);
-			OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
-		}
-
-		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideError")]
-		protected virtual void OnError (string message)
-		{
-			GLib.Value ret = GLib.Value.Empty;
-			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-			GLib.Value[] vals = new GLib.Value [2];
-			vals [0] = new GLib.Value (this);
-			inst_and_params.Append (vals [0]);
-			vals [1] = new GLib.Value (message);
-			inst_and_params.Append (vals [1]);
-			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-			foreach (GLib.Value v in vals)
-				v.Dispose ();
-		}
-
-		[GLib.Signal("error")]
-		public event ErrorHandler Error {
-			add {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
-				sig.AddDelegate (value);
-			}
-			remove {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
-				sig.RemoveDelegate (value);
-			}
-		}
-		
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void DeviceChangeSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
-
-		static void DeviceChangeSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
-		{
-			DeviceChangeArgs args = new DeviceChangeArgs ();
-			try {
-				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
-				if (sig == null)
-					throw new Exception("Unknown signal GC handle received " + gch);
-
-				args.Args = new object[1];
-				args.Args[0] = arg1;
-				DeviceChangeHandler handler = (DeviceChangeHandler) sig.Handler;
-				handler (GLib.Object.GetObject (arg0), args);
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void DeviceChangeVMDelegate (IntPtr gcc, int deviceChange);
-
-		static DeviceChangeVMDelegate DeviceChangeVMCallback;
-
-		static void device_change_cb (IntPtr gcc, int deviceChange)
-		{
-			try {
-				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
-				gcc_managed.OnDeviceChange (deviceChange);
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		private static void OverrideDeviceChange (GLib.GType gtype)
-		{
-			if (DeviceChangeVMCallback == null)
-				DeviceChangeVMCallback = new DeviceChangeVMDelegate (device_change_cb);
-			OverrideVirtualMethod (gtype, "device_change", DeviceChangeVMCallback);
-		}
-
-		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideDeviceChange")]
-		protected virtual void OnDeviceChange (int deviceChange)
-		{
-			GLib.Value ret = GLib.Value.Empty;
-			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-			GLib.Value[] vals = new GLib.Value [2];
-			vals [0] = new GLib.Value (this);
-			inst_and_params.Append (vals [0]);
-			vals [1] = new GLib.Value (deviceChange);
-			inst_and_params.Append (vals [1]);
-			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-			foreach (GLib.Value v in vals)
-				v.Dispose ();
-		}
-
-		[GLib.Signal("device_change")]
-		public event DeviceChangeHandler DeviceChange {
-			add {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
-				sig.AddDelegate (value);
-			}
-			remove {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
-				sig.RemoveDelegate (value);
-			}
-		}
-
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void EosVMDelegate (IntPtr gcc);
-
-		static EosVMDelegate EosVMCallback;
-
-		static void eos_cb (IntPtr gcc)
-		{
-			try {
-				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
-				gcc_managed.OnEos ();
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		private static void OverrideEos (GLib.GType gtype)
-		{
-			if (EosVMCallback == null)
-				EosVMCallback = new EosVMDelegate (eos_cb);
-			OverrideVirtualMethod (gtype, "eos", EosVMCallback);
-		}
-
-		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideEos")]
-		protected virtual void OnEos ()
-		{
-			GLib.Value ret = GLib.Value.Empty;
-			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
-			GLib.Value[] vals = new GLib.Value [1];
-			vals [0] = new GLib.Value (this);
-			inst_and_params.Append (vals [0]);
-			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-			foreach (GLib.Value v in vals)
-				v.Dispose ();
-		}
-
-		[GLib.Signal("eos")]
-		public event System.EventHandler Eos {
-			add {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
-				sig.AddDelegate (value);
-			}
-			remove {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
-				sig.RemoveDelegate (value);
-			}
-		}
-#pragma warning restore 0169
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_init_backend(out int argc, IntPtr argv);
-
-		public static int InitBackend(string argv) {
-			int argc;
-			gst_camera_capturer_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
-			return argc;
-		}
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_stop(IntPtr raw);
-
-		public void Stop() {
-			timer.Stop();
-			gst_camera_capturer_stop(Handle);
-		}
-
-	
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
-
-		public void TogglePause() {
-			timer.TogglePause();
-			gst_camera_capturer_toggle_pause(Handle);
-		}
-	
-		public int CurrentTime{
-			get{
-				return timer.CurrentTime;
-			}
-		}
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_start(IntPtr raw);
-
-		public void Start() {
-			timer.Start();
-			gst_camera_capturer_start(Handle);
-		}
-
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_run(IntPtr raw);
-
-		public void Run() {
-			gst_camera_capturer_run(Handle);
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_camera_capturer_close(IntPtr raw);
-
-		public void Close() {
-			gst_camera_capturer_close(Handle);
-		}		
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern bool gst_camera_capturer_set_video_muxer(IntPtr raw, int type, out IntPtr error);
-
-		public bool SetVideoMuxer(VideoMuxerType type) {
-			IntPtr error = IntPtr.Zero;
-			bool raw_ret = gst_camera_capturer_set_video_muxer(Handle, (int) type, out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			bool ret = raw_ret;
-			return ret;
-		}
-
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern bool gst_camera_capturer_set_video_encoder(IntPtr raw, int type, out IntPtr error);
-
-		public bool SetVideoEncoder(VideoEncoderType type) {
-			IntPtr error = IntPtr.Zero;
-			bool raw_ret = gst_camera_capturer_set_video_encoder(Handle, (int) type, out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			bool ret = raw_ret;
-			return ret;
-		}
-
-		[DllImport("libcesarplayer.dll")]
-		static extern bool gst_camera_capturer_set_audio_encoder(IntPtr raw, int type, out IntPtr error);
-
-		public bool SetAudioEncoder(AudioEncoderType type) {
-			IntPtr error = IntPtr.Zero;			
-			bool raw_ret = gst_camera_capturer_set_audio_encoder(Handle, (int) type, out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			bool ret = raw_ret;
-			return ret;
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, out IntPtr error);
-
-		public bool SetSource(CaptureSourceType type) {
-			IntPtr error = IntPtr.Zero;			
-			bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			bool ret = raw_ret;
-			return ret;
-		}		
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_camera_capturer_get_type();
-
-		public static new GLib.GType GType { 
-			get {
-				IntPtr raw_ret = gst_camera_capturer_get_type();
-				GLib.GType ret = new GLib.GType(raw_ret);
-				return ret;
-			}
-		} 
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_camera_capturer_enum_audio_devices();
-
-		public static string[] AudioDevices { 
-			get {
-				IntPtr raw_ret = gst_camera_capturer_enum_audio_devices();
-				return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List),  true, false, typeof(String));
-			}
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_camera_capturer_enum_video_devices();
-
-		public static string[] VideoDevices { 
-			get {
-				IntPtr raw_ret = gst_camera_capturer_enum_video_devices();
-				return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List),  true, false, typeof(String));					
-			}
-		}
-		
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
-		
-		public Gdk.Pixbuf CurrentFrame {
-			get {
-				IntPtr raw_ret = gst_camera_capturer_get_current_frame (Handle);
-				Gdk.Pixbuf p = GLib.Object.GetObject (raw_ret) as Gdk.Pixbuf;
-				/* The refcount for p is now 2. We need to decrease the counter to 1
-				 * so that p.Dipose() sets it to 0 and triggers the pixbuf destroy function
-				 * that frees the associated data*/ 
-				gst_camera_capturer_unref_pixbuf (raw_ret);
-				return p;
-			}
-		}		
-		
-		static GstCameraCapturer ()
-		{
-			LongoMatch.GtkSharp.Capturer.ObjectManager.Initialize ();
-		}
-#endregion
-		
-	}
-}
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Capturer {
+
+	using System;
+	using System.Collections;
+	using System.Runtime.InteropServices;
+	using LongoMatch.Video.Common;
+
+#region Autogenerated code
+	public  class GstCameraCapturer : Gtk.HBox, LongoMatch.Video.Capturer.ICapturer {
+		
+		public event EllpasedTimeHandler EllapsedTime;
+		
+		private LiveSourceTimer timer;
+
+		[Obsolete]
+		protected GstCameraCapturer(GLib.GType gtype) : base(gtype) {}
+		public GstCameraCapturer(IntPtr raw) : base(raw) {}
+
+		[DllImport("libcesarplayer.dll")]
+		static extern unsafe IntPtr gst_camera_capturer_new(IntPtr filename, out IntPtr err);
+
+		public unsafe GstCameraCapturer (string filename) : base (IntPtr.Zero)
+		{
+			if (GetType () != typeof (GstCameraCapturer)) {
+				throw new InvalidOperationException ("Can't override this constructor.");
+			}
+			IntPtr error = IntPtr.Zero;
+			Raw = gst_camera_capturer_new(GLib.Marshaller.StringToPtrGStrdup(filename), out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			
+			timer = new LiveSourceTimer();	
+			timer.EllapsedTime += delegate(int ellapsedTime) {
+				if (EllapsedTime!= null)
+					EllapsedTime(ellapsedTime);
+			};			
+		}
+
+		[GLib.Property ("output_height")]
+		public uint OutputHeight {
+			get {
+				GLib.Value val = GetProperty ("output_height");
+				uint ret = (uint) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("output_height", val);
+				val.Dispose ();
+			}
+		}
+
+		[GLib.Property ("output_width")]
+		public uint OutputWidth {
+			get {
+				GLib.Value val = GetProperty ("output_width");
+				uint ret = (uint) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("output_width", val);
+				val.Dispose ();
+			}
+		}
+
+		[GLib.Property ("video_bitrate")]
+		public uint VideoBitrate {
+			get {
+				GLib.Value val = GetProperty ("video_bitrate");
+				uint ret = (uint) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("video_bitrate", val);
+				val.Dispose ();
+			}
+		}
+
+		[GLib.Property ("output_file")]
+		public string OutputFile {
+			get {
+				GLib.Value val = GetProperty ("output_file");
+				string ret = (string) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("output_file", val);
+				val.Dispose ();
+			}
+		}
+
+		[GLib.Property ("audio_bitrate")]
+		public uint AudioBitrate {
+			get {
+				GLib.Value val = GetProperty ("audio_bitrate");
+				uint ret = (uint) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("audio_bitrate", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("device_id")]
+		public string DeviceID {
+			get {
+				GLib.Value val = GetProperty ("device_id");
+				string ret = (string) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("device_id", val);
+				val.Dispose ();
+			}
+		}
+		
+#pragma warning disable 0169
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void ErrorSignalDelegate (IntPtr arg0, IntPtr arg1, IntPtr gch);
+
+		static void ErrorSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr gch)
+		{
+			ErrorArgs args = new ErrorArgs ();
+			try {
+				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
+				if (sig == null)
+					throw new Exception("Unknown signal GC handle received " + gch);
+
+				args.Args = new object[1];
+				args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg1);
+				ErrorHandler handler = (ErrorHandler) sig.Handler;
+				handler (GLib.Object.GetObject (arg0), args);
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void ErrorVMDelegate (IntPtr gcc, IntPtr message);
+
+		static ErrorVMDelegate ErrorVMCallback;
+
+		static void error_cb (IntPtr gcc, IntPtr message)
+		{
+			try {
+				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+				gcc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		private static void OverrideError (GLib.GType gtype)
+		{
+			if (ErrorVMCallback == null)
+				ErrorVMCallback = new ErrorVMDelegate (error_cb);
+			OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+		}
+
+		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideError")]
+		protected virtual void OnError (string message)
+		{
+			GLib.Value ret = GLib.Value.Empty;
+			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+			GLib.Value[] vals = new GLib.Value [2];
+			vals [0] = new GLib.Value (this);
+			inst_and_params.Append (vals [0]);
+			vals [1] = new GLib.Value (message);
+			inst_and_params.Append (vals [1]);
+			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+			foreach (GLib.Value v in vals)
+				v.Dispose ();
+		}
+
+		[GLib.Signal("error")]
+		public event ErrorHandler Error {
+			add {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+				sig.AddDelegate (value);
+			}
+			remove {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "error", new ErrorSignalDelegate(ErrorSignalCallback));
+				sig.RemoveDelegate (value);
+			}
+		}
+		
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void DeviceChangeSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
+
+		static void DeviceChangeSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
+		{
+			DeviceChangeArgs args = new DeviceChangeArgs ();
+			try {
+				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
+				if (sig == null)
+					throw new Exception("Unknown signal GC handle received " + gch);
+
+				args.Args = new object[1];
+				args.Args[0] = arg1;
+				DeviceChangeHandler handler = (DeviceChangeHandler) sig.Handler;
+				handler (GLib.Object.GetObject (arg0), args);
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void DeviceChangeVMDelegate (IntPtr gcc, int deviceChange);
+
+		static DeviceChangeVMDelegate DeviceChangeVMCallback;
+
+		static void device_change_cb (IntPtr gcc, int deviceChange)
+		{
+			try {
+				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+				gcc_managed.OnDeviceChange (deviceChange);
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		private static void OverrideDeviceChange (GLib.GType gtype)
+		{
+			if (DeviceChangeVMCallback == null)
+				DeviceChangeVMCallback = new DeviceChangeVMDelegate (device_change_cb);
+			OverrideVirtualMethod (gtype, "device_change", DeviceChangeVMCallback);
+		}
+
+		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideDeviceChange")]
+		protected virtual void OnDeviceChange (int deviceChange)
+		{
+			GLib.Value ret = GLib.Value.Empty;
+			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+			GLib.Value[] vals = new GLib.Value [2];
+			vals [0] = new GLib.Value (this);
+			inst_and_params.Append (vals [0]);
+			vals [1] = new GLib.Value (deviceChange);
+			inst_and_params.Append (vals [1]);
+			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+			foreach (GLib.Value v in vals)
+				v.Dispose ();
+		}
+
+		[GLib.Signal("device_change")]
+		public event DeviceChangeHandler DeviceChange {
+			add {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+				sig.AddDelegate (value);
+			}
+			remove {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "device_change", new DeviceChangeSignalDelegate(DeviceChangeSignalCallback));
+				sig.RemoveDelegate (value);
+			}
+		}
+
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void EosVMDelegate (IntPtr gcc);
+
+		static EosVMDelegate EosVMCallback;
+
+		static void eos_cb (IntPtr gcc)
+		{
+			try {
+				GstCameraCapturer gcc_managed = GLib.Object.GetObject (gcc, false) as GstCameraCapturer;
+				gcc_managed.OnEos ();
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		private static void OverrideEos (GLib.GType gtype)
+		{
+			if (EosVMCallback == null)
+				EosVMCallback = new EosVMDelegate (eos_cb);
+			OverrideVirtualMethod (gtype, "eos", EosVMCallback);
+		}
+
+		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Capturer.GstCameraCapturer), ConnectionMethod="OverrideEos")]
+		protected virtual void OnEos ()
+		{
+			GLib.Value ret = GLib.Value.Empty;
+			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
+			GLib.Value[] vals = new GLib.Value [1];
+			vals [0] = new GLib.Value (this);
+			inst_and_params.Append (vals [0]);
+			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+			foreach (GLib.Value v in vals)
+				v.Dispose ();
+		}
+
+		[GLib.Signal("eos")]
+		public event System.EventHandler Eos {
+			add {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+				sig.AddDelegate (value);
+			}
+			remove {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "eos");
+				sig.RemoveDelegate (value);
+			}
+		}
+#pragma warning restore 0169
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_init_backend(out int argc, IntPtr argv);
+
+		public static int InitBackend(string argv) {
+			int argc;
+			gst_camera_capturer_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
+			return argc;
+		}
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_stop(IntPtr raw);
+
+		public void Stop() {
+			timer.Stop();
+			gst_camera_capturer_stop(Handle);
+		}
+
+	
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_toggle_pause(IntPtr raw);
+
+		public void TogglePause() {
+			timer.TogglePause();
+			gst_camera_capturer_toggle_pause(Handle);
+		}
+	
+		public int CurrentTime{
+			get{
+				return timer.CurrentTime;
+			}
+		}
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_start(IntPtr raw);
+
+		public void Start() {
+			timer.Start();
+			gst_camera_capturer_start(Handle);
+		}
+
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_run(IntPtr raw);
+
+		public void Run() {
+			gst_camera_capturer_run(Handle);
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_camera_capturer_close(IntPtr raw);
+
+		public void Close() {
+			gst_camera_capturer_close(Handle);
+		}		
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern bool gst_camera_capturer_set_video_muxer(IntPtr raw, int type, out IntPtr error);
+
+		public bool SetVideoMuxer(VideoMuxerType type) {
+			IntPtr error = IntPtr.Zero;
+			bool raw_ret = gst_camera_capturer_set_video_muxer(Handle, (int) type, out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			bool ret = raw_ret;
+			return ret;
+		}
+
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern bool gst_camera_capturer_set_video_encoder(IntPtr raw, int type, out IntPtr error);
+
+		public bool SetVideoEncoder(VideoEncoderType type) {
+			IntPtr error = IntPtr.Zero;
+			bool raw_ret = gst_camera_capturer_set_video_encoder(Handle, (int) type, out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			bool ret = raw_ret;
+			return ret;
+		}
+
+		[DllImport("libcesarplayer.dll")]
+		static extern bool gst_camera_capturer_set_audio_encoder(IntPtr raw, int type, out IntPtr error);
+
+		public bool SetAudioEncoder(AudioEncoderType type) {
+			IntPtr error = IntPtr.Zero;			
+			bool raw_ret = gst_camera_capturer_set_audio_encoder(Handle, (int) type, out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			bool ret = raw_ret;
+			return ret;
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern bool gst_camera_capturer_set_source(IntPtr raw, int type, out IntPtr error);
+
+		public bool SetSource(CaptureSourceType type) {
+			IntPtr error = IntPtr.Zero;			
+			bool raw_ret = gst_camera_capturer_set_source(Handle, (int) type, out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			bool ret = raw_ret;
+			return ret;
+		}		
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_camera_capturer_get_type();
+
+		public static new GLib.GType GType { 
+			get {
+				IntPtr raw_ret = gst_camera_capturer_get_type();
+				GLib.GType ret = new GLib.GType(raw_ret);
+				return ret;
+			}
+		} 
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_camera_capturer_enum_audio_devices();
+
+		public static string[] AudioDevices { 
+			get {
+				IntPtr raw_ret = gst_camera_capturer_enum_audio_devices();
+				return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List),  true, false, typeof(String));
+			}
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_camera_capturer_enum_video_devices();
+
+		public static string[] VideoDevices { 
+			get {
+				IntPtr raw_ret = gst_camera_capturer_enum_video_devices();
+				return (string[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List),  true, false, typeof(String));					
+			}
+		}
+		
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_camera_capturer_get_current_frame(IntPtr raw);
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_camera_capturer_unref_pixbuf(IntPtr raw);
+		
+		public Gdk.Pixbuf CurrentFrame {
+			get {
+				IntPtr raw_ret = gst_camera_capturer_get_current_frame (Handle);
+				Gdk.Pixbuf p = GLib.Object.GetObject (raw_ret) as Gdk.Pixbuf;
+				/* The refcount for p is now 2. We need to decrease the counter to 1
+				 * so that p.Dipose() sets it to 0 and triggers the pixbuf destroy function
+				 * that frees the associated data*/ 
+				gst_camera_capturer_unref_pixbuf (raw_ret);
+				return p;
+			}
+		}		
+		
+		static GstCameraCapturer ()
+		{
+			LongoMatch.GtkSharp.Capturer.ObjectManager.Initialize ();
+		}
+#endregion
+		
+	}
+}
diff --git a/CesarPlayer/Capturer/ICapturer.cs b/CesarPlayer/Capturer/ICapturer.cs
index 4960bdb..5c7a06e 100644
--- a/CesarPlayer/Capturer/ICapturer.cs
+++ b/CesarPlayer/Capturer/ICapturer.cs
@@ -1,93 +1,93 @@
-// ICapturer.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using LongoMatch.Video.Common;
-using Gdk;
-
-namespace LongoMatch.Video.Capturer
-{
-	
-	
-	public interface ICapturer
-	{	
-		event EllpasedTimeHandler EllapsedTime;
-		event ErrorHandler Error;
-		event DeviceChangeHandler DeviceChange;
-			
-		uint OutputWidth {
-			get ;
-			set ;
-		}
-
-		uint OutputHeight {
-			get;
-			set ;
-		}
-		
-		 string OutputFile {
-			get ;
-			set ;
-		}
-				
-		uint VideoBitrate {
-			get;
-			set ;
-		}
-		
-		uint AudioBitrate {
-			get ;
-			set ;
-		}
-		
-		int CurrentTime {
-			get ;
-		}
-		
-		Pixbuf CurrentFrame {
-			get;
-		}
-		
-		string DeviceID {
-			set;
-			get;
-		}
-		
-		bool SetVideoEncoder(VideoEncoderType type);
-		
-		bool SetAudioEncoder(AudioEncoderType type);
-		
-		bool SetVideoMuxer(VideoMuxerType type);
-		
-		bool SetSource(CaptureSourceType type);
-		
-		void TogglePause();
-		
-		void Start();
-		
-		void Stop();
-		
-		void Run();
-		
-		void Close();
-		
-		void Dispose();
-	}
-}
+// ICapturer.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Common;
+using Gdk;
+
+namespace LongoMatch.Video.Capturer
+{
+	
+	
+	public interface ICapturer
+	{	
+		event EllpasedTimeHandler EllapsedTime;
+		event ErrorHandler Error;
+		event DeviceChangeHandler DeviceChange;
+			
+		uint OutputWidth {
+			get ;
+			set ;
+		}
+
+		uint OutputHeight {
+			get;
+			set ;
+		}
+		
+		 string OutputFile {
+			get ;
+			set ;
+		}
+				
+		uint VideoBitrate {
+			get;
+			set ;
+		}
+		
+		uint AudioBitrate {
+			get ;
+			set ;
+		}
+		
+		int CurrentTime {
+			get ;
+		}
+		
+		Pixbuf CurrentFrame {
+			get;
+		}
+		
+		string DeviceID {
+			set;
+			get;
+		}
+		
+		bool SetVideoEncoder(VideoEncoderType type);
+		
+		bool SetAudioEncoder(AudioEncoderType type);
+		
+		bool SetVideoMuxer(VideoMuxerType type);
+		
+		bool SetSource(CaptureSourceType type);
+		
+		void TogglePause();
+		
+		void Start();
+		
+		void Stop();
+		
+		void Run();
+		
+		void Close();
+		
+		void Dispose();
+	}
+}
diff --git a/CesarPlayer/Capturer/ObjectManager.cs b/CesarPlayer/Capturer/ObjectManager.cs
index ed2be4c..1e4ff83 100644
--- a/CesarPlayer/Capturer/ObjectManager.cs
+++ b/CesarPlayer/Capturer/ObjectManager.cs
@@ -1,39 +1,39 @@
-// ObjectManager.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-// This file was generated by the Gtk# code generator.
-// Any changes made will be lost if regenerated.
-
-namespace LongoMatch.GtkSharp.Capturer {
-
-	public class ObjectManager {
-
-		static bool initialized = false;
-		// Call this method from the appropriate module init function.
-		public static void Initialize ()
-		{
-			if (initialized)
-				return;
-
-			initialized = true;
-
-			GLib.GType.Register (LongoMatch.Video.Capturer.GstCameraCapturer.GType, typeof (LongoMatch.Video.Capturer.GstCameraCapturer));
-		}
-	}
-}
+// ObjectManager.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+// This file was generated by the Gtk# code generator.
+// Any changes made will be lost if regenerated.
+
+namespace LongoMatch.GtkSharp.Capturer {
+
+	public class ObjectManager {
+
+		static bool initialized = false;
+		// Call this method from the appropriate module init function.
+		public static void Initialize ()
+		{
+			if (initialized)
+				return;
+
+			initialized = true;
+
+			GLib.GType.Register (LongoMatch.Video.Capturer.GstCameraCapturer.GType, typeof (LongoMatch.Video.Capturer.GstCameraCapturer));
+		}
+	}
+}
diff --git a/CesarPlayer/Editor/GstVideoSplitter.cs b/CesarPlayer/Editor/GstVideoSplitter.cs
index c97c1cb..7c298a9 100644
--- a/CesarPlayer/Editor/GstVideoSplitter.cs
+++ b/CesarPlayer/Editor/GstVideoSplitter.cs
@@ -1,433 +1,433 @@
-// GstVideoSplitter.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-namespace LongoMatch.Video.Editor {
-
-	using System;
-	using System.Collections;
-	using System.Runtime.InteropServices;
-	using LongoMatch.Video.Common;
-
-
-	public class GstVideoSplitter : GLib.Object, IVideoEditor, IVideoSplitter {
-
-		[DllImport("libcesarplayer.dll")]
-		static extern unsafe IntPtr gst_video_editor_new(out IntPtr err);
-
-		public event ProgressHandler Progress;
-		
-		public unsafe GstVideoSplitter () : base (IntPtr.Zero)
-		{
-			if (GetType () != typeof (GstVideoSplitter)) {
-				throw new InvalidOperationException ("Can't override this constructor.");
-			}
-			IntPtr error = IntPtr.Zero;
-			Raw = gst_video_editor_new(out error);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			PercentCompleted += delegate(object o, PercentCompletedArgs args) {
-				if (Progress!= null)
-					Progress (args.Percent);
-			};
-		}
-
-		#region Properties
-		
-		[GLib.Property ("enable-audio")]
-		public bool EnableAudio {
-			get {
-				GLib.Value val = GetProperty ("enable-audio");
-				bool ret = (bool) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("enable-audio", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("enable-title")]
-		public bool EnableTitle {
-			get {
-				GLib.Value val = GetProperty ("enable-title");
-				bool ret = (bool) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("enable-title", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("video_bitrate")]
-		public int VideoBitrate {
-			get {
-				GLib.Value val = GetProperty ("video_bitrate");
-				int ret = (int) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("video_bitrate", val);
-				val.Dispose ();
-			}
-		}
-
-		[GLib.Property ("audio_bitrate")]
-		public int AudioBitrate {
-			get {
-				GLib.Value val = GetProperty ("audio_bitrate");
-				int ret = (int) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("audio_bitrate", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("width")]
-		public int Width {
-			get {
-				GLib.Value val = GetProperty ("width");
-				int ret = (int) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("width", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("height")]
-		public int Height {
-			get {
-				GLib.Value val = GetProperty ("height");
-				int ret = (int) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);
-				SetProperty("height", val);
-				val.Dispose ();
-			}
-		}
-		
-		[GLib.Property ("output_file")]
-		public string OutputFile {
-			get {
-				GLib.Value val = GetProperty ("output_file");
-				string ret = (string) val;
-				val.Dispose ();
-				return ret;
-			}
-			set {
-				GLib.Value val = new GLib.Value(value);				
-				SetProperty("output_file", val);
-				val.Dispose ();
-			}
-		}
-		
-		#endregion
-
-		
-		
-		#region GSignals
-#pragma warning disable 0169
-		[GLib.CDeclCallback]
-		delegate void ErrorVMDelegate (IntPtr gvc, IntPtr message);
-
-		static ErrorVMDelegate ErrorVMCallback;
-
-		static void error_cb (IntPtr gvc, IntPtr message)
-		{
-			try {
-				GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
-				gvc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		private static void OverrideError (GLib.GType gtype)
-		{
-			if (ErrorVMCallback == null)
-				ErrorVMCallback = new ErrorVMDelegate (error_cb);
-			OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
-		}
-
-		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverrideError")]
-		protected virtual void OnError (string message)
-		{
-			GLib.Value ret = GLib.Value.Empty;
-			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-			GLib.Value[] vals = new GLib.Value [2];
-			vals [0] = new GLib.Value (this);
-			inst_and_params.Append (vals [0]);
-			vals [1] = new GLib.Value (message);
-			inst_and_params.Append (vals [1]);
-			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-			foreach (GLib.Value v in vals)
-				v.Dispose ();
-		}
-
-		[GLib.Signal("error")]
-		public event ErrorHandler Error {
-			add {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
-				sig.AddDelegate (value);
-			}
-			remove {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
-				sig.RemoveDelegate (value);
-			}
-		}
-		
-
-		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-		delegate void PercentCompletedVMDelegate (IntPtr gvc, float percent);
-
-		static PercentCompletedVMDelegate PercentCompletedVMCallback;
-
-		static void percentcompleted_cb (IntPtr gvc, float percent)
-		{
-			try {
-				GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
-				gvc_managed.OnPercentCompleted (percent);
-			} catch (Exception e) {
-				GLib.ExceptionManager.RaiseUnhandledException (e, false);
-			}
-		}
-
-		private static void OverridePercentCompleted (GLib.GType gtype)
-		{
-			if (PercentCompletedVMCallback == null)
-				PercentCompletedVMCallback = new PercentCompletedVMDelegate (percentcompleted_cb);
-			OverrideVirtualMethod (gtype, "percent_completed", PercentCompletedVMCallback);
-		}
-
-		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverridePercentCompleted")]
-		protected virtual void OnPercentCompleted (float percent)
-		{
-			GLib.Value ret = GLib.Value.Empty;
-			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
-			GLib.Value[] vals = new GLib.Value [2];
-			vals [0] = new GLib.Value (this);
-			inst_and_params.Append (vals [0]);
-			vals [1] = new GLib.Value (percent);
-			inst_and_params.Append (vals [1]);
-			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
-			foreach (GLib.Value v in vals)
-				v.Dispose ();
-		}
-
-		[GLib.Signal("percent_completed")]
-		public event PercentCompletedHandler PercentCompleted {
-			add {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
-				sig.AddDelegate (value);
-			}
-			remove {
-				GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
-				sig.RemoveDelegate (value);
-			}
-		}
-#pragma warning restore 0169
-		#endregion
-		
-		#region Public Methods
-
-		[DllImport("libcesarplayer.dll")]
-		static extern IntPtr gst_video_editor_get_type();
-
-		public static new GLib.GType GType { 
-			get {
-				IntPtr raw_ret = gst_video_editor_get_type();
-				GLib.GType ret = new GLib.GType(raw_ret);
-				return ret;
-			}
-		}
-		
-		
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_clear_segments_list(IntPtr raw);
-
-		public void ClearList() {
-			gst_video_editor_clear_segments_list(Handle);
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_add_segment(IntPtr raw, string file_path, long start, long duration, double rate, IntPtr title, bool hasAudio);
-
-		public void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
-			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
-				filePath="file:///"+filePath;
-			gst_video_editor_add_segment(Handle, filePath, start, duration, rate, GLib.Marshaller.StringToPtrGStrdup(title), hasAudio);
-		}
-		
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_start(IntPtr raw);
-
-		public void Start() {
-			gst_video_editor_start(Handle);
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_cancel(IntPtr raw);
-
-		public void Cancel() {
-			// The handle might have already been dealocated
-			try{
-				gst_video_editor_cancel(Handle);
-			}catch{
-			}
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_set_video_encoder(IntPtr raw, out IntPtr error_ptr, int type);
-
-		public void SetVideoEncoder(out string error, VideoEncoderType codec) {
-			IntPtr error_ptr = IntPtr.Zero;
-			gst_video_editor_set_video_encoder(Handle,out error_ptr,(int)codec);
-			if (error_ptr != IntPtr.Zero)
-				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
-			else
-				error = null;
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_set_audio_encoder(IntPtr raw, out IntPtr error_ptr, int type);
-
-		public void SetAudioEncoder(out string error, AudioEncoderType codec) {
-			IntPtr error_ptr = IntPtr.Zero;
-			gst_video_editor_set_audio_encoder(Handle,out error_ptr,(int)codec);
-			if (error_ptr != IntPtr.Zero)
-				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
-			else
-				error = null;
-		}
-		
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_set_video_muxer(IntPtr raw, out IntPtr error_ptr, int type);
-
-		public void SetVideoMuxer(out string error, VideoMuxerType muxer) {
-			IntPtr error_ptr = IntPtr.Zero;
-			gst_video_editor_set_video_muxer(Handle,out error_ptr,(int)muxer);
-			if (error_ptr != IntPtr.Zero)
-				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
-			else
-				error = null;
-		}
-
-		[DllImport("libcesarplayer.dll")]
-		static extern void gst_video_editor_init_backend(out int argc, IntPtr argv);
-
-		public static int InitBackend(string argv) {
-			int argc;
-			gst_video_editor_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
-			return argc;
-		}
-		
-		
-		public void SetSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio){
-			ClearList();
-			AddSegment(filePath, start, duration, rate, title,hasAudio);
-		}
-		
-		public VideoQuality VideoQuality{
-			set{VideoBitrate=(int)value;}
-		}
-		
-		public AudioQuality AudioQuality{
-			set{AudioBitrate = (int)value;}
-		}
-		
-		public VideoFormat VideoFormat{
-			set{
-				if (value == VideoFormat.PORTABLE){
-					Height = 240;
-					Width = 320;
-				}
-				else if (value == VideoFormat.VGA){
-					Height = 480 ;
-					Width = 640;
-				}
-				else if (value == VideoFormat.TV){
-					Height = 576;
-					Width = 720;
-				}
-				else if (value == VideoFormat.HD720p){
-					Height = 720;
-					Width = 1280;
-				}
-				else if (value == VideoFormat.HD1080p){
-					Height = 1080;
-					Width = 1920;
-				}
-			}
-		}
-		
-		public AudioEncoderType AudioEncoder{
-			set{
-				string error;
-				SetAudioEncoder(out error,value);
-				if (error != null)
-					throw new Exception(error);
-			}
-		}
-		
-		public VideoEncoderType VideoEncoder{
-			set{
-				string error;
-				SetVideoEncoder(out error, value);
-				if (error != null)
-					throw new Exception(error);
-			}
-		}
-		
-		public VideoMuxerType VideoMuxer{
-			set{
-				string error;
-				SetVideoMuxer(out error,value);
-				if (error != null)
-					throw new Exception(error);
-			}
-		}
-		
-		public string TempDir{
-			set{;}
-		}
-		
-		#endregion
-
-		
-	}
-}
+// GstVideoSplitter.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+namespace LongoMatch.Video.Editor {
+
+	using System;
+	using System.Collections;
+	using System.Runtime.InteropServices;
+	using LongoMatch.Video.Common;
+
+
+	public class GstVideoSplitter : GLib.Object, IVideoEditor, IVideoSplitter {
+
+		[DllImport("libcesarplayer.dll")]
+		static extern unsafe IntPtr gst_video_editor_new(out IntPtr err);
+
+		public event ProgressHandler Progress;
+		
+		public unsafe GstVideoSplitter () : base (IntPtr.Zero)
+		{
+			if (GetType () != typeof (GstVideoSplitter)) {
+				throw new InvalidOperationException ("Can't override this constructor.");
+			}
+			IntPtr error = IntPtr.Zero;
+			Raw = gst_video_editor_new(out error);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			PercentCompleted += delegate(object o, PercentCompletedArgs args) {
+				if (Progress!= null)
+					Progress (args.Percent);
+			};
+		}
+
+		#region Properties
+		
+		[GLib.Property ("enable-audio")]
+		public bool EnableAudio {
+			get {
+				GLib.Value val = GetProperty ("enable-audio");
+				bool ret = (bool) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("enable-audio", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("enable-title")]
+		public bool EnableTitle {
+			get {
+				GLib.Value val = GetProperty ("enable-title");
+				bool ret = (bool) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("enable-title", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("video_bitrate")]
+		public int VideoBitrate {
+			get {
+				GLib.Value val = GetProperty ("video_bitrate");
+				int ret = (int) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("video_bitrate", val);
+				val.Dispose ();
+			}
+		}
+
+		[GLib.Property ("audio_bitrate")]
+		public int AudioBitrate {
+			get {
+				GLib.Value val = GetProperty ("audio_bitrate");
+				int ret = (int) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("audio_bitrate", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("width")]
+		public int Width {
+			get {
+				GLib.Value val = GetProperty ("width");
+				int ret = (int) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("width", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("height")]
+		public int Height {
+			get {
+				GLib.Value val = GetProperty ("height");
+				int ret = (int) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);
+				SetProperty("height", val);
+				val.Dispose ();
+			}
+		}
+		
+		[GLib.Property ("output_file")]
+		public string OutputFile {
+			get {
+				GLib.Value val = GetProperty ("output_file");
+				string ret = (string) val;
+				val.Dispose ();
+				return ret;
+			}
+			set {
+				GLib.Value val = new GLib.Value(value);				
+				SetProperty("output_file", val);
+				val.Dispose ();
+			}
+		}
+		
+		#endregion
+
+		
+		
+		#region GSignals
+#pragma warning disable 0169
+		[GLib.CDeclCallback]
+		delegate void ErrorVMDelegate (IntPtr gvc, IntPtr message);
+
+		static ErrorVMDelegate ErrorVMCallback;
+
+		static void error_cb (IntPtr gvc, IntPtr message)
+		{
+			try {
+				GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
+				gvc_managed.OnError (GLib.Marshaller.Utf8PtrToString (message));
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		private static void OverrideError (GLib.GType gtype)
+		{
+			if (ErrorVMCallback == null)
+				ErrorVMCallback = new ErrorVMDelegate (error_cb);
+			OverrideVirtualMethod (gtype, "error", ErrorVMCallback);
+		}
+
+		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverrideError")]
+		protected virtual void OnError (string message)
+		{
+			GLib.Value ret = GLib.Value.Empty;
+			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+			GLib.Value[] vals = new GLib.Value [2];
+			vals [0] = new GLib.Value (this);
+			inst_and_params.Append (vals [0]);
+			vals [1] = new GLib.Value (message);
+			inst_and_params.Append (vals [1]);
+			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+			foreach (GLib.Value v in vals)
+				v.Dispose ();
+		}
+
+		[GLib.Signal("error")]
+		public event ErrorHandler Error {
+			add {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+				sig.AddDelegate (value);
+			}
+			remove {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "error", typeof (ErrorArgs));
+				sig.RemoveDelegate (value);
+			}
+		}
+		
+
+		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+		delegate void PercentCompletedVMDelegate (IntPtr gvc, float percent);
+
+		static PercentCompletedVMDelegate PercentCompletedVMCallback;
+
+		static void percentcompleted_cb (IntPtr gvc, float percent)
+		{
+			try {
+				GstVideoSplitter gvc_managed = GLib.Object.GetObject (gvc, false) as GstVideoSplitter;
+				gvc_managed.OnPercentCompleted (percent);
+			} catch (Exception e) {
+				GLib.ExceptionManager.RaiseUnhandledException (e, false);
+			}
+		}
+
+		private static void OverridePercentCompleted (GLib.GType gtype)
+		{
+			if (PercentCompletedVMCallback == null)
+				PercentCompletedVMCallback = new PercentCompletedVMDelegate (percentcompleted_cb);
+			OverrideVirtualMethod (gtype, "percent_completed", PercentCompletedVMCallback);
+		}
+
+		[GLib.DefaultSignalHandler(Type=typeof(LongoMatch.Video.Editor.GstVideoSplitter), ConnectionMethod="OverridePercentCompleted")]
+		protected virtual void OnPercentCompleted (float percent)
+		{
+			GLib.Value ret = GLib.Value.Empty;
+			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
+			GLib.Value[] vals = new GLib.Value [2];
+			vals [0] = new GLib.Value (this);
+			inst_and_params.Append (vals [0]);
+			vals [1] = new GLib.Value (percent);
+			inst_and_params.Append (vals [1]);
+			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
+			foreach (GLib.Value v in vals)
+				v.Dispose ();
+		}
+
+		[GLib.Signal("percent_completed")]
+		public event PercentCompletedHandler PercentCompleted {
+			add {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
+				sig.AddDelegate (value);
+			}
+			remove {
+				GLib.Signal sig = GLib.Signal.Lookup (this, "percent_completed", typeof (PercentCompletedArgs));
+				sig.RemoveDelegate (value);
+			}
+		}
+#pragma warning restore 0169
+		#endregion
+		
+		#region Public Methods
+
+		[DllImport("libcesarplayer.dll")]
+		static extern IntPtr gst_video_editor_get_type();
+
+		public static new GLib.GType GType { 
+			get {
+				IntPtr raw_ret = gst_video_editor_get_type();
+				GLib.GType ret = new GLib.GType(raw_ret);
+				return ret;
+			}
+		}
+		
+		
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_clear_segments_list(IntPtr raw);
+
+		public void ClearList() {
+			gst_video_editor_clear_segments_list(Handle);
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_add_segment(IntPtr raw, string file_path, long start, long duration, double rate, IntPtr title, bool hasAudio);
+
+		public void AddSegment(string filePath, long start, long duration, double rate, string title, bool hasAudio) {
+			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+				filePath="file:///"+filePath;
+			gst_video_editor_add_segment(Handle, filePath, start, duration, rate, GLib.Marshaller.StringToPtrGStrdup(title), hasAudio);
+		}
+		
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_start(IntPtr raw);
+
+		public void Start() {
+			gst_video_editor_start(Handle);
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_cancel(IntPtr raw);
+
+		public void Cancel() {
+			// The handle might have already been dealocated
+			try{
+				gst_video_editor_cancel(Handle);
+			}catch{
+			}
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_set_video_encoder(IntPtr raw, out IntPtr error_ptr, int type);
+
+		public void SetVideoEncoder(out string error, VideoEncoderType codec) {
+			IntPtr error_ptr = IntPtr.Zero;
+			gst_video_editor_set_video_encoder(Handle,out error_ptr,(int)codec);
+			if (error_ptr != IntPtr.Zero)
+				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+			else
+				error = null;
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_set_audio_encoder(IntPtr raw, out IntPtr error_ptr, int type);
+
+		public void SetAudioEncoder(out string error, AudioEncoderType codec) {
+			IntPtr error_ptr = IntPtr.Zero;
+			gst_video_editor_set_audio_encoder(Handle,out error_ptr,(int)codec);
+			if (error_ptr != IntPtr.Zero)
+				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+			else
+				error = null;
+		}
+		
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_set_video_muxer(IntPtr raw, out IntPtr error_ptr, int type);
+
+		public void SetVideoMuxer(out string error, VideoMuxerType muxer) {
+			IntPtr error_ptr = IntPtr.Zero;
+			gst_video_editor_set_video_muxer(Handle,out error_ptr,(int)muxer);
+			if (error_ptr != IntPtr.Zero)
+				error = GLib.Marshaller.Utf8PtrToString(error_ptr);
+			else
+				error = null;
+		}
+
+		[DllImport("libcesarplayer.dll")]
+		static extern void gst_video_editor_init_backend(out int argc, IntPtr argv);
+
+		public static int InitBackend(string argv) {
+			int argc;
+			gst_video_editor_init_backend(out argc, GLib.Marshaller.StringToPtrGStrdup(argv));
+			return argc;
+		}
+		
+		
+		public void SetSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio){
+			ClearList();
+			AddSegment(filePath, start, duration, rate, title,hasAudio);
+		}
+		
+		public VideoQuality VideoQuality{
+			set{VideoBitrate=(int)value;}
+		}
+		
+		public AudioQuality AudioQuality{
+			set{AudioBitrate = (int)value;}
+		}
+		
+		public VideoFormat VideoFormat{
+			set{
+				if (value == VideoFormat.PORTABLE){
+					Height = 240;
+					Width = 320;
+				}
+				else if (value == VideoFormat.VGA){
+					Height = 480 ;
+					Width = 640;
+				}
+				else if (value == VideoFormat.TV){
+					Height = 576;
+					Width = 720;
+				}
+				else if (value == VideoFormat.HD720p){
+					Height = 720;
+					Width = 1280;
+				}
+				else if (value == VideoFormat.HD1080p){
+					Height = 1080;
+					Width = 1920;
+				}
+			}
+		}
+		
+		public AudioEncoderType AudioEncoder{
+			set{
+				string error;
+				SetAudioEncoder(out error,value);
+				if (error != null)
+					throw new Exception(error);
+			}
+		}
+		
+		public VideoEncoderType VideoEncoder{
+			set{
+				string error;
+				SetVideoEncoder(out error, value);
+				if (error != null)
+					throw new Exception(error);
+			}
+		}
+		
+		public VideoMuxerType VideoMuxer{
+			set{
+				string error;
+				SetVideoMuxer(out error,value);
+				if (error != null)
+					throw new Exception(error);
+			}
+		}
+		
+		public string TempDir{
+			set{;}
+		}
+		
+		#endregion
+
+		
+	}
+}
diff --git a/CesarPlayer/Editor/IVideoEditor.cs b/CesarPlayer/Editor/IVideoEditor.cs
index 68cc46c..0bc4c1b 100644
--- a/CesarPlayer/Editor/IVideoEditor.cs
+++ b/CesarPlayer/Editor/IVideoEditor.cs
@@ -1,83 +1,83 @@
-// IVideoEditor.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using LongoMatch.Video.Common;
-
-namespace LongoMatch.Video.Editor
-{
-	
-	
-	public interface IVideoEditor
-	{
-		event ProgressHandler Progress;		
-		
-		VideoQuality VideoQuality{
-			set;
-		}
-		
-		AudioQuality AudioQuality{
-			set;
-		}
-		
-		VideoFormat VideoFormat{
-			set;
-		}
-		
-		AudioEncoderType AudioEncoder{
-			set;
-		}
-		
-		VideoEncoderType VideoEncoder{
-			set;
-		}
-		
-		VideoMuxerType VideoMuxer{
-			set;
-		}		
-		
-		string OutputFile{
-			set;
-		}
-		
-		string TempDir{
-			set;
-		}
-		
-		bool EnableTitle{
-			set;
-		}
-		
-		bool EnableAudio{
-			set;
-		}
-		
-			
-		void AddSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
-		
-		void ClearList();
-		
-		void Start();		
-		
-		void Cancel();
-		
-	}
-}
+// IVideoEditor.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video.Editor
+{
+	
+	
+	public interface IVideoEditor
+	{
+		event ProgressHandler Progress;		
+		
+		VideoQuality VideoQuality{
+			set;
+		}
+		
+		AudioQuality AudioQuality{
+			set;
+		}
+		
+		VideoFormat VideoFormat{
+			set;
+		}
+		
+		AudioEncoderType AudioEncoder{
+			set;
+		}
+		
+		VideoEncoderType VideoEncoder{
+			set;
+		}
+		
+		VideoMuxerType VideoMuxer{
+			set;
+		}		
+		
+		string OutputFile{
+			set;
+		}
+		
+		string TempDir{
+			set;
+		}
+		
+		bool EnableTitle{
+			set;
+		}
+		
+		bool EnableAudio{
+			set;
+		}
+		
+			
+		void AddSegment (string filePath, long start, long duration, double rate, string title, bool hasAudio) ;
+		
+		void ClearList();
+		
+		void Start();		
+		
+		void Cancel();
+		
+	}
+}
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
index 304ea6f..bc4fd1c 100644
--- a/CesarPlayer/Gui/CapturerBin.cs
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -1,362 +1,362 @@
-// CapturerBin.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Gdk;
-using GLib;
-using LongoMatch.Video;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Capturer;
-using LongoMatch.Video.Utils;
-using Mono.Unix;
-
-namespace LongoMatch.Gui
-{
-	
-	
+// CapturerBin.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using GLib;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+namespace LongoMatch.Gui
+{
+	
+	
 	[System.ComponentModel.Category("CesarPlayer")]
 	[System.ComponentModel.ToolboxItem(true)]
-	public partial class CapturerBin : Gtk.Bin
-	{
-		public event EventHandler CaptureFinished;
-		public event ErrorHandler Error;
-		
-		private Pixbuf logopix;
-		private CapturePropertiesStruct captureProps;
-		private CapturerType capturerType;
-		private bool captureStarted;
-		private bool capturing;
-		private const int THUMBNAIL_MAX_WIDTH = 100;		
-		
-		ICapturer capturer;
-		
-		public CapturerBin()
-		{
-			this.Build();
-			captureProps = new CapturePropertiesStruct();
-			captureProps.Width = 320;
-			captureProps.Height = 240;
-			captureProps.VideoBitrate = 1000;
-			captureProps.AudioBitrate = 128;
-			captureProps.VideoEncoder = VideoEncoderType.H264;
-			captureProps.AudioEncoder = AudioEncoderType.Aac;
-			captureProps.Muxer = VideoMuxerType.Mp4;
-			captureProps.OutputFile = "";
-			captureProps.CaptureSourceType = CaptureSourceType.Raw;
-			Type = CapturerType.Fake;
-		}		
-		
-		public CapturerType Type {
-			set {
-				/* Close any previous instance of the capturer */
-				Close();
-
-				MultimediaFactory factory = new MultimediaFactory();
-				capturer = factory.getCapturer(value);	
-				capturer.EllapsedTime += OnTick;
-				if (value != CapturerType.Fake){
-					capturer.Error += OnError;
-					capturer.DeviceChange += OnDeviceChange;
-					capturerhbox.Add((Widget)capturer);
-					(capturer as Widget).Visible = true;
-					capturerhbox.Visible = true;
-					logodrawingarea.Visible = false;
-				}
-				else{
-					logodrawingarea.Visible = true;
-					capturerhbox.Visible = false;
-				}
-				SetProperties();
-				capturerType = value;
-			}
-
-		}
-		
-		public string Logo{
-			set{
-				try{
-					this.logopix = new Pixbuf(value);
-				}catch{
-					/* FIXME: Add log */
-				}
-			}
-		}
-		
-		public int CurrentTime {
-			get {
-				if (capturer == null)
-					return -1;
-				return capturer.CurrentTime;
-			}
-		}
-		
-		public bool Capturing{
-			get{
-				return capturing;
-			}
-		}
-		
-		public CapturePropertiesStruct CaptureProperties{
-			set{
-				captureProps = value;
-			}
-		}
-		
-		public void Start(){
-			if (capturer == null)
-				return;
-			
-			capturing = true;
-			captureStarted = true;
-			recbutton.Visible = false;
-			pausebutton.Visible = true;
-			stopbutton.Visible = true;
-			capturer.Start();
-		}
-		
-		public void TogglePause(){
-			if (capturer == null)
-				return;
-			
-			capturing = !capturing;
-			recbutton.Visible = !capturing;
-			pausebutton.Visible = capturing;
-			capturer.TogglePause();
-		}
-		
-		public void Stop() {
-			if (capturer != null){
-				capturing = false;
-				capturer.Stop();
-			}
-		}
-		
-		public void Run(){
-			if (capturer != null)
-				capturer.Run();
+	public partial class CapturerBin : Gtk.Bin
+	{
+		public event EventHandler CaptureFinished;
+		public event ErrorHandler Error;
+		
+		private Pixbuf logopix;
+		private CapturePropertiesStruct captureProps;
+		private CapturerType capturerType;
+		private bool captureStarted;
+		private bool capturing;
+		private const int THUMBNAIL_MAX_WIDTH = 100;		
+		
+		ICapturer capturer;
+		
+		public CapturerBin()
+		{
+			this.Build();
+			captureProps = new CapturePropertiesStruct();
+			captureProps.Width = 320;
+			captureProps.Height = 240;
+			captureProps.VideoBitrate = 1000;
+			captureProps.AudioBitrate = 128;
+			captureProps.VideoEncoder = VideoEncoderType.H264;
+			captureProps.AudioEncoder = AudioEncoderType.Aac;
+			captureProps.Muxer = VideoMuxerType.Mp4;
+			captureProps.OutputFile = "";
+			captureProps.CaptureSourceType = CaptureSourceType.Raw;
+			Type = CapturerType.Fake;
+		}		
+		
+		public CapturerType Type {
+			set {
+				/* Close any previous instance of the capturer */
+				Close();
+
+				MultimediaFactory factory = new MultimediaFactory();
+				capturer = factory.getCapturer(value);	
+				capturer.EllapsedTime += OnTick;
+				if (value != CapturerType.Fake){
+					capturer.Error += OnError;
+					capturer.DeviceChange += OnDeviceChange;
+					capturerhbox.Add((Widget)capturer);
+					(capturer as Widget).Visible = true;
+					capturerhbox.Visible = true;
+					logodrawingarea.Visible = false;
+				}
+				else{
+					logodrawingarea.Visible = true;
+					capturerhbox.Visible = false;
+				}
+				SetProperties();
+				capturerType = value;
+			}
+
+		}
+		
+		public string Logo{
+			set{
+				try{
+					this.logopix = new Pixbuf(value);
+				}catch{
+					/* FIXME: Add log */
+				}
+			}
+		}
+		
+		public int CurrentTime {
+			get {
+				if (capturer == null)
+					return -1;
+				return capturer.CurrentTime;
+			}
+		}
+		
+		public bool Capturing{
+			get{
+				return capturing;
+			}
+		}
+		
+		public CapturePropertiesStruct CaptureProperties{
+			set{
+				captureProps = value;
+			}
+		}
+		
+		public void Start(){
+			if (capturer == null)
+				return;
+			
+			capturing = true;
+			captureStarted = true;
+			recbutton.Visible = false;
+			pausebutton.Visible = true;
+			stopbutton.Visible = true;
+			capturer.Start();
+		}
+		
+		public void TogglePause(){
+			if (capturer == null)
+				return;
+			
+			capturing = !capturing;
+			recbutton.Visible = !capturing;
+			pausebutton.Visible = capturing;
+			capturer.TogglePause();
+		}
+		
+		public void Stop() {
+			if (capturer != null){
+				capturing = false;
+				capturer.Stop();
+			}
+		}
+		
+		public void Run(){
+			if (capturer != null)
+				capturer.Run();
 		}
 
-		public void Close(){
-			/* resetting common properties */
-			pausebutton.Visible = false;
-			stopbutton.Visible = false;
+		public void Close(){
+			/* resetting common properties */
+			pausebutton.Visible = false;
+			stopbutton.Visible = false;
 			recbutton.Visible = true;
-			captureStarted = false;
-			capturing = false;
+			captureStarted = false;
+			capturing = false;
 			OnTick(0);
-			
-			if (capturer == null)
-			return;
-			
-			/* stopping and closing capturer */
+			
+			if (capturer == null)
+			return;
+			
+			/* stopping and closing capturer */
 			try {
-				capturer.Stop();
-				capturer.Close();
-				if (capturerType == CapturerType.Live){
-					/* release and dispose live capturer */
-					capturer.Error -= OnError;
-					capturer.DeviceChange += OnDeviceChange;
-					capturerhbox.Remove(capturer as Gtk.Widget);
-					capturer.Dispose();
-				}
+				capturer.Stop();
+				capturer.Close();
+				if (capturerType == CapturerType.Live){
+					/* release and dispose live capturer */
+					capturer.Error -= OnError;
+					capturer.DeviceChange += OnDeviceChange;
+					capturerhbox.Remove(capturer as Gtk.Widget);
+					capturer.Dispose();
+				}
 			} catch (Exception e) {}
-			capturer = null;
-		}
-		
-		public Pixbuf CurrentMiniatureFrame {
-			get {
-				int h, w;
-				double rate;
-				Pixbuf scaled_pix;
-				Pixbuf pix;
-				
-				if (capturer == null)
-					return null;
-				
-				pix = capturer.CurrentFrame;
-				
-				if (pix == null)
-					return null;
-				
-				w = pix.Width;
-				h = pix.Height;
-				rate = (double)w / (double)h;
-				
-				if (h > w) {
-					w = (int)(THUMBNAIL_MAX_WIDTH * rate);
-					h = THUMBNAIL_MAX_WIDTH;
-				} else {
-					h = (int)(THUMBNAIL_MAX_WIDTH / rate);
-					w = THUMBNAIL_MAX_WIDTH;
-				}
-				scaled_pix = pix.ScaleSimple (w, h, Gdk.InterpType.Bilinear);
-				pix.Dispose();
-					
-				return scaled_pix;				                       
-			}
-		}
-		
-		private void SetProperties(){
-			if (capturer == null)
-				return;
-			
-			capturer.DeviceID = captureProps.DeviceID;
-			capturer.OutputFile = captureProps.OutputFile;
-			capturer.OutputHeight = captureProps.Height;
-			capturer.OutputWidth = captureProps.Width;
-			capturer.SetVideoEncoder(captureProps.VideoEncoder);
-			capturer.SetAudioEncoder(captureProps.AudioEncoder);
-			capturer.SetVideoMuxer(captureProps.Muxer);	
-			capturer.SetSource(captureProps.CaptureSourceType);
-			capturer.VideoBitrate = captureProps.VideoBitrate;
-			capturer.AudioBitrate = captureProps.AudioBitrate;
-		}
-
-		protected virtual void OnRecbuttonClicked (object sender, System.EventArgs e)
-		{
-			if (capturer == null)
-				return;
-			
-			if (captureStarted == true){
-				if (capturing)
-					return;
-				TogglePause();
-			}
-			else
-				Start();	
-		}
-
-		protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
-		{
-			if (capturer != null && capturing)
-				TogglePause();						
-		}
-
-		protected virtual void OnStopbuttonClicked (object sender, System.EventArgs e)
-		{
-			int res;
-			
-			if (capturer == null)
-				return;
-			
-			MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
-			                                     Catalog.GetString("You are going to stop and finish the current capture."+"\n"+
-			                                                       "Do you want to proceed?"));
-			res = md.Run();
-			md.Destroy();
-			if (res == (int)ResponseType.Yes){
-				md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
-				                                     Catalog.GetString("Finalizing file. This can take a while"));
-				md.Show();
-				Stop();
-				md.Destroy();
-				recbutton.Visible = true;
-				pausebutton.Visible = false;
-				stopbutton.Visible = false;
-				if (CaptureFinished != null)
-					CaptureFinished(this, new EventArgs());
-			}
-		}				
-		
-		protected virtual void OnTick (int ellapsedTime){
-			timelabel.Text = "Time: " + TimeString.MSecondsToSecondsString(CurrentTime);
-		}
-		
-		protected virtual void OnError (object o, ErrorArgs args)
-		{
-			if (Error != null)
-				Error (o, args);
-			
-			Close();
-		}
-		
-		protected virtual void OnDeviceChange (object o, DeviceChangeArgs args)
-		{
-			/* device disconnected, pause capture */
-			if (args.DeviceChange == -1){				
-				if (capturing) 
-					TogglePause();
-					
-				recbutton.Sensitive = false;
-				
-				MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
-				                                     MessageType.Question, ButtonsType.Ok,
-				                                     Catalog.GetString("Device disconnected. " +
-				                                     	"The capture will be paused"));
-				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
-				md.Run();
-				md.Destroy();			
-			} else {
-				recbutton.Sensitive = true;
-				MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
-				                                     MessageType.Question, ButtonsType.YesNo,
-				                                     Catalog.GetString("Device reconnected." +
-				                                     	"Do you want to restart the capture?"));
-				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
-				if (md.Run() == (int)ResponseType.Yes){
-					Console.WriteLine ("Accepted to toggle pause");
-					TogglePause();
-				}
-				md.Destroy();
-			}				
-		}
-		
-		protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
-		{	
-			Gdk.Window win;
-			Pixbuf frame;
-			int width, height, allocWidth, allocHeight, logoX, logoY;
-			float ratio;
-			
-			if (logopix == null)
-				return;
-
-			win = logodrawingarea.GdkWindow;
-			width = logopix.Width;
-			height = logopix.Height;
-			allocWidth = logodrawingarea.Allocation.Width;
-			allocHeight = logodrawingarea.Allocation.Height;
-			
-			/* Checking if allocated space is smaller than our logo */
-			if ((float) allocWidth / width > (float) allocHeight / height) {
-				ratio = (float) allocHeight / height;
-			} else {
-				ratio = (float) allocWidth / width;
-			}
-			width = (int) (width * ratio);
-			height = (int) (height * ratio);
-			
-			logoX = (allocWidth / 2) - (width / 2);
-			logoY = (allocHeight / 2) - (height / 2);
-
-			/* Drawing our frame */
-			frame = new Pixbuf(Colorspace.Rgb, false, 8, allocWidth, allocHeight);
-			logopix.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY, 
-			                  ratio, ratio, InterpType.Bilinear, 255);
-			
-			win.DrawPixbuf (this.Style.BlackGC, frame, 0, 0,
-			                0, 0, allocWidth, allocHeight,
-			                RgbDither.Normal, 0, 0);
-			frame.Dispose();
-			return;
-		}
-	}
-}
+			capturer = null;
+		}
+		
+		public Pixbuf CurrentMiniatureFrame {
+			get {
+				int h, w;
+				double rate;
+				Pixbuf scaled_pix;
+				Pixbuf pix;
+				
+				if (capturer == null)
+					return null;
+				
+				pix = capturer.CurrentFrame;
+				
+				if (pix == null)
+					return null;
+				
+				w = pix.Width;
+				h = pix.Height;
+				rate = (double)w / (double)h;
+				
+				if (h > w) {
+					w = (int)(THUMBNAIL_MAX_WIDTH * rate);
+					h = THUMBNAIL_MAX_WIDTH;
+				} else {
+					h = (int)(THUMBNAIL_MAX_WIDTH / rate);
+					w = THUMBNAIL_MAX_WIDTH;
+				}
+				scaled_pix = pix.ScaleSimple (w, h, Gdk.InterpType.Bilinear);
+				pix.Dispose();
+					
+				return scaled_pix;				                       
+			}
+		}
+		
+		private void SetProperties(){
+			if (capturer == null)
+				return;
+			
+			capturer.DeviceID = captureProps.DeviceID;
+			capturer.OutputFile = captureProps.OutputFile;
+			capturer.OutputHeight = captureProps.Height;
+			capturer.OutputWidth = captureProps.Width;
+			capturer.SetVideoEncoder(captureProps.VideoEncoder);
+			capturer.SetAudioEncoder(captureProps.AudioEncoder);
+			capturer.SetVideoMuxer(captureProps.Muxer);	
+			capturer.SetSource(captureProps.CaptureSourceType);
+			capturer.VideoBitrate = captureProps.VideoBitrate;
+			capturer.AudioBitrate = captureProps.AudioBitrate;
+		}
+
+		protected virtual void OnRecbuttonClicked (object sender, System.EventArgs e)
+		{
+			if (capturer == null)
+				return;
+			
+			if (captureStarted == true){
+				if (capturing)
+					return;
+				TogglePause();
+			}
+			else
+				Start();	
+		}
+
+		protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
+		{
+			if (capturer != null && capturing)
+				TogglePause();						
+		}
+
+		protected virtual void OnStopbuttonClicked (object sender, System.EventArgs e)
+		{
+			int res;
+			
+			if (capturer == null)
+				return;
+			
+			MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
+			                                     Catalog.GetString("You are going to stop and finish the current capture."+"\n"+
+			                                                       "Do you want to proceed?"));
+			res = md.Run();
+			md.Destroy();
+			if (res == (int)ResponseType.Yes){
+				md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
+				                                     Catalog.GetString("Finalizing file. This can take a while"));
+				md.Show();
+				Stop();
+				md.Destroy();
+				recbutton.Visible = true;
+				pausebutton.Visible = false;
+				stopbutton.Visible = false;
+				if (CaptureFinished != null)
+					CaptureFinished(this, new EventArgs());
+			}
+		}				
+		
+		protected virtual void OnTick (int ellapsedTime){
+			timelabel.Text = "Time: " + TimeString.MSecondsToSecondsString(CurrentTime);
+		}
+		
+		protected virtual void OnError (object o, ErrorArgs args)
+		{
+			if (Error != null)
+				Error (o, args);
+			
+			Close();
+		}
+		
+		protected virtual void OnDeviceChange (object o, DeviceChangeArgs args)
+		{
+			/* device disconnected, pause capture */
+			if (args.DeviceChange == -1){				
+				if (capturing) 
+					TogglePause();
+					
+				recbutton.Sensitive = false;
+				
+				MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+				                                     MessageType.Question, ButtonsType.Ok,
+				                                     Catalog.GetString("Device disconnected. " +
+				                                     	"The capture will be paused"));
+				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
+				md.Run();
+				md.Destroy();			
+			} else {
+				recbutton.Sensitive = true;
+				MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+				                                     MessageType.Question, ButtonsType.YesNo,
+				                                     Catalog.GetString("Device reconnected." +
+				                                     	"Do you want to restart the capture?"));
+				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
+				if (md.Run() == (int)ResponseType.Yes){
+					Console.WriteLine ("Accepted to toggle pause");
+					TogglePause();
+				}
+				md.Destroy();
+			}				
+		}
+		
+		protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
+		{	
+			Gdk.Window win;
+			Pixbuf frame;
+			int width, height, allocWidth, allocHeight, logoX, logoY;
+			float ratio;
+			
+			if (logopix == null)
+				return;
+
+			win = logodrawingarea.GdkWindow;
+			width = logopix.Width;
+			height = logopix.Height;
+			allocWidth = logodrawingarea.Allocation.Width;
+			allocHeight = logodrawingarea.Allocation.Height;
+			
+			/* Checking if allocated space is smaller than our logo */
+			if ((float) allocWidth / width > (float) allocHeight / height) {
+				ratio = (float) allocHeight / height;
+			} else {
+				ratio = (float) allocWidth / width;
+			}
+			width = (int) (width * ratio);
+			height = (int) (height * ratio);
+			
+			logoX = (allocWidth / 2) - (width / 2);
+			logoY = (allocHeight / 2) - (height / 2);
+
+			/* Drawing our frame */
+			frame = new Pixbuf(Colorspace.Rgb, false, 8, allocWidth, allocHeight);
+			logopix.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY, 
+			                  ratio, ratio, InterpType.Bilinear, 255);
+			
+			win.DrawPixbuf (this.Style.BlackGC, frame, 0, 0,
+			                0, 0, allocWidth, allocHeight,
+			                RgbDither.Normal, 0, 0);
+			frame.Dispose();
+			return;
+		}
+	}
+}
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index 7a99fc7..caa4675 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -1,619 +1,619 @@
-// PlayerBin.cs 
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-using System;
-using Gtk;
-using Gdk;
-using Mono.Unix;
-using System.Runtime.InteropServices;
-using LongoMatch.Video;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Player;
-using LongoMatch.Video.Utils;
-
-namespace LongoMatch.Gui
-{
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-		
-	public partial class PlayerBin : Gtk.Bin
-	{
-		
-		public event SegmentClosedHandler SegmentClosedEvent;
-		public event TickHandler Tick;
-		public event ErrorHandler Error;
-		public event StateChangeHandler PlayStateChanged;
-		public event NextButtonClickedHandler Next;
-		public event PrevButtonClickedHandler Prev;
-		public event DrawFrameHandler DrawFrame;
-		public event SeekEventHandler SeekEvent;
-			
-		private const int THUMBNAIL_MAX_WIDTH = 100;
-		private TickHandler tickHandler;
-		private IPlayer player;
-		private long length=0;
-		private string slength;
-		private long segmentStartTime;
-		private long segmentStopTime;
-		private bool seeking=false;
-		private double[] seeksQueue; 
-		private bool IsPlayingPrevState = false;
-		private float rate=1;
-		private double previousVLevel = 1;
-		private bool muted=false;
-		private object[] pendingSeek=null; //{start,stop,rate}
-		//the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
-		private string filename = null;
-		protected VolumeWindow vwin;
-		
-				
-#region Constructors		
-		public PlayerBin()
-		{		
-			this.Build();
-			PlayerInit();
-			vwin = new VolumeWindow();
-			vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
-			controlsbox.Visible = false;	
-			UnSensitive();
-			timescale.Adjustment.PageIncrement = 0.01;
-			timescale.Adjustment.StepIncrement = 0.0001;
-			playbutton.CanFocus = false;
-			prevbutton.CanFocus = false;
-			nextbutton.CanFocus = false;
-			volumebutton.CanFocus = false;
-			timescale.CanFocus = false;
-			vscale1.CanFocus = false;	
-			drawbutton.CanFocus = false;
-			seeksQueue = new double[2];
-			seeksQueue [0] = -1;
-			seeksQueue [1] = -1;
-		}
-		
-#endregion
-	
-#region Properties
-		
-		public IPlayer Player{
-			get{return player;}
-		}
-		
-		public long AccurateCurrentTime{
-			get{return player.AccurateCurrentTime;}
-		}
-		
-		public long CurrentTime{
-			get{return player.CurrentTime;}
-		}
-		
-		public long StreamLength{
-			get{return player.StreamLength;}
-		}
-		
-		public float Rate{
-			get{return rate;}
-			set{vscale1.Value = (int)(value*25);}
-		}
-		
-		public bool FullScreen{
-			set{
-				if (value)
-					GdkWindow.Fullscreen();
-				else 
-					GdkWindow.Unfullscreen();				
-			}
-		}
-		
-		public Pixbuf CurrentMiniatureFrame{
-			get{
-				Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);				
-				return pixbuf;
-			}
-		}
-		
-		public Pixbuf CurrentFrame{
-			get{return player.GetCurrentFrame();}
-		}
-		
-		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;}
-			set{player.ExpandLogo = value;}
-		}
-		
-		public bool Opened {
-		    get{return filename != null;}
-		}
-			
-		public Widget VideoWidget{
-			get{return ((Gtk.EventBox)player);}
-		}
-#endregion	
-		
-#region Public methods		
-		
-		public void Open (string mrl){
-			filename = mrl;
-			ResetGui();
-			CloseActualSegment();			
-				try{
-					player.Open(mrl);
-				}
-				catch {
-				//We handle this error async				
-				}
-		}
-		
-		public void Play(){			
-			player.Play();			
-			float val = GetRateFromScale();							
-			if (segmentStartTime == 0 && segmentStopTime==0)
-				player.SetRate(val);
-			else
-				player.SetRateInSegment(val,segmentStopTime);		
-		}
-		
-		public void Pause(){
-			player.Pause();
-		}		
-		
-		public void TogglePlay(){
-			if (player.Playing)
-				Pause();
-			else 
-				Play();
-		}
-		
-		public void SetLogo (string filename){
-			player.Logo=filename;
-		}
-		
-		public void ResetGui(){
-			closebutton.Hide();
-			SetSensitive();
-			timescale.Value=0;
-			timelabel.Text="";
-			player.CancelProgramedStop();			
-		}
-	
-		public void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext){
-			if (hasNext)
-				nextbutton.Sensitive = true;
-			else
-				nextbutton.Sensitive = false;
-			
-			if (fileName != filename){
-				Open(fileName);	
-				//Wait until the pipeline is prerolled and ready to seek
-				pendingSeek = new object[3] {start,stop,rate};
-			}
-			else player.SegmentSeek(start,stop,rate);	
-			
-			segmentStartTime = start;
-			segmentStopTime = stop;
-			player.LogoMode = false;
-			Rate = rate;
-		}
-		
-		public void Close(){
-			player.Close();
-			filename = null;
-			timescale.Value = 0;
-			UnSensitive();
-		}
-		
-		public void SeekTo(long time, bool accurate){
-			player.SeekTime(time,1,accurate);
-			if (SeekEvent != null)
-				SeekEvent(time);
-		}
-		
-		public void SeekInSegment(long pos){
-			player.SeekInSegment(pos, GetRateFromScale());
-			if (SeekEvent != null)
-				SeekEvent(pos);
-		}
-		
-		public void SeekToNextFrame(bool in_segment){
-			int currentTime = (int)player.CurrentTime;
-			if (segmentStopTime==0 | currentTime < segmentStopTime){
-				if (player.Playing)
-					player.Pause();
-				player.SeekToNextFrame( GetRateFromScale(), in_segment);
-				if (SeekEvent != null)
-					SeekEvent(currentTime );
-			}
-			
-		}
-		
-		public void SeekToPreviousFrame(bool in_segment){
-			long currentTime = player.CurrentTime;
-			if (currentTime> segmentStartTime){
-				if (player.Playing)
-					player.Pause();
-				player.SeekToPreviousFrame( GetRateFromScale(),in_segment);
-				if (SeekEvent != null)
-					SeekEvent(currentTime);
-			}
-		}
-		
-		public void StepForward(){
-			SeekFromTimescale(timescale.Value + timescale.Adjustment.PageIncrement);
-		}
-		
-		public void StepBackward(){			
-			SeekFromTimescale(timescale.Value - timescale.Adjustment.PageIncrement);
-		}
-		
-		public void FramerateUp(){
-			vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
-		}
-		
-		public void FramerateDown(){
-			vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
-		}
-		
-		public void UpdateSegmentStartTime (long start){
-			segmentStartTime = start;
-			player.SegmentStartUpdate(start, GetRateFromScale());
-			if (SeekEvent != null)
-				SeekEvent(start);
-		}
-		
-		public void UpdateSegmentStopTime (long stop){
-			segmentStopTime = stop;
-			player.SegmentStopUpdate(stop, GetRateFromScale());	
-			if (SeekEvent != null)
-				SeekEvent(stop);
-		}
-		
-		public void SetStartStop(long start, long stop){
-			segmentStartTime = start;
-			segmentStopTime = stop;
-			closebutton.Show();
-			vscale1.Value = 25;
-			player.SegmentSeek(start,stop, GetRateFromScale());	
-			player.Play();
-		}
-		
-		public void CloseActualSegment(){
-			closebutton.Hide();
-			segmentStartTime = 0;
-			segmentStopTime = 0;
-			vscale1.Value=25;
-			//timescale.Sensitive = true;
-			slength = TimeString.MSecondsToSecondsString(length);
-			SegmentClosedEvent();
-			player.CancelProgramedStop();			
-		}
-		
-		public void SetSensitive(){
-			controlsbox.Sensitive = true;
-			vscale1.Sensitive = true;					
-		}
-		
-		public void UnSensitive(){			
-			controlsbox.Sensitive = false;
-			vscale1.Sensitive = false;				
-		}		
-		
-#endregion
-		
-#region Private methods
-		
-		private float GetRateFromScale(){
-			VScale scale= vscale1;
-			double val = scale.Value;
-			
-			if (val >25 ){
-				val = val-25 ;					
-			}
-			else if (val <=25){			
-				val = val/25;
-			}
-			return (float)val;
-		}
-		
-		private bool InSegment(){
-			return  !(segmentStopTime == 0 && segmentStartTime ==0) ;
-		}
-		
-		private void PlayerInit(){
-			MultimediaFactory factory;
-			Widget playerWidget;
-			
-			factory= new MultimediaFactory();
-			player = factory.getPlayer(320,280);
-			
-			tickHandler = new TickHandler(OnTick);
-			player.Tick += tickHandler;
-			player.StateChange += new StateChangeHandler(OnStateChanged);
-			player.Eos += new EventHandler (OnEndOfStream);
-			player.Error += new ErrorHandler (OnError);
-			player.ReadyToSeek += new EventHandler(OnReadyToSeek);
-			
-			playerWidget = (Widget)player;
-			playerWidget.ButtonPressEvent += OnVideoboxButtonPressEvent;
-			playerWidget.ScrollEvent += OnVideoboxScrollEvent;
-			playerWidget.Show();
-			videobox.Add(playerWidget);	
-				
-		}
-		
-		private void SeekFromTimescale(double pos){						
-			if (InSegment()){
-				long seekPos = segmentStartTime + (long)(pos*(segmentStopTime-segmentStartTime));
-				player.SeekInSegment(seekPos, GetRateFromScale());	
-				timelabel.Text= TimeString.MSecondsToSecondsString(seekPos) + "/" + 
-					TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
-			}
-			else {
-				player.Position = pos;
-				timelabel.Text= TimeString.MSecondsToSecondsString(player.CurrentTime) + "/" + slength;
-				Rate = 1;				
-			}	
-		}
-		
-#endregion
-		
-#region Callbacks
-		protected virtual void OnStateChanged(object o, StateChangeArgs args){
-			if (args.Playing){
-				playbutton.Hide();
-				pausebutton.Show();
-			}
-			else{
-				playbutton.Show();
-				pausebutton.Hide();
-			}
-			if (PlayStateChanged != null)
-				PlayStateChanged(this,args);
-		}
-		
-		protected void OnReadyToSeek(object o, EventArgs args){
-			if (pendingSeek != null){
-				player.SegmentSeek((long)pendingSeek[0],
-				                   (long)pendingSeek[1],
-				                   (float)pendingSeek[2]);
-				player.Play();
-				pendingSeek = null;
-				                   
-			}
-		}
-		
-		protected virtual void OnTick(object o,TickArgs args){
-			long currentTime = args.CurrentTime;
-			float currentposition = args.CurrentPosition;		
-			long streamLength = args.StreamLength;		
-			
-			//Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
-			if (length != streamLength){							
-				length = streamLength;
-				slength = TimeString.MSecondsToSecondsString(length);				
-			}
-			
-			if  (InSegment()){
-				currentTime -= segmentStartTime;
-				currentposition = (float)currentTime/(float)(segmentStopTime-segmentStartTime);
-				slength = TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
-			}						
-			
-			timelabel.Text = TimeString.MSecondsToSecondsString(currentTime) + "/" + slength;			    
-			timescale.Value = currentposition;
-			if (Tick != null)
-				Tick(o,args);
-			
-		}
-		
-		protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
-		{
-			double pos;		
-			
-			if (!seeking){
-				seeking = true;
-				IsPlayingPrevState = player.Playing;
-				player.Tick -= tickHandler;
-				player.Pause();
-				seeksQueue [0] = -1;
-				seeksQueue [1] = -1;
-			}
-			
-			pos = timescale.Value;	
-			seeksQueue[0] = seeksQueue[1];
-			seeksQueue[1] = pos;
-			
-			SeekFromTimescale(pos);		
-		}		
-
-		protected virtual void OnTimescaleValueChanged(object sender, System.EventArgs e)
-		{
-			if (seeking){
-				/* Releasing the timescale always report value different from the real one. 
-				 * We need to cache previous position and seek again to the this position */				
-				SeekFromTimescale(seeksQueue[0] != -1 ? seeksQueue[0] : seeksQueue[1]);
-				seeking=false;				
-				player.Tick += tickHandler;
-				if (IsPlayingPrevState)
-					player.Play();
-			}
-		}
-
-		protected virtual void OnPlaybuttonClicked(object sender, System.EventArgs e)
-		{
-			  Play();		
-		}
-
-		protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
-		{
-			player.SeekTime(segmentStartTime,1,true);
-		}
-
-		protected virtual void OnVolumebuttonClicked(object sender, System.EventArgs e)
-		{
-			vwin.SetLevel(player.Volume);
-			vwin.Show();
-		}
-
-		protected virtual void OnDestroyEvent(object o, Gtk.DestroyEventArgs args)
-		{
-			player.Dispose();
-		}
-		
-		protected virtual void OnVolumeChanged(double level){
-			player.Volume = level;
-			if (level == 0)
-				muted = true;
-			else
-				muted = false;
-		}
-
-		protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
-		{			
-			player.Pause();
-		}
-		
-		protected virtual void OnEndOfStream (object o, EventArgs args){
-			player.SeekInSegment(0, GetRateFromScale());
-			player.Pause();			
-		}
-		
-				
-		protected virtual void OnError (object o, ErrorArgs args){
-			if(Error != null)
-				Error(o,args);
-		}
-
-		protected virtual void OnClosebuttonClicked (object sender, System.EventArgs e)
-		{
-			CloseActualSegment();	
-		}
-
-		protected virtual void OnPrevbuttonClicked (object sender, System.EventArgs e)
-		{			
-			if (Prev != null)
-				Prev();
-		}
-
-		protected virtual void OnNextbuttonClicked (object sender, System.EventArgs e)
-		{
-			if (Next != null)
-				Next();		
-		}
-
-		protected virtual void OnVscale1FormatValue (object o, Gtk.FormatValueArgs args)
-		{
-			double val = args.Value;
-			if (val >25 ){
-				val = val-25 ;
-				args.RetVal = val +"X";
-			}
-			else if (val ==25){
-				args.RetVal = "1X";
-			}
-			else if (val <25){
-				args.RetVal = "-"+val+"/25"+"X";
-			}
-		}
-
-		protected virtual void OnVscale1ValueChanged (object sender, System.EventArgs e)
-		{
-			float val = GetRateFromScale();
-			
-			// Mute for rate != 1
-			if (val != 1 && player.Volume != 0){ 
-				previousVLevel = player.Volume;
-				player.Volume=0;
-			}
-			else if  (val != 1 && muted)
-			          previousVLevel = 0;			
-			else if (val ==1)
-				player.Volume = previousVLevel;			
-			
-			if (InSegment()){
-				player.SetRateInSegment(val,segmentStopTime);
-			}
-			else
-				player.SetRate(val);			
-			rate = val;
-		}
-
-		protected virtual void OnVideoboxButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
-		{
-			if(filename == null)
-				return;
-			/* FIXME: The pointer is grabbed when the event box is clicked.
-			 * Make sure to ungrab it in order to avoid clicks outisde the window
-			 * triggering this callback. This should be fixed properly.*/ 
-			Pointer.Ungrab(Gtk.Global.CurrentEventTime);
-			if (!player.Playing)
-				Play();
-			else 
-				Pause();		
-		}
-		
-		protected virtual void OnVideoboxScrollEvent (object o, Gtk.ScrollEventArgs args)
-		{
-			switch (args.Event.Direction){
-				case ScrollDirection.Down:
-					SeekToPreviousFrame(InSegment());
-					break;
-				case ScrollDirection.Up:
-					SeekToNextFrame(InSegment());
-					break;
-				case ScrollDirection.Left:
-					StepBackward();
-					break;
-				case ScrollDirection.Right:
-					StepForward();
-					break;
-			}
-		}
-		
-		protected virtual void OnDrawButtonClicked (object sender, System.EventArgs e)
-		{
-			int currentTime;
-			
-			currentTime = (int)AccurateCurrentTime;
-			// If the player has reached the end of the segment the current time
-			// will be unseekable and it's not possible to get a frame at this
-			// instant. If we exceed the segment stop time, decrease in a 
-			// milisecond the position. 
-			if (InSegment() && currentTime >= segmentStopTime)
-				currentTime -= 1;
-			if (DrawFrame != null)
-				DrawFrame(currentTime);
-		}
-#endregion	
-	}
-}
+// PlayerBin.cs 
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+using System.Runtime.InteropServices;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Utils;
+
+namespace LongoMatch.Gui
+{
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+		
+	public partial class PlayerBin : Gtk.Bin
+	{
+		
+		public event SegmentClosedHandler SegmentClosedEvent;
+		public event TickHandler Tick;
+		public event ErrorHandler Error;
+		public event StateChangeHandler PlayStateChanged;
+		public event NextButtonClickedHandler Next;
+		public event PrevButtonClickedHandler Prev;
+		public event DrawFrameHandler DrawFrame;
+		public event SeekEventHandler SeekEvent;
+			
+		private const int THUMBNAIL_MAX_WIDTH = 100;
+		private TickHandler tickHandler;
+		private IPlayer player;
+		private long length=0;
+		private string slength;
+		private long segmentStartTime;
+		private long segmentStopTime;
+		private bool seeking=false;
+		private double[] seeksQueue; 
+		private bool IsPlayingPrevState = false;
+		private float rate=1;
+		private double previousVLevel = 1;
+		private bool muted=false;
+		private object[] pendingSeek=null; //{start,stop,rate}
+		//the player.mrl is diferent from the filename as it's an uri eg:file:///foo.avi
+		private string filename = null;
+		protected VolumeWindow vwin;
+		
+				
+#region Constructors		
+		public PlayerBin()
+		{		
+			this.Build();
+			PlayerInit();
+			vwin = new VolumeWindow();
+			vwin.VolumeChanged += new VolumeChangedHandler(OnVolumeChanged);
+			controlsbox.Visible = false;	
+			UnSensitive();
+			timescale.Adjustment.PageIncrement = 0.01;
+			timescale.Adjustment.StepIncrement = 0.0001;
+			playbutton.CanFocus = false;
+			prevbutton.CanFocus = false;
+			nextbutton.CanFocus = false;
+			volumebutton.CanFocus = false;
+			timescale.CanFocus = false;
+			vscale1.CanFocus = false;	
+			drawbutton.CanFocus = false;
+			seeksQueue = new double[2];
+			seeksQueue [0] = -1;
+			seeksQueue [1] = -1;
+		}
+		
+#endregion
+	
+#region Properties
+		
+		public IPlayer Player{
+			get{return player;}
+		}
+		
+		public long AccurateCurrentTime{
+			get{return player.AccurateCurrentTime;}
+		}
+		
+		public long CurrentTime{
+			get{return player.CurrentTime;}
+		}
+		
+		public long StreamLength{
+			get{return player.StreamLength;}
+		}
+		
+		public float Rate{
+			get{return rate;}
+			set{vscale1.Value = (int)(value*25);}
+		}
+		
+		public bool FullScreen{
+			set{
+				if (value)
+					GdkWindow.Fullscreen();
+				else 
+					GdkWindow.Unfullscreen();				
+			}
+		}
+		
+		public Pixbuf CurrentMiniatureFrame{
+			get{
+				Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);				
+				return pixbuf;
+			}
+		}
+		
+		public Pixbuf CurrentFrame{
+			get{return player.GetCurrentFrame();}
+		}
+		
+		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;}
+			set{player.ExpandLogo = value;}
+		}
+		
+		public bool Opened {
+		    get{return filename != null;}
+		}
+			
+		public Widget VideoWidget{
+			get{return ((Gtk.EventBox)player);}
+		}
+#endregion	
+		
+#region Public methods		
+		
+		public void Open (string mrl){
+			filename = mrl;
+			ResetGui();
+			CloseActualSegment();			
+				try{
+					player.Open(mrl);
+				}
+				catch {
+				//We handle this error async				
+				}
+		}
+		
+		public void Play(){			
+			player.Play();			
+			float val = GetRateFromScale();							
+			if (segmentStartTime == 0 && segmentStopTime==0)
+				player.SetRate(val);
+			else
+				player.SetRateInSegment(val,segmentStopTime);		
+		}
+		
+		public void Pause(){
+			player.Pause();
+		}		
+		
+		public void TogglePlay(){
+			if (player.Playing)
+				Pause();
+			else 
+				Play();
+		}
+		
+		public void SetLogo (string filename){
+			player.Logo=filename;
+		}
+		
+		public void ResetGui(){
+			closebutton.Hide();
+			SetSensitive();
+			timescale.Value=0;
+			timelabel.Text="";
+			player.CancelProgramedStop();			
+		}
+	
+		public void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext){
+			if (hasNext)
+				nextbutton.Sensitive = true;
+			else
+				nextbutton.Sensitive = false;
+			
+			if (fileName != filename){
+				Open(fileName);	
+				//Wait until the pipeline is prerolled and ready to seek
+				pendingSeek = new object[3] {start,stop,rate};
+			}
+			else player.SegmentSeek(start,stop,rate);	
+			
+			segmentStartTime = start;
+			segmentStopTime = stop;
+			player.LogoMode = false;
+			Rate = rate;
+		}
+		
+		public void Close(){
+			player.Close();
+			filename = null;
+			timescale.Value = 0;
+			UnSensitive();
+		}
+		
+		public void SeekTo(long time, bool accurate){
+			player.SeekTime(time,1,accurate);
+			if (SeekEvent != null)
+				SeekEvent(time);
+		}
+		
+		public void SeekInSegment(long pos){
+			player.SeekInSegment(pos, GetRateFromScale());
+			if (SeekEvent != null)
+				SeekEvent(pos);
+		}
+		
+		public void SeekToNextFrame(bool in_segment){
+			int currentTime = (int)player.CurrentTime;
+			if (segmentStopTime==0 | currentTime < segmentStopTime){
+				if (player.Playing)
+					player.Pause();
+				player.SeekToNextFrame( GetRateFromScale(), in_segment);
+				if (SeekEvent != null)
+					SeekEvent(currentTime );
+			}
+			
+		}
+		
+		public void SeekToPreviousFrame(bool in_segment){
+			long currentTime = player.CurrentTime;
+			if (currentTime> segmentStartTime){
+				if (player.Playing)
+					player.Pause();
+				player.SeekToPreviousFrame( GetRateFromScale(),in_segment);
+				if (SeekEvent != null)
+					SeekEvent(currentTime);
+			}
+		}
+		
+		public void StepForward(){
+			SeekFromTimescale(timescale.Value + timescale.Adjustment.PageIncrement);
+		}
+		
+		public void StepBackward(){			
+			SeekFromTimescale(timescale.Value - timescale.Adjustment.PageIncrement);
+		}
+		
+		public void FramerateUp(){
+			vscale1.Adjustment.Value += vscale1.Adjustment.StepIncrement;
+		}
+		
+		public void FramerateDown(){
+			vscale1.Adjustment.Value -= vscale1.Adjustment.StepIncrement;
+		}
+		
+		public void UpdateSegmentStartTime (long start){
+			segmentStartTime = start;
+			player.SegmentStartUpdate(start, GetRateFromScale());
+			if (SeekEvent != null)
+				SeekEvent(start);
+		}
+		
+		public void UpdateSegmentStopTime (long stop){
+			segmentStopTime = stop;
+			player.SegmentStopUpdate(stop, GetRateFromScale());	
+			if (SeekEvent != null)
+				SeekEvent(stop);
+		}
+		
+		public void SetStartStop(long start, long stop){
+			segmentStartTime = start;
+			segmentStopTime = stop;
+			closebutton.Show();
+			vscale1.Value = 25;
+			player.SegmentSeek(start,stop, GetRateFromScale());	
+			player.Play();
+		}
+		
+		public void CloseActualSegment(){
+			closebutton.Hide();
+			segmentStartTime = 0;
+			segmentStopTime = 0;
+			vscale1.Value=25;
+			//timescale.Sensitive = true;
+			slength = TimeString.MSecondsToSecondsString(length);
+			SegmentClosedEvent();
+			player.CancelProgramedStop();			
+		}
+		
+		public void SetSensitive(){
+			controlsbox.Sensitive = true;
+			vscale1.Sensitive = true;					
+		}
+		
+		public void UnSensitive(){			
+			controlsbox.Sensitive = false;
+			vscale1.Sensitive = false;				
+		}		
+		
+#endregion
+		
+#region Private methods
+		
+		private float GetRateFromScale(){
+			VScale scale= vscale1;
+			double val = scale.Value;
+			
+			if (val >25 ){
+				val = val-25 ;					
+			}
+			else if (val <=25){			
+				val = val/25;
+			}
+			return (float)val;
+		}
+		
+		private bool InSegment(){
+			return  !(segmentStopTime == 0 && segmentStartTime ==0) ;
+		}
+		
+		private void PlayerInit(){
+			MultimediaFactory factory;
+			Widget playerWidget;
+			
+			factory= new MultimediaFactory();
+			player = factory.getPlayer(320,280);
+			
+			tickHandler = new TickHandler(OnTick);
+			player.Tick += tickHandler;
+			player.StateChange += new StateChangeHandler(OnStateChanged);
+			player.Eos += new EventHandler (OnEndOfStream);
+			player.Error += new ErrorHandler (OnError);
+			player.ReadyToSeek += new EventHandler(OnReadyToSeek);
+			
+			playerWidget = (Widget)player;
+			playerWidget.ButtonPressEvent += OnVideoboxButtonPressEvent;
+			playerWidget.ScrollEvent += OnVideoboxScrollEvent;
+			playerWidget.Show();
+			videobox.Add(playerWidget);	
+				
+		}
+		
+		private void SeekFromTimescale(double pos){						
+			if (InSegment()){
+				long seekPos = segmentStartTime + (long)(pos*(segmentStopTime-segmentStartTime));
+				player.SeekInSegment(seekPos, GetRateFromScale());	
+				timelabel.Text= TimeString.MSecondsToSecondsString(seekPos) + "/" + 
+					TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
+			}
+			else {
+				player.Position = pos;
+				timelabel.Text= TimeString.MSecondsToSecondsString(player.CurrentTime) + "/" + slength;
+				Rate = 1;				
+			}	
+		}
+		
+#endregion
+		
+#region Callbacks
+		protected virtual void OnStateChanged(object o, StateChangeArgs args){
+			if (args.Playing){
+				playbutton.Hide();
+				pausebutton.Show();
+			}
+			else{
+				playbutton.Show();
+				pausebutton.Hide();
+			}
+			if (PlayStateChanged != null)
+				PlayStateChanged(this,args);
+		}
+		
+		protected void OnReadyToSeek(object o, EventArgs args){
+			if (pendingSeek != null){
+				player.SegmentSeek((long)pendingSeek[0],
+				                   (long)pendingSeek[1],
+				                   (float)pendingSeek[2]);
+				player.Play();
+				pendingSeek = null;
+				                   
+			}
+		}
+		
+		protected virtual void OnTick(object o,TickArgs args){
+			long currentTime = args.CurrentTime;
+			float currentposition = args.CurrentPosition;		
+			long streamLength = args.StreamLength;		
+			
+			//Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
+			if (length != streamLength){							
+				length = streamLength;
+				slength = TimeString.MSecondsToSecondsString(length);				
+			}
+			
+			if  (InSegment()){
+				currentTime -= segmentStartTime;
+				currentposition = (float)currentTime/(float)(segmentStopTime-segmentStartTime);
+				slength = TimeString.MSecondsToSecondsString(segmentStopTime-segmentStartTime);
+			}						
+			
+			timelabel.Text = TimeString.MSecondsToSecondsString(currentTime) + "/" + slength;			    
+			timescale.Value = currentposition;
+			if (Tick != null)
+				Tick(o,args);
+			
+		}
+		
+		protected virtual void OnTimescaleAdjustBounds(object o, Gtk.AdjustBoundsArgs args)
+		{
+			double pos;		
+			
+			if (!seeking){
+				seeking = true;
+				IsPlayingPrevState = player.Playing;
+				player.Tick -= tickHandler;
+				player.Pause();
+				seeksQueue [0] = -1;
+				seeksQueue [1] = -1;
+			}
+			
+			pos = timescale.Value;	
+			seeksQueue[0] = seeksQueue[1];
+			seeksQueue[1] = pos;
+			
+			SeekFromTimescale(pos);		
+		}		
+
+		protected virtual void OnTimescaleValueChanged(object sender, System.EventArgs e)
+		{
+			if (seeking){
+				/* Releasing the timescale always report value different from the real one. 
+				 * We need to cache previous position and seek again to the this position */				
+				SeekFromTimescale(seeksQueue[0] != -1 ? seeksQueue[0] : seeksQueue[1]);
+				seeking=false;				
+				player.Tick += tickHandler;
+				if (IsPlayingPrevState)
+					player.Play();
+			}
+		}
+
+		protected virtual void OnPlaybuttonClicked(object sender, System.EventArgs e)
+		{
+			  Play();		
+		}
+
+		protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
+		{
+			player.SeekTime(segmentStartTime,1,true);
+		}
+
+		protected virtual void OnVolumebuttonClicked(object sender, System.EventArgs e)
+		{
+			vwin.SetLevel(player.Volume);
+			vwin.Show();
+		}
+
+		protected virtual void OnDestroyEvent(object o, Gtk.DestroyEventArgs args)
+		{
+			player.Dispose();
+		}
+		
+		protected virtual void OnVolumeChanged(double level){
+			player.Volume = level;
+			if (level == 0)
+				muted = true;
+			else
+				muted = false;
+		}
+
+		protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
+		{			
+			player.Pause();
+		}
+		
+		protected virtual void OnEndOfStream (object o, EventArgs args){
+			player.SeekInSegment(0, GetRateFromScale());
+			player.Pause();			
+		}
+		
+				
+		protected virtual void OnError (object o, ErrorArgs args){
+			if(Error != null)
+				Error(o,args);
+		}
+
+		protected virtual void OnClosebuttonClicked (object sender, System.EventArgs e)
+		{
+			CloseActualSegment();	
+		}
+
+		protected virtual void OnPrevbuttonClicked (object sender, System.EventArgs e)
+		{			
+			if (Prev != null)
+				Prev();
+		}
+
+		protected virtual void OnNextbuttonClicked (object sender, System.EventArgs e)
+		{
+			if (Next != null)
+				Next();		
+		}
+
+		protected virtual void OnVscale1FormatValue (object o, Gtk.FormatValueArgs args)
+		{
+			double val = args.Value;
+			if (val >25 ){
+				val = val-25 ;
+				args.RetVal = val +"X";
+			}
+			else if (val ==25){
+				args.RetVal = "1X";
+			}
+			else if (val <25){
+				args.RetVal = "-"+val+"/25"+"X";
+			}
+		}
+
+		protected virtual void OnVscale1ValueChanged (object sender, System.EventArgs e)
+		{
+			float val = GetRateFromScale();
+			
+			// Mute for rate != 1
+			if (val != 1 && player.Volume != 0){ 
+				previousVLevel = player.Volume;
+				player.Volume=0;
+			}
+			else if  (val != 1 && muted)
+			          previousVLevel = 0;			
+			else if (val ==1)
+				player.Volume = previousVLevel;			
+			
+			if (InSegment()){
+				player.SetRateInSegment(val,segmentStopTime);
+			}
+			else
+				player.SetRate(val);			
+			rate = val;
+		}
+
+		protected virtual void OnVideoboxButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
+		{
+			if(filename == null)
+				return;
+			/* FIXME: The pointer is grabbed when the event box is clicked.
+			 * Make sure to ungrab it in order to avoid clicks outisde the window
+			 * triggering this callback. This should be fixed properly.*/ 
+			Pointer.Ungrab(Gtk.Global.CurrentEventTime);
+			if (!player.Playing)
+				Play();
+			else 
+				Pause();		
+		}
+		
+		protected virtual void OnVideoboxScrollEvent (object o, Gtk.ScrollEventArgs args)
+		{
+			switch (args.Event.Direction){
+				case ScrollDirection.Down:
+					SeekToPreviousFrame(InSegment());
+					break;
+				case ScrollDirection.Up:
+					SeekToNextFrame(InSegment());
+					break;
+				case ScrollDirection.Left:
+					StepBackward();
+					break;
+				case ScrollDirection.Right:
+					StepForward();
+					break;
+			}
+		}
+		
+		protected virtual void OnDrawButtonClicked (object sender, System.EventArgs e)
+		{
+			int currentTime;
+			
+			currentTime = (int)AccurateCurrentTime;
+			// If the player has reached the end of the segment the current time
+			// will be unseekable and it's not possible to get a frame at this
+			// instant. If we exceed the segment stop time, decrease in a 
+			// milisecond the position. 
+			if (InSegment() && currentTime >= segmentStopTime)
+				currentTime -= 1;
+			if (DrawFrame != null)
+				DrawFrame(currentTime);
+		}
+#endregion	
+	}
+}
diff --git a/CesarPlayer/Gui/VolumeWindow.cs b/CesarPlayer/Gui/VolumeWindow.cs
index 6b4945e..ccd9706 100644
--- a/CesarPlayer/Gui/VolumeWindow.cs
+++ b/CesarPlayer/Gui/VolumeWindow.cs
@@ -1,21 +1,21 @@
 // VolumeWindow.cs 
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
 //
 using System;
 using LongoMatch.Video.Common;
diff --git a/CesarPlayer/MultimediaFactory.cs b/CesarPlayer/MultimediaFactory.cs
index a9712c1..29730b9 100644
--- a/CesarPlayer/MultimediaFactory.cs
+++ b/CesarPlayer/MultimediaFactory.cs
@@ -1,108 +1,108 @@
-// PlayerMaker.cs 
-//
-//  Copyright(C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using LongoMatch.Video.Capturer;
-using LongoMatch.Video.Player;
-using LongoMatch.Video.Editor;
-using LongoMatch.Video.Utils;
-using LongoMatch.Video.Common;
-
-namespace LongoMatch.Video
-{
-	
-	
-	public class MultimediaFactory
-	{
-		
-		OperatingSystem oS;
-		
-		public MultimediaFactory()
-		{
-			oS = Environment.OSVersion;	
-		}
-		
-		public IPlayer getPlayer(int width, int height){
-			switch (oS.Platform) { 
-				case PlatformID.Unix:
-					return new GstPlayer(width,height,PlayerUseType.Video);
-					
-				case PlatformID.Win32NT:
-					return new GstPlayer(width,height,PlayerUseType.Video);
-				
-				default:
-					return new GstPlayer(width,height,PlayerUseType.Video);
-			}		
-		}
-		
-		public IMetadataReader getMetadataReader(){
-			
-			switch (oS.Platform) { 
-				case PlatformID.Unix:
-					return new GstPlayer(1,1,PlayerUseType.Metadata);
-					
-				case PlatformID.Win32NT:
-					return new GstPlayer(1,1,PlayerUseType.Metadata);
-					
-				default:
-					return new GstPlayer(1,1,PlayerUseType.Metadata);
-			}
-		}
-		
-		public IFramesCapturer getFramesCapturer(){
-			switch (oS.Platform) { 
-				case PlatformID.Unix:
-					return new GstPlayer(1,1,PlayerUseType.Capture);
-					
-				case PlatformID.Win32NT:
-					return new GstPlayer(1,1,PlayerUseType.Capture);
-					
-				default:
-					return new GstPlayer(1,1,PlayerUseType.Capture);
-			}
-		}
-		
-		public IVideoEditor getVideoEditor(){
-			switch (oS.Platform) { 
-				case PlatformID.Unix:
-					return new GstVideoSplitter();
-					
-				case PlatformID.Win32NT:
-					return new GstVideoSplitter();	
-					
-				default:
-					return new GstVideoSplitter();
-			}
-		}	
-		
-		public ICapturer getCapturer(CapturerType type){
-			switch (type) { 
-				case CapturerType.Fake:
-					return new FakeCapturer();
-					
-				case CapturerType.Live:
-					return new GstCameraCapturer("test.avi");
-									
-				default:
-					return new FakeCapturer();
-			}			
-		}
-	}
+// PlayerMaker.cs 
+//
+//  Copyright(C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Player;
+using LongoMatch.Video.Editor;
+using LongoMatch.Video.Utils;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Video
+{
+	
+	
+	public class MultimediaFactory
+	{
+		
+		OperatingSystem oS;
+		
+		public MultimediaFactory()
+		{
+			oS = Environment.OSVersion;	
+		}
+		
+		public IPlayer getPlayer(int width, int height){
+			switch (oS.Platform) { 
+				case PlatformID.Unix:
+					return new GstPlayer(width,height,PlayerUseType.Video);
+					
+				case PlatformID.Win32NT:
+					return new GstPlayer(width,height,PlayerUseType.Video);
+				
+				default:
+					return new GstPlayer(width,height,PlayerUseType.Video);
+			}		
+		}
+		
+		public IMetadataReader getMetadataReader(){
+			
+			switch (oS.Platform) { 
+				case PlatformID.Unix:
+					return new GstPlayer(1,1,PlayerUseType.Metadata);
+					
+				case PlatformID.Win32NT:
+					return new GstPlayer(1,1,PlayerUseType.Metadata);
+					
+				default:
+					return new GstPlayer(1,1,PlayerUseType.Metadata);
+			}
+		}
+		
+		public IFramesCapturer getFramesCapturer(){
+			switch (oS.Platform) { 
+				case PlatformID.Unix:
+					return new GstPlayer(1,1,PlayerUseType.Capture);
+					
+				case PlatformID.Win32NT:
+					return new GstPlayer(1,1,PlayerUseType.Capture);
+					
+				default:
+					return new GstPlayer(1,1,PlayerUseType.Capture);
+			}
+		}
+		
+		public IVideoEditor getVideoEditor(){
+			switch (oS.Platform) { 
+				case PlatformID.Unix:
+					return new GstVideoSplitter();
+					
+				case PlatformID.Win32NT:
+					return new GstVideoSplitter();	
+					
+				default:
+					return new GstVideoSplitter();
+			}
+		}	
+		
+		public ICapturer getCapturer(CapturerType type){
+			switch (type) { 
+				case CapturerType.Fake:
+					return new FakeCapturer();
+					
+				case CapturerType.Live:
+					return new GstCameraCapturer("test.avi");
+									
+				default:
+					return new FakeCapturer();
+			}			
+		}
+	}
 }
\ No newline at end of file
diff --git a/CesarPlayer/Player/IPlayer.cs b/CesarPlayer/Player/IPlayer.cs
index 0f18b51..b24dbbf 100644
--- a/CesarPlayer/Player/IPlayer.cs
+++ b/CesarPlayer/Player/IPlayer.cs
@@ -1,21 +1,21 @@
 // IPlayer.cs
 //
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
 //
 
 using System;
diff --git a/CesarPlayer/Utils/TimeString.cs b/CesarPlayer/Utils/TimeString.cs
index e264a0f..d4f755f 100644
--- a/CesarPlayer/Utils/TimeString.cs
+++ b/CesarPlayer/Utils/TimeString.cs
@@ -1,21 +1,21 @@
 // TimeString.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
 //
 
 using System;
diff --git a/LongoMatch/Common/Constants.cs b/LongoMatch/Common/Constants.cs
index a030deb..2f9879d 100644
--- a/LongoMatch/Common/Constants.cs
+++ b/LongoMatch/Common/Constants.cs
@@ -28,7 +28,7 @@ namespace LongoMatch.Common
 		
 		public const string DB_FILE = "longomatch.1.db";
 		
-		public const string COPYRIGHT =  "Copyright ©2007-2010 Andoni Morales Alastruey";
+		public const string COPYRIGHT =  "Copyright ..2007-2010 Andoni Morales Alastruey";
 		
 		public const string FAKE_PROJECT = "@Fake Project@";
 		
@@ -53,18 +53,18 @@ Bruno Brouard (fr)
 Daniel Nylander (sv)
 G. Baylard (fr)
 Joan Charmant (fr)
-João Paulo Azevedo (pt)
+Jo.úo Paulo Azevedo (pt)
 Joe Hansen (da)
-Jorge González (es)
+Jorge Gonz.ílez (es)
 Kenneth Nielsen (da)
 Kjartan Maraas (nb)
 Peter Strikwerda (nl)
 Laurent Coudeur (fr)
 Marek Cernocky (cs)
-Mario Blättermann (de)
-Matej UrbanÄ?iÄ? (sl)
+Mario Bl.ñttermann (de)
+Matej Urban.ìi.ì (sl)
 Maurizio Napolitano (it)
-Pavel Bárta (cs)
+Pavel B.írta (cs)
 Petr Kovar (cs)
 Xavier Queralt Mateu (ca)";
 		
diff --git a/LongoMatch/DB/DataBase.cs b/LongoMatch/DB/DataBase.cs
index 9f242ba..8c22e7e 100644
--- a/LongoMatch/DB/DataBase.cs
+++ b/LongoMatch/DB/DataBase.cs
@@ -1,386 +1,386 @@
-// DB.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Db4objects.Db4o;
-using Db4objects.Db4o.Query;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Gui;
-using LongoMatch.Store;
-using LongoMatch.Store.Templates;
-using LongoMatch.Video.Utils;
-using Mono.Unix;
-
-namespace LongoMatch.DB
-{
-
-	/// <summary>
-	/// I am a proxy for the db4o database. I can store,retrieve, update and search
-	/// <see cref="LongoMatch.DB.Projects"/>.
-	/// Projects are uniquely indentified by their filename, assuming that you can't
-	/// create two projects for the same video file.
-	/// </summary>
-	public sealed class DataBase
-	{
-		// File path of the database
-		private string file;
-		// Lock object
-		private object locker;
-
-		private Version dbVersion;
-
-		private const int MAYOR=1;
-
-		private const int MINOR=0;
-
-		/// <summary>
-		/// Creates a proxy for the database
-		/// </summary>
-		/// <param name="file">
-		/// A <see cref="System.String"/> with the database file path
-		/// </param>
-		public DataBase(string file)
-		{
-			this.file = file;
-			if (!System.IO.File.Exists(file)) {
-				// Create new DB and add version
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try {
-					dbVersion= new Version(MAYOR,MINOR);
-					db.Store(dbVersion);
-				}
-				finally {
-					db.Close();
-				}
-			}
-			else {
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try	{
-					IQuery query = db.Query();
-					query.Constrain(typeof(Version));
-					IObjectSet result = query.Execute();
-					if (result.HasNext()) {
-						dbVersion = (Version)result.Next();
-					}
-					else {
-						dbVersion = new Version(0,0);
-					}
-				}
-				finally
-				{
-					db.Close();
-
-				}
-			}
-			locker = new object();
-		}
-
-		//// <value>
-		/// The database version
-		/// </value>
-		public Version Version {
-			get {
-				return dbVersion;
-			}
-		}
-
-		/// <summary>
-		/// Retrieve all the projects from the database. This method don't return the
-		/// the whole <see cref="LongoMatch.DB.Project"/> but the projects fields to
-		/// create a <see cref="LongoMatch.DB.ProjectDescription"/> to make the seek
-		/// faster.
-		/// </summary>
-		/// <returns>
-		/// A <see cref="List"/>
-		/// </returns>
-		public List<ProjectDescription> GetAllProjects() {
-			lock (this.locker) {
-				SetUpdateCascadeOptions();
-				List<ProjectDescription> list = new List<ProjectDescription>();
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				db.Ext().Configure().ActivationDepth(1);
-				try	{
-					IQuery query = db.Query();
-					query.Constrain(typeof(Project));
-					IObjectSet result = query.Execute();
-					while (result.HasNext()) {
-						try{
-							Project p = (Project)result.Next();
-							ProjectDescription desc = p.Description;
-							db.Activate(desc,3);
-							try{
-								//FIXME: It happens that the project's File object is set to null?¿?¿
-								// In that case, reset the value to let the user change it with the
-								// projects manager.
-								if (desc.File.FilePath == null){}							
-							}catch{
-								MessagePopup.PopupMessage(null, MessageType.Warning, 
-								                          Catalog.GetString("Error retrieving the file " +
-								                                            "info for project:")+
-								                          " "+ desc.Title+"\n"+
-								                          Catalog.GetString("This value will be reset. " +
-								                                            "Remember to change it later with the " +
-								                                            "projects manager"));
-								desc.File = new PreviewMediaFile{
-									FilePath = Catalog.GetString("Change Me"),
-									VideoHeight = 0,
-									VideoWidth = 0,
-									HasVideo = false,
-									HasAudio = false,
-									Length = 0,
-									Fps = 0, 
-									VideoCodec = "",
-									AudioCodec = "",
-									Preview = null,
-								};
-									db.Store(p);
-							}
-							list.Add(desc);
-						}catch{	
-							Console.WriteLine("Error retreiving project. Skip");
-						}
-					}
-					return list;
-				}
-				finally
-				{
-					CloseDB(db);
-				}
-			}
-		}
-
-		/// <summary>
-		/// Search and return a project in the database. Returns null if the
-		/// project is not found
-		/// </summary>
-		/// <param name="filename">
-		/// A <see cref="System.String"/> with the project's video file name
-		/// </param>
-		/// <returns>
-		/// A <see cref="LongoMatch.DB.Project"/>
-		/// </returns>
-		public Project GetProject(String filename) {
-			Project ret;
-			lock (this.locker) {
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try	{
-					IQuery query = GetQueryWithContrains(db, file);
-					IObjectSet result = query.Execute();
-					ret = (Project) db.Ext().PeekPersisted(result.Next(),10,true);
-					return ret;
-				}
-				finally
-				{
-					CloseDB(db);
-				}
-			}
-		}
-
-		/// <summary>
-		/// Add a project to the databse
-		/// </summary>
-		/// <param name="project">
-		/// A <see cref="Project"/> to add
-		/// </param>
-		public void AddProject(Project project) {
-			lock (this.locker) {
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try
-				{
-					if (!Exists(project.Description.File.FilePath,db)) {
-						db.Store(project);
-						db.Commit();
-					}
-					else throw new Exception(Catalog.GetString("The Project for this video file already exists.")+"\n"+Catalog.GetString("Try to edit it with the Database Manager"));
-				}
-				finally {
-					CloseDB(db);
-				}
-			}
-		}
-
-		/// <summary>
-		/// Delete a project from the database
-		/// </summary>
-		/// <param name="filePath">
-		/// A <see cref="System.String"/> with the project's video file path
-		/// </param>
-		public void RemoveProject(string filePath) {
-			lock (this.locker) {
-				SetDeleteCascadeOptions();
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try	{
-					IQuery query = GetQueryWithContrains(db, file);
-					IObjectSet result = query.Execute();
-					Project project = (Project)result.Next();
-					db.Delete(project);
-					db.Commit();
-				}
-				finally
-				{
-					CloseDB(db);
-				}
-			}
-		}
-
-		/// <summary>
-		/// Updates a project in the database. Because a <see cref="LongoMatch.DB.Project"/> has
-		/// many objects associated, a simple update would leave in the databse many orphaned objects.
-		/// Therefore we need to delete the old project a replace it with the changed one. We need to
-		/// now the old file path associate to this project in case it has been changed in the update
-		/// </summary>
-		/// <param name="project">
-		/// A <see cref="Project"/> to update
-		/// </param>
-		/// <param name="previousFileName">
-		/// A <see cref="System.String"/> with the old file path
-		/// </param>
-		public void UpdateProject(Project project, string previousFileName) {
-			lock (this.locker) {
-				bool error = false;
-				// Configure db4o to cascade on delete for each one of the objects stored in a Project
-				SetDeleteCascadeOptions();
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try	{
-					// We look for a project with the same filename
-					if (!Exists(project.Description.File.FilePath,db)) {
-						IQuery query = GetQueryWithContrains(db, file);
-						IObjectSet result = query.Execute();
-						//Get the stored project and replace it with the new one
-						if (result.Count == 1){
-							Project fd = (Project)result.Next();
-							db.Delete(fd);
-							// Add the updated project
-							db.Store(project);
-							db.Commit();
-						} else {
-							error = true;
-						}
-					}
-					else
-						error = true;
-				}
-				finally {
-					CloseDB(db);
-					if (error)
-						throw new Exception();
-				}
-			}
-		}
-
-		/// <summary>
-		/// Updates a project in the databse whose file path hasn't changed
-		/// </summary>
-		/// <param name="project">
-		/// A <see cref="Project"/> to update
-		/// </param>
-		public void UpdateProject(Project project) {
-			lock (this.locker) {
-				SetDeleteCascadeOptions();
-				IObjectContainer db = Db4oFactory.OpenFile(file);
-				try	{
-					IQuery query = GetQueryWithContrains(db, file);
-					IObjectSet result = query.Execute();
-					//Get the stored project and replace it with the new one
-					Project fd = (Project)result.Next();
-					db.Delete(fd);
-					db.Store(project);
-					db.Commit();
-				}
-				finally
-				{
-					CloseDB(db);
-				}
-			}
-		}
-		
-		/// <summary>
-		/// Checks if a project already exists in the DataBase with the same file 
-		/// </summary>
-		/// <param name="project">
-		/// A <see cref="Project"/> to compare
-		/// </param>
-		/// <returns>
-		/// A <see cref="System.Boolean"/>
-		/// </returns>
-		public bool Exists(Project project){
-			IObjectContainer db = Db4oFactory.OpenFile(file);
-			try{
-				return Exists(project.Description.File.FilePath, db);
-			}catch{
-				return false;
-			}finally{
-				CloseDB(db);
-			}				
-		}
-		
-		private IQuery GetQueryWithContrains(IObjectContainer db, string filename){
-			IQuery query = db.Query();
-			query.Constrain(typeof(Project));
-			query.Descend("description").Descend("file").Descend("filePath").Constrain(filename);
-			return query;
-		}
-
-		private void CloseDB(IObjectContainer db) {
-			db.Ext().Purge();
-			db.Close();
-		}
-
-		private void SetDeleteCascadeOptions() {
-			Db4oFactory.Configure().ObjectClass(typeof(Project)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Categories)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Category)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(TimeNode)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Play)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Time)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Team)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(HotKey)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Player)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Tag)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(TeamTemplate)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Drawing)).CascadeOnDelete(true);
-		}
-
-		private void SetUpdateCascadeOptions() {
-			Db4oFactory.Configure().ObjectClass(typeof(Project)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Categories)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Category)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(TimeNode)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Play)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Time)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Team)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(HotKey)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Player)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(TeamTemplate)).CascadeOnUpdate(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Tag)).CascadeOnDelete(true);
-			Db4oFactory.Configure().ObjectClass(typeof(Drawing)).CascadeOnUpdate(true);
-		}
-
-		private bool Exists(string filename, IObjectContainer db) {
-			IQuery query = db.Query();
-			query.Constrain(typeof(Project));
-			query.Descend("file").Descend("filePath").Constrain(filename);
-			IObjectSet result = query.Execute();
-			return (result.HasNext());
-		}
-	}
-}
+// DB.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Db4objects.Db4o;
+using Db4objects.Db4o.Query;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Gui;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+namespace LongoMatch.DB
+{
+
+	/// <summary>
+	/// I am a proxy for the db4o database. I can store,retrieve, update and search
+	/// <see cref="LongoMatch.DB.Projects"/>.
+	/// Projects are uniquely indentified by their filename, assuming that you can't
+	/// create two projects for the same video file.
+	/// </summary>
+	public sealed class DataBase
+	{
+		// File path of the database
+		private string file;
+		// Lock object
+		private object locker;
+
+		private Version dbVersion;
+
+		private const int MAYOR=1;
+
+		private const int MINOR=0;
+
+		/// <summary>
+		/// Creates a proxy for the database
+		/// </summary>
+		/// <param name="file">
+		/// A <see cref="System.String"/> with the database file path
+		/// </param>
+		public DataBase(string file)
+		{
+			this.file = file;
+			if (!System.IO.File.Exists(file)) {
+				// Create new DB and add version
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try {
+					dbVersion= new Version(MAYOR,MINOR);
+					db.Store(dbVersion);
+				}
+				finally {
+					db.Close();
+				}
+			}
+			else {
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try	{
+					IQuery query = db.Query();
+					query.Constrain(typeof(Version));
+					IObjectSet result = query.Execute();
+					if (result.HasNext()) {
+						dbVersion = (Version)result.Next();
+					}
+					else {
+						dbVersion = new Version(0,0);
+					}
+				}
+				finally
+				{
+					db.Close();
+
+				}
+			}
+			locker = new object();
+		}
+
+		//// <value>
+		/// The database version
+		/// </value>
+		public Version Version {
+			get {
+				return dbVersion;
+			}
+		}
+
+		/// <summary>
+		/// Retrieve all the projects from the database. This method don't return the
+		/// the whole <see cref="LongoMatch.DB.Project"/> but the projects fields to
+		/// create a <see cref="LongoMatch.DB.ProjectDescription"/> to make the seek
+		/// faster.
+		/// </summary>
+		/// <returns>
+		/// A <see cref="List"/>
+		/// </returns>
+		public List<ProjectDescription> GetAllProjects() {
+			lock (this.locker) {
+				SetUpdateCascadeOptions();
+				List<ProjectDescription> list = new List<ProjectDescription>();
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				db.Ext().Configure().ActivationDepth(1);
+				try	{
+					IQuery query = db.Query();
+					query.Constrain(typeof(Project));
+					IObjectSet result = query.Execute();
+					while (result.HasNext()) {
+						try{
+							Project p = (Project)result.Next();
+							ProjectDescription desc = p.Description;
+							db.Activate(desc,3);
+							try{
+								//FIXME: It happens that the project's File object is set to null?..?..
+								// In that case, reset the value to let the user change it with the
+								// projects manager.
+								if (desc.File.FilePath == null){}							
+							}catch{
+								MessagePopup.PopupMessage(null, MessageType.Warning, 
+								                          Catalog.GetString("Error retrieving the file " +
+								                                            "info for project:")+
+								                          " "+ desc.Title+"\n"+
+								                          Catalog.GetString("This value will be reset. " +
+								                                            "Remember to change it later with the " +
+								                                            "projects manager"));
+								desc.File = new PreviewMediaFile{
+									FilePath = Catalog.GetString("Change Me"),
+									VideoHeight = 0,
+									VideoWidth = 0,
+									HasVideo = false,
+									HasAudio = false,
+									Length = 0,
+									Fps = 0, 
+									VideoCodec = "",
+									AudioCodec = "",
+									Preview = null,
+								};
+									db.Store(p);
+							}
+							list.Add(desc);
+						}catch{	
+							Console.WriteLine("Error retreiving project. Skip");
+						}
+					}
+					return list;
+				}
+				finally
+				{
+					CloseDB(db);
+				}
+			}
+		}
+
+		/// <summary>
+		/// Search and return a project in the database. Returns null if the
+		/// project is not found
+		/// </summary>
+		/// <param name="filename">
+		/// A <see cref="System.String"/> with the project's video file name
+		/// </param>
+		/// <returns>
+		/// A <see cref="LongoMatch.DB.Project"/>
+		/// </returns>
+		public Project GetProject(String filename) {
+			Project ret;
+			lock (this.locker) {
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try	{
+					IQuery query = GetQueryWithContrains(db, file);
+					IObjectSet result = query.Execute();
+					ret = (Project) db.Ext().PeekPersisted(result.Next(),10,true);
+					return ret;
+				}
+				finally
+				{
+					CloseDB(db);
+				}
+			}
+		}
+
+		/// <summary>
+		/// Add a project to the databse
+		/// </summary>
+		/// <param name="project">
+		/// A <see cref="Project"/> to add
+		/// </param>
+		public void AddProject(Project project) {
+			lock (this.locker) {
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try
+				{
+					if (!Exists(project.Description.File.FilePath,db)) {
+						db.Store(project);
+						db.Commit();
+					}
+					else throw new Exception(Catalog.GetString("The Project for this video file already exists.")+"\n"+Catalog.GetString("Try to edit it with the Database Manager"));
+				}
+				finally {
+					CloseDB(db);
+				}
+			}
+		}
+
+		/// <summary>
+		/// Delete a project from the database
+		/// </summary>
+		/// <param name="filePath">
+		/// A <see cref="System.String"/> with the project's video file path
+		/// </param>
+		public void RemoveProject(string filePath) {
+			lock (this.locker) {
+				SetDeleteCascadeOptions();
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try	{
+					IQuery query = GetQueryWithContrains(db, file);
+					IObjectSet result = query.Execute();
+					Project project = (Project)result.Next();
+					db.Delete(project);
+					db.Commit();
+				}
+				finally
+				{
+					CloseDB(db);
+				}
+			}
+		}
+
+		/// <summary>
+		/// Updates a project in the database. Because a <see cref="LongoMatch.DB.Project"/> has
+		/// many objects associated, a simple update would leave in the databse many orphaned objects.
+		/// Therefore we need to delete the old project a replace it with the changed one. We need to
+		/// now the old file path associate to this project in case it has been changed in the update
+		/// </summary>
+		/// <param name="project">
+		/// A <see cref="Project"/> to update
+		/// </param>
+		/// <param name="previousFileName">
+		/// A <see cref="System.String"/> with the old file path
+		/// </param>
+		public void UpdateProject(Project project, string previousFileName) {
+			lock (this.locker) {
+				bool error = false;
+				// Configure db4o to cascade on delete for each one of the objects stored in a Project
+				SetDeleteCascadeOptions();
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try	{
+					// We look for a project with the same filename
+					if (!Exists(project.Description.File.FilePath,db)) {
+						IQuery query = GetQueryWithContrains(db, file);
+						IObjectSet result = query.Execute();
+						//Get the stored project and replace it with the new one
+						if (result.Count == 1){
+							Project fd = (Project)result.Next();
+							db.Delete(fd);
+							// Add the updated project
+							db.Store(project);
+							db.Commit();
+						} else {
+							error = true;
+						}
+					}
+					else
+						error = true;
+				}
+				finally {
+					CloseDB(db);
+					if (error)
+						throw new Exception();
+				}
+			}
+		}
+
+		/// <summary>
+		/// Updates a project in the databse whose file path hasn't changed
+		/// </summary>
+		/// <param name="project">
+		/// A <see cref="Project"/> to update
+		/// </param>
+		public void UpdateProject(Project project) {
+			lock (this.locker) {
+				SetDeleteCascadeOptions();
+				IObjectContainer db = Db4oFactory.OpenFile(file);
+				try	{
+					IQuery query = GetQueryWithContrains(db, file);
+					IObjectSet result = query.Execute();
+					//Get the stored project and replace it with the new one
+					Project fd = (Project)result.Next();
+					db.Delete(fd);
+					db.Store(project);
+					db.Commit();
+				}
+				finally
+				{
+					CloseDB(db);
+				}
+			}
+		}
+		
+		/// <summary>
+		/// Checks if a project already exists in the DataBase with the same file 
+		/// </summary>
+		/// <param name="project">
+		/// A <see cref="Project"/> to compare
+		/// </param>
+		/// <returns>
+		/// A <see cref="System.Boolean"/>
+		/// </returns>
+		public bool Exists(Project project){
+			IObjectContainer db = Db4oFactory.OpenFile(file);
+			try{
+				return Exists(project.Description.File.FilePath, db);
+			}catch{
+				return false;
+			}finally{
+				CloseDB(db);
+			}				
+		}
+		
+		private IQuery GetQueryWithContrains(IObjectContainer db, string filename){
+			IQuery query = db.Query();
+			query.Constrain(typeof(Project));
+			query.Descend("description").Descend("file").Descend("filePath").Constrain(filename);
+			return query;
+		}
+
+		private void CloseDB(IObjectContainer db) {
+			db.Ext().Purge();
+			db.Close();
+		}
+
+		private void SetDeleteCascadeOptions() {
+			Db4oFactory.Configure().ObjectClass(typeof(Project)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Categories)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Category)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(TimeNode)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Play)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Time)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Team)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(HotKey)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Player)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Tag)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(TeamTemplate)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Drawing)).CascadeOnDelete(true);
+		}
+
+		private void SetUpdateCascadeOptions() {
+			Db4oFactory.Configure().ObjectClass(typeof(Project)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Categories)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Category)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(TimeNode)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Play)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Time)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Team)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(HotKey)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Player)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(TeamTemplate)).CascadeOnUpdate(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Tag)).CascadeOnDelete(true);
+			Db4oFactory.Configure().ObjectClass(typeof(Drawing)).CascadeOnUpdate(true);
+		}
+
+		private bool Exists(string filename, IObjectContainer db) {
+			IQuery query = db.Query();
+			query.Constrain(typeof(Project));
+			query.Descend("file").Descend("filePath").Constrain(filename);
+			IObjectSet result = query.Execute();
+			return (result.HasNext());
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/PlayListWidget.cs b/LongoMatch/Gui/Component/PlayListWidget.cs
index bb85be2..ba254ab 100644
--- a/LongoMatch/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch/Gui/Component/PlayListWidget.cs
@@ -1,330 +1,330 @@
-// PlayListWidget.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Gdk;
-using LongoMatch.Video.Editor;
-using Mono.Unix;
-using System.IO;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-using LongoMatch.Video.Player;
-using LongoMatch.Video;
-using LongoMatch.Video.Common;
-using LongoMatch.Gui;
-using LongoMatch.Gui.Dialog;
-using LongoMatch.Playlist;
-
-
-
-namespace LongoMatch.Gui.Component
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public partial class PlayListWidget : Gtk.Bin
-	{
-		public event PlayListNodeSelectedHandler PlayListNodeSelected;
-		public event ApplyCurrentRateHandler ApplyCurrentRate;
-		public event ProgressHandler Progress;
-
-		private PlayerBin player;
-		private PlayListPlay plNode;
-		private PlayList playList;
-		private uint timeout;
-		private object lock_node;
-		private bool clock_started = false;
-		private IVideoEditor videoEditor;
-		private MultimediaFactory factory;
-
-
-		public PlayListWidget ()
-		{
-			this.Build ();
-			lock_node = new System.Object ();
-			factory = new MultimediaFactory ();
-			playlisttreeview1.Reorderable = true;
-			playlisttreeview1.RowActivated += OnPlaylisttreeview1RowActivated;
-			playlisttreeview1.ApplyCurrentRate += OnApplyRate;
-			savebutton.Sensitive = false;
-			
-			newbutton.CanFocus = false;
-			openbutton.CanFocus = false;
-			savebutton.CanFocus = false;
-			newvideobutton.CanFocus = false;
-			closebutton.CanFocus = false;
-		}
-
-		public void SetPlayer(PlayerBin player) {
-			this.player = player;
-			closebutton.Hide();
-			newvideobutton.Hide();
-		}
-
-		public void Load(string filePath) {
-			try {
-				playList = new PlayList(filePath);
-				Model = playList.GetModel();
-				label1.Visible = false;
-				newvideobutton.Show();
-				playlisttreeview1.PlayList = playList;
-				playlisttreeview1.Sensitive = true;
-				savebutton.Sensitive = true;
-			} catch {
-				MessagePopup.PopupMessage(this,MessageType.Error,Catalog.GetString("The file you are trying to load is not a playlist or it's not compatible with the current version"));
-			}
-		}
-
-		public ListStore Model {
-			set {
-				playlisttreeview1.Model = value;
-			}
-			get {
-				return (ListStore)playlisttreeview1.Model;
-			}
-		}
-
-		public void Add(PlayListPlay plNode) {
-			if (playList!=null) {
-				Model.AppendValues(plNode);
-				playList.Add(plNode);
-			}
-		}
-
-		public PlayListPlay Next() {
-			if (playList.HasNext()) {
-				plNode = playList.Next();
-				playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
-				playlisttreeview1.LoadedPlay = plNode;
-				if (PlayListNodeSelected != null && plNode.Valid) {
-					PlayListNodeSelected(plNode,playList.HasNext());
-					StartClock();
-				}
-				else
-					Next();
-				return plNode;
-			}
-			else {
-				return null;
-			}
-		}
-
-		public void Prev() {
-			if ((player.AccurateCurrentTime - plNode.Start.MSeconds) < 500) {
-				//Seleccionando el elemento anterior si no han pasado más 500ms
-				if (playList.HasPrev()) {
-					plNode = playList.Prev();
-					playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
-					playlisttreeview1.LoadedPlay = plNode;
-					if (PlayListNodeSelected != null)
-						PlayListNodeSelected(plNode,playList.HasNext());
-					StartClock();
-				}
-			}
-			else {
-				//Nos situamos al inicio del segmento
-				player.SeekTo(plNode.Start.MSeconds,true);
-				player.Rate=plNode.Rate;
-			}
-		}
-
-		public void StopEdition() {
-			if (videoEditor != null)
-				videoEditor.Cancel();
-		}
-
-		public void Stop() {
-			StopClock();
-		}
-
-		void StartClock()	{
-			if (player!=null && !clock_started) {
-				timeout = GLib.Timeout.Add(20,CheckStopTime);
-				clock_started=true;
-			}
-		}
-
-		private void StopClock() {
-			if (clock_started) {
-				GLib.Source.Remove(timeout);
-				clock_started = false;
-			}
-		}
-
-		private bool CheckStopTime() {
-			lock (lock_node) {
-				if (player != null) {
-					if (player.AccurateCurrentTime >= plNode.Stop.MSeconds-200) {
-						if (Next() == null)
-							StopClock();
-					}
-				}
-				return true;
-			}
-		}
-		private PlayListPlay SelectPlayListNode(TreePath path) {
-
-			plNode = playList.Select(Int32.Parse(path.ToString()));
-			if (PlayListNodeSelected != null && plNode.Valid) {
-				PlayListNodeSelected(plNode,playList.HasNext());
-				StartClock();
-			}
-			return plNode;
-		}
-
-		private FileFilter FileFilter {
-			get {
-				FileFilter filter = new FileFilter();
-				filter.Name = "LGM playlist";
-				filter.AddPattern("*.lgm");
-				return filter;
-			}
-		}
-
-		private void LoadEditor() {
-			videoEditor = factory.getVideoEditor();
-			videoEditor.Progress += new ProgressHandler(OnProgress);
-		}
-
-		protected virtual void OnPlaylisttreeview1RowActivated(object o, Gtk.RowActivatedArgs args)
-		{
-			playlisttreeview1.LoadedPlay = SelectPlayListNode(args.Path);
-		}
-
-
-		protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
-		{
-			if (playList != null) {
-				playList.Save();
-			}
-		}
-
-		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
-		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Open playlist"),
-			                (Gtk.Window)this.Toplevel,
-			                FileChooserAction.Open,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-open",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.PlayListDir());
-			fChooser.AddFilter(FileFilter);
-			fChooser.DoOverwriteConfirmation = true;
-			if (fChooser.Run() == (int)ResponseType.Accept)
-				Load(fChooser.Filename);
-			fChooser.Destroy();
-		}
-
-		protected virtual void OnNewbuttonClicked(object sender, System.EventArgs e)
-		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("New playlist"),
-			                (Gtk.Window)this.Toplevel,
-			                FileChooserAction.Save,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.PlayListDir());
-			fChooser.AddFilter(FileFilter);
-
-			if (fChooser.Run() == (int)ResponseType.Accept)
-				Load(fChooser.Filename);
-			fChooser.Destroy();
-		}
-
-		protected virtual void OnPlaylisttreeview1DragEnd(object o, Gtk.DragEndArgs args)
-		{
-			playList.SetModel((ListStore)playlisttreeview1.Model);
-		}
-
-		protected virtual void OnNewvideobuttonClicked(object sender, System.EventArgs e)
-		{
-			VideoEditionProperties vep;
-			int response;
-
-			if (playList.Count == 0) {
-				MessagePopup.PopupMessage(this,MessageType.Warning,
-				                          Catalog.GetString("The playlist is empty!"));
-				return;
-			}
-
-			vep = new VideoEditionProperties();
-			vep.TransientFor = (Gtk.Window)this.Toplevel;
-			response = vep.Run();
-			while (response == (int)ResponseType.Ok && vep.Filename == "") {
-				MessagePopup.PopupMessage(this, MessageType.Warning,
-				                          Catalog.GetString("Please, select a video file."));
-				response=vep.Run();
-			}
-			if (response ==(int)ResponseType.Ok) {
-				//FIXME:Create a new instance of the video editor until we fix the audio swith enable/disabled
-				LoadEditor();
-				//videoEditor.ClearList();
-				foreach (PlayListPlay segment in playList) {
-					if (segment.Valid)
-						videoEditor.AddSegment(segment.MediaFile.FilePath,
-						                       segment.Start.MSeconds,
-						                       segment.Duration.MSeconds,
-						                       segment.Rate,
-						                       segment.Name,
-						                       segment.MediaFile.HasAudio);
-				}
-				try {
-					videoEditor.VideoQuality = vep.VideoQuality;
-					videoEditor.AudioQuality = AudioQuality.Good;
-					videoEditor.VideoFormat = vep.VideoFormat;
-					videoEditor.AudioEncoder = vep.AudioEncoderType;
-					videoEditor.VideoEncoder = vep.VideoEncoderType;
-					videoEditor.OutputFile = vep.Filename;
-					videoEditor.EnableTitle = vep.TitleOverlay;
-					videoEditor.EnableAudio = vep.EnableAudio;
-					videoEditor.VideoMuxer = vep.VideoMuxer;
-					videoEditor.Start();
-					closebutton.Show();
-					newvideobutton.Hide();
-				}
-				catch (Exception ex) {
-					MessagePopup.PopupMessage(this, MessageType.Error, Catalog.GetString(ex.Message));
-				}
-			vep.Destroy();
-			}
-		}
-
-		protected virtual void OnClosebuttonClicked(object sender, System.EventArgs e)
-		{
-			videoEditor.Cancel();
-			closebutton.Hide();
-			newvideobutton.Show();
-		}
-
-		protected virtual void OnProgress(float progress) {
-			if (Progress!= null)
-				Progress(progress);
-
-			if (progress ==1) {
-				closebutton.Hide();
-				newvideobutton.Show();
-			}
-		}
-
-		protected virtual void OnApplyRate(PlayListPlay plNode) {
-			if (ApplyCurrentRate != null)
-				ApplyCurrentRate(plNode);
-		}
-	}
-}
+// PlayListWidget.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using LongoMatch.Video.Editor;
+using Mono.Unix;
+using System.IO;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Video.Player;
+using LongoMatch.Video;
+using LongoMatch.Video.Common;
+using LongoMatch.Gui;
+using LongoMatch.Gui.Dialog;
+using LongoMatch.Playlist;
+
+
+
+namespace LongoMatch.Gui.Component
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class PlayListWidget : Gtk.Bin
+	{
+		public event PlayListNodeSelectedHandler PlayListNodeSelected;
+		public event ApplyCurrentRateHandler ApplyCurrentRate;
+		public event ProgressHandler Progress;
+
+		private PlayerBin player;
+		private PlayListPlay plNode;
+		private PlayList playList;
+		private uint timeout;
+		private object lock_node;
+		private bool clock_started = false;
+		private IVideoEditor videoEditor;
+		private MultimediaFactory factory;
+
+
+		public PlayListWidget ()
+		{
+			this.Build ();
+			lock_node = new System.Object ();
+			factory = new MultimediaFactory ();
+			playlisttreeview1.Reorderable = true;
+			playlisttreeview1.RowActivated += OnPlaylisttreeview1RowActivated;
+			playlisttreeview1.ApplyCurrentRate += OnApplyRate;
+			savebutton.Sensitive = false;
+			
+			newbutton.CanFocus = false;
+			openbutton.CanFocus = false;
+			savebutton.CanFocus = false;
+			newvideobutton.CanFocus = false;
+			closebutton.CanFocus = false;
+		}
+
+		public void SetPlayer(PlayerBin player) {
+			this.player = player;
+			closebutton.Hide();
+			newvideobutton.Hide();
+		}
+
+		public void Load(string filePath) {
+			try {
+				playList = new PlayList(filePath);
+				Model = playList.GetModel();
+				label1.Visible = false;
+				newvideobutton.Show();
+				playlisttreeview1.PlayList = playList;
+				playlisttreeview1.Sensitive = true;
+				savebutton.Sensitive = true;
+			} catch {
+				MessagePopup.PopupMessage(this,MessageType.Error,Catalog.GetString("The file you are trying to load is not a playlist or it's not compatible with the current version"));
+			}
+		}
+
+		public ListStore Model {
+			set {
+				playlisttreeview1.Model = value;
+			}
+			get {
+				return (ListStore)playlisttreeview1.Model;
+			}
+		}
+
+		public void Add(PlayListPlay plNode) {
+			if (playList!=null) {
+				Model.AppendValues(plNode);
+				playList.Add(plNode);
+			}
+		}
+
+		public PlayListPlay Next() {
+			if (playList.HasNext()) {
+				plNode = playList.Next();
+				playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
+				playlisttreeview1.LoadedPlay = plNode;
+				if (PlayListNodeSelected != null && plNode.Valid) {
+					PlayListNodeSelected(plNode,playList.HasNext());
+					StartClock();
+				}
+				else
+					Next();
+				return plNode;
+			}
+			else {
+				return null;
+			}
+		}
+
+		public void Prev() {
+			if ((player.AccurateCurrentTime - plNode.Start.MSeconds) < 500) {
+				//Seleccionando el elemento anterior si no han pasado m.ís 500ms
+				if (playList.HasPrev()) {
+					plNode = playList.Prev();
+					playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
+					playlisttreeview1.LoadedPlay = plNode;
+					if (PlayListNodeSelected != null)
+						PlayListNodeSelected(plNode,playList.HasNext());
+					StartClock();
+				}
+			}
+			else {
+				//Nos situamos al inicio del segmento
+				player.SeekTo(plNode.Start.MSeconds,true);
+				player.Rate=plNode.Rate;
+			}
+		}
+
+		public void StopEdition() {
+			if (videoEditor != null)
+				videoEditor.Cancel();
+		}
+
+		public void Stop() {
+			StopClock();
+		}
+
+		void StartClock()	{
+			if (player!=null && !clock_started) {
+				timeout = GLib.Timeout.Add(20,CheckStopTime);
+				clock_started=true;
+			}
+		}
+
+		private void StopClock() {
+			if (clock_started) {
+				GLib.Source.Remove(timeout);
+				clock_started = false;
+			}
+		}
+
+		private bool CheckStopTime() {
+			lock (lock_node) {
+				if (player != null) {
+					if (player.AccurateCurrentTime >= plNode.Stop.MSeconds-200) {
+						if (Next() == null)
+							StopClock();
+					}
+				}
+				return true;
+			}
+		}
+		private PlayListPlay SelectPlayListNode(TreePath path) {
+
+			plNode = playList.Select(Int32.Parse(path.ToString()));
+			if (PlayListNodeSelected != null && plNode.Valid) {
+				PlayListNodeSelected(plNode,playList.HasNext());
+				StartClock();
+			}
+			return plNode;
+		}
+
+		private FileFilter FileFilter {
+			get {
+				FileFilter filter = new FileFilter();
+				filter.Name = "LGM playlist";
+				filter.AddPattern("*.lgm");
+				return filter;
+			}
+		}
+
+		private void LoadEditor() {
+			videoEditor = factory.getVideoEditor();
+			videoEditor.Progress += new ProgressHandler(OnProgress);
+		}
+
+		protected virtual void OnPlaylisttreeview1RowActivated(object o, Gtk.RowActivatedArgs args)
+		{
+			playlisttreeview1.LoadedPlay = SelectPlayListNode(args.Path);
+		}
+
+
+		protected virtual void OnSavebuttonClicked(object sender, System.EventArgs e)
+		{
+			if (playList != null) {
+				playList.Save();
+			}
+		}
+
+		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Open playlist"),
+			                (Gtk.Window)this.Toplevel,
+			                FileChooserAction.Open,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-open",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.PlayListDir());
+			fChooser.AddFilter(FileFilter);
+			fChooser.DoOverwriteConfirmation = true;
+			if (fChooser.Run() == (int)ResponseType.Accept)
+				Load(fChooser.Filename);
+			fChooser.Destroy();
+		}
+
+		protected virtual void OnNewbuttonClicked(object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("New playlist"),
+			                (Gtk.Window)this.Toplevel,
+			                FileChooserAction.Save,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-save",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.PlayListDir());
+			fChooser.AddFilter(FileFilter);
+
+			if (fChooser.Run() == (int)ResponseType.Accept)
+				Load(fChooser.Filename);
+			fChooser.Destroy();
+		}
+
+		protected virtual void OnPlaylisttreeview1DragEnd(object o, Gtk.DragEndArgs args)
+		{
+			playList.SetModel((ListStore)playlisttreeview1.Model);
+		}
+
+		protected virtual void OnNewvideobuttonClicked(object sender, System.EventArgs e)
+		{
+			VideoEditionProperties vep;
+			int response;
+
+			if (playList.Count == 0) {
+				MessagePopup.PopupMessage(this,MessageType.Warning,
+				                          Catalog.GetString("The playlist is empty!"));
+				return;
+			}
+
+			vep = new VideoEditionProperties();
+			vep.TransientFor = (Gtk.Window)this.Toplevel;
+			response = vep.Run();
+			while (response == (int)ResponseType.Ok && vep.Filename == "") {
+				MessagePopup.PopupMessage(this, MessageType.Warning,
+				                          Catalog.GetString("Please, select a video file."));
+				response=vep.Run();
+			}
+			if (response ==(int)ResponseType.Ok) {
+				//FIXME:Create a new instance of the video editor until we fix the audio swith enable/disabled
+				LoadEditor();
+				//videoEditor.ClearList();
+				foreach (PlayListPlay segment in playList) {
+					if (segment.Valid)
+						videoEditor.AddSegment(segment.MediaFile.FilePath,
+						                       segment.Start.MSeconds,
+						                       segment.Duration.MSeconds,
+						                       segment.Rate,
+						                       segment.Name,
+						                       segment.MediaFile.HasAudio);
+				}
+				try {
+					videoEditor.VideoQuality = vep.VideoQuality;
+					videoEditor.AudioQuality = AudioQuality.Good;
+					videoEditor.VideoFormat = vep.VideoFormat;
+					videoEditor.AudioEncoder = vep.AudioEncoderType;
+					videoEditor.VideoEncoder = vep.VideoEncoderType;
+					videoEditor.OutputFile = vep.Filename;
+					videoEditor.EnableTitle = vep.TitleOverlay;
+					videoEditor.EnableAudio = vep.EnableAudio;
+					videoEditor.VideoMuxer = vep.VideoMuxer;
+					videoEditor.Start();
+					closebutton.Show();
+					newvideobutton.Hide();
+				}
+				catch (Exception ex) {
+					MessagePopup.PopupMessage(this, MessageType.Error, Catalog.GetString(ex.Message));
+				}
+			vep.Destroy();
+			}
+		}
+
+		protected virtual void OnClosebuttonClicked(object sender, System.EventArgs e)
+		{
+			videoEditor.Cancel();
+			closebutton.Hide();
+			newvideobutton.Show();
+		}
+
+		protected virtual void OnProgress(float progress) {
+			if (Progress!= null)
+				Progress(progress);
+
+			if (progress ==1) {
+				closebutton.Hide();
+				newvideobutton.Show();
+			}
+		}
+
+		protected virtual void OnApplyRate(PlayListPlay plNode) {
+			if (ApplyCurrentRate != null)
+				ApplyCurrentRate(plNode);
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
index 5d09f07..a6306f8 100644
--- a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
@@ -1,181 +1,181 @@
-// TreeWidget.cs
-//
-//  Copyright(C) 20072009 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.Collections.Generic;
-using Gtk;
-using Mono.Unix;
-using LongoMatch.DB;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-using LongoMatch.Common;
-
-namespace LongoMatch.Gui.Component
-{
-
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public partial class PlaysListTreeWidget : Gtk.Bin
-	{
-
-		public event TimeNodeSelectedHandler TimeNodeSelected;
-		public event TimeNodeChangedHandler TimeNodeChanged;
-		public event TimeNodeDeletedHandler TimeNodeDeleted;
-		public event PlayListNodeAddedHandler PlayListNodeAdded;
-		public event SnapshotSeriesHandler SnapshotSeriesEvent;
-		public event PlayersTaggedHandler PlayersTagged;
-		public event TagPlayHandler TagPlay;
-
-		private Project project;
-
-		public PlaysListTreeWidget()
-		{
-			this.Build();
-			treeview.TimeNodeChanged += OnTimeNodeChanged;
-            treeview.TimeNodeSelected += OnTimeNodeSelected;
-            treeview.TimeNodeDeleted += OnTimeNodeDeleted;
-            treeview.PlayListNodeAdded += OnPlayListNodeAdded;
-            treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
-            treeview.PlayersTagged += OnPlayersTagged;
-            treeview.TagPlay += OnTagPlay;
-		}
-
-		public void RemovePlays(List<Play> plays) {
-			TreeIter iter, child;
-			TreeStore model;
-			List<TreeIter> removeIters;
-			
-			if (project == null)
-				return;
-			
-			removeIters = new List<TreeIter>();
-			model = (TreeStore)treeview.Model;
-			model.GetIterFirst(out iter);
-			/* Scan all the tree and store the iter of each play 
-			 * we need to delete, but don't delete it yet so that
-			 * we don't alter the tree */
-			do{
-				if (!model.IterHasChild(iter))
-					continue;
-				
-				model.IterChildren(out child, iter);
-				do {
-					Play play = (Play) model.GetValue(child,0);
-					if (plays.Contains(play)) {
-						removeIters.Add(child);
-					}
-				} while (model.IterNext(ref child)); 
-			} while (model.IterNext(ref iter));
-			
-			/* Remove the selected iters now */
-			for (int i=0; i < removeIters.Count; i++){
-				iter = removeIters[i];
-				model.Remove(ref iter);
-			}
-		}
-
-		public void AddPlay(Play play) {
-			TreeIter categoryIter;
-			
-			if (project == null)
-			return;
-			
-			var cat = play.Category;
-			var model = (TreeStore)treeview.Model;
-			model.GetIterFromString(out categoryIter, CategoryPath(cat));
-			var playIter = model.AppendValues(categoryIter,play);
-			var playPath = model.GetPath(playIter);
-			treeview.Selection.UnselectAll();				
-			treeview.ExpandToPath(playPath);
-			treeview.Selection.SelectIter(playIter);
-		}
-
-		public bool ProjectIsLive{
-			set{
-				treeview.ProjectIsLive = value;
-			}
-		}
-
-		public Project Project {
-			set {
-				project = value;
-				if (project != null) {
-					treeview.Model = project.GetModel();
-					treeview.Colors = true;
-					treeview.VisitorTeam = project.Description.VisitorName;
-					treeview.LocalTeam = project.Description.LocalName;
-				}
-				else {
-					treeview.Model = null;
-				}
-			}
-		}
-
-		public bool PlayListLoaded {
-			set {
-				treeview.PlayListLoaded=value;
-			}
-		}
-		
-		private string CategoryPath(Category cat){
-			return project.Categories.IndexOf(cat).ToString();
-		}
-
-		protected virtual void OnTimeNodeChanged(TimeNode tNode,object val) {
-			if (TimeNodeChanged != null)
-				TimeNodeChanged(tNode,val);
-		}
-
-		protected virtual void OnTimeNodeSelected(Play tNode) {
-			if (TimeNodeSelected != null)
-				TimeNodeSelected(tNode);
-		}
-
-		protected virtual void OnTimeNodeDeleted(List<Play> plays){
-			if (TimeNodeDeleted != null)
-				TimeNodeDeleted(plays);
-		}
-
-		protected virtual void OnPlayListNodeAdded(Play tNode)
-		{
-			if (PlayListNodeAdded != null)
-				PlayListNodeAdded(tNode);
-		}
-
-		protected virtual void OnSnapshotSeriesEvent(LongoMatch.Store.Play tNode)
-		{
-			if (SnapshotSeriesEvent != null)
-				SnapshotSeriesEvent(tNode);
-		}
-
-		protected virtual void OnPlayersTagged(LongoMatch.Store.Play tNode, Team team)
-		{
-			if (PlayersTagged != null)
-				PlayersTagged(tNode,team);
-		}
-
-		protected virtual void OnTagPlay (LongoMatch.Store.Play tNode)
-		{
-			if (TagPlay != null)
-				TagPlay(tNode);
-		}
-	}
-}
+// TreeWidget.cs
+//
+//  Copyright(C) 20072009 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.Collections.Generic;
+using Gtk;
+using Mono.Unix;
+using LongoMatch.DB;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Common;
+
+namespace LongoMatch.Gui.Component
+{
+
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class PlaysListTreeWidget : Gtk.Bin
+	{
+
+		public event TimeNodeSelectedHandler TimeNodeSelected;
+		public event TimeNodeChangedHandler TimeNodeChanged;
+		public event TimeNodeDeletedHandler TimeNodeDeleted;
+		public event PlayListNodeAddedHandler PlayListNodeAdded;
+		public event SnapshotSeriesHandler SnapshotSeriesEvent;
+		public event PlayersTaggedHandler PlayersTagged;
+		public event TagPlayHandler TagPlay;
+
+		private Project project;
+
+		public PlaysListTreeWidget()
+		{
+			this.Build();
+			treeview.TimeNodeChanged += OnTimeNodeChanged;
+            treeview.TimeNodeSelected += OnTimeNodeSelected;
+            treeview.TimeNodeDeleted += OnTimeNodeDeleted;
+            treeview.PlayListNodeAdded += OnPlayListNodeAdded;
+            treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
+            treeview.PlayersTagged += OnPlayersTagged;
+            treeview.TagPlay += OnTagPlay;
+		}
+
+		public void RemovePlays(List<Play> plays) {
+			TreeIter iter, child;
+			TreeStore model;
+			List<TreeIter> removeIters;
+			
+			if (project == null)
+				return;
+			
+			removeIters = new List<TreeIter>();
+			model = (TreeStore)treeview.Model;
+			model.GetIterFirst(out iter);
+			/* Scan all the tree and store the iter of each play 
+			 * we need to delete, but don't delete it yet so that
+			 * we don't alter the tree */
+			do{
+				if (!model.IterHasChild(iter))
+					continue;
+				
+				model.IterChildren(out child, iter);
+				do {
+					Play play = (Play) model.GetValue(child,0);
+					if (plays.Contains(play)) {
+						removeIters.Add(child);
+					}
+				} while (model.IterNext(ref child)); 
+			} while (model.IterNext(ref iter));
+			
+			/* Remove the selected iters now */
+			for (int i=0; i < removeIters.Count; i++){
+				iter = removeIters[i];
+				model.Remove(ref iter);
+			}
+		}
+
+		public void AddPlay(Play play) {
+			TreeIter categoryIter;
+			
+			if (project == null)
+			return;
+			
+			var cat = play.Category;
+			var model = (TreeStore)treeview.Model;
+			model.GetIterFromString(out categoryIter, CategoryPath(cat));
+			var playIter = model.AppendValues(categoryIter,play);
+			var playPath = model.GetPath(playIter);
+			treeview.Selection.UnselectAll();				
+			treeview.ExpandToPath(playPath);
+			treeview.Selection.SelectIter(playIter);
+		}
+
+		public bool ProjectIsLive{
+			set{
+				treeview.ProjectIsLive = value;
+			}
+		}
+
+		public Project Project {
+			set {
+				project = value;
+				if (project != null) {
+					treeview.Model = project.GetModel();
+					treeview.Colors = true;
+					treeview.VisitorTeam = project.Description.VisitorName;
+					treeview.LocalTeam = project.Description.LocalName;
+				}
+				else {
+					treeview.Model = null;
+				}
+			}
+		}
+
+		public bool PlayListLoaded {
+			set {
+				treeview.PlayListLoaded=value;
+			}
+		}
+		
+		private string CategoryPath(Category cat){
+			return project.Categories.IndexOf(cat).ToString();
+		}
+
+		protected virtual void OnTimeNodeChanged(TimeNode tNode,object val) {
+			if (TimeNodeChanged != null)
+				TimeNodeChanged(tNode,val);
+		}
+
+		protected virtual void OnTimeNodeSelected(Play tNode) {
+			if (TimeNodeSelected != null)
+				TimeNodeSelected(tNode);
+		}
+
+		protected virtual void OnTimeNodeDeleted(List<Play> plays){
+			if (TimeNodeDeleted != null)
+				TimeNodeDeleted(plays);
+		}
+
+		protected virtual void OnPlayListNodeAdded(Play tNode)
+		{
+			if (PlayListNodeAdded != null)
+				PlayListNodeAdded(tNode);
+		}
+
+		protected virtual void OnSnapshotSeriesEvent(LongoMatch.Store.Play tNode)
+		{
+			if (SnapshotSeriesEvent != null)
+				SnapshotSeriesEvent(tNode);
+		}
+
+		protected virtual void OnPlayersTagged(LongoMatch.Store.Play tNode, Team team)
+		{
+			if (PlayersTagged != null)
+				PlayersTagged(tNode,team);
+		}
+
+		protected virtual void OnTagPlay (LongoMatch.Store.Play tNode)
+		{
+			if (TagPlay != null)
+				TagPlay(tNode);
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index 81258c6..0f25914 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -1,600 +1,600 @@
-// FileDescriptionWidget.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Gui.Dialog;
-using LongoMatch.Gui.Popup;
-using LongoMatch.Handlers;
-using LongoMatch.IO;
-using LongoMatch.Store;
-using LongoMatch.Store.Templates;
-using LongoMatch.Video.Capturer;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Utils;
-using Mono.Unix;
-
-namespace LongoMatch.Gui.Component
-{
-
-
-	//TODO añadir eventos de cambios para realizar el cambio directamente sobre el file data abierto
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public partial class ProjectDetailsWidget : Gtk.Bin
-	{
-		public event EventHandler EditedEvent;
-		private Project project;
-		private LongoMatch.Video.Utils.PreviewMediaFile mFile;
-		private bool edited;
-		private DateTime date;
-		private CalendarPopup cp;
-		private Win32CalendarDialog win32CP;
-		private Categories actualCategory;
-		private TeamTemplate actualVisitorTeam;
-		private TeamTemplate actualLocalTeam;
-		private ProjectType useType;
-		private List<Device> videoDevices;
-		private const string PAL_FORMAT = "720x576 (4:3)";
-		private const string PAL_3_4_FORMAT = "540x432 (4:3)";
-		private const string PAL_1_2_FORMAT = "360x288 (4:3)";
-		private const string DV_SOURCE = "DV Source";
-		private const string GCONF_SOURCE = "GConf Source";
-		
-		
-		public ProjectDetailsWidget()
-		{
-			this.Build();
-
-			//HACK:The calendar dialog does not respond on win32
-			if (Environment.OSVersion.Platform != PlatformID.Win32NT) {
-				cp = new CalendarPopup();
-				cp.Hide();
-				cp.DateSelectedEvent += new DateSelectedHandler(OnDateSelected);
-			}
-			
-			FillSections();
-			FillTeamsTemplate();
-			FillFormats();
-			
-			videoDevices = new List<Device>();
-
-			Use=ProjectType.FileProject;
-		}
-
-		public ProjectType Use {
-			set {
-				bool visible1 = value == ProjectType.CaptureProject; 
-				bool visible2 = value != ProjectType.FakeCaptureProject;
-				bool visible3 = value != ProjectType.EditProject;
-				
-				filelabel.Visible = visible2;
-				filehbox.Visible = visible2;
-				
-				tagscombobox.Visible = visible3;
-				localcombobox.Visible = visible3;
-				visitorcombobox.Visible = visible3;
-				
-				expander1.Visible = visible1;
-				device.Visible = visible1;
-				devicecombobox.Visible = visible1;
-				
-				useType = value;
-			}
-			get {
-				return useType;
-			}
-		}
-
-		public bool Edited {
-			set {
-				edited=value;
-			}
-			get {
-				return edited;
-			}
-		}
-
-		public string LocalName {
-			get {
-				return localTeamEntry.Text;
-			}
-			set {
-				localTeamEntry.Text = value;
-			}
-		}
-
-		public string VisitorName {
-			get {
-				return visitorTeamEntry.Text;
-			}
-			set {
-				visitorTeamEntry.Text = value;
-			}
-		}
-
-		public string Season {
-			get {
-				return seasonentry.Text;
-			}
-			set {
-				seasonentry.Text = value;
-			}
-		}
-
-		public string Competition {
-			get {
-				return competitionentry.Text;
-			}
-			set {
-				competitionentry.Text = value;
-			}
-		}
-
-		public int LocalGoals {
-			get {
-				return (int)localSpinButton.Value;
-			}
-			set {
-				localSpinButton.Value = value;
-			}
-		}
-
-		public int VisitorGoals {
-			get {
-				return (int)visitorSpinButton.Value;
-			}
-			set {
-				visitorSpinButton.Value = value;
-			}
-		}
-
-		private string Filename {
-			get {
-				return fileEntry.Text;
-			}
-			set {
-				fileEntry.Text = value;
-			}
-		}
-
-		public DateTime Date {
-			get {
-				return date;
-			}
-			set {
-				date = value;
-				dateEntry.Text = value.ToShortDateString();
-			}
-		}
-
-		public Categories Categories {
-			get {
-				return actualCategory;
-			}
-			set {
-				actualCategory = value;
-			}
-		}
-
-		public TeamTemplate LocalTeamTemplate {
-			get {
-				return actualLocalTeam;
-			}
-			set {
-				actualLocalTeam = value;
-			}
-		}
-
-		public TeamTemplate VisitorTeamTemplate {
-			get {
-				return actualVisitorTeam;
-			}
-			set {
-				actualVisitorTeam = value;
-			}
-		}
-
-		private string SectionsFile {
-			get {
-				return tagscombobox.ActiveText + ".sct";
-			}
-		}
-
-		private string LocalTeamTemplateFile {
-			get {
-				return localcombobox.ActiveText + ".tem";
-			}
-		}
-
-		private string VisitorTeamTemplateFile {
-			get {
-				return visitorcombobox.ActiveText + ".tem";
-			}
-		}
-		
-		public CapturePropertiesStruct CaptureProperties{
-			get{
-				CapturePropertiesStruct s = new CapturePropertiesStruct();
-				s.OutputFile = fileEntry.Text;
-				s.AudioBitrate = (uint)audiobitratespinbutton.Value;
-				s.VideoBitrate = (uint)videobitratespinbutton.Value;
-				if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV){
-					if (Environment.OSVersion.Platform == PlatformID.Win32NT)
-						s.CaptureSourceType = CaptureSourceType.DShow;
-					else
-						s.CaptureSourceType = CaptureSourceType.DV;
-				}
-				else {
-					s.CaptureSourceType = CaptureSourceType.Raw;
-				}
-				s.DeviceID = videoDevices[devicecombobox.Active].ID;
-				/* Get size info */
-				switch (sizecombobox.ActiveText){
-					/* FIXME: Don't harcode size values */
-					case PAL_FORMAT:
-						s.Width = 720;
-						s.Height = 576;
-						break;
-					case PAL_3_4_FORMAT:
-						s.Width = 540;
-						s.Height = 432;
-						break;
-					case PAL_1_2_FORMAT:
-						s.Width = 360;
-						s.Height = 288;
-						break;
-					default:
-						s.Width = 0;
-						s.Height = 0;
-						break;
-				}
-				/* Get video compresion format info */
-				switch (videoformatcombobox.ActiveText){
-					case Constants.AVI:
-						s.VideoEncoder = VideoEncoderType.Mpeg4;
-						s.AudioEncoder = AudioEncoderType.Mp3;
-						s.Muxer = VideoMuxerType.Avi;
-						break;
-					case Constants.MP4:
-						s.VideoEncoder = VideoEncoderType.H264;
-						s.AudioEncoder = AudioEncoderType.Aac;
-						s.Muxer = VideoMuxerType.Mp4;
-						break;
-					case Constants.OGG:
-						s.VideoEncoder = VideoEncoderType.Theora;
-						s.AudioEncoder = AudioEncoderType.Vorbis;
-						s.Muxer = VideoMuxerType.Ogg;
-						break;
-					case Constants.WEBM:
-						s.VideoEncoder = VideoEncoderType.VP8;
-						s.AudioEncoder = AudioEncoderType.Vorbis;
-						s.Muxer = VideoMuxerType.WebM;
-						break;
-				}
-				return s;
-			}
-		}
-		
-		public void SetProject(Project project) {
-			this.project = project;
-			var desc = project.Description;
-			mFile = desc.File;
-			Filename = mFile != null ? mFile.FilePath : "";
-			LocalName = desc.LocalName;
-			VisitorName = desc.VisitorName;
-			LocalGoals = desc.LocalGoals;
-			VisitorGoals = desc.VisitorGoals;
-			Date = desc.MatchDate;
-			Season = desc.Season;
-			Competition = desc.Competition;
-			Categories = project.Categories;
-			LocalTeamTemplate = project.LocalTeamTemplate;
-			VisitorTeamTemplate = project.VisitorTeamTemplate;
-			Edited = false;
-		}
-
-		public void UpdateProject() {
-			var desc = project.Description;
-			desc.File= mFile;			
-			desc.LocalName = localTeamEntry.Text;
-			desc.VisitorName = visitorTeamEntry.Text;
-			desc.LocalGoals = (int)localSpinButton.Value;
-			desc.VisitorGoals = (int)visitorSpinButton.Value;
-			desc.MatchDate = DateTime.Parse(dateEntry.Text);
-			desc.Competition = competitionentry.Text;
-			desc.Season = seasonentry.Text;
-			project.Categories = Categories;
-			project.LocalTeamTemplate = LocalTeamTemplate;
-			project.VisitorTeamTemplate = VisitorTeamTemplate;
-		}
-
-		public Project GetProject() {
-			if (useType != ProjectType.EditProject) {
-				if (Filename == "" && useType != ProjectType.FakeCaptureProject)
-					return null;
-				else {
-					if (useType == ProjectType.FakeCaptureProject){
-						mFile = new PreviewMediaFile();
-						mFile.FilePath = Constants.FAKE_PROJECT;
-						mFile.Fps = 25;
-					} else if  (useType == ProjectType.CaptureProject){
-						mFile = new PreviewMediaFile();
-						mFile.FilePath = fileEntry.Text;
-						mFile.Fps = 25;
-					}
-					var desc = new ProjectDescription {
-						File = mFile,
-						LocalName = LocalName,
-						VisitorName = VisitorName,
-						Season = Season,
-						Competition = Competition,
-						LocalGoals = LocalGoals,
-						MatchDate = Date
-					};
-					
-					return new Project{
-						Description = desc,
-						Categories = Categories,
-						LocalTeamTemplate = LocalTeamTemplate,
-						VisitorTeamTemplate = VisitorTeamTemplate};
-				}				
-			}
-			else {
-				// New imported project from a fake live analysis will have a null File
-				// return null to force selecting a new file.
-				if (mFile == null)
-					return null;
-				UpdateProject();
-				return project;
-			}
-		}
-
-		public void Clear() {
-			LocalName = "";
-			VisitorName = "";
-			LocalGoals = 0;
-			VisitorGoals = 0;
-			Date = System.DateTime.Today;
-			Filename = "";
-			mFile = null;
-			edited = false;
-		}
-		
-		public void FillDevices(List<Device> devices){
-			videoDevices = devices;
-			
-			foreach (Device device in devices){
-				string deviceElement;
-				string deviceName;
-				if (Environment.OSVersion.Platform == PlatformID.Unix){
-					if (device.DeviceType == DeviceType.DV)
-						deviceElement = Catalog.GetString(DV_SOURCE);
-					else 
-						deviceElement = Catalog.GetString(GCONF_SOURCE);
-				} else 
-					deviceElement = Catalog.GetString("DirectShow Source");
-				deviceName = (device.ID == "") ? Catalog.GetString("Unknown"): device.ID;
-				devicecombobox.AppendText(deviceName + " ("+deviceElement+")");
-				devicecombobox.Active = 0;
-			}
-		}
-
-		private void FillSections() {
-			string[] allFiles;
-			int i=0;
-			int index = 0;
-
-			allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.sct");
-			foreach (string filePath in allFiles) {
-				string fileName = System.IO	.Path.GetFileNameWithoutExtension(filePath);
-				tagscombobox.AppendText(fileName);
-				//Setting the selected value to the default template
-				if (fileName == "default")
-					index = i;
-				i++;
-			}
-			tagscombobox.Active = index;
-			Categories = Categories.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
-		}
-
-		private void FillTeamsTemplate() {
-			string[] allFiles;
-			int i=0;
-			int index = 0;
-
-			allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.tem");
-			foreach (string filePath in allFiles) {
-				string fileName = System.IO	.Path.GetFileNameWithoutExtension(filePath);
-				localcombobox.AppendText(fileName);
-				visitorcombobox.AppendText(fileName);
-
-				//Setting the selected value to the default template
-				if (fileName == "default")
-					index = i;
-				i++;
-			}
-			localcombobox.Active = index;
-			visitorcombobox.Active = index;
-			LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
-			                                                                     LocalTeamTemplateFile));
-			VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
-			                                                                       VisitorTeamTemplateFile));
-		}
-		
-		private void FillFormats(){
-			sizecombobox.AppendText (Catalog.GetString("Keep original size"));
-			sizecombobox.AppendText(PAL_FORMAT);
-			sizecombobox.AppendText(PAL_3_4_FORMAT);
-			sizecombobox.AppendText(PAL_1_2_FORMAT);
-			sizecombobox.Active = 0;
-		
-			videoformatcombobox.AppendText(Constants.AVI);
-			if (Environment.OSVersion.Platform != PlatformID.Win32NT)
-				videoformatcombobox.AppendText(Constants.WEBM);
-			videoformatcombobox.AppendText(Constants.OGG);
-			videoformatcombobox.AppendText(Constants.MP4);
-			videoformatcombobox.Active = 0;
-		}
-		
-		protected virtual void OnDateSelected(DateTime dateTime) {
-			Date = dateTime;
-		}
-
-		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
-		{
-			FileChooserDialog fChooser = null;
-
-			if (useType == ProjectType.CaptureProject) {
-				fChooser = new FileChooserDialog(Catalog.GetString("Output file"),
-				                                 (Gtk.Window)this.Toplevel,
-				                                 FileChooserAction.Save,
-				                                 "gtk-cancel",ResponseType.Cancel,
-				                                 "gtk-save",ResponseType.Accept);
-				fChooser.SetCurrentFolder(MainClass.VideosDir());
-				fChooser.DoOverwriteConfirmation = true;
-				if (fChooser.Run() == (int)ResponseType.Accept)
-					fileEntry.Text = fChooser.Filename;
-				fChooser.Destroy();
-
-			} else	{
-				fChooser = new FileChooserDialog(Catalog.GetString("Open file..."),
-				                                 (Gtk.Window)this.Toplevel,
-				                                 FileChooserAction.Open,
-				                                 "gtk-cancel",ResponseType.Cancel,
-				                                 "gtk-open",ResponseType.Accept);
-
-				fChooser.SetCurrentFolder(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal));
-
-				if (fChooser.Run() == (int)ResponseType.Accept) {
-					MessageDialog md=null;
-					string filename = fChooser.Filename;
-					fChooser.Destroy();
-					try {
-						md = new MessageDialog((Gtk.Window)this.Toplevel,
-						                       DialogFlags.Modal,
-						                       MessageType.Info,
-						                       Gtk.ButtonsType.None,
-						                       Catalog.GetString("Analyzing video file:")+"\n"+filename);
-						md.Icon=Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
-						md.Show();
-						mFile = LongoMatch.Video.Utils.PreviewMediaFile.GetMediaFile(filename);
-						if (!mFile.HasVideo || mFile.VideoCodec == "")
-							throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
-						if (mFile.HasVideo && mFile.Length == 0)
-							throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
-						
-							
-						fileEntry.Text = filename;
-					}
-					catch (Exception ex) {
-						MessagePopup.PopupMessage(this, MessageType.Error,
-						                          ex.Message);
-					}
-					finally {
-						md.Destroy();
-					}
-				}
-				fChooser.Destroy();
-			}
-		}
-
-
-		protected virtual void OnCalendarbuttonClicked(object sender, System.EventArgs e)
-		{
-			if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
-				win32CP = new Win32CalendarDialog();
-				win32CP.TransientFor = (Gtk.Window)this.Toplevel;
-				win32CP.Run();
-				Date = win32CP.getSelectedDate();
-				win32CP.Destroy();
-			}
-			else {
-				cp.TransientFor=(Gtk.Window)this.Toplevel;
-				cp.Show();
-			}
-		}
-
-		protected virtual void OnCombobox1Changed(object sender, System.EventArgs e)
-		{
-			Categories = Categories.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
-		}
-
-		protected virtual void OnVisitorcomboboxChanged(object sender, System.EventArgs e)
-		{
-			VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(), 
-			                                                                       VisitorTeamTemplateFile));
-		}
-
-
-		protected virtual void OnLocalcomboboxChanged(object sender, System.EventArgs e)
-		{
-			LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(), 
-			                                                                     LocalTeamTemplateFile));
-		}
-
-		protected virtual void OnEditbuttonClicked(object sender, System.EventArgs e)
-		{
-			ProjectTemplateEditorDialog ted = new ProjectTemplateEditorDialog();
-			ted.TransientFor = (Window)Toplevel;
-			ted.Categories = Categories;
-			ted.Project = project;
-			ted.CanExport = Use == ProjectType.EditProject;
-			if (ted.Run() == (int)ResponseType.Apply) {
-				Categories = ted.Categories;
-			}
-			ted.Destroy();
-			OnEdited(this,null);
-		}
-
-		protected virtual void OnLocaltemplatebuttonClicked(object sender, System.EventArgs e) {
-			TeamTemplateEditor tted = new TeamTemplateEditor();
-			tted.TransientFor = (Window)Toplevel;
-			tted.Title=Catalog.GetString("Local Team Template");
-			tted.SetTeamTemplate(LocalTeamTemplate);
-			
-			if (tted.Run() == (int)ResponseType.Apply) {
-				LocalTeamTemplate = tted.GetTeamTemplate();
-			}
-			tted.Destroy();
-			OnEdited(this,null);
-		}
-
-		protected virtual void OnVisitorbuttonClicked(object sender, System.EventArgs e) {
-			TeamTemplateEditor tted = new TeamTemplateEditor();
-			tted.TransientFor = (Window)Toplevel;
-			tted.Title=Catalog.GetString("Visitor Team Template");
-			tted.SetTeamTemplate(VisitorTeamTemplate);
-			if (tted.Run() == (int)ResponseType.Apply) {
-				VisitorTeamTemplate = tted.GetTeamTemplate();
-			}
-			tted.Destroy();
-			OnEdited(this,null);
-		}
-
-		protected virtual void OnEdited(object sender, System.EventArgs e) {
-			Edited = true;
-			if (EditedEvent != null)
-				EditedEvent(this,null);
-		}
-	}
-}
+// FileDescriptionWidget.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Gui.Dialog;
+using LongoMatch.Gui.Popup;
+using LongoMatch.Handlers;
+using LongoMatch.IO;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+namespace LongoMatch.Gui.Component
+{
+
+
+	//TODO a..adir eventos de cambios para realizar el cambio directamente sobre el file data abierto
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class ProjectDetailsWidget : Gtk.Bin
+	{
+		public event EventHandler EditedEvent;
+		private Project project;
+		private LongoMatch.Video.Utils.PreviewMediaFile mFile;
+		private bool edited;
+		private DateTime date;
+		private CalendarPopup cp;
+		private Win32CalendarDialog win32CP;
+		private Categories actualCategory;
+		private TeamTemplate actualVisitorTeam;
+		private TeamTemplate actualLocalTeam;
+		private ProjectType useType;
+		private List<Device> videoDevices;
+		private const string PAL_FORMAT = "720x576 (4:3)";
+		private const string PAL_3_4_FORMAT = "540x432 (4:3)";
+		private const string PAL_1_2_FORMAT = "360x288 (4:3)";
+		private const string DV_SOURCE = "DV Source";
+		private const string GCONF_SOURCE = "GConf Source";
+		
+		
+		public ProjectDetailsWidget()
+		{
+			this.Build();
+
+			//HACK:The calendar dialog does not respond on win32
+			if (Environment.OSVersion.Platform != PlatformID.Win32NT) {
+				cp = new CalendarPopup();
+				cp.Hide();
+				cp.DateSelectedEvent += new DateSelectedHandler(OnDateSelected);
+			}
+			
+			FillSections();
+			FillTeamsTemplate();
+			FillFormats();
+			
+			videoDevices = new List<Device>();
+
+			Use=ProjectType.FileProject;
+		}
+
+		public ProjectType Use {
+			set {
+				bool visible1 = value == ProjectType.CaptureProject; 
+				bool visible2 = value != ProjectType.FakeCaptureProject;
+				bool visible3 = value != ProjectType.EditProject;
+				
+				filelabel.Visible = visible2;
+				filehbox.Visible = visible2;
+				
+				tagscombobox.Visible = visible3;
+				localcombobox.Visible = visible3;
+				visitorcombobox.Visible = visible3;
+				
+				expander1.Visible = visible1;
+				device.Visible = visible1;
+				devicecombobox.Visible = visible1;
+				
+				useType = value;
+			}
+			get {
+				return useType;
+			}
+		}
+
+		public bool Edited {
+			set {
+				edited=value;
+			}
+			get {
+				return edited;
+			}
+		}
+
+		public string LocalName {
+			get {
+				return localTeamEntry.Text;
+			}
+			set {
+				localTeamEntry.Text = value;
+			}
+		}
+
+		public string VisitorName {
+			get {
+				return visitorTeamEntry.Text;
+			}
+			set {
+				visitorTeamEntry.Text = value;
+			}
+		}
+
+		public string Season {
+			get {
+				return seasonentry.Text;
+			}
+			set {
+				seasonentry.Text = value;
+			}
+		}
+
+		public string Competition {
+			get {
+				return competitionentry.Text;
+			}
+			set {
+				competitionentry.Text = value;
+			}
+		}
+
+		public int LocalGoals {
+			get {
+				return (int)localSpinButton.Value;
+			}
+			set {
+				localSpinButton.Value = value;
+			}
+		}
+
+		public int VisitorGoals {
+			get {
+				return (int)visitorSpinButton.Value;
+			}
+			set {
+				visitorSpinButton.Value = value;
+			}
+		}
+
+		private string Filename {
+			get {
+				return fileEntry.Text;
+			}
+			set {
+				fileEntry.Text = value;
+			}
+		}
+
+		public DateTime Date {
+			get {
+				return date;
+			}
+			set {
+				date = value;
+				dateEntry.Text = value.ToShortDateString();
+			}
+		}
+
+		public Categories Categories {
+			get {
+				return actualCategory;
+			}
+			set {
+				actualCategory = value;
+			}
+		}
+
+		public TeamTemplate LocalTeamTemplate {
+			get {
+				return actualLocalTeam;
+			}
+			set {
+				actualLocalTeam = value;
+			}
+		}
+
+		public TeamTemplate VisitorTeamTemplate {
+			get {
+				return actualVisitorTeam;
+			}
+			set {
+				actualVisitorTeam = value;
+			}
+		}
+
+		private string SectionsFile {
+			get {
+				return tagscombobox.ActiveText + ".sct";
+			}
+		}
+
+		private string LocalTeamTemplateFile {
+			get {
+				return localcombobox.ActiveText + ".tem";
+			}
+		}
+
+		private string VisitorTeamTemplateFile {
+			get {
+				return visitorcombobox.ActiveText + ".tem";
+			}
+		}
+		
+		public CapturePropertiesStruct CaptureProperties{
+			get{
+				CapturePropertiesStruct s = new CapturePropertiesStruct();
+				s.OutputFile = fileEntry.Text;
+				s.AudioBitrate = (uint)audiobitratespinbutton.Value;
+				s.VideoBitrate = (uint)videobitratespinbutton.Value;
+				if (videoDevices[devicecombobox.Active].DeviceType == DeviceType.DV){
+					if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+						s.CaptureSourceType = CaptureSourceType.DShow;
+					else
+						s.CaptureSourceType = CaptureSourceType.DV;
+				}
+				else {
+					s.CaptureSourceType = CaptureSourceType.Raw;
+				}
+				s.DeviceID = videoDevices[devicecombobox.Active].ID;
+				/* Get size info */
+				switch (sizecombobox.ActiveText){
+					/* FIXME: Don't harcode size values */
+					case PAL_FORMAT:
+						s.Width = 720;
+						s.Height = 576;
+						break;
+					case PAL_3_4_FORMAT:
+						s.Width = 540;
+						s.Height = 432;
+						break;
+					case PAL_1_2_FORMAT:
+						s.Width = 360;
+						s.Height = 288;
+						break;
+					default:
+						s.Width = 0;
+						s.Height = 0;
+						break;
+				}
+				/* Get video compresion format info */
+				switch (videoformatcombobox.ActiveText){
+					case Constants.AVI:
+						s.VideoEncoder = VideoEncoderType.Mpeg4;
+						s.AudioEncoder = AudioEncoderType.Mp3;
+						s.Muxer = VideoMuxerType.Avi;
+						break;
+					case Constants.MP4:
+						s.VideoEncoder = VideoEncoderType.H264;
+						s.AudioEncoder = AudioEncoderType.Aac;
+						s.Muxer = VideoMuxerType.Mp4;
+						break;
+					case Constants.OGG:
+						s.VideoEncoder = VideoEncoderType.Theora;
+						s.AudioEncoder = AudioEncoderType.Vorbis;
+						s.Muxer = VideoMuxerType.Ogg;
+						break;
+					case Constants.WEBM:
+						s.VideoEncoder = VideoEncoderType.VP8;
+						s.AudioEncoder = AudioEncoderType.Vorbis;
+						s.Muxer = VideoMuxerType.WebM;
+						break;
+				}
+				return s;
+			}
+		}
+		
+		public void SetProject(Project project) {
+			this.project = project;
+			var desc = project.Description;
+			mFile = desc.File;
+			Filename = mFile != null ? mFile.FilePath : "";
+			LocalName = desc.LocalName;
+			VisitorName = desc.VisitorName;
+			LocalGoals = desc.LocalGoals;
+			VisitorGoals = desc.VisitorGoals;
+			Date = desc.MatchDate;
+			Season = desc.Season;
+			Competition = desc.Competition;
+			Categories = project.Categories;
+			LocalTeamTemplate = project.LocalTeamTemplate;
+			VisitorTeamTemplate = project.VisitorTeamTemplate;
+			Edited = false;
+		}
+
+		public void UpdateProject() {
+			var desc = project.Description;
+			desc.File= mFile;			
+			desc.LocalName = localTeamEntry.Text;
+			desc.VisitorName = visitorTeamEntry.Text;
+			desc.LocalGoals = (int)localSpinButton.Value;
+			desc.VisitorGoals = (int)visitorSpinButton.Value;
+			desc.MatchDate = DateTime.Parse(dateEntry.Text);
+			desc.Competition = competitionentry.Text;
+			desc.Season = seasonentry.Text;
+			project.Categories = Categories;
+			project.LocalTeamTemplate = LocalTeamTemplate;
+			project.VisitorTeamTemplate = VisitorTeamTemplate;
+		}
+
+		public Project GetProject() {
+			if (useType != ProjectType.EditProject) {
+				if (Filename == "" && useType != ProjectType.FakeCaptureProject)
+					return null;
+				else {
+					if (useType == ProjectType.FakeCaptureProject){
+						mFile = new PreviewMediaFile();
+						mFile.FilePath = Constants.FAKE_PROJECT;
+						mFile.Fps = 25;
+					} else if  (useType == ProjectType.CaptureProject){
+						mFile = new PreviewMediaFile();
+						mFile.FilePath = fileEntry.Text;
+						mFile.Fps = 25;
+					}
+					var desc = new ProjectDescription {
+						File = mFile,
+						LocalName = LocalName,
+						VisitorName = VisitorName,
+						Season = Season,
+						Competition = Competition,
+						LocalGoals = LocalGoals,
+						MatchDate = Date
+					};
+					
+					return new Project{
+						Description = desc,
+						Categories = Categories,
+						LocalTeamTemplate = LocalTeamTemplate,
+						VisitorTeamTemplate = VisitorTeamTemplate};
+				}				
+			}
+			else {
+				// New imported project from a fake live analysis will have a null File
+				// return null to force selecting a new file.
+				if (mFile == null)
+					return null;
+				UpdateProject();
+				return project;
+			}
+		}
+
+		public void Clear() {
+			LocalName = "";
+			VisitorName = "";
+			LocalGoals = 0;
+			VisitorGoals = 0;
+			Date = System.DateTime.Today;
+			Filename = "";
+			mFile = null;
+			edited = false;
+		}
+		
+		public void FillDevices(List<Device> devices){
+			videoDevices = devices;
+			
+			foreach (Device device in devices){
+				string deviceElement;
+				string deviceName;
+				if (Environment.OSVersion.Platform == PlatformID.Unix){
+					if (device.DeviceType == DeviceType.DV)
+						deviceElement = Catalog.GetString(DV_SOURCE);
+					else 
+						deviceElement = Catalog.GetString(GCONF_SOURCE);
+				} else 
+					deviceElement = Catalog.GetString("DirectShow Source");
+				deviceName = (device.ID == "") ? Catalog.GetString("Unknown"): device.ID;
+				devicecombobox.AppendText(deviceName + " ("+deviceElement+")");
+				devicecombobox.Active = 0;
+			}
+		}
+
+		private void FillSections() {
+			string[] allFiles;
+			int i=0;
+			int index = 0;
+
+			allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.sct");
+			foreach (string filePath in allFiles) {
+				string fileName = System.IO	.Path.GetFileNameWithoutExtension(filePath);
+				tagscombobox.AppendText(fileName);
+				//Setting the selected value to the default template
+				if (fileName == "default")
+					index = i;
+				i++;
+			}
+			tagscombobox.Active = index;
+			Categories = Categories.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
+		}
+
+		private void FillTeamsTemplate() {
+			string[] allFiles;
+			int i=0;
+			int index = 0;
+
+			allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*.tem");
+			foreach (string filePath in allFiles) {
+				string fileName = System.IO	.Path.GetFileNameWithoutExtension(filePath);
+				localcombobox.AppendText(fileName);
+				visitorcombobox.AppendText(fileName);
+
+				//Setting the selected value to the default template
+				if (fileName == "default")
+					index = i;
+				i++;
+			}
+			localcombobox.Active = index;
+			visitorcombobox.Active = index;
+			LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
+			                                                                     LocalTeamTemplateFile));
+			VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),
+			                                                                       VisitorTeamTemplateFile));
+		}
+		
+		private void FillFormats(){
+			sizecombobox.AppendText (Catalog.GetString("Keep original size"));
+			sizecombobox.AppendText(PAL_FORMAT);
+			sizecombobox.AppendText(PAL_3_4_FORMAT);
+			sizecombobox.AppendText(PAL_1_2_FORMAT);
+			sizecombobox.Active = 0;
+		
+			videoformatcombobox.AppendText(Constants.AVI);
+			if (Environment.OSVersion.Platform != PlatformID.Win32NT)
+				videoformatcombobox.AppendText(Constants.WEBM);
+			videoformatcombobox.AppendText(Constants.OGG);
+			videoformatcombobox.AppendText(Constants.MP4);
+			videoformatcombobox.Active = 0;
+		}
+		
+		protected virtual void OnDateSelected(DateTime dateTime) {
+			Date = dateTime;
+		}
+
+		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = null;
+
+			if (useType == ProjectType.CaptureProject) {
+				fChooser = new FileChooserDialog(Catalog.GetString("Output file"),
+				                                 (Gtk.Window)this.Toplevel,
+				                                 FileChooserAction.Save,
+				                                 "gtk-cancel",ResponseType.Cancel,
+				                                 "gtk-save",ResponseType.Accept);
+				fChooser.SetCurrentFolder(MainClass.VideosDir());
+				fChooser.DoOverwriteConfirmation = true;
+				if (fChooser.Run() == (int)ResponseType.Accept)
+					fileEntry.Text = fChooser.Filename;
+				fChooser.Destroy();
+
+			} else	{
+				fChooser = new FileChooserDialog(Catalog.GetString("Open file..."),
+				                                 (Gtk.Window)this.Toplevel,
+				                                 FileChooserAction.Open,
+				                                 "gtk-cancel",ResponseType.Cancel,
+				                                 "gtk-open",ResponseType.Accept);
+
+				fChooser.SetCurrentFolder(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal));
+
+				if (fChooser.Run() == (int)ResponseType.Accept) {
+					MessageDialog md=null;
+					string filename = fChooser.Filename;
+					fChooser.Destroy();
+					try {
+						md = new MessageDialog((Gtk.Window)this.Toplevel,
+						                       DialogFlags.Modal,
+						                       MessageType.Info,
+						                       Gtk.ButtonsType.None,
+						                       Catalog.GetString("Analyzing video file:")+"\n"+filename);
+						md.Icon=Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
+						md.Show();
+						mFile = LongoMatch.Video.Utils.PreviewMediaFile.GetMediaFile(filename);
+						if (!mFile.HasVideo || mFile.VideoCodec == "")
+							throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
+						if (mFile.HasVideo && mFile.Length == 0)
+							throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
+						
+							
+						fileEntry.Text = filename;
+					}
+					catch (Exception ex) {
+						MessagePopup.PopupMessage(this, MessageType.Error,
+						                          ex.Message);
+					}
+					finally {
+						md.Destroy();
+					}
+				}
+				fChooser.Destroy();
+			}
+		}
+
+
+		protected virtual void OnCalendarbuttonClicked(object sender, System.EventArgs e)
+		{
+			if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+				win32CP = new Win32CalendarDialog();
+				win32CP.TransientFor = (Gtk.Window)this.Toplevel;
+				win32CP.Run();
+				Date = win32CP.getSelectedDate();
+				win32CP.Destroy();
+			}
+			else {
+				cp.TransientFor=(Gtk.Window)this.Toplevel;
+				cp.Show();
+			}
+		}
+
+		protected virtual void OnCombobox1Changed(object sender, System.EventArgs e)
+		{
+			Categories = Categories.Load(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
+		}
+
+		protected virtual void OnVisitorcomboboxChanged(object sender, System.EventArgs e)
+		{
+			VisitorTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(), 
+			                                                                       VisitorTeamTemplateFile));
+		}
+
+
+		protected virtual void OnLocalcomboboxChanged(object sender, System.EventArgs e)
+		{
+			LocalTeamTemplate = TeamTemplate.Load(System.IO.Path.Combine(MainClass.TemplatesDir(), 
+			                                                                     LocalTeamTemplateFile));
+		}
+
+		protected virtual void OnEditbuttonClicked(object sender, System.EventArgs e)
+		{
+			ProjectTemplateEditorDialog ted = new ProjectTemplateEditorDialog();
+			ted.TransientFor = (Window)Toplevel;
+			ted.Categories = Categories;
+			ted.Project = project;
+			ted.CanExport = Use == ProjectType.EditProject;
+			if (ted.Run() == (int)ResponseType.Apply) {
+				Categories = ted.Categories;
+			}
+			ted.Destroy();
+			OnEdited(this,null);
+		}
+
+		protected virtual void OnLocaltemplatebuttonClicked(object sender, System.EventArgs e) {
+			TeamTemplateEditor tted = new TeamTemplateEditor();
+			tted.TransientFor = (Window)Toplevel;
+			tted.Title=Catalog.GetString("Local Team Template");
+			tted.SetTeamTemplate(LocalTeamTemplate);
+			
+			if (tted.Run() == (int)ResponseType.Apply) {
+				LocalTeamTemplate = tted.GetTeamTemplate();
+			}
+			tted.Destroy();
+			OnEdited(this,null);
+		}
+
+		protected virtual void OnVisitorbuttonClicked(object sender, System.EventArgs e) {
+			TeamTemplateEditor tted = new TeamTemplateEditor();
+			tted.TransientFor = (Window)Toplevel;
+			tted.Title=Catalog.GetString("Visitor Team Template");
+			tted.SetTeamTemplate(VisitorTeamTemplate);
+			if (tted.Run() == (int)ResponseType.Apply) {
+				VisitorTeamTemplate = tted.GetTeamTemplate();
+			}
+			tted.Destroy();
+			OnEdited(this,null);
+		}
+
+		protected virtual void OnEdited(object sender, System.EventArgs e) {
+			Edited = true;
+			if (EditedEvent != null)
+				EditedEvent(this,null);
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/TimeLineWidget.cs b/LongoMatch/Gui/Component/TimeLineWidget.cs
index 208dfd0..3f704e3 100644
--- a/LongoMatch/Gui/Component/TimeLineWidget.cs
+++ b/LongoMatch/Gui/Component/TimeLineWidget.cs
@@ -1,246 +1,246 @@
-// TimeLineWidget.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-using System;
-using System.Collections.Generic;
-using Gtk;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-using LongoMatch.Store.Templates;
-
-namespace LongoMatch.Gui.Component {
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public partial class TimeLineWidget : Gtk.Bin
-	{
-
-		public event TimeNodeChangedHandler TimeNodeChanged;
-		public event TimeNodeSelectedHandler TimeNodeSelected;
-		public event TimeNodeDeletedHandler TimeNodeDeleted;
-		public event NewMarkAtFrameEventHandler NewMarkEvent;
-		//public event PlayListNodeAddedHandler PlayListNodeAdded;
-
-		private Dictionary<Category,TimeScale> tsList;
-		private Categories categories;
-		private TimeReferenceWidget tr;
-		CategoriesScale cs;
-		private uint frames;
-		private uint pixelRatio;
-		private Play selected;
-		private uint currentFrame;
-		private bool hasProject;
-
-
-		public TimeLineWidget()
-		{
-			this.Build();
-			SetPixelRatio(10);
-			zoomscale.CanFocus = false;
-			
-			GtkScrolledWindow.Vadjustment.ValueChanged += HandleScrollEvent;
-			GtkScrolledWindow.Hadjustment.ValueChanged += HandleScrollEvent;
-			
-			GtkScrolledWindow.HScrollbar.SizeAllocated += OnSizeAllocated;
-			
-			cs = new CategoriesScale();
-			cs.WidthRequest = 100;
-			categoriesbox.PackStart(cs, false, false, 0);
-			
-			tr = new TimeReferenceWidget();
-			timescalebox.PackStart(tr,false,false,0);
-			
-			tr.HeightRequest = 50 - leftbox.Spacing; 
-			toolsbox.HeightRequest = 50 - leftbox.Spacing;
-		}
-		
-		public Play SelectedTimeNode {
-			get {
-				return selected;
-			}
-			set {
-				if (!hasProject)
-					return;
-					
-				selected = value;
-				foreach (TimeScale  ts in tsList.Values)
-					ts.SelectedTimeNode = value;
-				if (selected != null) {
-					if (SelectedTimeNode.StartFrame/pixelRatio < GtkScrolledWindow.Hadjustment.Value ||
-					                SelectedTimeNode.StartFrame/pixelRatio > GtkScrolledWindow.Hadjustment.Value +
-					                GtkScrolledWindow.Allocation.Width - GtkScrolledWindow.VScrollbar.Allocation.Width)
-						AdjustPostion(SelectedTimeNode.StartFrame);
-				}
-				QueueDraw();
-			}
-		}
-
-		public uint CurrentFrame {
-			get {
-				return currentFrame;
-			}
-			set {
-				if (!hasProject)
-					return;
-				
-				currentFrame = value;
-				foreach (TimeScale  ts in tsList.Values) 
-					ts.CurrentFrame = value;
-				tr.CurrentFrame = value;
-				QueueDraw();
-			}
-		}
-
-		public void AdjustPostion(uint currentframe) {
-			int visibleWidth;
-			int realWidth;
-			uint pos;
-			int scrollbarWidth;
-			if (Visible) {
-				scrollbarWidth= GtkScrolledWindow.VScrollbar.Allocation.Width;
-				visibleWidth = GtkScrolledWindow.Allocation.Width-scrollbarWidth;
-				realWidth = vbox1.Allocation.Width;
-				pos = currentframe/pixelRatio;
-				if (pos+visibleWidth < realWidth) {
-					GtkScrolledWindow.Hadjustment.Value = pos;
-				}
-				else {
-					GtkScrolledWindow.Hadjustment.Value = realWidth-visibleWidth-20;
-				}
-			}
-		}
-
-		private void SetPixelRatio(uint pixelRatio) {
-			if (!hasProject)
-				return;
-			
-			this.pixelRatio = pixelRatio;
-			tr.PixelRatio = pixelRatio;
-			foreach (TimeScale  ts in tsList.Values)
-				ts.PixelRatio = pixelRatio;
-			zoomscale.Value=pixelRatio;
-		}
-
-		public Project Project {
-			set {
-				ResetGui();
-
-				if (value == null) {
-					categories = null;
-					tsList.Clear();
-					tsList=null;
-					hasProject = false;
-					return;
-				}
-				hasProject = true;
-				categories = value.Categories;
-				tsList = new Dictionary<Category, TimeScale>();
-				frames = value.Description.File.GetFrames();
-
-				cs.Categories = categories;
-				cs.Show();
-
-				tr.Frames = frames;
-				tr.FrameRate = value.Description.File.Fps;
-				tr.Show();
-				
-				foreach (Category cat in  categories) {
-					List<Play> playsList = value.PlaysInCategory(cat);
-					TimeScale ts = new TimeScale(cat, playsList,frames);
-					tsList[cat] = ts;
-					ts.TimeNodeChanged += new TimeNodeChangedHandler(OnTimeNodeChanged);
-					ts.TimeNodeSelected += new TimeNodeSelectedHandler(OnTimeNodeSelected);
-					ts.TimeNodeDeleted += new TimeNodeDeletedHandler(OnTimeNodeDeleted);
-					ts.NewMarkAtFrameEvent += new NewMarkAtFrameEventHandler(OnNewMark);
-					vbox1.PackStart(ts,true,true,0);
-					ts.Show();
-				}
-				SetPixelRatio(3);
-			}
-		}
-
-		public void AddPlay(Play play){
-			TimeScale ts;
-			if (tsList.TryGetValue(play.Category, out ts))
-				ts.AddPlay(play);
-		}
-		
-		public void RemovePlays (List<Play> plays){
-			TimeScale ts;
-			foreach (Play play in plays){
-				if (tsList.TryGetValue(play.Category, out ts))
-					ts.RemovePlay(play);
-			}
-			
-		}
-		private void ResetGui() {
-			//Unrealize all children
-			foreach (Widget w in vbox1.AllChildren) {
-				vbox1.Remove(w);
-				w.Destroy();
-			}
-		}
-
-		protected virtual void OnNewMark(Category category, int frame) {
-			if (NewMarkEvent != null)
-				NewMarkEvent(category,frame);
-		}
-
-		protected virtual void OnTimeNodeChanged(TimeNode tn, object val) {
-			if (TimeNodeChanged != null)
-				TimeNodeChanged(tn,val);
-		}
-
-		protected virtual void OnTimeNodeSelected(Play tn) {
-			if (TimeNodeSelected != null)
-				TimeNodeSelected(tn);
-		}
-		protected virtual void OnTimeNodeDeleted(List<Play> plays) {
-			if (TimeNodeDeleted != null)
-				TimeNodeDeleted(plays);
-		}
-
-		protected virtual void OnFitbuttonClicked(object sender, System.EventArgs e)
-		{
-			AdjustPostion(currentFrame);
-		}
-
-		protected virtual void OnZoomscaleValueChanged(object sender, System.EventArgs e)
-		{
-			SetPixelRatio((uint)(zoomscale.Value));
-			QueueDraw();
-			AdjustPostion(currentFrame);
-		}
-		
-		protected virtual void HandleScrollEvent (object sender, System.EventArgs args)
-		{
-			if (sender == GtkScrolledWindow.Vadjustment)
-				cs.Scroll = GtkScrolledWindow.Vadjustment.Value;
-			else if (sender == GtkScrolledWindow.Hadjustment)
-				tr.Scroll = GtkScrolledWindow.Hadjustment.Value;
-		}
-		
-		protected virtual void OnSizeAllocated (object sender, SizeAllocatedArgs e)
-		{
-			/* Align the categories list widget on top of the timeline's horizontal bar */
-			if (sender == GtkScrolledWindow.HScrollbar)
-				categoriesalignment1.BottomPadding = (uint) GtkScrolledWindow.HScrollbar.Allocation.Height;
-		}
-	}
-}
+// TimeLineWidget.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using System.Collections.Generic;
+using Gtk;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+
+namespace LongoMatch.Gui.Component {
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class TimeLineWidget : Gtk.Bin
+	{
+
+		public event TimeNodeChangedHandler TimeNodeChanged;
+		public event TimeNodeSelectedHandler TimeNodeSelected;
+		public event TimeNodeDeletedHandler TimeNodeDeleted;
+		public event NewMarkAtFrameEventHandler NewMarkEvent;
+		//public event PlayListNodeAddedHandler PlayListNodeAdded;
+
+		private Dictionary<Category,TimeScale> tsList;
+		private Categories categories;
+		private TimeReferenceWidget tr;
+		CategoriesScale cs;
+		private uint frames;
+		private uint pixelRatio;
+		private Play selected;
+		private uint currentFrame;
+		private bool hasProject;
+
+
+		public TimeLineWidget()
+		{
+			this.Build();
+			SetPixelRatio(10);
+			zoomscale.CanFocus = false;
+			
+			GtkScrolledWindow.Vadjustment.ValueChanged += HandleScrollEvent;
+			GtkScrolledWindow.Hadjustment.ValueChanged += HandleScrollEvent;
+			
+			GtkScrolledWindow.HScrollbar.SizeAllocated += OnSizeAllocated;
+			
+			cs = new CategoriesScale();
+			cs.WidthRequest = 100;
+			categoriesbox.PackStart(cs, false, false, 0);
+			
+			tr = new TimeReferenceWidget();
+			timescalebox.PackStart(tr,false,false,0);
+			
+			tr.HeightRequest = 50 - leftbox.Spacing; 
+			toolsbox.HeightRequest = 50 - leftbox.Spacing;
+		}
+		
+		public Play SelectedTimeNode {
+			get {
+				return selected;
+			}
+			set {
+				if (!hasProject)
+					return;
+					
+				selected = value;
+				foreach (TimeScale  ts in tsList.Values)
+					ts.SelectedTimeNode = value;
+				if (selected != null) {
+					if (SelectedTimeNode.StartFrame/pixelRatio < GtkScrolledWindow.Hadjustment.Value ||
+					                SelectedTimeNode.StartFrame/pixelRatio > GtkScrolledWindow.Hadjustment.Value +
+					                GtkScrolledWindow.Allocation.Width - GtkScrolledWindow.VScrollbar.Allocation.Width)
+						AdjustPostion(SelectedTimeNode.StartFrame);
+				}
+				QueueDraw();
+			}
+		}
+
+		public uint CurrentFrame {
+			get {
+				return currentFrame;
+			}
+			set {
+				if (!hasProject)
+					return;
+				
+				currentFrame = value;
+				foreach (TimeScale  ts in tsList.Values) 
+					ts.CurrentFrame = value;
+				tr.CurrentFrame = value;
+				QueueDraw();
+			}
+		}
+
+		public void AdjustPostion(uint currentframe) {
+			int visibleWidth;
+			int realWidth;
+			uint pos;
+			int scrollbarWidth;
+			if (Visible) {
+				scrollbarWidth= GtkScrolledWindow.VScrollbar.Allocation.Width;
+				visibleWidth = GtkScrolledWindow.Allocation.Width-scrollbarWidth;
+				realWidth = vbox1.Allocation.Width;
+				pos = currentframe/pixelRatio;
+				if (pos+visibleWidth < realWidth) {
+					GtkScrolledWindow.Hadjustment.Value = pos;
+				}
+				else {
+					GtkScrolledWindow.Hadjustment.Value = realWidth-visibleWidth-20;
+				}
+			}
+		}
+
+		private void SetPixelRatio(uint pixelRatio) {
+			if (!hasProject)
+				return;
+			
+			this.pixelRatio = pixelRatio;
+			tr.PixelRatio = pixelRatio;
+			foreach (TimeScale  ts in tsList.Values)
+				ts.PixelRatio = pixelRatio;
+			zoomscale.Value=pixelRatio;
+		}
+
+		public Project Project {
+			set {
+				ResetGui();
+
+				if (value == null) {
+					categories = null;
+					tsList.Clear();
+					tsList=null;
+					hasProject = false;
+					return;
+				}
+				hasProject = true;
+				categories = value.Categories;
+				tsList = new Dictionary<Category, TimeScale>();
+				frames = value.Description.File.GetFrames();
+
+				cs.Categories = categories;
+				cs.Show();
+
+				tr.Frames = frames;
+				tr.FrameRate = value.Description.File.Fps;
+				tr.Show();
+				
+				foreach (Category cat in  categories) {
+					List<Play> playsList = value.PlaysInCategory(cat);
+					TimeScale ts = new TimeScale(cat, playsList,frames);
+					tsList[cat] = ts;
+					ts.TimeNodeChanged += new TimeNodeChangedHandler(OnTimeNodeChanged);
+					ts.TimeNodeSelected += new TimeNodeSelectedHandler(OnTimeNodeSelected);
+					ts.TimeNodeDeleted += new TimeNodeDeletedHandler(OnTimeNodeDeleted);
+					ts.NewMarkAtFrameEvent += new NewMarkAtFrameEventHandler(OnNewMark);
+					vbox1.PackStart(ts,true,true,0);
+					ts.Show();
+				}
+				SetPixelRatio(3);
+			}
+		}
+
+		public void AddPlay(Play play){
+			TimeScale ts;
+			if (tsList.TryGetValue(play.Category, out ts))
+				ts.AddPlay(play);
+		}
+		
+		public void RemovePlays (List<Play> plays){
+			TimeScale ts;
+			foreach (Play play in plays){
+				if (tsList.TryGetValue(play.Category, out ts))
+					ts.RemovePlay(play);
+			}
+			
+		}
+		private void ResetGui() {
+			//Unrealize all children
+			foreach (Widget w in vbox1.AllChildren) {
+				vbox1.Remove(w);
+				w.Destroy();
+			}
+		}
+
+		protected virtual void OnNewMark(Category category, int frame) {
+			if (NewMarkEvent != null)
+				NewMarkEvent(category,frame);
+		}
+
+		protected virtual void OnTimeNodeChanged(TimeNode tn, object val) {
+			if (TimeNodeChanged != null)
+				TimeNodeChanged(tn,val);
+		}
+
+		protected virtual void OnTimeNodeSelected(Play tn) {
+			if (TimeNodeSelected != null)
+				TimeNodeSelected(tn);
+		}
+		protected virtual void OnTimeNodeDeleted(List<Play> plays) {
+			if (TimeNodeDeleted != null)
+				TimeNodeDeleted(plays);
+		}
+
+		protected virtual void OnFitbuttonClicked(object sender, System.EventArgs e)
+		{
+			AdjustPostion(currentFrame);
+		}
+
+		protected virtual void OnZoomscaleValueChanged(object sender, System.EventArgs e)
+		{
+			SetPixelRatio((uint)(zoomscale.Value));
+			QueueDraw();
+			AdjustPostion(currentFrame);
+		}
+		
+		protected virtual void HandleScrollEvent (object sender, System.EventArgs args)
+		{
+			if (sender == GtkScrolledWindow.Vadjustment)
+				cs.Scroll = GtkScrolledWindow.Vadjustment.Value;
+			else if (sender == GtkScrolledWindow.Hadjustment)
+				tr.Scroll = GtkScrolledWindow.Hadjustment.Value;
+		}
+		
+		protected virtual void OnSizeAllocated (object sender, SizeAllocatedArgs e)
+		{
+			/* Align the categories list widget on top of the timeline's horizontal bar */
+			if (sender == GtkScrolledWindow.HScrollbar)
+				categoriesalignment1.BottomPadding = (uint) GtkScrolledWindow.HScrollbar.Allocation.Height;
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/TimeReferenceWidget.cs b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
index acb9c90..8ac7237 100644
--- a/LongoMatch/Gui/Component/TimeReferenceWidget.cs
+++ b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
@@ -1,161 +1,161 @@
-// TimeReferenceWidget.cs
-//
-//  Copyright (C2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Gdk;
-using Cairo;
-using LongoMatch.Common;
-using LongoMatch.Store;
-using Pango;
-
-namespace LongoMatch.Gui.Component
-{
-
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public partial class TimeReferenceWidget : Gtk.DrawingArea
-	{
-		private const int SECTION_HEIGHT = 30;
-		double scroll;
-		uint frames;
-		uint pixelRatio=10;//Número de frames por pixel
-		Pango.Layout layout;
-
-		public TimeReferenceWidget()
-		{
-			Frames = 1;
-			PixelRatio = 1;
-			FrameRate = 1;
-			
-			this.HeightRequest= SECTION_HEIGHT;
-			layout = new Pango.Layout(this.PangoContext);
-		}
-
-		public uint CurrentFrame {
-			get;
-			set;
-		}
-		
-		public uint Frames {
-			set{
-				frames = value;
-			}
-		}
-		
-		public ushort FrameRate {
-			set;
-			get;
-		}
-		
-		public double Scroll {
-			get {
-				return scroll;
-			}
-			set {
-				scroll = value;
-				QueueDraw();
-			}
-		}
-
-		public uint PixelRatio {
-			get {
-				return pixelRatio;
-			}
-			set {
-				pixelRatio = value;
-			}
-		}
-
-		protected override bool OnExposeEvent(EventExpose evnt)
-		{
-			int height;
-			int width;
-
-			Gdk.Window win = evnt.Window;
-
-			win.GetSize(out width, out height);
-			win.Resize((int)(frames/pixelRatio), height);
-			win.GetSize(out width, out height);
-
-			if (Environment.OSVersion.Platform == PlatformID.Unix)
-				this.CairoDraw(evnt,height,width);
-			else
-				this.GdkDraw(evnt,height,width);
-			return base.OnExposeEvent(evnt);
-		}
-		
-		private void CairoDraw(EventExpose evnt,int height,int width) {
-			Time time = new Time();
-			using(Cairo.Context g = Gdk.CairoHelper.Create(evnt.Window)) {
-				Cairo.Color color = new Cairo.Color(0, 0, 0);
-				/* Drawing position triangle */
-				CairoUtils.DrawTriangle(g,CurrentFrame/pixelRatio-Scroll, height, 10, 15, color);
-				/* Draw '0' */
-				CairoUtils.DrawLine(g, 0-Scroll, height, width, height, 2, color);
-				g.MoveTo(new PointD(0-Scroll,height-20));
-				g.ShowText("0");
-
-				for (int i=10*FrameRate; i<=frames/pixelRatio;) {
-					CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
-					                    height-10, 2, color);
-					g.MoveTo(new PointD(i-Scroll-13,height-20));
-					time.MSeconds = (int)(i/FrameRate*pixelRatio);
-					g.ShowText(time.ToSecondsString());
-					i=i+10*FrameRate;
-				}
-				for (int i=0; i<=frames/pixelRatio;) {
-					CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
-					                    height-5, 1, color);
-					i=i+FrameRate;
-				}
-			}
-		}
-		
-		private void GdkDraw(EventExpose evnt,int height,int width) {
-			Time time = new Time();
-			layout.SetMarkup("0");
-			this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),0,height-23,layout);
-
-			Gdk.Point topL= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll-5),height-15);
-			Gdk.Point topR= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll+5),height-15);
-			Gdk.Point bottom= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll),height);
-			this.GdkWindow.DrawPolygon(this.Style.TextGC(StateType.Normal),true,new Gdk.Point[] {topL,topR,bottom});
-
-			for (int i=10*FrameRate; i<=frames/pixelRatio;) {
-				// Drawing separator line
-				evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-10);
-				time.MSeconds = (int)(i/FrameRate*pixelRatio);
-				layout.SetMarkup(time.ToSecondsString());
-				this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),i-(int)Scroll-13,height-23,layout);
-				//g.ShowText(time.ToSecondsString());
-				i=i+10*FrameRate;
-			}
-
-			for (int i=0; i<=frames/pixelRatio;) {
-				evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-5);
-				i=i+FrameRate;
-			}
-			// Drawing main line
-			evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),0,height,width,height);
-		}
-	}
-}
+// TimeReferenceWidget.cs
+//
+//  Copyright (C2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using Cairo;
+using LongoMatch.Common;
+using LongoMatch.Store;
+using Pango;
+
+namespace LongoMatch.Gui.Component
+{
+
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class TimeReferenceWidget : Gtk.DrawingArea
+	{
+		private const int SECTION_HEIGHT = 30;
+		double scroll;
+		uint frames;
+		uint pixelRatio=10;//N..mero de frames por pixel
+		Pango.Layout layout;
+
+		public TimeReferenceWidget()
+		{
+			Frames = 1;
+			PixelRatio = 1;
+			FrameRate = 1;
+			
+			this.HeightRequest= SECTION_HEIGHT;
+			layout = new Pango.Layout(this.PangoContext);
+		}
+
+		public uint CurrentFrame {
+			get;
+			set;
+		}
+		
+		public uint Frames {
+			set{
+				frames = value;
+			}
+		}
+		
+		public ushort FrameRate {
+			set;
+			get;
+		}
+		
+		public double Scroll {
+			get {
+				return scroll;
+			}
+			set {
+				scroll = value;
+				QueueDraw();
+			}
+		}
+
+		public uint PixelRatio {
+			get {
+				return pixelRatio;
+			}
+			set {
+				pixelRatio = value;
+			}
+		}
+
+		protected override bool OnExposeEvent(EventExpose evnt)
+		{
+			int height;
+			int width;
+
+			Gdk.Window win = evnt.Window;
+
+			win.GetSize(out width, out height);
+			win.Resize((int)(frames/pixelRatio), height);
+			win.GetSize(out width, out height);
+
+			if (Environment.OSVersion.Platform == PlatformID.Unix)
+				this.CairoDraw(evnt,height,width);
+			else
+				this.GdkDraw(evnt,height,width);
+			return base.OnExposeEvent(evnt);
+		}
+		
+		private void CairoDraw(EventExpose evnt,int height,int width) {
+			Time time = new Time();
+			using(Cairo.Context g = Gdk.CairoHelper.Create(evnt.Window)) {
+				Cairo.Color color = new Cairo.Color(0, 0, 0);
+				/* Drawing position triangle */
+				CairoUtils.DrawTriangle(g,CurrentFrame/pixelRatio-Scroll, height, 10, 15, color);
+				/* Draw '0' */
+				CairoUtils.DrawLine(g, 0-Scroll, height, width, height, 2, color);
+				g.MoveTo(new PointD(0-Scroll,height-20));
+				g.ShowText("0");
+
+				for (int i=10*FrameRate; i<=frames/pixelRatio;) {
+					CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
+					                    height-10, 2, color);
+					g.MoveTo(new PointD(i-Scroll-13,height-20));
+					time.MSeconds = (int)(i/FrameRate*pixelRatio);
+					g.ShowText(time.ToSecondsString());
+					i=i+10*FrameRate;
+				}
+				for (int i=0; i<=frames/pixelRatio;) {
+					CairoUtils.DrawLine(g, i-Scroll, height,i-Scroll,
+					                    height-5, 1, color);
+					i=i+FrameRate;
+				}
+			}
+		}
+		
+		private void GdkDraw(EventExpose evnt,int height,int width) {
+			Time time = new Time();
+			layout.SetMarkup("0");
+			this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),0,height-23,layout);
+
+			Gdk.Point topL= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll-5),height-15);
+			Gdk.Point topR= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll+5),height-15);
+			Gdk.Point bottom= new Gdk.Point((int)(CurrentFrame/pixelRatio-Scroll),height);
+			this.GdkWindow.DrawPolygon(this.Style.TextGC(StateType.Normal),true,new Gdk.Point[] {topL,topR,bottom});
+
+			for (int i=10*FrameRate; i<=frames/pixelRatio;) {
+				// Drawing separator line
+				evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-10);
+				time.MSeconds = (int)(i/FrameRate*pixelRatio);
+				layout.SetMarkup(time.ToSecondsString());
+				this.GdkWindow.DrawLayout(this.Style.TextGC(StateType.Normal),i-(int)Scroll-13,height-23,layout);
+				//g.ShowText(time.ToSecondsString());
+				i=i+10*FrameRate;
+			}
+
+			for (int i=0; i<=frames/pixelRatio;) {
+				evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),i-(int)Scroll,height,i-(int)Scroll,height-5);
+				i=i+FrameRate;
+			}
+			// Drawing main line
+			evnt.Window.DrawLine(Style.DarkGC(StateType.Normal),0,height,width,height);
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Component/TimeScale.cs b/LongoMatch/Gui/Component/TimeScale.cs
index d880757..39b0e98 100644
--- a/LongoMatch/Gui/Component/TimeScale.cs
+++ b/LongoMatch/Gui/Component/TimeScale.cs
@@ -1,367 +1,367 @@
-// TimeScale.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Cairo;
-using Gdk;
-using Gtk;
-using Pango;
-using Mono.Unix;
-using LongoMatch.Common;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-
-namespace LongoMatch.Gui.Component
-{
-
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public class TimeScale : Gtk.DrawingArea
-	{
-		private const int SECTION_HEIGHT = 30;
-		private const double ALPHA = 0.6;
-
-		private uint frames;
-		private uint pixelRatio=10;
-
-		private object locker;
-
-		private Category category;
-		private Cairo.Color color;
-		private List<Play> list;
-
-		private Play candidateTN;
-		private bool candidateStart;
-		private bool movingLimit;
-		private Play selected=null;
-
-		private uint lastTime=0;
-		private uint currentFrame;
-
-		private Menu deleteMenu;
-		private Menu menu;
-		private MenuItem delete;
-		private int cursorFrame;
-		private Dictionary<MenuItem,Play> dic;
-
-		private Pango.Layout layout;
-
-		public event NewMarkAtFrameEventHandler NewMarkAtFrameEvent;
-		public event TimeNodeChangedHandler TimeNodeChanged;
-		public event TimeNodeSelectedHandler TimeNodeSelected;
-		public event TimeNodeDeletedHandler TimeNodeDeleted;
-
-
-		public TimeScale(Category category, List<Play> list, uint frames)
-		{
-			this.category = category;
-			this.frames = frames;
-			this.list = list;
-			HeightRequest= SECTION_HEIGHT;
-			Size((int)(frames/pixelRatio),SECTION_HEIGHT);
-			this.color = new Cairo.Color(0, 0, 1);
-			this.color.A = ALPHA;
-			Events = EventMask.PointerMotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask ;
-
-			dic = new Dictionary<MenuItem,Play>();
-
-			layout =  new Pango.Layout(PangoContext);
-			layout.Wrap = Pango.WrapMode.Char;
-			layout.Alignment = Pango.Alignment.Left;
-
-			SetMenu();
-			locker = new object();
-		}
-
-		public uint PixelRatio {
-			get {
-				return pixelRatio;
-			}
-			set {
-				lock (locker) {
-					pixelRatio = value;
-					Size((int)(frames/pixelRatio),SECTION_HEIGHT);
-				}
-			}
-		}
-
-		public uint CurrentFrame {
-			get {
-				return currentFrame;
-			}
-			set {
-				currentFrame = value;
-			}
-		}
-
-		public Play SelectedTimeNode {
-			get {
-				return selected;
-			}
-			set {
-				selected = value;
-			}
-		}
-
-		public void AddPlay(Play play) {
-			list.Add(play);
-		}
-
-		public void RemovePlay(Play play) {
-			list.Remove(play);
-		}
-		
-		public void ReDraw() {
-			Gdk.Region region = GdkWindow.ClipRegion;
-			GdkWindow.InvalidateRegion(region,true);
-			GdkWindow.ProcessUpdates(true);
-		}
-
-
-		private void SetMenu() {
-			MenuItem newPlay;
-
-			menu = new Menu();
-			delete = new MenuItem(Catalog.GetString("Delete Play"));
-			newPlay = new MenuItem(Catalog.GetString("Add New Play"));
-
-			menu.Append(newPlay);
-			menu.Append(delete);
-
-			newPlay.Activated += new EventHandler(OnNewPlay);
-
-			menu.ShowAll();
-		}
-
-		private void DrawTimeNodes(Gdk.Window win) {
-			lock (locker) {
-				bool hasSelectedTimeNode=false;
-
-				using(Cairo.Context g = Gdk.CairoHelper.Create(win)) {
-					int height;
-					int width;
-
-					win.Resize((int)(frames/pixelRatio), Allocation.Height);
-					win.GetSize(out width, out height);
-
-					g.Operator = Operator.Over;
-
-					foreach (Play tn in list) {
-						if (tn != selected) {
-							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);
-						}
-						else {
-							hasSelectedTimeNode = true;
-						}
-					}
-					//Then we draw the selected TimeNode over the others
-					if (hasSelectedTimeNode) {
-						Cairo.Color borderColor = new Cairo.Color(0, 0, 0, 1);
-						CairoUtils.DrawRoundedRectangle(g,selected.StartFrame/pixelRatio,3,
-						                                selected.TotalFrames/pixelRatio,height-6,
-						                                SECTION_HEIGHT/7, color, borderColor);
-						if (selected.HasDrawings) {
-							g.MoveTo(selected.KeyFrame/pixelRatio,3);
-							g.LineTo(selected.KeyFrame/pixelRatio,SECTION_HEIGHT-3);
-							g.StrokePreserve();
-						}
-					}
-					DrawLines(win,g,height,width);
-				}
-			}
-		}
-
-		private void DrawLines(Gdk.Window win, Cairo.Context g, int height, int width) {
-			if (Environment.OSVersion.Platform == PlatformID.Unix) {
-				Cairo.Color color = new Cairo.Color(0,0,0);
-				CairoUtils.DrawLine(g, currentFrame/pixelRatio,0,currentFrame/pixelRatio,height, 
-				                    1, color);
-				CairoUtils.DrawLine(g,0 ,0, width, 0, 1, color);
-				CairoUtils.DrawLine(g,0 ,height, width, height, 1, color);
-			}
-
-			else {
-				win.DrawLine(Style.DarkGC(StateType.Normal),0,0,width,0);
-				win.DrawLine(Style.DarkGC(StateType.Normal),
-				             (int)(currentFrame/pixelRatio),0,
-				             (int)(currentFrame/pixelRatio),height);
-			}
-		}
-
-
-		private void DrawTimeNodesName() {
-			lock (locker) {
-				foreach (Play tn in list) {
-					layout.Width = Pango.Units.FromPixels((int)(tn.TotalFrames/pixelRatio));
-					layout.SetMarkup(tn.Name);
-					GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
-					                     (int)(tn.StartFrame/pixelRatio)+2,
-					                     2,layout);
-				}
-			}
-		}
-
-		private void ProcessButton3(double X) {
-			cursorFrame =(int)(X*pixelRatio);
-			deleteMenu = new Menu();
-			delete.Submenu=deleteMenu;
-			dic.Clear();
-			foreach (Play tn in list) {
-				//We scan all the time Nodes looking for one matching the cursor selectcio
-				//And we add them to the delete menu
-				if (tn.HasFrame(cursorFrame)) {
-					MenuItem del = new MenuItem(Catalog.GetString("Delete "+tn.Name));
-					del.Activated += new EventHandler(OnDelete);
-					deleteMenu.Append(del);
-					dic.Add(del,tn);
-				}
-			}
-			menu.ShowAll();
-			menu.Popup();
-		}
-
-		private void ProcessButton1(EventButton evnt) {
-			if (lastTime != evnt.Time) {
-				candidateTN = null;
-				foreach (Play tn in list) {
-					int pos = (int)(evnt.X*pixelRatio);
-					//Moving from the right side
-					if (Math.Abs(pos-tn.StopFrame) < 3*pixelRatio) {
-						candidateStart = false;
-						candidateTN = tn;
-						movingLimit = true;
-						GdkWindow.Cursor = new Gdk.Cursor(CursorType.SbHDoubleArrow);
-						TimeNodeChanged(tn,tn.Stop);
-						ReDraw();
-						break;
-					}
-					//Moving from the left side
-					else if (Math.Abs(pos-tn.StartFrame) < 3*pixelRatio) {
-						candidateStart =true;
-						candidateTN = tn;
-						movingLimit = true;
-						GdkWindow.Cursor = new Gdk.Cursor(CursorType.SbHDoubleArrow);
-						TimeNodeChanged(tn,tn.Start);
-						ReDraw();
-						break;
-					}
-				}
-			}
-			//On Double Click
-			else {
-				foreach (Play tn in list) {
-					int pos = (int)(evnt.X*pixelRatio);
-					if (TimeNodeSelected!= null && tn.HasFrame(pos)) {
-						TimeNodeSelected(tn);
-						break;
-					}
-				}
-			}
-		}
-
-		protected void OnNewPlay(object obj, EventArgs args) {
-			if (NewMarkAtFrameEvent != null)
-				NewMarkAtFrameEvent(category,cursorFrame);
-		}
-
-		protected void OnDelete(object obj, EventArgs args) {
-			Play tNode;
-			dic.TryGetValue((MenuItem)obj, out tNode);
-			if (TimeNodeDeleted != null && tNode != null) {
-				var list = new List<Play>();
-				list.Add(tNode);
-				TimeNodeDeleted(list);
-			}
-		}
-
-		protected override bool OnExposeEvent(EventExpose evnt)
-		{
-			if (Visible) {
-				DrawTimeNodes(evnt.Window);
-				//We don't need the draw the Sections Names if we also draw the TimeNode name
-				//DrawSectionName();
-				DrawTimeNodesName();
-			}
-			return base.OnExposeEvent(evnt);
-		}
-
-		protected override bool OnMotionNotifyEvent(EventMotion evnt)
-		{
-			int pos = (int)(evnt.X*pixelRatio);
-
-			//If not moving don't do anything
-			if (!movingLimit) {
-			}
-			//Moving Start time
-			else if (candidateStart) {
-				if (candidateTN.HasDrawings && pos > 0 && pos > candidateTN.KeyFrame-10)
-					candidateTN.StartFrame = candidateTN.KeyFrame-10;
-				//Check not to go under start time nor 0
-				else if (pos  > 0 && pos < candidateTN.StopFrame-10)
-					candidateTN.StartFrame = (uint)pos;
-				if (TimeNodeChanged != null)
-					TimeNodeChanged(candidateTN,candidateTN.Start);
-			}
-			//Moving Stop time
-			else if (!candidateStart) {
-				if (candidateTN.HasDrawings &&  pos < candidateTN.KeyFrame+10)
-					candidateTN.StopFrame = candidateTN.KeyFrame+10;
-				//Check not to go under start time nor 0
-				else if (pos < frames && pos > candidateTN.StartFrame+10)
-					candidateTN.StopFrame = (uint) pos;
-				if (TimeNodeChanged != null)
-					TimeNodeChanged(candidateTN,candidateTN.Stop);
-			}
-
-			Gdk.Region region = GdkWindow.ClipRegion;
-			GdkWindow.InvalidateRegion(region,true);
-			GdkWindow.ProcessUpdates(true);
-
-			return base.OnMotionNotifyEvent(evnt);
-		}
-
-		protected override bool OnButtonPressEvent(EventButton evnt)
-		{
-			if (evnt.Button == 1)
-				ProcessButton1(evnt);
-			// On Right button pressed
-			else if (evnt.Button == 3)
-				ProcessButton3(evnt.X);
-			lastTime = evnt.Time;
-			return base.OnButtonPressEvent(evnt);
-		}
-
-		protected override bool OnButtonReleaseEvent(EventButton evnt)
-		{
-			if (movingLimit) {
-				movingLimit = false;
-				candidateTN.Selected = false;
-				GdkWindow.Cursor = new Gdk.Cursor(CursorType.Arrow);
-				ReDraw();
-			}
-			return base.OnButtonReleaseEvent(evnt);
-		}
-	}
-}
+// TimeScale.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Cairo;
+using Gdk;
+using Gtk;
+using Pango;
+using Mono.Unix;
+using LongoMatch.Common;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+
+namespace LongoMatch.Gui.Component
+{
+
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public class TimeScale : Gtk.DrawingArea
+	{
+		private const int SECTION_HEIGHT = 30;
+		private const double ALPHA = 0.6;
+
+		private uint frames;
+		private uint pixelRatio=10;
+
+		private object locker;
+
+		private Category category;
+		private Cairo.Color color;
+		private List<Play> list;
+
+		private Play candidateTN;
+		private bool candidateStart;
+		private bool movingLimit;
+		private Play selected=null;
+
+		private uint lastTime=0;
+		private uint currentFrame;
+
+		private Menu deleteMenu;
+		private Menu menu;
+		private MenuItem delete;
+		private int cursorFrame;
+		private Dictionary<MenuItem,Play> dic;
+
+		private Pango.Layout layout;
+
+		public event NewMarkAtFrameEventHandler NewMarkAtFrameEvent;
+		public event TimeNodeChangedHandler TimeNodeChanged;
+		public event TimeNodeSelectedHandler TimeNodeSelected;
+		public event TimeNodeDeletedHandler TimeNodeDeleted;
+
+
+		public TimeScale(Category category, List<Play> list, uint frames)
+		{
+			this.category = category;
+			this.frames = frames;
+			this.list = list;
+			HeightRequest= SECTION_HEIGHT;
+			Size((int)(frames/pixelRatio),SECTION_HEIGHT);
+			this.color = new Cairo.Color(0, 0, 1);
+			this.color.A = ALPHA;
+			Events = EventMask.PointerMotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask ;
+
+			dic = new Dictionary<MenuItem,Play>();
+
+			layout =  new Pango.Layout(PangoContext);
+			layout.Wrap = Pango.WrapMode.Char;
+			layout.Alignment = Pango.Alignment.Left;
+
+			SetMenu();
+			locker = new object();
+		}
+
+		public uint PixelRatio {
+			get {
+				return pixelRatio;
+			}
+			set {
+				lock (locker) {
+					pixelRatio = value;
+					Size((int)(frames/pixelRatio),SECTION_HEIGHT);
+				}
+			}
+		}
+
+		public uint CurrentFrame {
+			get {
+				return currentFrame;
+			}
+			set {
+				currentFrame = value;
+			}
+		}
+
+		public Play SelectedTimeNode {
+			get {
+				return selected;
+			}
+			set {
+				selected = value;
+			}
+		}
+
+		public void AddPlay(Play play) {
+			list.Add(play);
+		}
+
+		public void RemovePlay(Play play) {
+			list.Remove(play);
+		}
+		
+		public void ReDraw() {
+			Gdk.Region region = GdkWindow.ClipRegion;
+			GdkWindow.InvalidateRegion(region,true);
+			GdkWindow.ProcessUpdates(true);
+		}
+
+
+		private void SetMenu() {
+			MenuItem newPlay;
+
+			menu = new Menu();
+			delete = new MenuItem(Catalog.GetString("Delete Play"));
+			newPlay = new MenuItem(Catalog.GetString("Add New Play"));
+
+			menu.Append(newPlay);
+			menu.Append(delete);
+
+			newPlay.Activated += new EventHandler(OnNewPlay);
+
+			menu.ShowAll();
+		}
+
+		private void DrawTimeNodes(Gdk.Window win) {
+			lock (locker) {
+				bool hasSelectedTimeNode=false;
+
+				using(Cairo.Context g = Gdk.CairoHelper.Create(win)) {
+					int height;
+					int width;
+
+					win.Resize((int)(frames/pixelRatio), Allocation.Height);
+					win.GetSize(out width, out height);
+
+					g.Operator = Operator.Over;
+
+					foreach (Play tn in list) {
+						if (tn != selected) {
+							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);
+						}
+						else {
+							hasSelectedTimeNode = true;
+						}
+					}
+					//Then we draw the selected TimeNode over the others
+					if (hasSelectedTimeNode) {
+						Cairo.Color borderColor = new Cairo.Color(0, 0, 0, 1);
+						CairoUtils.DrawRoundedRectangle(g,selected.StartFrame/pixelRatio,3,
+						                                selected.TotalFrames/pixelRatio,height-6,
+						                                SECTION_HEIGHT/7, color, borderColor);
+						if (selected.HasDrawings) {
+							g.MoveTo(selected.KeyFrame/pixelRatio,3);
+							g.LineTo(selected.KeyFrame/pixelRatio,SECTION_HEIGHT-3);
+							g.StrokePreserve();
+						}
+					}
+					DrawLines(win,g,height,width);
+				}
+			}
+		}
+
+		private void DrawLines(Gdk.Window win, Cairo.Context g, int height, int width) {
+			if (Environment.OSVersion.Platform == PlatformID.Unix) {
+				Cairo.Color color = new Cairo.Color(0,0,0);
+				CairoUtils.DrawLine(g, currentFrame/pixelRatio,0,currentFrame/pixelRatio,height, 
+				                    1, color);
+				CairoUtils.DrawLine(g,0 ,0, width, 0, 1, color);
+				CairoUtils.DrawLine(g,0 ,height, width, height, 1, color);
+			}
+
+			else {
+				win.DrawLine(Style.DarkGC(StateType.Normal),0,0,width,0);
+				win.DrawLine(Style.DarkGC(StateType.Normal),
+				             (int)(currentFrame/pixelRatio),0,
+				             (int)(currentFrame/pixelRatio),height);
+			}
+		}
+
+
+		private void DrawTimeNodesName() {
+			lock (locker) {
+				foreach (Play tn in list) {
+					layout.Width = Pango.Units.FromPixels((int)(tn.TotalFrames/pixelRatio));
+					layout.SetMarkup(tn.Name);
+					GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
+					                     (int)(tn.StartFrame/pixelRatio)+2,
+					                     2,layout);
+				}
+			}
+		}
+
+		private void ProcessButton3(double X) {
+			cursorFrame =(int)(X*pixelRatio);
+			deleteMenu = new Menu();
+			delete.Submenu=deleteMenu;
+			dic.Clear();
+			foreach (Play tn in list) {
+				//We scan all the time Nodes looking for one matching the cursor selectcio
+				//And we add them to the delete menu
+				if (tn.HasFrame(cursorFrame)) {
+					MenuItem del = new MenuItem(Catalog.GetString("Delete "+tn.Name));
+					del.Activated += new EventHandler(OnDelete);
+					deleteMenu.Append(del);
+					dic.Add(del,tn);
+				}
+			}
+			menu.ShowAll();
+			menu.Popup();
+		}
+
+		private void ProcessButton1(EventButton evnt) {
+			if (lastTime != evnt.Time) {
+				candidateTN = null;
+				foreach (Play tn in list) {
+					int pos = (int)(evnt.X*pixelRatio);
+					//Moving from the right side
+					if (Math.Abs(pos-tn.StopFrame) < 3*pixelRatio) {
+						candidateStart = false;
+						candidateTN = tn;
+						movingLimit = true;
+						GdkWindow.Cursor = new Gdk.Cursor(CursorType.SbHDoubleArrow);
+						TimeNodeChanged(tn,tn.Stop);
+						ReDraw();
+						break;
+					}
+					//Moving from the left side
+					else if (Math.Abs(pos-tn.StartFrame) < 3*pixelRatio) {
+						candidateStart =true;
+						candidateTN = tn;
+						movingLimit = true;
+						GdkWindow.Cursor = new Gdk.Cursor(CursorType.SbHDoubleArrow);
+						TimeNodeChanged(tn,tn.Start);
+						ReDraw();
+						break;
+					}
+				}
+			}
+			//On Double Click
+			else {
+				foreach (Play tn in list) {
+					int pos = (int)(evnt.X*pixelRatio);
+					if (TimeNodeSelected!= null && tn.HasFrame(pos)) {
+						TimeNodeSelected(tn);
+						break;
+					}
+				}
+			}
+		}
+
+		protected void OnNewPlay(object obj, EventArgs args) {
+			if (NewMarkAtFrameEvent != null)
+				NewMarkAtFrameEvent(category,cursorFrame);
+		}
+
+		protected void OnDelete(object obj, EventArgs args) {
+			Play tNode;
+			dic.TryGetValue((MenuItem)obj, out tNode);
+			if (TimeNodeDeleted != null && tNode != null) {
+				var list = new List<Play>();
+				list.Add(tNode);
+				TimeNodeDeleted(list);
+			}
+		}
+
+		protected override bool OnExposeEvent(EventExpose evnt)
+		{
+			if (Visible) {
+				DrawTimeNodes(evnt.Window);
+				//We don't need the draw the Sections Names if we also draw the TimeNode name
+				//DrawSectionName();
+				DrawTimeNodesName();
+			}
+			return base.OnExposeEvent(evnt);
+		}
+
+		protected override bool OnMotionNotifyEvent(EventMotion evnt)
+		{
+			int pos = (int)(evnt.X*pixelRatio);
+
+			//If not moving don't do anything
+			if (!movingLimit) {
+			}
+			//Moving Start time
+			else if (candidateStart) {
+				if (candidateTN.HasDrawings && pos > 0 && pos > candidateTN.KeyFrame-10)
+					candidateTN.StartFrame = candidateTN.KeyFrame-10;
+				//Check not to go under start time nor 0
+				else if (pos  > 0 && pos < candidateTN.StopFrame-10)
+					candidateTN.StartFrame = (uint)pos;
+				if (TimeNodeChanged != null)
+					TimeNodeChanged(candidateTN,candidateTN.Start);
+			}
+			//Moving Stop time
+			else if (!candidateStart) {
+				if (candidateTN.HasDrawings &&  pos < candidateTN.KeyFrame+10)
+					candidateTN.StopFrame = candidateTN.KeyFrame+10;
+				//Check not to go under start time nor 0
+				else if (pos < frames && pos > candidateTN.StartFrame+10)
+					candidateTN.StopFrame = (uint) pos;
+				if (TimeNodeChanged != null)
+					TimeNodeChanged(candidateTN,candidateTN.Stop);
+			}
+
+			Gdk.Region region = GdkWindow.ClipRegion;
+			GdkWindow.InvalidateRegion(region,true);
+			GdkWindow.ProcessUpdates(true);
+
+			return base.OnMotionNotifyEvent(evnt);
+		}
+
+		protected override bool OnButtonPressEvent(EventButton evnt)
+		{
+			if (evnt.Button == 1)
+				ProcessButton1(evnt);
+			// On Right button pressed
+			else if (evnt.Button == 3)
+				ProcessButton3(evnt.X);
+			lastTime = evnt.Time;
+			return base.OnButtonPressEvent(evnt);
+		}
+
+		protected override bool OnButtonReleaseEvent(EventButton evnt)
+		{
+			if (movingLimit) {
+				movingLimit = false;
+				candidateTN.Selected = false;
+				GdkWindow.Cursor = new Gdk.Cursor(CursorType.Arrow);
+				ReDraw();
+			}
+			return base.OnButtonReleaseEvent(evnt);
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs b/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
index ed46201..8c5bd29 100644
--- a/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
+++ b/LongoMatch/Gui/Dialog/FramesCaptureProgressDialog.cs
@@ -1,68 +1,68 @@
-// FramesCaptureProgressDialog.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Gdk;
-using Mono.Unix;
-using LongoMatch.Video.Utils;
-using LongoMatch.Video.Common;
-
-namespace LongoMatch.Gui.Dialog
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class FramesCaptureProgressDialog : Gtk.Dialog
-	{
-		private FramesSeriesCapturer capturer;
-
-		public FramesCaptureProgressDialog(FramesSeriesCapturer capturer)
-		{
-			this.Build();
-			this.Deletable = false;
-			this.capturer = capturer;
-			capturer.Progress += new FramesProgressHandler(Update);
-			capturer.Start();
-		}
-
-		protected virtual void Update(int actual, int total,Pixbuf frame) {
-			if (actual <= total) {
-				progressbar.Text= Catalog.GetString("Capturing frame: ")+actual+"/"+total;
-				progressbar.Fraction = (double)actual/(double)total;
-				if (frame != null) {
-					if (image.Pixbuf != null)
-						image.Pixbuf.Dispose();
-					image.Pixbuf = frame;
-				}
-			}
-			if (actual == total) {
-				progressbar.Text= Catalog.GetString("Done");
-				cancelbutton.Visible = false;
-				okbutton.Visible = true;
-			}
-		}
-
-		protected virtual void OnButtonCancelClicked(object sender, System.EventArgs e)
-		{
-			capturer.Cancel();
-		}
-	}
-}
+// FramesCaptureProgressDialog.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+using LongoMatch.Video.Utils;
+using LongoMatch.Video.Common;
+
+namespace LongoMatch.Gui.Dialog
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class FramesCaptureProgressDialog : Gtk.Dialog
+	{
+		private FramesSeriesCapturer capturer;
+
+		public FramesCaptureProgressDialog(FramesSeriesCapturer capturer)
+		{
+			this.Build();
+			this.Deletable = false;
+			this.capturer = capturer;
+			capturer.Progress += new FramesProgressHandler(Update);
+			capturer.Start();
+		}
+
+		protected virtual void Update(int actual, int total,Pixbuf frame) {
+			if (actual <= total) {
+				progressbar.Text= Catalog.GetString("Capturing frame: ")+actual+"/"+total;
+				progressbar.Fraction = (double)actual/(double)total;
+				if (frame != null) {
+					if (image.Pixbuf != null)
+						image.Pixbuf.Dispose();
+					image.Pixbuf = frame;
+				}
+			}
+			if (actual == total) {
+				progressbar.Text= Catalog.GetString("Done");
+				cancelbutton.Visible = false;
+				okbutton.Visible = true;
+			}
+		}
+
+		protected virtual void OnButtonCancelClicked(object sender, System.EventArgs e)
+		{
+			capturer.Cancel();
+		}
+	}
+}
diff --git a/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs b/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
index bd50113..f3e2ff2 100644
--- a/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
+++ b/LongoMatch/Gui/Dialog/HotKeySelectorDialog.cs
@@ -1,79 +1,79 @@
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Gdk;
-using LongoMatch.Store;
-
-namespace LongoMatch.Gui.Dialog
-{
-
-
-	public partial class HotKeySelectorDialog : Gtk.Dialog
-	{
-		HotKey hotKey;
-
-		#region Constructors
-
-		public HotKeySelectorDialog()
-		{
-			hotKey = new HotKey();
-			this.Build();
-		}
-		#endregion
-
-		#region Properties
-
-		public HotKey HotKey {
-			get {
-				return this.hotKey;
-			}
-		}
-		#endregion
-
-		#region Overrides
-
-		protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
-		{
-			Gdk.Key key = evnt.Key;
-			ModifierType modifier = evnt.State;
-			
-			// Only react to {Shift|Alt|Ctrl}+key
-			// Ctrl is a modifier to select single keys
-			// Combination are allowed with Alt and Shift (Ctrl is not allowed to avoid
-			// conflicts with menus shortcuts)
-			if ((modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask | ModifierType.ControlMask)) != 0
-			                && key != Gdk.Key.Shift_L
-			                && key != Gdk.Key.Shift_R
-			                && key != Gdk.Key.Alt_L
-			                && key != Gdk.Key.Control_L
-			                && key != Gdk.Key.Control_R)
-			{
-				hotKey.Key = key;
-				hotKey.Modifier = modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask);
-				this.Respond(ResponseType.Ok);
-			}
-
-			return base.OnKeyPressEvent(evnt);
-		}
-		#endregion
-
-	}
-}
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Gdk;
+using LongoMatch.Store;
+
+namespace LongoMatch.Gui.Dialog
+{
+
+
+	public partial class HotKeySelectorDialog : Gtk.Dialog
+	{
+		HotKey hotKey;
+
+		#region Constructors
+
+		public HotKeySelectorDialog()
+		{
+			hotKey = new HotKey();
+			this.Build();
+		}
+		#endregion
+
+		#region Properties
+
+		public HotKey HotKey {
+			get {
+				return this.hotKey;
+			}
+		}
+		#endregion
+
+		#region Overrides
+
+		protected override bool OnKeyPressEvent(Gdk.EventKey evnt)
+		{
+			Gdk.Key key = evnt.Key;
+			ModifierType modifier = evnt.State;
+			
+			// Only react to {Shift|Alt|Ctrl}+key
+			// Ctrl is a modifier to select single keys
+			// Combination are allowed with Alt and Shift (Ctrl is not allowed to avoid
+			// conflicts with menus shortcuts)
+			if ((modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask | ModifierType.ControlMask)) != 0
+			                && key != Gdk.Key.Shift_L
+			                && key != Gdk.Key.Shift_R
+			                && key != Gdk.Key.Alt_L
+			                && key != Gdk.Key.Control_L
+			                && key != Gdk.Key.Control_R)
+			{
+				hotKey.Key = key;
+				hotKey.Modifier = modifier & (ModifierType.Mod1Mask | ModifierType.ShiftMask);
+				this.Respond(ResponseType.Ok);
+			}
+
+			return base.OnKeyPressEvent(evnt);
+		}
+		#endregion
+
+	}
+}
diff --git a/LongoMatch/Gui/Dialog/OpenProjectDialog.cs b/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
index 003eab4..eadd516 100644
--- a/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
+++ b/LongoMatch/Gui/Dialog/OpenProjectDialog.cs
@@ -1,55 +1,55 @@
-// OpenProjectDialog.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System.Collections.Generic;
-using Gtk;
-using LongoMatch.Store;
-
-namespace LongoMatch.Gui.Dialog
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class OpenProjectDialog : Gtk.Dialog
-	{
-
-		public OpenProjectDialog()
-		{
-			this.Build();
-			this.Fill();
-			projectlistwidget.SelectionMode = SelectionMode.Single;
-		}
-		
-		public ProjectDescription SelectedProject {
-			get;
-			set;
-		}
-
-		public void Fill() {
-			projectlistwidget.Fill(MainClass.DB.GetAllProjects());
-		}
-		
-		protected virtual void OnProjectlistwidgetProjectsSelected (List<ProjectDescription> projects)
-		{
-			buttonOk.Sensitive =  (projects.Count == 1);
-			SelectedProject = projects[0];			
-		}
-	}
+// OpenProjectDialog.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System.Collections.Generic;
+using Gtk;
+using LongoMatch.Store;
+
+namespace LongoMatch.Gui.Dialog
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class OpenProjectDialog : Gtk.Dialog
+	{
+
+		public OpenProjectDialog()
+		{
+			this.Build();
+			this.Fill();
+			projectlistwidget.SelectionMode = SelectionMode.Single;
+		}
+		
+		public ProjectDescription SelectedProject {
+			get;
+			set;
+		}
+
+		public void Fill() {
+			projectlistwidget.Fill(MainClass.DB.GetAllProjects());
+		}
+		
+		protected virtual void OnProjectlistwidgetProjectsSelected (List<ProjectDescription> projects)
+		{
+			buttonOk.Sensitive =  (projects.Count == 1);
+			SelectedProject = projects[0];			
+		}
+	}
 }
\ No newline at end of file
diff --git a/LongoMatch/Gui/Dialog/ProjectsManager.cs b/LongoMatch/Gui/Dialog/ProjectsManager.cs
index d2c3903..cccda84 100644
--- a/LongoMatch/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch/Gui/Dialog/ProjectsManager.cs
@@ -1,45 +1,45 @@
-// DBManager.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Store;
-using Mono.Unix;
-
-namespace LongoMatch.Gui.Dialog
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class ProjectsManager : Gtk.Dialog
+// DBManager.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Store;
+using Mono.Unix;
+
+namespace LongoMatch.Gui.Dialog
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class ProjectsManager : Gtk.Dialog
 	{
 
-		private string originalFilePath;
-		private Project openedProject;
+		private string originalFilePath;
+		private Project openedProject;
 		private List<ProjectDescription> selectedProjects;
 
 		public ProjectsManager(Project openedProject)
 		{
-			this.Build();
+			this.Build();
 			this.openedProject = openedProject;
 			this.Fill();
 			this.projectdetails.Use = ProjectType.EditProject;
@@ -49,29 +49,29 @@ namespace LongoMatch.Gui.Dialog
 		public void Fill() {
 			List<ProjectDescription> projectsList = MainClass.DB.GetAllProjects();
 			projectlistwidget1.Fill(projectsList);
-			projectlistwidget1.ClearSearch();
+			projectlistwidget1.ClearSearch();
 			projectlistwidget1.SelectionMode = SelectionMode.Multiple;
 			Clear();
 			originalFilePath=null;
-		}
-		
-		private void Clear(){
-			projectdetails.Clear();
-			projectdetails.Sensitive = false;
-			saveButton.Sensitive = false;
-			deleteButton.Sensitive = false;
-			exportbutton.Sensitive = false;	
-		}
-		
-		private void PromptToSaveEditedProject(){			
-			MessageDialog md = new MessageDialog((Window)this.Toplevel,DialogFlags.Modal,
-			                                     MessageType.Question, ButtonsType.YesNo,
-			                                     Catalog.GetString("The Project has been edited, do you want to save the changes?"));
-			if (md.Run() == (int)ResponseType.Yes) {
-				SaveProject();
-				projectdetails.Edited=false;
-			}
-			md.Destroy();
+		}
+		
+		private void Clear(){
+			projectdetails.Clear();
+			projectdetails.Sensitive = false;
+			saveButton.Sensitive = false;
+			deleteButton.Sensitive = false;
+			exportbutton.Sensitive = false;	
+		}
+		
+		private void PromptToSaveEditedProject(){			
+			MessageDialog md = new MessageDialog((Window)this.Toplevel,DialogFlags.Modal,
+			                                     MessageType.Question, ButtonsType.YesNo,
+			                                     Catalog.GetString("The Project has been edited, do you want to save the changes?"));
+			if (md.Run() == (int)ResponseType.Yes) {
+				SaveProject();
+				projectdetails.Edited=false;
+			}
+			md.Destroy();
 		}
 
 		private void SaveProject() {
@@ -99,18 +99,18 @@ namespace LongoMatch.Gui.Dialog
 
 
 		protected virtual void OnDeleteButtonPressed(object sender, System.EventArgs e)
-		{
-		    List<ProjectDescription> deletedProjects = new List<ProjectDescription>();
-			
-			if (selectedProjects == null)
-			    return;
+		{
+		    List<ProjectDescription> deletedProjects = new List<ProjectDescription>();
+			
+			if (selectedProjects == null)
+			    return;
 			
-			foreach (ProjectDescription selectedProject in selectedProjects) {
-				if (openedProject != null &&
+			foreach (ProjectDescription selectedProject in selectedProjects) {
+				if (openedProject != null &&
 				    selectedProject.File.FilePath == openedProject.Description.File.FilePath) {
 					MessagePopup.PopupMessage(this, MessageType.Warning,
 					                          Catalog.GetString("This Project is actually in use.")+"\n"+
-					                          Catalog.GetString("Close it first to allow its removal from the database"));
+					                          Catalog.GetString("Close it first to allow its removal from the database"));
 					continue;
 				}
 				MessageDialog md = new MessageDialog(this,DialogFlags.Modal,
@@ -119,13 +119,13 @@ namespace LongoMatch.Gui.Dialog
 				                                     Catalog.GetString("Do you really want to delete:")+
 				                                     "\n"+selectedProject.Title);
 				if (md.Run()== (int)ResponseType.Yes) {
-					MainClass.DB.RemoveProject(selectedProject.File.FilePath);
+					MainClass.DB.RemoveProject(selectedProject.File.FilePath);
 					deletedProjects.Add (selectedProject);
-				} 
+				} 
 				md.Destroy();
-			}
-			projectlistwidget1.RemoveProjects (deletedProjects);
-			Clear();
+			}
+			projectlistwidget1.RemoveProjects (deletedProjects);
+			Clear();
 		}
 
 		protected virtual void OnSaveButtonPressed(object sender, System.EventArgs e)
@@ -137,78 +137,78 @@ namespace LongoMatch.Gui.Dialog
 
 
 		protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
-		{
-			if (projectdetails.Edited) {
-				PromptToSaveEditedProject();
+		{
+			if (projectdetails.Edited) {
+				PromptToSaveEditedProject();
 			}
 			this.Destroy();
 		}
 
 		protected virtual void OnProjectlistwidget1ProjectsSelected(List<ProjectDescription> projects)
-		{
-			ProjectDescription project;
-			
-			/* prompt tp save the opened project if has changes */
-			if (projectdetails.Edited) {
-				PromptToSaveEditedProject();
-			}
-			
-			selectedProjects = projects;
-			
-			/* if no projects are selected clear everything */
-			if (projects.Count == 0){
-				Clear();
-				return;
-			/* if more than one project is selected clear everything but keep 
-			 * the delete button and the export button sensitives */
-			} else if (projects.Count > 1){
-				Clear();
-				deleteButton.Sensitive = true;
-				exportbutton.Sensitive = true;
-				return;
-			} 
-			
-			/* if only one project is selected try to load it in the editor */
-			project = projects[0];
+		{
+			ProjectDescription project;
 			
-			if (openedProject != null && 
+			/* prompt tp save the opened project if has changes */
+			if (projectdetails.Edited) {
+				PromptToSaveEditedProject();
+			}
+			
+			selectedProjects = projects;
+			
+			/* if no projects are selected clear everything */
+			if (projects.Count == 0){
+				Clear();
+				return;
+			/* if more than one project is selected clear everything but keep 
+			 * the delete button and the export button sensitives */
+			} else if (projects.Count > 1){
+				Clear();
+				deleteButton.Sensitive = true;
+				exportbutton.Sensitive = true;
+				return;
+			} 
+			
+			/* if only one project is selected try to load it in the editor */
+			project = projects[0];
+			
+			if (openedProject != null && 
 			    project.File.FilePath == openedProject.Description.File.FilePath) {
 				MessagePopup.PopupMessage(this, MessageType.Warning,
 				                          Catalog.GetString("The Project you are trying to load is actually in use.")+"\n" +Catalog.GetString("Close it first to edit it"));
-				Clear();
+				Clear();
 			}
 			else {
 				projectdetails.Sensitive = true;
 				projectdetails.SetProject(MainClass.DB.GetProject(project.File.FilePath));
 				originalFilePath = project.File.FilePath;
 				saveButton.Sensitive = false;
-				deleteButton.Sensitive = true;
+				deleteButton.Sensitive = true;
 				exportbutton.Sensitive = true;
 			}
 		}
 
 		protected virtual void OnProjectdetailsEditedEvent(object sender, System.EventArgs e)
 		{
-			saveButton.Sensitive = true;
-		}
-		
-		protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
-		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
-			                (Gtk.Window)Toplevel,
-			                FileChooserAction.Save,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.HomeDir());
-			FileFilter filter = new FileFilter();
-			filter.Name = Constants.PROJECT_NAME;
-			filter.AddPattern("*.lpr");
-
-			fChooser.AddFilter(filter);
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				Project.Export(projectdetails.GetProject(), fChooser.Filename);
-			}
-			fChooser.Destroy();
+			saveButton.Sensitive = true;
+		}
+		
+		protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
+			                (Gtk.Window)Toplevel,
+			                FileChooserAction.Save,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-save",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.HomeDir());
+			FileFilter filter = new FileFilter();
+			filter.Name = Constants.PROJECT_NAME;
+			filter.AddPattern("*.lpr");
+
+			fChooser.AddFilter(filter);
+			if (fChooser.Run() == (int)ResponseType.Accept) {
+				Project.Export(projectdetails.GetProject(), fChooser.Filename);
+			}
+			fChooser.Destroy();
 		}
 	}
 }
diff --git a/LongoMatch/Gui/Dialog/TemplatesEditor.cs b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
index 468a9d0..fc7c76a 100644
--- a/LongoMatch/Gui/Dialog/TemplatesEditor.cs
+++ b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
@@ -75,7 +75,7 @@ namespace LongoMatch.Gui.Dialog
 			}
 		}
 
-		//Recorrer el directorio en busca de los archivos de configuración validos
+		//Recorrer el directorio en busca de los archivos de configuraci..n validos
 		private void Fill() {
 			string[] allFiles = System.IO.Directory.GetFiles(MainClass.TemplatesDir(),"*"+fileExtension);
 
diff --git a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
index 8c64643..5b5cae9 100644
--- a/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch/Gui/Dialog/VideoEditionProperties.cs
@@ -1,201 +1,201 @@
-// VideoEditionProperties.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gtk;
-using Mono.Unix;
-using LongoMatch.Video.Editor;
-using LongoMatch.Video.Common;
-using LongoMatch.Common;
-
-namespace LongoMatch.Gui.Dialog
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class VideoEditionProperties : Gtk.Dialog
-	{
-		private VideoQuality vq;
-		private VideoFormat vf;
-		private VideoEncoderType vcodec;
-		private AudioEncoderType acodec;
-		private VideoMuxerType muxer;
-
-
-		#region Constructors
-		public VideoEditionProperties()
-		{
-			this.Build();
-			formatcombobox.AppendText(Constants.MP4);
-			formatcombobox.AppendText(Constants.AVI);
-			if (System.Environment.OSVersion.Platform != PlatformID.Win32NT) {
-				formatcombobox.AppendText(Constants.WEBM);
-				formatcombobox.AppendText(Constants.OGG);
-				formatcombobox.AppendText(Constants.DVD);
-			}
-			formatcombobox.Active=0;
-		}
-		#endregion
-
-		#region Properties
-
-		public VideoQuality VideoQuality {
-			get {
-				return vq;
-			}
-		}
-
-		public VideoEncoderType VideoEncoderType {
-			get {
-				return vcodec;
-			}
-		}
-
-		public AudioEncoderType AudioEncoderType {
-			get {
-				return acodec;
-			}
-		}
-
-		public VideoMuxerType VideoMuxer {
-			get {
-				return muxer;
-			}
-		}
-
-		public string Filename {
-			get {
-				return fileentry.Text;
-			}
-		}
-
-		public bool EnableAudio {
-			get {
-				return audiocheckbutton.Active;
-			}
-		}
-
-		public bool TitleOverlay {
-			get {
-				return descriptioncheckbutton.Active;
-			}
-		}
-
-		public VideoFormat VideoFormat {
-			get {
-				return vf;
-			}
-		}
-		#endregion Properties
-
-		#region Private Methods
-
-		private string GetExtension() {
-			if (formatcombobox.ActiveText == Constants.MP4)
-				return "mp4";
-			else if (formatcombobox.ActiveText == Constants.OGG)
-				return "ogg";
-			else if (formatcombobox.ActiveText == Constants.WEBM)
-				return "webm";
-			else if (formatcombobox.ActiveText == Constants.AVI)
-				return "avi";
-			else
-				return "mpg";
-		}
-
-		#endregion
-
-		protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
-		{
-			if (qualitycombobox.ActiveText == Catalog.GetString("Low")) {
-				vq = VideoQuality.Low;
-			}
-			else if (qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
-				vq = VideoQuality.Normal;
-			}
-			else if (qualitycombobox.ActiveText == Catalog.GetString("Good")) {
-				vq = VideoQuality.Good;
-			}
-			else if (qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
-				vq = VideoQuality.Extra;
-			}
-
-			vf = (VideoFormat)sizecombobox.Active;
-
-			if (formatcombobox.ActiveText == Constants.MP4) {
-				vcodec = VideoEncoderType.H264;
-				acodec = AudioEncoderType.Aac;
-				muxer = VideoMuxerType.Mp4;
-			}
-			else if (formatcombobox.ActiveText == Constants.OGG) {
-				vcodec = VideoEncoderType.Theora;
-				acodec = AudioEncoderType.Vorbis;
-				muxer = VideoMuxerType.Ogg;
-			}
-			else if (formatcombobox.ActiveText == Constants.WEBM) {
-				vcodec = VideoEncoderType.VP8;
-				acodec = AudioEncoderType.Vorbis;
-				muxer = VideoMuxerType.WebM;
-			}
-			else if (formatcombobox.ActiveText == Constants.AVI) {
-				vcodec = VideoEncoderType.Xvid;
-				acodec = AudioEncoderType.Mp3;
-				muxer = VideoMuxerType.Avi;
-			}
-			else if (formatcombobox.ActiveText == Constants.DVD) {
-				vcodec = VideoEncoderType.Mpeg2;
-				acodec = AudioEncoderType.Mp3;
-				muxer = VideoMuxerType.MpegPS;
-			}
-			Hide();
-		}
-
-		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
-		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Video As ..."),
-			                this,
-			                FileChooserAction.Save,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.VideosDir());
-			fChooser.CurrentName = "NewVideo."+GetExtension();
-			fChooser.DoOverwriteConfirmation = true;
-			FileFilter filter = new FileFilter();
-			filter.Name = "Multimedia Files";
-			filter.AddPattern("*.mkv");
-			filter.AddPattern("*.mp4");
-			filter.AddPattern("*.ogg");
-			filter.AddPattern("*.avi");
-			filter.AddPattern("*.mpg");
-			filter.AddPattern("*.vob");
-			fChooser.Filter = filter;
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				fileentry.Text = fChooser.Filename;
-			}
-			fChooser.Destroy();
-		}
-		protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e)
-		{
-			this.Destroy();
-		}
-		
-		
-	}
-}
+// VideoEditionProperties.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gtk;
+using Mono.Unix;
+using LongoMatch.Video.Editor;
+using LongoMatch.Video.Common;
+using LongoMatch.Common;
+
+namespace LongoMatch.Gui.Dialog
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class VideoEditionProperties : Gtk.Dialog
+	{
+		private VideoQuality vq;
+		private VideoFormat vf;
+		private VideoEncoderType vcodec;
+		private AudioEncoderType acodec;
+		private VideoMuxerType muxer;
+
+
+		#region Constructors
+		public VideoEditionProperties()
+		{
+			this.Build();
+			formatcombobox.AppendText(Constants.MP4);
+			formatcombobox.AppendText(Constants.AVI);
+			if (System.Environment.OSVersion.Platform != PlatformID.Win32NT) {
+				formatcombobox.AppendText(Constants.WEBM);
+				formatcombobox.AppendText(Constants.OGG);
+				formatcombobox.AppendText(Constants.DVD);
+			}
+			formatcombobox.Active=0;
+		}
+		#endregion
+
+		#region Properties
+
+		public VideoQuality VideoQuality {
+			get {
+				return vq;
+			}
+		}
+
+		public VideoEncoderType VideoEncoderType {
+			get {
+				return vcodec;
+			}
+		}
+
+		public AudioEncoderType AudioEncoderType {
+			get {
+				return acodec;
+			}
+		}
+
+		public VideoMuxerType VideoMuxer {
+			get {
+				return muxer;
+			}
+		}
+
+		public string Filename {
+			get {
+				return fileentry.Text;
+			}
+		}
+
+		public bool EnableAudio {
+			get {
+				return audiocheckbutton.Active;
+			}
+		}
+
+		public bool TitleOverlay {
+			get {
+				return descriptioncheckbutton.Active;
+			}
+		}
+
+		public VideoFormat VideoFormat {
+			get {
+				return vf;
+			}
+		}
+		#endregion Properties
+
+		#region Private Methods
+
+		private string GetExtension() {
+			if (formatcombobox.ActiveText == Constants.MP4)
+				return "mp4";
+			else if (formatcombobox.ActiveText == Constants.OGG)
+				return "ogg";
+			else if (formatcombobox.ActiveText == Constants.WEBM)
+				return "webm";
+			else if (formatcombobox.ActiveText == Constants.AVI)
+				return "avi";
+			else
+				return "mpg";
+		}
+
+		#endregion
+
+		protected virtual void OnButtonOkClicked(object sender, System.EventArgs e)
+		{
+			if (qualitycombobox.ActiveText == Catalog.GetString("Low")) {
+				vq = VideoQuality.Low;
+			}
+			else if (qualitycombobox.ActiveText == Catalog.GetString("Normal")) {
+				vq = VideoQuality.Normal;
+			}
+			else if (qualitycombobox.ActiveText == Catalog.GetString("Good")) {
+				vq = VideoQuality.Good;
+			}
+			else if (qualitycombobox.ActiveText == Catalog.GetString("Extra")) {
+				vq = VideoQuality.Extra;
+			}
+
+			vf = (VideoFormat)sizecombobox.Active;
+
+			if (formatcombobox.ActiveText == Constants.MP4) {
+				vcodec = VideoEncoderType.H264;
+				acodec = AudioEncoderType.Aac;
+				muxer = VideoMuxerType.Mp4;
+			}
+			else if (formatcombobox.ActiveText == Constants.OGG) {
+				vcodec = VideoEncoderType.Theora;
+				acodec = AudioEncoderType.Vorbis;
+				muxer = VideoMuxerType.Ogg;
+			}
+			else if (formatcombobox.ActiveText == Constants.WEBM) {
+				vcodec = VideoEncoderType.VP8;
+				acodec = AudioEncoderType.Vorbis;
+				muxer = VideoMuxerType.WebM;
+			}
+			else if (formatcombobox.ActiveText == Constants.AVI) {
+				vcodec = VideoEncoderType.Xvid;
+				acodec = AudioEncoderType.Mp3;
+				muxer = VideoMuxerType.Avi;
+			}
+			else if (formatcombobox.ActiveText == Constants.DVD) {
+				vcodec = VideoEncoderType.Mpeg2;
+				acodec = AudioEncoderType.Mp3;
+				muxer = VideoMuxerType.MpegPS;
+			}
+			Hide();
+		}
+
+		protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Video As ..."),
+			                this,
+			                FileChooserAction.Save,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-save",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.VideosDir());
+			fChooser.CurrentName = "NewVideo."+GetExtension();
+			fChooser.DoOverwriteConfirmation = true;
+			FileFilter filter = new FileFilter();
+			filter.Name = "Multimedia Files";
+			filter.AddPattern("*.mkv");
+			filter.AddPattern("*.mp4");
+			filter.AddPattern("*.ogg");
+			filter.AddPattern("*.avi");
+			filter.AddPattern("*.mpg");
+			filter.AddPattern("*.vob");
+			fChooser.Filter = filter;
+			if (fChooser.Run() == (int)ResponseType.Accept) {
+				fileentry.Text = fChooser.Filename;
+			}
+			fChooser.Destroy();
+		}
+		protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e)
+		{
+			this.Destroy();
+		}
+		
+		
+	}
+}
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 30ec3a1..107db19 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -1,624 +1,623 @@
-// MainWindow.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.IO;
-using System.Reflection;
-using Gdk;
-using GLib;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Gui.Dialog;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-using LongoMatch.Utils;
-using LongoMatch.Video.Capturer;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Utils;
-using Mono.Unix;
-
-
-
-namespace LongoMatch.Gui
-{
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class MainWindow : Gtk.Window
-	{
-		private static Project openedProject;
-		private ProjectType projectType;
-		private TimeNode selectedTimeNode;
-
-		private EventsManager eManager;
-		private HotKeysManager hkManager;
-		private KeyPressEventHandler hotkeysListener;
-		
-		
-		#region Constructors
-		public MainWindow() :
-		base("LongoMatch")
-		{
-			this.Build();
-
-			/*Updater updater = new Updater();
-			A
-			updater.NewVersion += new LongoMatch.Handlers.NewVersionHandler(OnUpdate);
-			updater.Run();*/
-			
-			projectType = ProjectType.None;
-
-			eManager = new EventsManager(treewidget1,
-			                             localplayerslisttreewidget,
-			                             visitorplayerslisttreewidget,
-			                             tagstreewidget1,
-			                             buttonswidget1,
-			                             playlistwidget2,
-			                             playerbin1,
-			                             timelinewidget1,
-			                             videoprogressbar,
-			                             noteswidget1,
-			                             capturerBin);
-
-			hkManager = new HotKeysManager();
-			// Listenning only when a project is loaded
-			hotkeysListener = new KeyPressEventHandler(hkManager.KeyListener);
-			// Forward the event to the events manager
-			hkManager.newMarkEvent += new NewMarkEventHandler(eManager.OnNewMark);
-
-			DrawingManager dManager = new DrawingManager(drawingtoolbox1,playerbin1.VideoWidget);
-			//Forward Key and Button events to the Drawing Manager
-			KeyPressEvent += new KeyPressEventHandler(dManager.OnKeyPressEvent);
-
-			playerbin1.SetLogo(System.IO.Path.Combine(MainClass.ImagesDir(),"background.png"));
-			playerbin1.LogoMode = true;
-			
-			capturerBin.Visible = false;
-			capturerBin.Logo = System.IO.Path.Combine(MainClass.ImagesDir(),"background.png");
-			capturerBin.CaptureFinished += delegate {
-						CloseCaptureProject();};
-			
-			buttonswidget1.Mode = TagMode.Predifined;
-
-			playlistwidget2.SetPlayer(playerbin1);
-
-			localplayerslisttreewidget.Team = Team.LOCAL;
-			visitorplayerslisttreewidget.Team = Team.VISITOR;
-		}
-
-		#endregion
-		
-		#region Private Methods
-		private void SetProject (Project project, ProjectType projectType, CapturePropertiesStruct props)
-		{
-			bool isLive = false;
-			
-			if (project == null)
-				return;
-			
-			if (openedProject != null)
-				CloseOpenedProject (true);
-			
-			openedProject = project;
-			this.projectType = projectType;
-			eManager.OpenedProject = project;
-			eManager.OpenedProjectType = projectType;
-			
-			/* Update tabs labels */
-			/* FIXME 1.0: Teams should have default names */
-			var desc = project.Description;
-			if (desc.VisitorName == "")
-				visitorteamlabel.Text = Catalog.GetString("Visitor Team");
-			else
-				visitorteamlabel.Text = desc.VisitorName;
-			if (desc.LocalName == "")
-				localteamlabel.Text = Catalog.GetString("Local Team");
-			else
-				localteamlabel.Text = desc.LocalName;
-				
-			if (projectType == ProjectType.FileProject) {
-				// Check if the file associated to the project exists
-				if (!File.Exists (desc.File.FilePath)) {
-					MessagePopup.PopupMessage (this, MessageType.Warning,
-					                           Catalog.GetString ("The file associated to this project doesn't exist.") + "\n"
-					                           + Catalog.GetString ("If the location of the file has changed try to edit it with the database manager."));
-					CloseOpenedProject (true);
-					return;
-				}
-				Title = System.IO.Path.GetFileNameWithoutExtension (desc.File.FilePath) + 
-					" - " +	Constants.SOFTWARE_NAME;
-				try {
-					playerbin1.Open (desc.File.FilePath);
-				}
-				catch (GLib.GException ex) {
-					MessagePopup.PopupMessage (this, MessageType.Error,
-					                           Catalog.GetString ("An error occurred opening this project:") + "\n" + ex.Message);
-					CloseOpenedProject (true);
-						return;
-				}
-				playerbin1.LogoMode = false;
-				timelinewidget1.Project = project;
-				
-			} else {
-				Title = Constants.SOFTWARE_NAME;
-				isLive = true;
-				if (projectType == ProjectType.CaptureProject) {
-					capturerBin.CaptureProperties = props;
-					try {
-						capturerBin.Type = CapturerType.Live;
-					} catch (Exception ex) {
-						MessagePopup.PopupMessage (this, MessageType.Error, ex.Message);
-						CloseOpenedProject (false);
-						return;
-					}
-				} else
-					capturerBin.Type = CapturerType.Fake;
-				playerbin1.Visible = false;
-				capturerBin.Visible = true;
-				capturerBin.Run ();
-				CaptureModeAction.Active = true;
-			}
-			
-			treewidget1.ProjectIsLive = isLive;
-			localplayerslisttreewidget.ProjectIsLive = isLive;
-			visitorplayerslisttreewidget.ProjectIsLive = isLive;
-			tagstreewidget1.ProjectIsLive = isLive;
-			playlistwidget2.Stop();
-			treewidget1.Project=project;
-			tagstreewidget1.Project = project;				
-			buttonswidget1.Categories = project.Categories;
-			hkManager.Categories=project.Categories;
-			KeyPressEvent += hotkeysListener;
-			MakeActionsSensitive(true,projectType);
-			ShowWidgets();
-	}
-		
-		private void SaveCaptureProject(){
-			PreviewMediaFile file;
-			Project newProject = openedProject;
-			string filePath = openedProject.Description.File.FilePath;
-			
-			MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
-			                                     Catalog.GetString("Loading newly created project..."));
-			md.Show();
-
-			/* scan the new file to build a new PreviewMediaFile with all the metadata */
-			try{
-				file = PreviewMediaFile.GetMediaFile(filePath);		
-				openedProject.Description.File = file;
-				MainClass.DB.AddProject(openedProject);
-			} catch (Exception ex){
-				string projectFile = filePath + "-" + DateTime.Now;
-				projectFile = projectFile.Replace("-", "_");
-				projectFile = projectFile.Replace(" ", "_");
-				projectFile = projectFile.Replace(":", "_");
-				Project.Export(openedProject, projectFile);
-				MessagePopup.PopupMessage(this, MessageType.Error,
-				                          Catalog.GetString("An error occured saving the project:\n")+ex.Message+ "\n\n"+
-				                          Catalog.GetString("The video file and a backup of the project has been "+
-				                                            "saved. Try to import it later:\n")+
-				                          filePath+"\n"+projectFile);
-			}
-			/* we need to set the opened project to null to avoid calling again CloseOpendProject() */
-			openedProject = null;
-			SetProject(newProject, ProjectType.FileProject, new CapturePropertiesStruct());
-			md.Destroy();
-		}
-		
-		private void CloseCaptureProject (){
-			if (projectType == ProjectType.CaptureProject){
-				capturerBin.Close();
-				playerbin1.Visible = true;
-				capturerBin.Visible = false;;
-				SaveCaptureProject();
-			} else if (projectType == ProjectType.FakeCaptureProject){
-				CloseOpenedProject(true);
-			}
-		}
-
-		private void CloseOpenedProject(bool save) {
-			if (save)
-				SaveProject();
-			
-			if (projectType != ProjectType.FileProject)
-				capturerBin.Close();
-			else 
-				playerbin1.Close();
-			
-			if (openedProject != null)
-				openedProject.Clear();
-			openedProject = null;
-			projectType = ProjectType.None;
-			eManager.OpenedProject = null;
-			eManager.OpenedProjectType = ProjectType.None;				
-			ResetGUI();
-		}
-		
-		private void ResetGUI(){
-			bool playlistVisible = playlistwidget2.Visible;	
-
-			Title = Constants.SOFTWARE_NAME;
-			playerbin1.Visible = true;
-			playerbin1.LogoMode = true;
-			capturerBin.Visible = false;
-			ClearWidgets();
-			HideWidgets();	
-			
-			playlistwidget2.Visible = playlistVisible;
-			rightvbox.Visible = playlistVisible;
-			noteswidget1.Visible = false;			
-			selectedTimeNode = null;
-			MakeActionsSensitive(false, projectType);
-			hkManager.Categories = null;
-			KeyPressEvent -= hotkeysListener;
-		}
-
-		private void MakeActionsSensitive(bool sensitive, ProjectType projectType) {
-			bool sensitive2 = sensitive && projectType == ProjectType.FileProject;
-			CloseProjectAction.Sensitive=sensitive;
-			SaveProjectAction.Sensitive = sensitive;
-			CaptureModeAction.Sensitive = sensitive2;
-			FreeCaptureModeAction.Sensitive = sensitive2;
-			AnalyzeModeAction.Sensitive = sensitive2;
-			ExportProjectToCSVFileAction.Sensitive = sensitive2;
-			HideAllWidgetsAction.Sensitive=sensitive2;
-		}
-
-		private void ShowWidgets() {
-			leftbox.Show();
-			if (CaptureModeAction.Active || FreeCaptureModeAction.Active)
-				buttonswidget1.Show();
-			else
-				timelinewidget1.Show();
-		}
-
-		private void HideWidgets() {
-			leftbox.Hide();
-			rightvbox.Hide();
-			buttonswidget1.Hide();
-			timelinewidget1.Hide();
-		}
-
-		private void ClearWidgets() {
-			buttonswidget1.Categories = null;
-			treewidget1.Project = null;
-			tagstreewidget1.Clear();
-			timelinewidget1.Project = null;
-			localplayerslisttreewidget.Clear();
-			visitorplayerslisttreewidget.Clear();
-		}
-
-		private void SaveProject() {
-			if (openedProject != null && projectType == ProjectType.FileProject) {
-				try {
-					MainClass.DB.UpdateProject(openedProject);
-				} catch (Exception e){
-					Log.Exception(e);
-				}
-			} else if (projectType == ProjectType.FakeCaptureProject)
-				ProjectUtils.SaveFakeLiveProject(openedProject, this);
-		}
-		
-		private bool PromptCloseProject(){
-			int res;
-			EndCaptureDialog dialog;
-			
-			if (openedProject == null)
-				return true;
-			
-			if (projectType == ProjectType.FileProject){
-				MessageDialog md = new MessageDialog(this, DialogFlags.Modal, 
-				                                     MessageType.Question, ButtonsType.OkCancel,
-				                                     Catalog.GetString("Do you want to close the current project?"));
-				res = md.Run();
-				md.Destroy();
-				if (res == (int)ResponseType.Ok){
-					CloseOpenedProject(true);
-					return true;
-				}
-				return false;
-			}
-			
-			dialog = new EndCaptureDialog();
-			dialog.TransientFor = (Gtk.Window)this.Toplevel;			
-			res = dialog.Run();
-			dialog.Destroy();			
-			
-			/* Close project wihtout saving */
-			if (res == (int)EndCaptureResponse.Quit){
-				CloseOpenedProject(false);
-				return true;
-			} else if (res == (int)EndCaptureResponse.Save){
-				/* Close and save project */
-				CloseOpenedProject(true);
-				return true;
-			} else
-				/* Continue with the current project */
-				return false;			
-		}
-		
-		private void CloseAndQuit(){
-			if (!PromptCloseProject())
-				return;
-			playlistwidget2.StopEdition();
-			SaveProject();
-			playerbin1.Dispose();
-			Application.Quit();
-		}
-		#endregion	
-
-		#region Callbacks
-		#region File
-		protected virtual void OnNewActivated(object sender, System.EventArgs e)
-		{
-			Project project;
-			ProjectType projectType;
-			CapturePropertiesStruct captureProps;
-			
-			if (!PromptCloseProject())
-				return;
-			
-			ProjectUtils.CreateNewProject(this, out project, out projectType, out captureProps);	
-			if (project != null)
-				SetProject(project, projectType, captureProps);
-		}
-		
-		protected virtual void OnOpenActivated(object sender, System.EventArgs e)
-		{
-			if (!PromptCloseProject())
-				return;
-			
-			ProjectDescription project=null;
-			OpenProjectDialog opd = new OpenProjectDialog();
-			opd.TransientFor = this;
-
-			if (opd.Run() == (int)ResponseType.Ok)
-				project = opd.SelectedProject;
-			opd.Destroy();
-			if (project != null)
-				SetProject(MainClass.DB.GetProject(project.File.FilePath), ProjectType.FileProject, new CapturePropertiesStruct());
-		}
-		
-		protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
-		{
-			SaveProject();
-		}
-		
-		protected virtual void OnCloseActivated(object sender, System.EventArgs e)
-		{
-			PromptCloseProject();
-		}
-		
-		protected virtual void OnImportProjectActionActivated (object sender, System.EventArgs e)
-		{
-			ProjectUtils.ImportProject(this);
-		}
-		
-		protected virtual void OnQuitActivated(object sender, System.EventArgs e)
-		{
-			CloseAndQuit();
-		}	
-		#endregion
-		#region Tools
-		protected virtual void OnDatabaseManagerActivated(object sender, System.EventArgs e)
-		{
-			ProjectsManager pm = new ProjectsManager(openedProject);
-			pm.TransientFor = this;
-			pm.Show();
-		}
-		
-		protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
-		{
-			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.CategoriesTemplate);
-			tManager.TransientFor = this;
-			tManager.Show();
-		}
-
-		protected virtual void OnTeamsTemplatesManagerActionActivated(object sender, System.EventArgs e)
-		{
-			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.TeamTemplate);
-			tManager.TransientFor = this;
-			tManager.Show();
-		}
-		
-		protected virtual void OnExportProjectToCSVFileActionActivated(object sender, System.EventArgs e)
-		{
-			ProjectUtils.ExportToCSV(this, openedProject);
-		}
-		#endregion
-		#region View
-		protected virtual void OnFullScreenActionToggled(object sender, System.EventArgs e)
-		{
-			playerbin1.FullScreen = ((Gtk.ToggleAction)sender).Active;
-		}
-		
-		protected virtual void OnPlaylistActionToggled(object sender, System.EventArgs e)
-		{
-			bool visible = ((Gtk.ToggleAction)sender).Active;
-			playlistwidget2.Visible=visible;
-			treewidget1.PlayListLoaded=visible;
-			localplayerslisttreewidget.PlayListLoaded=visible;
-			visitorplayerslisttreewidget.PlayListLoaded=visible;
-
-			if (!visible && !noteswidget1.Visible) {
-				rightvbox.Visible = false;
-			}
-			else if (visible) {
-				rightvbox.Visible = true;
-			}
-		}	
-		
-		protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
-		{
-			if (openedProject != null) {
-				leftbox.Visible = !((Gtk.ToggleAction)sender).Active;
-				timelinewidget1.Visible = !((Gtk.ToggleAction)sender).Active && AnalyzeModeAction.Active;
-				buttonswidget1.Visible = !((Gtk.ToggleAction)sender).Active && 
-					(CaptureModeAction.Active || CaptureModeAction.Active);
-				if (((Gtk.ToggleAction)sender).Active)
-					rightvbox.Visible = false;
-				else if (!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
-					rightvbox.Visible = true;
-			}
-		}
-		
-		protected virtual void OnViewToggled(object sender, System.EventArgs e)
-		{
-			/* this callback is triggered by Capture and Free Capture */
-			ToggleAction view = (Gtk.ToggleAction)sender;
-			buttonswidget1.Visible = view.Active;
-			timelinewidget1.Visible = !view.Active;
-			if (view == FreeCaptureModeAction)
-				buttonswidget1.Mode = TagMode.Free;
-			else 
-				buttonswidget1.Mode = TagMode.Predifined;			
-		}	
-		#endregion
-		#region Help
-		protected virtual void OnHelpAction1Activated(object sender, System.EventArgs e)
-		{
-			try {
-				System.Diagnostics.Process.Start(Constants.MANUAL);
-			} catch {}
-		}
-		
-		protected virtual void OnAboutActionActivated(object sender, System.EventArgs e)
-		{
-			Version version = Assembly.GetExecutingAssembly().GetName().Version;
-			Gtk.AboutDialog about = new AboutDialog();
-			if (Environment.OSVersion.Platform == PlatformID.Unix)
-				about.ProgramName = Constants.SOFTWARE_NAME;
-			about.Version = String.Format("{0}.{1}.{2}",version.Major,version.Minor,version.Build);
-			about.Copyright = Constants.COPYRIGHT;
-			about.Website = Constants.WEBSITE;
-			about.License = Constants.LICENSE;
-			about.Authors = new string[] {"Andoni Morales Alastruey"};
-			about.Artists = new string[] {"Bencomo González Marrero"};
-			about.TranslatorCredits = Constants.TRANSLATORS;
-			about.TransientFor = this;
-			Gtk.AboutDialog.SetUrlHook(delegate(AboutDialog dialog,string url) {
-				try {
-					System.Diagnostics.Process.Start(url);
-				} catch {}
-			});
-			about.Run();
-			about.Destroy();
-
-		}
-		#endregion			
-
-		protected virtual void OnTimeprecisionadjustwidget1SizeRequested(object o, Gtk.SizeRequestedArgs args)
-		{
-			if (args.Requisition.Width>= hpaned.Position)
-				hpaned.Position = args.Requisition.Width;
-		}		
-
-		protected virtual void OnPlayerbin1Error(object o, ErrorArgs args)
-		{
-			MessagePopup.PopupMessage(this, MessageType.Info,
-			                          Catalog.GetString("The actual project will be closed due to an error in the media player:")+"\n" +args.Message);
-			CloseOpenedProject(true);
-		}
-
-		protected override bool OnKeyPressEvent(EventKey evnt)
-		{
-			Gdk.Key key = evnt.Key;
-			Gdk.ModifierType modifier = evnt.State;
-			bool ret;
-			
-			ret = base.OnKeyPressEvent(evnt);
-
-			if (openedProject == null && !playerbin1.Opened)
-				return ret;
-			
-			if (projectType != ProjectType.CaptureProject &&
-			    projectType != ProjectType.FakeCaptureProject){
-				switch (key){
-					case Constants.SEEK_FORWARD:
-						if (modifier == Constants.STEP)
-							playerbin1.StepForward();
-						else 
-							playerbin1.SeekToNextFrame(selectedTimeNode != null);						
-						break;
-					case Constants.SEEK_BACKWARD:
-						if (modifier == Constants.STEP)
-							playerbin1.StepBackward();
-						else 
-							playerbin1.SeekToPreviousFrame(selectedTimeNode != null);						
-						break;
-					case Constants.FRAMERATE_UP:
-						playerbin1.FramerateUp();
-						break;
-					case Constants.FRAMERATE_DOWN:
-						playerbin1.FramerateDown();
-						break;
-					case Constants.TOGGLE_PLAY:
-						playerbin1.TogglePlay();
-						break;			
-				}	
-			} else {
-				switch (key){
-					case Constants.TOGGLE_PLAY:
-						capturerBin.TogglePause();
-						break;			
-				}	
-			}
-			return ret;
-		}
-
-		protected virtual void OnTimeNodeSelected(Play play)
-		{
-			rightvbox.Visible=true;
-		}
-
-		protected virtual void OnSegmentClosedEvent()
-		{
-			if (!playlistwidget2.Visible)
-				rightvbox.Visible=false;
-		}
-
-		protected virtual void OnUpdate(Version version, string URL) {
-			LongoMatch.Gui.Dialog.UpdateDialog updater = new LongoMatch.Gui.Dialog.UpdateDialog();
-			updater.Fill(version, URL);
-			updater.TransientFor = this;
-			updater.Run();
-			updater.Destroy();
-		}
-
-		protected virtual void OnDrawingToolActionToggled(object sender, System.EventArgs e)
-		{
-			drawingtoolbox1.Visible = DrawingToolAction.Active;
-			drawingtoolbox1.DrawingVisibility = DrawingToolAction.Active;
-		}
-	
-		protected override bool OnDeleteEvent (Gdk.Event evnt)
-		{
-			CloseAndQuit();	
-			return true;
-		}
-		
-		protected virtual void OnCapturerBinError (object o, ErrorArgs args)
-		{
-			MessagePopup.PopupMessage(this, MessageType.Info,
-			                          Catalog.GetString("An error occured in the video capturer and the current project will be closed:")+"\n" +args.Message);
-			CloseOpenedProject(true);
-		}
-		#endregion	
-	}
+// MainWindow.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using Gdk;
+using GLib;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Gui.Dialog;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Utils;
+using LongoMatch.Video.Capturer;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+
+
+namespace LongoMatch.Gui
+{
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class MainWindow : Gtk.Window
+	{
+		private static Project openedProject;
+		private ProjectType projectType;
+		private TimeNode selectedTimeNode;
+
+		private EventsManager eManager;
+		private HotKeysManager hkManager;
+		private KeyPressEventHandler hotkeysListener;
+		
+		
+		#region Constructors
+		public MainWindow() :
+		base("LongoMatch")
+		{
+			this.Build();
+
+			/*Updater updater = new Updater();
+			updater.NewVersion += new LongoMatch.Handlers.NewVersionHandler(OnUpdate);
+			updater.Run();*/
+			
+			projectType = ProjectType.None;
+
+			eManager = new EventsManager(treewidget1,
+			                             localplayerslisttreewidget,
+			                             visitorplayerslisttreewidget,
+			                             tagstreewidget1,
+			                             buttonswidget1,
+			                             playlistwidget2,
+			                             playerbin1,
+			                             timelinewidget1,
+			                             videoprogressbar,
+			                             noteswidget1,
+			                             capturerBin);
+
+			hkManager = new HotKeysManager();
+			// Listenning only when a project is loaded
+			hotkeysListener = new KeyPressEventHandler(hkManager.KeyListener);
+			// Forward the event to the events manager
+			hkManager.newMarkEvent += new NewMarkEventHandler(eManager.OnNewMark);
+
+			DrawingManager dManager = new DrawingManager(drawingtoolbox1,playerbin1.VideoWidget);
+			//Forward Key and Button events to the Drawing Manager
+			KeyPressEvent += new KeyPressEventHandler(dManager.OnKeyPressEvent);
+
+			playerbin1.SetLogo(System.IO.Path.Combine(MainClass.ImagesDir(),"background.png"));
+			playerbin1.LogoMode = true;
+			
+			capturerBin.Visible = false;
+			capturerBin.Logo = System.IO.Path.Combine(MainClass.ImagesDir(),"background.png");
+			capturerBin.CaptureFinished += delegate {
+						CloseCaptureProject();};
+			
+			buttonswidget1.Mode = TagMode.Predifined;
+
+			playlistwidget2.SetPlayer(playerbin1);
+
+			localplayerslisttreewidget.Team = Team.LOCAL;
+			visitorplayerslisttreewidget.Team = Team.VISITOR;
+		}
+
+		#endregion
+		
+		#region Private Methods
+		private void SetProject (Project project, ProjectType projectType, CapturePropertiesStruct props)
+		{
+			bool isLive = false;
+			
+			if (project == null)
+				return;
+			
+			if (openedProject != null)
+				CloseOpenedProject (true);
+			
+			openedProject = project;
+			this.projectType = projectType;
+			eManager.OpenedProject = project;
+			eManager.OpenedProjectType = projectType;
+			
+			/* Update tabs labels */
+			/* FIXME 1.0: Teams should have default names */
+			var desc = project.Description;
+			if (desc.VisitorName == "")
+				visitorteamlabel.Text = Catalog.GetString("Visitor Team");
+			else
+				visitorteamlabel.Text = desc.VisitorName;
+			if (desc.LocalName == "")
+				localteamlabel.Text = Catalog.GetString("Local Team");
+			else
+				localteamlabel.Text = desc.LocalName;
+				
+			if (projectType == ProjectType.FileProject) {
+				// Check if the file associated to the project exists
+				if (!File.Exists (desc.File.FilePath)) {
+					MessagePopup.PopupMessage (this, MessageType.Warning,
+					                           Catalog.GetString ("The file associated to this project doesn't exist.") + "\n"
+					                           + Catalog.GetString ("If the location of the file has changed try to edit it with the database manager."));
+					CloseOpenedProject (true);
+					return;
+				}
+				Title = System.IO.Path.GetFileNameWithoutExtension (desc.File.FilePath) + 
+					" - " +	Constants.SOFTWARE_NAME;
+				try {
+					playerbin1.Open (desc.File.FilePath);
+				}
+				catch (GLib.GException ex) {
+					MessagePopup.PopupMessage (this, MessageType.Error,
+					                           Catalog.GetString ("An error occurred opening this project:") + "\n" + ex.Message);
+					CloseOpenedProject (true);
+						return;
+				}
+				playerbin1.LogoMode = false;
+				timelinewidget1.Project = project;
+				
+			} else {
+				Title = Constants.SOFTWARE_NAME;
+				isLive = true;
+				if (projectType == ProjectType.CaptureProject) {
+					capturerBin.CaptureProperties = props;
+					try {
+						capturerBin.Type = CapturerType.Live;
+					} catch (Exception ex) {
+						MessagePopup.PopupMessage (this, MessageType.Error, ex.Message);
+						CloseOpenedProject (false);
+						return;
+					}
+				} else
+					capturerBin.Type = CapturerType.Fake;
+				playerbin1.Visible = false;
+				capturerBin.Visible = true;
+				capturerBin.Run ();
+				CaptureModeAction.Active = true;
+			}
+			
+			treewidget1.ProjectIsLive = isLive;
+			localplayerslisttreewidget.ProjectIsLive = isLive;
+			visitorplayerslisttreewidget.ProjectIsLive = isLive;
+			tagstreewidget1.ProjectIsLive = isLive;
+			playlistwidget2.Stop();
+			treewidget1.Project=project;
+			tagstreewidget1.Project = project;				
+			buttonswidget1.Categories = project.Categories;
+			hkManager.Categories=project.Categories;
+			KeyPressEvent += hotkeysListener;
+			MakeActionsSensitive(true,projectType);
+			ShowWidgets();
+	}
+		
+		private void SaveCaptureProject(){
+			PreviewMediaFile file;
+			Project newProject = openedProject;
+			string filePath = openedProject.Description.File.FilePath;
+			
+			MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
+			                                     Catalog.GetString("Loading newly created project..."));
+			md.Show();
+
+			/* scan the new file to build a new PreviewMediaFile with all the metadata */
+			try{
+				file = PreviewMediaFile.GetMediaFile(filePath);		
+				openedProject.Description.File = file;
+				MainClass.DB.AddProject(openedProject);
+			} catch (Exception ex){
+				string projectFile = filePath + "-" + DateTime.Now;
+				projectFile = projectFile.Replace("-", "_");
+				projectFile = projectFile.Replace(" ", "_");
+				projectFile = projectFile.Replace(":", "_");
+				Project.Export(openedProject, projectFile);
+				MessagePopup.PopupMessage(this, MessageType.Error,
+				                          Catalog.GetString("An error occured saving the project:\n")+ex.Message+ "\n\n"+
+				                          Catalog.GetString("The video file and a backup of the project has been "+
+				                                            "saved. Try to import it later:\n")+
+				                          filePath+"\n"+projectFile);
+			}
+			/* we need to set the opened project to null to avoid calling again CloseOpendProject() */
+			openedProject = null;
+			SetProject(newProject, ProjectType.FileProject, new CapturePropertiesStruct());
+			md.Destroy();
+		}
+		
+		private void CloseCaptureProject (){
+			if (projectType == ProjectType.CaptureProject){
+				capturerBin.Close();
+				playerbin1.Visible = true;
+				capturerBin.Visible = false;;
+				SaveCaptureProject();
+			} else if (projectType == ProjectType.FakeCaptureProject){
+				CloseOpenedProject(true);
+			}
+		}
+
+		private void CloseOpenedProject(bool save) {
+			if (save)
+				SaveProject();
+			
+			if (projectType != ProjectType.FileProject)
+				capturerBin.Close();
+			else 
+				playerbin1.Close();
+			
+			if (openedProject != null)
+				openedProject.Clear();
+			openedProject = null;
+			projectType = ProjectType.None;
+			eManager.OpenedProject = null;
+			eManager.OpenedProjectType = ProjectType.None;				
+			ResetGUI();
+		}
+		
+		private void ResetGUI(){
+			bool playlistVisible = playlistwidget2.Visible;	
+
+			Title = Constants.SOFTWARE_NAME;
+			playerbin1.Visible = true;
+			playerbin1.LogoMode = true;
+			capturerBin.Visible = false;
+			ClearWidgets();
+			HideWidgets();	
+			
+			playlistwidget2.Visible = playlistVisible;
+			rightvbox.Visible = playlistVisible;
+			noteswidget1.Visible = false;			
+			selectedTimeNode = null;
+			MakeActionsSensitive(false, projectType);
+			hkManager.Categories = null;
+			KeyPressEvent -= hotkeysListener;
+		}
+
+		private void MakeActionsSensitive(bool sensitive, ProjectType projectType) {
+			bool sensitive2 = sensitive && projectType == ProjectType.FileProject;
+			CloseProjectAction.Sensitive=sensitive;
+			SaveProjectAction.Sensitive = sensitive;
+			CaptureModeAction.Sensitive = sensitive2;
+			FreeCaptureModeAction.Sensitive = sensitive2;
+			AnalyzeModeAction.Sensitive = sensitive2;
+			ExportProjectToCSVFileAction.Sensitive = sensitive2;
+			HideAllWidgetsAction.Sensitive=sensitive2;
+		}
+
+		private void ShowWidgets() {
+			leftbox.Show();
+			if (CaptureModeAction.Active || FreeCaptureModeAction.Active)
+				buttonswidget1.Show();
+			else
+				timelinewidget1.Show();
+		}
+
+		private void HideWidgets() {
+			leftbox.Hide();
+			rightvbox.Hide();
+			buttonswidget1.Hide();
+			timelinewidget1.Hide();
+		}
+
+		private void ClearWidgets() {
+			buttonswidget1.Categories = null;
+			treewidget1.Project = null;
+			tagstreewidget1.Clear();
+			timelinewidget1.Project = null;
+			localplayerslisttreewidget.Clear();
+			visitorplayerslisttreewidget.Clear();
+		}
+
+		private void SaveProject() {
+			if (openedProject != null && projectType == ProjectType.FileProject) {
+				try {
+					MainClass.DB.UpdateProject(openedProject);
+				} catch (Exception e){
+					Log.Exception(e);
+				}
+			} else if (projectType == ProjectType.FakeCaptureProject)
+				ProjectUtils.SaveFakeLiveProject(openedProject, this);
+		}
+		
+		private bool PromptCloseProject(){
+			int res;
+			EndCaptureDialog dialog;
+			
+			if (openedProject == null)
+				return true;
+			
+			if (projectType == ProjectType.FileProject){
+				MessageDialog md = new MessageDialog(this, DialogFlags.Modal, 
+				                                     MessageType.Question, ButtonsType.OkCancel,
+				                                     Catalog.GetString("Do you want to close the current project?"));
+				res = md.Run();
+				md.Destroy();
+				if (res == (int)ResponseType.Ok){
+					CloseOpenedProject(true);
+					return true;
+				}
+				return false;
+			}
+			
+			dialog = new EndCaptureDialog();
+			dialog.TransientFor = (Gtk.Window)this.Toplevel;			
+			res = dialog.Run();
+			dialog.Destroy();			
+			
+			/* Close project wihtout saving */
+			if (res == (int)EndCaptureResponse.Quit){
+				CloseOpenedProject(false);
+				return true;
+			} else if (res == (int)EndCaptureResponse.Save){
+				/* Close and save project */
+				CloseOpenedProject(true);
+				return true;
+			} else
+				/* Continue with the current project */
+				return false;			
+		}
+		
+		private void CloseAndQuit(){
+			if (!PromptCloseProject())
+				return;
+			playlistwidget2.StopEdition();
+			SaveProject();
+			playerbin1.Dispose();
+			Application.Quit();
+		}
+		#endregion	
+
+		#region Callbacks
+		#region File
+		protected virtual void OnNewActivated(object sender, System.EventArgs e)
+		{
+			Project project;
+			ProjectType projectType;
+			CapturePropertiesStruct captureProps;
+			
+			if (!PromptCloseProject())
+				return;
+			
+			ProjectUtils.CreateNewProject(this, out project, out projectType, out captureProps);	
+			if (project != null)
+				SetProject(project, projectType, captureProps);
+		}
+		
+		protected virtual void OnOpenActivated(object sender, System.EventArgs e)
+		{
+			if (!PromptCloseProject())
+				return;
+			
+			ProjectDescription project=null;
+			OpenProjectDialog opd = new OpenProjectDialog();
+			opd.TransientFor = this;
+
+			if (opd.Run() == (int)ResponseType.Ok)
+				project = opd.SelectedProject;
+			opd.Destroy();
+			if (project != null)
+				SetProject(MainClass.DB.GetProject(project.File.FilePath), ProjectType.FileProject, new CapturePropertiesStruct());
+		}
+		
+		protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
+		{
+			SaveProject();
+		}
+		
+		protected virtual void OnCloseActivated(object sender, System.EventArgs e)
+		{
+			PromptCloseProject();
+		}
+		
+		protected virtual void OnImportProjectActionActivated (object sender, System.EventArgs e)
+		{
+			ProjectUtils.ImportProject(this);
+		}
+		
+		protected virtual void OnQuitActivated(object sender, System.EventArgs e)
+		{
+			CloseAndQuit();
+		}	
+		#endregion
+		#region Tools
+		protected virtual void OnDatabaseManagerActivated(object sender, System.EventArgs e)
+		{
+			ProjectsManager pm = new ProjectsManager(openedProject);
+			pm.TransientFor = this;
+			pm.Show();
+		}
+		
+		protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
+		{
+			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.CategoriesTemplate);
+			tManager.TransientFor = this;
+			tManager.Show();
+		}
+
+		protected virtual void OnTeamsTemplatesManagerActionActivated(object sender, System.EventArgs e)
+		{
+			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.TeamTemplate);
+			tManager.TransientFor = this;
+			tManager.Show();
+		}
+		
+		protected virtual void OnExportProjectToCSVFileActionActivated(object sender, System.EventArgs e)
+		{
+			ProjectUtils.ExportToCSV(this, openedProject);
+		}
+		#endregion
+		#region View
+		protected virtual void OnFullScreenActionToggled(object sender, System.EventArgs e)
+		{
+			playerbin1.FullScreen = ((Gtk.ToggleAction)sender).Active;
+		}
+		
+		protected virtual void OnPlaylistActionToggled(object sender, System.EventArgs e)
+		{
+			bool visible = ((Gtk.ToggleAction)sender).Active;
+			playlistwidget2.Visible=visible;
+			treewidget1.PlayListLoaded=visible;
+			localplayerslisttreewidget.PlayListLoaded=visible;
+			visitorplayerslisttreewidget.PlayListLoaded=visible;
+
+			if (!visible && !noteswidget1.Visible) {
+				rightvbox.Visible = false;
+			}
+			else if (visible) {
+				rightvbox.Visible = true;
+			}
+		}	
+		
+		protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
+		{
+			if (openedProject != null) {
+				leftbox.Visible = !((Gtk.ToggleAction)sender).Active;
+				timelinewidget1.Visible = !((Gtk.ToggleAction)sender).Active && AnalyzeModeAction.Active;
+				buttonswidget1.Visible = !((Gtk.ToggleAction)sender).Active && 
+					(CaptureModeAction.Active || CaptureModeAction.Active);
+				if (((Gtk.ToggleAction)sender).Active)
+					rightvbox.Visible = false;
+				else if (!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
+					rightvbox.Visible = true;
+			}
+		}
+		
+		protected virtual void OnViewToggled(object sender, System.EventArgs e)
+		{
+			/* this callback is triggered by Capture and Free Capture */
+			ToggleAction view = (Gtk.ToggleAction)sender;
+			buttonswidget1.Visible = view.Active;
+			timelinewidget1.Visible = !view.Active;
+			if (view == FreeCaptureModeAction)
+				buttonswidget1.Mode = TagMode.Free;
+			else 
+				buttonswidget1.Mode = TagMode.Predifined;			
+		}	
+		#endregion
+		#region Help
+		protected virtual void OnHelpAction1Activated(object sender, System.EventArgs e)
+		{
+			try {
+				System.Diagnostics.Process.Start(Constants.MANUAL);
+			} catch {}
+		}
+		
+		protected virtual void OnAboutActionActivated(object sender, System.EventArgs e)
+		{
+			Version version = Assembly.GetExecutingAssembly().GetName().Version;
+			Gtk.AboutDialog about = new AboutDialog();
+			if (Environment.OSVersion.Platform == PlatformID.Unix)
+				about.ProgramName = Constants.SOFTWARE_NAME;
+			about.Version = String.Format("{0}.{1}.{2}",version.Major,version.Minor,version.Build);
+			about.Copyright = Constants.COPYRIGHT;
+			about.Website = Constants.WEBSITE;
+			about.License = Constants.LICENSE;
+			about.Authors = new string[] {"Andoni Morales Alastruey"};
+			about.Artists = new string[] {"Bencomo González Marrero"};
+			about.TranslatorCredits = Constants.TRANSLATORS;
+			about.TransientFor = this;
+			Gtk.AboutDialog.SetUrlHook(delegate(AboutDialog dialog,string url) {
+				try {
+					System.Diagnostics.Process.Start(url);
+				} catch {}
+			});
+			about.Run();
+			about.Destroy();
+
+		}
+		#endregion			
+
+		protected virtual void OnTimeprecisionadjustwidget1SizeRequested(object o, Gtk.SizeRequestedArgs args)
+		{
+			if (args.Requisition.Width>= hpaned.Position)
+				hpaned.Position = args.Requisition.Width;
+		}		
+
+		protected virtual void OnPlayerbin1Error(object o, ErrorArgs args)
+		{
+			MessagePopup.PopupMessage(this, MessageType.Info,
+			                          Catalog.GetString("The actual project will be closed due to an error in the media player:")+"\n" +args.Message);
+			CloseOpenedProject(true);
+		}
+
+		protected override bool OnKeyPressEvent(EventKey evnt)
+		{
+			Gdk.Key key = evnt.Key;
+			Gdk.ModifierType modifier = evnt.State;
+			bool ret;
+			
+			ret = base.OnKeyPressEvent(evnt);
+
+			if (openedProject == null && !playerbin1.Opened)
+				return ret;
+			
+			if (projectType != ProjectType.CaptureProject &&
+			    projectType != ProjectType.FakeCaptureProject){
+				switch (key){
+					case Constants.SEEK_FORWARD:
+						if (modifier == Constants.STEP)
+							playerbin1.StepForward();
+						else 
+							playerbin1.SeekToNextFrame(selectedTimeNode != null);						
+						break;
+					case Constants.SEEK_BACKWARD:
+						if (modifier == Constants.STEP)
+							playerbin1.StepBackward();
+						else 
+							playerbin1.SeekToPreviousFrame(selectedTimeNode != null);						
+						break;
+					case Constants.FRAMERATE_UP:
+						playerbin1.FramerateUp();
+						break;
+					case Constants.FRAMERATE_DOWN:
+						playerbin1.FramerateDown();
+						break;
+					case Constants.TOGGLE_PLAY:
+						playerbin1.TogglePlay();
+						break;			
+				}	
+			} else {
+				switch (key){
+					case Constants.TOGGLE_PLAY:
+						capturerBin.TogglePause();
+						break;			
+				}	
+			}
+			return ret;
+		}
+
+		protected virtual void OnTimeNodeSelected(Play play)
+		{
+			rightvbox.Visible=true;
+		}
+
+		protected virtual void OnSegmentClosedEvent()
+		{
+			if (!playlistwidget2.Visible)
+				rightvbox.Visible=false;
+		}
+
+		protected virtual void OnUpdate(Version version, string URL) {
+			LongoMatch.Gui.Dialog.UpdateDialog updater = new LongoMatch.Gui.Dialog.UpdateDialog();
+			updater.Fill(version, URL);
+			updater.TransientFor = this;
+			updater.Run();
+			updater.Destroy();
+		}
+
+		protected virtual void OnDrawingToolActionToggled(object sender, System.EventArgs e)
+		{
+			drawingtoolbox1.Visible = DrawingToolAction.Active;
+			drawingtoolbox1.DrawingVisibility = DrawingToolAction.Active;
+		}
+	
+		protected override bool OnDeleteEvent (Gdk.Event evnt)
+		{
+			CloseAndQuit();	
+			return true;
+		}
+		
+		protected virtual void OnCapturerBinError (object o, ErrorArgs args)
+		{
+			MessagePopup.PopupMessage(this, MessageType.Info,
+			                          Catalog.GetString("An error occured in the video capturer and the current project will be closed:")+"\n" +args.Message);
+			CloseOpenedProject(true);
+		}
+		#endregion	
+	}
 }
diff --git a/LongoMatch/Gui/Popup/CalendarPopup.cs b/LongoMatch/Gui/Popup/CalendarPopup.cs
index 9908850..240d9a4 100644
--- a/LongoMatch/Gui/Popup/CalendarPopup.cs
+++ b/LongoMatch/Gui/Popup/CalendarPopup.cs
@@ -1,36 +1,36 @@
-// CalendarPopup.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using LongoMatch.Handlers;
-
-namespace LongoMatch.Gui.Popup
-{
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(false)]
-	public partial class CalendarPopup : Gtk.Window
-	{
-
-		public event DateSelectedHandler DateSelectedEvent;
-		private DateTime selectedDate;
+// CalendarPopup.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.Handlers;
+
+namespace LongoMatch.Gui.Popup
+{
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(false)]
+	public partial class CalendarPopup : Gtk.Window
+	{
+
+		public event DateSelectedHandler DateSelectedEvent;
+		private DateTime selectedDate;
 
 
 		public CalendarPopup() :
diff --git a/LongoMatch/Gui/TreeView/PlayListTreeView.cs b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
index 35d78cb..4c327ed 100644
--- a/LongoMatch/Gui/TreeView/PlayListTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
@@ -1,158 +1,158 @@
-// PlayListTreeView.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-using System;
-using Gtk;
-using Gdk;
-using Mono.Unix;
-using LongoMatch.Store;
-using LongoMatch.Playlist;
-using LongoMatch.Handlers;
-using LongoMatch.Gui.Dialog;
-
-namespace LongoMatch.Gui.Component
-{
-
-
-	[System.ComponentModel.Category("LongoMatch")]
-	[System.ComponentModel.ToolboxItem(true)]
-	public class PlayListTreeView : Gtk.TreeView
-	{
-		private Menu menu;
-		private MenuItem setRate;
-		private ListStore ls;
-		private PlayList playlist;
-		private PlayListPlay loadedTimeNode = null; //The play currently loaded in the player
-		private PlayListPlay selectedTimeNode = null; //The play selected in the tree
-		private TreeIter selectedIter;
-
-		public event ApplyCurrentRateHandler ApplyCurrentRate;
-
-
-		public PlayListTreeView() {
-
-			this.HeadersVisible = false;
-
-			ls = new ListStore(typeof(PlayListPlay));
-			this.Model = ls;
-
-			menu = new Menu();
-			MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
-			title.Activated += new EventHandler(OnTitle);
-			title.Show();
-			MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
-			delete.Activated += new EventHandler(OnDelete);
-			delete.Show();
-			setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
-			setRate.Activated += new EventHandler(OnApplyRate);
-			setRate.Show();
-			menu.Append(title);
-			menu.Append(setRate);
-			menu.Append(delete);
-
-
-			Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
-			nameColumn.Title = Catalog.GetString("Name");
-			Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
-			nameColumn.PackStart(nameCell, true);
-			nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
-			this.AppendColumn(nameColumn);
-		}
-
-		public PlayList PlayList {
-			set {
-				this.playlist = value;
-			}
-		}
-
-		public PlayListPlay LoadedPlay {
-			set {
-				loadedTimeNode = value;
-				this.QueueDraw();
-			}
-		}
-
-		~PlayListTreeView()
-		{
-		}
-
-
-		protected override bool OnButtonPressEvent(EventButton evnt)
-		{
-			if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
-			{
-				TreePath path;
-				GetPathAtPos((int)evnt.X,(int)evnt.Y,out path);
-				if (path!=null) {
-					ListStore list = ((ListStore)Model);
-					Model.GetIter(out selectedIter,path);
-					selectedTimeNode = (PlayListPlay)(list.GetValue(selectedIter,0));
-					setRate.Sensitive = selectedTimeNode == loadedTimeNode;
-					menu.Popup();
-				}
-			}
-			return base.OnButtonPressEvent(evnt);
-		}
-
-		protected void OnTitle(object o, EventArgs args) {
-			EntryDialog ed = new EntryDialog();
-			ed.Title = Catalog.GetString("Edit Title");
-			ed.Text = selectedTimeNode.Name;
-			if (ed.Run() == (int)ResponseType.Ok) {
-				selectedTimeNode.Name = ed.Text;
-				this.QueueDraw();
-			}
-			ed.Destroy();
-		}
-
-		protected void OnDelete(object obj, EventArgs args) {
-			ListStore list = ((ListStore)Model);
-			playlist.Remove(selectedTimeNode);
-			list.Remove(ref selectedIter);
-		}
-
-		protected void OnApplyRate(object obj, EventArgs args) {
-			if (ApplyCurrentRate != null)
-				ApplyCurrentRate(selectedTimeNode);
-		}
-
-		private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
-		{
-			PlayListPlay tNode = (PlayListPlay) model.GetValue(iter, 0);
-			(cell as Gtk.CellRendererText).Text = 	Catalog.GetString("Title")+": "+tNode.Name +"\n"+
-			                                       Catalog.GetString("Start")+": "+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
-			                                       Catalog.GetString("Duration")+": "+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
-			                                       Catalog.GetString("Play Rate")+": "+tNode.Rate.ToString();
-			if (!tNode.Valid) {
-				(cell as Gtk.CellRendererText).Foreground = "red";
-				(cell as Gtk.CellRendererText).Text += "\n"+Catalog.GetString("File not found")+": "+tNode.MediaFile.FilePath;
-			}
-			else if (tNode == loadedTimeNode)
-				(cell as Gtk.CellRendererText).Foreground = "blue";
-			else
-				(cell as Gtk.CellRendererText).Foreground = "black";
-
-		}
-
-		protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
-		{
-			return false;
-		}		
-	}
-}
+// PlayListTreeView.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+using System;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+using LongoMatch.Store;
+using LongoMatch.Playlist;
+using LongoMatch.Handlers;
+using LongoMatch.Gui.Dialog;
+
+namespace LongoMatch.Gui.Component
+{
+
+
+	[System.ComponentModel.Category("LongoMatch")]
+	[System.ComponentModel.ToolboxItem(true)]
+	public class PlayListTreeView : Gtk.TreeView
+	{
+		private Menu menu;
+		private MenuItem setRate;
+		private ListStore ls;
+		private PlayList playlist;
+		private PlayListPlay loadedTimeNode = null; //The play currently loaded in the player
+		private PlayListPlay selectedTimeNode = null; //The play selected in the tree
+		private TreeIter selectedIter;
+
+		public event ApplyCurrentRateHandler ApplyCurrentRate;
+
+
+		public PlayListTreeView() {
+
+			this.HeadersVisible = false;
+
+			ls = new ListStore(typeof(PlayListPlay));
+			this.Model = ls;
+
+			menu = new Menu();
+			MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
+			title.Activated += new EventHandler(OnTitle);
+			title.Show();
+			MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
+			delete.Activated += new EventHandler(OnDelete);
+			delete.Show();
+			setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
+			setRate.Activated += new EventHandler(OnApplyRate);
+			setRate.Show();
+			menu.Append(title);
+			menu.Append(setRate);
+			menu.Append(delete);
+
+
+			Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
+			nameColumn.Title = Catalog.GetString("Name");
+			Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
+			nameColumn.PackStart(nameCell, true);
+			nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
+			this.AppendColumn(nameColumn);
+		}
+
+		public PlayList PlayList {
+			set {
+				this.playlist = value;
+			}
+		}
+
+		public PlayListPlay LoadedPlay {
+			set {
+				loadedTimeNode = value;
+				this.QueueDraw();
+			}
+		}
+
+		~PlayListTreeView()
+		{
+		}
+
+
+		protected override bool OnButtonPressEvent(EventButton evnt)
+		{
+			if ((evnt.Type == EventType.ButtonPress) && (evnt.Button == 3))
+			{
+				TreePath path;
+				GetPathAtPos((int)evnt.X,(int)evnt.Y,out path);
+				if (path!=null) {
+					ListStore list = ((ListStore)Model);
+					Model.GetIter(out selectedIter,path);
+					selectedTimeNode = (PlayListPlay)(list.GetValue(selectedIter,0));
+					setRate.Sensitive = selectedTimeNode == loadedTimeNode;
+					menu.Popup();
+				}
+			}
+			return base.OnButtonPressEvent(evnt);
+		}
+
+		protected void OnTitle(object o, EventArgs args) {
+			EntryDialog ed = new EntryDialog();
+			ed.Title = Catalog.GetString("Edit Title");
+			ed.Text = selectedTimeNode.Name;
+			if (ed.Run() == (int)ResponseType.Ok) {
+				selectedTimeNode.Name = ed.Text;
+				this.QueueDraw();
+			}
+			ed.Destroy();
+		}
+
+		protected void OnDelete(object obj, EventArgs args) {
+			ListStore list = ((ListStore)Model);
+			playlist.Remove(selectedTimeNode);
+			list.Remove(ref selectedIter);
+		}
+
+		protected void OnApplyRate(object obj, EventArgs args) {
+			if (ApplyCurrentRate != null)
+				ApplyCurrentRate(selectedTimeNode);
+		}
+
+		private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+		{
+			PlayListPlay tNode = (PlayListPlay) model.GetValue(iter, 0);
+			(cell as Gtk.CellRendererText).Text = 	Catalog.GetString("Title")+": "+tNode.Name +"\n"+
+			                                       Catalog.GetString("Start")+": "+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
+			                                       Catalog.GetString("Duration")+": "+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
+			                                       Catalog.GetString("Play Rate")+": "+tNode.Rate.ToString();
+			if (!tNode.Valid) {
+				(cell as Gtk.CellRendererText).Foreground = "red";
+				(cell as Gtk.CellRendererText).Text += "\n"+Catalog.GetString("File not found")+": "+tNode.MediaFile.FilePath;
+			}
+			else if (tNode == loadedTimeNode)
+				(cell as Gtk.CellRendererText).Foreground = "blue";
+			else
+				(cell as Gtk.CellRendererText).Foreground = "black";
+
+		}
+
+		protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+		{
+			return false;
+		}		
+	}
+}
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index 1e57a56..4b5c720 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -1,478 +1,478 @@
-// EventsManager.cs
-//
-//  Copyright (C2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System.Collections.Generic;
-using Gdk;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Gui;
-using LongoMatch.Gui.Component;
-using LongoMatch.Gui.Dialog;
-using LongoMatch.Handlers;
-using LongoMatch.Store;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Editor;
-using LongoMatch.Video.Utils;
-using Mono.Unix;
-
-namespace LongoMatch
-{
-
-
-	public class EventsManager
-	{
-
-		private PlaysListTreeWidget treewidget;
-		private PlayersListTreeWidget localPlayersList,visitorPlayersList;
-		private TagsTreeWidget tagsTreeWidget;
-		private ButtonsWidget buttonswidget;
-		private PlayListWidget playlist;
-		private PlayerBin player;
-		private CapturerBin capturer;
-		private TimeLineWidget timeline;
-		private ProgressBar videoprogressbar;
-		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;
-		// current proyect in use
-		private Project openedProject;
-		private ProjectType projectType;
-		private Time startTime;
-
-		public EventsManager(PlaysListTreeWidget treewidget, PlayersListTreeWidget localPlayersList, 
-		                     PlayersListTreeWidget visitorPlayersList, TagsTreeWidget tagsTreeWidget,
-		                     ButtonsWidget buttonswidget, PlayListWidget playlist, PlayerBin player, 
-		                     TimeLineWidget timeline, ProgressBar videoprogressbar,NotesWidget notes,
-		                     CapturerBin capturer)
-		{
-			this.treewidget = treewidget;
-			this.localPlayersList = localPlayersList;
-			this.visitorPlayersList = visitorPlayersList;
-			this.tagsTreeWidget = tagsTreeWidget;
-			this.buttonswidget = buttonswidget;
-			this.playlist = playlist;
-			this.player = player;
-			this.timeline = timeline;
-			this.videoprogressbar = videoprogressbar;
-			this.notes = notes;
-			this.capturer = capturer;
-			this.drawingManager = new VideoDrawingsManager(player);
-
-			ConnectSignals();
-		}
-
-		public  Project OpenedProject {
-			set {
-				openedProject = value;
-			}
-		}
-		
-		public ProjectType OpenedProjectType{
-			set {
-				projectType = value;
-			}
-		}
-
-		private void ConnectSignals() {
-			/* Adding Handlers for each event */
-
-			/* Connect new mark event */
-			buttonswidget.NewMarkEvent += OnNewMark;
-			buttonswidget.NewMarkStartEvent += OnNewMarkStart;
-			buttonswidget.NewMarkStopEvent += OnNewMarkStop;
-			
-			/* Connect TimeNodeChanged events */
-			treewidget.TimeNodeChanged += OnTimeNodeChanged;
-			localPlayersList.TimeNodeChanged += OnTimeNodeChanged;
-			visitorPlayersList.TimeNodeChanged += OnTimeNodeChanged;
-			tagsTreeWidget.TimeNodeChanged += OnTimeNodeChanged;
-			timeline.TimeNodeChanged += OnTimeNodeChanged;
-			notes.TimeNodeChanged += OnTimeNodeChanged;
-
-			/* Connect TimeNodeDeleted events */
-			treewidget.TimeNodeDeleted += OnTimeNodeDeleted;
-			timeline.TimeNodeDeleted += OnTimeNodeDeleted;
-
-			/* Connect TimeNodeSelected events */
-			treewidget.TimeNodeSelected += OnTimeNodeSelected;
-			localPlayersList.TimeNodeSelected += OnTimeNodeSelected;
-			visitorPlayersList.TimeNodeSelected += OnTimeNodeSelected;
-			tagsTreeWidget.TimeNodeSelected += OnTimeNodeSelected;
-			timeline.TimeNodeSelected += OnTimeNodeSelected;
-
-			/* Connect playlist events */
-			playlist.PlayListNodeSelected += OnPlayListNodeSelected;
-			playlist.Progress += OnProgress;
-			playlist.ApplyCurrentRate += OnApplyRate;
-
-			/* Connect PlayListNodeAdded events */
-			treewidget.PlayListNodeAdded += OnPlayListNodeAdded;
-			localPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
-			visitorPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
-			tagsTreeWidget.PlayListNodeAdded += OnPlayListNodeAdded;
-
-			/* Connect tags events */
-			treewidget.PlayersTagged += OnPlayersTagged;
-			treewidget.TagPlay += OnTagPlay;
-			
-			/* Connect SnapshotSeries events */
-			treewidget.SnapshotSeriesEvent += OnSnapshotSeries;
-			localPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
-			visitorPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
-			tagsTreeWidget.SnapshotSeriesEvent += OnSnapshotSeries;
-
-			/* Connect timeline events */
-			timeline.NewMarkEvent += OnNewMarkAtFrame;
-			
-			/* Connect player events */
-			player.Prev += OnPrev;
-			player.Next += OnNext;
-			player.Tick += OnTick;
-			player.SegmentClosedEvent += OnSegmentClosedEvent;
-			player.DrawFrame += OnDrawFrame;
-		}
-
-		private void ProcessNewMarkEvent(Category category,Time pos) {
-			Time length, startTime, stopTime, start, stop, fStart, fStop;	
-			
-			if (player == null || openedProject == null)
-				return;
-						
-			//Get the default lead and lag time for the section
-			startTime = category.Start;
-			stopTime = category.Stop;
-			// Calculating borders of the segment depnding
-			start = pos - startTime;
-			stop = pos + stopTime;
-			fStart = (start < new Time {MSeconds =0}) ? new Time {MSeconds = 0} : start;
-			
-			if (projectType == ProjectType.FakeCaptureProject || 
-			    projectType == ProjectType.CaptureProject){
-				fStop = stop;					
-			}
-			else {
-				length = new Time {MSeconds = (int)player.StreamLength};
-				fStop = (stop > length) ? length: stop;
-			}	
-			AddNewPlay(fStart, fStop, category);
-		}
-		
-		private void AddNewPlay(Time start, Time stop, Category category){
-			Pixbuf miniature;
-		
-			if (projectType == ProjectType.CaptureProject){
-				if (!capturer.Capturing){
-					MessagePopup.PopupMessage(capturer, MessageType.Info,
-					                          Catalog.GetString("You can't create a new play if the capturer "+
-					                                            "is not recording."));
-					return;
-				}
-				miniature = capturer.CurrentMiniatureFrame;
-			}
-			else if (projectType == ProjectType.FileProject)
-				miniature = player.CurrentMiniatureFrame;
-			else 
-				miniature = null;
-			var play = openedProject.AddPlay(category, start, stop,miniature);
-			treewidget.AddPlay(play);
-			tagsTreeWidget.AddPlay(play);
-			timeline.AddPlay(play);
-			timeline.QueueDraw();
-		}
-
-		protected virtual void OnProgress(float progress) {
-
-			if (progress > (float)EditorState.START && progress <= (float)EditorState.FINISHED && progress > videoprogressbar.Fraction) {
-				videoprogressbar.Fraction = progress;
-			}
-
-			if (progress == (float)EditorState.CANCELED) {
-				videoprogressbar.Hide();
-			}
-
-			else if (progress == (float)EditorState.START) {
-				videoprogressbar.Show();
-				videoprogressbar.Fraction = 0;
-				videoprogressbar.Text = "Creating new video";
-			}
-
-			else if (progress == (float)EditorState.FINISHED) {
-				MessagePopup.PopupMessage(player, MessageType.Info,  Catalog.GetString("The video edition has finished successfully."));
-				videoprogressbar.Hide();
-			}
-
-			else if (progress == (float)EditorState.ERROR) {
-				MessagePopup.PopupMessage(player, MessageType.Error,
-				                          Catalog.GetString("An error has occurred in the video editor.")
-				                          +Catalog.GetString("Please, try again."));
-				videoprogressbar.Hide();
-			}
-		}
-
-		protected virtual void OnNewMarkAtFrame(Category category, int frame) {
-			Time pos = new Time{ MSeconds = frame*1000/openedProject.Description.File.Fps};
-			player.CloseActualSegment();
-			player.SeekTo ((long)pos.MSeconds, true);
-			ProcessNewMarkEvent(category,pos);
-		}
-
-		public virtual void OnNewMark(Category category) {
-			Time pos;
-			
-			if (projectType == ProjectType.FakeCaptureProject || 
-			    projectType == ProjectType.CaptureProject)
-				pos =  new Time { MSeconds = (int)capturer.CurrentTime};
-			else 
-				pos = new Time {MSeconds = (int)player.CurrentTime};
-			ProcessNewMarkEvent(category,pos);
-		}
-		
-		public virtual void OnNewMarkStart(){
-			startTime = new Time {MSeconds = (int)player.CurrentTime};
-		}
-		
-		public virtual void OnNewMarkStop(Category category){
-			int diff;
-			Time stopTime = new Time {MSeconds = (int)player.CurrentTime};
-			
-			diff = stopTime.MSeconds - startTime.MSeconds;
-			
-			if (diff < 0){
-				MessagePopup.PopupMessage(buttonswidget, MessageType.Warning,
-				                          Catalog.GetString("The stop time is smaller than the start time. "+
-				                                            "The play will not be added."));
-				return;
-			}
-			if (diff < 500){
-				int correction = 500 - diff;
-				if (startTime.MSeconds - correction > 0)
-					startTime = startTime - correction;
-				else 
-					stopTime = stopTime + correction;			
-			} 
-			AddNewPlay(startTime, stopTime, category);		
-		}
-
-		protected virtual void OnTimeNodeSelected(Play tNode)
-		{
-			selectedTimeNode = tNode;
-			timeline.SelectedTimeNode = tNode;
-			player.SetStartStop(tNode.Start.MSeconds,tNode.Stop.MSeconds);
-			notes.Visible = true;
-			notes.Play= tNode;
-			drawingManager.Play=tNode;
-		}
-
-		protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
-		{
-			//Si hemos modificado el valor de un nodo de tiempo a través del
-			//widget de ajuste de tiempo posicionamos el reproductor en el punto
-			//
-			if (tNode is Play && val is Time) {
-				if (tNode != selectedTimeNode)
-					OnTimeNodeSelected((Play)tNode);
-				Time pos = (Time)val;
-				if (pos == tNode.Start) {
-					player.UpdateSegmentStartTime(pos.MSeconds);
-				}
-				else {
-					player.UpdateSegmentStopTime(pos.MSeconds);
-				}
-			}
-			else if (tNode is Category) {
-				buttonswidget.Categories = openedProject.Categories;
-			}
-		}
-
-		protected virtual void OnTimeNodeDeleted(List<Play> plays)
-		{
-			treewidget.RemovePlays(plays);
-			timeline.RemovePlays(plays);
-			tagsTreeWidget.RemovePlays(plays);
-
-			localPlayersList.RemovePlays(plays);
-			visitorPlayersList.RemovePlays(plays);
-
-			openedProject.RemovePlays(plays);
-			if (projectType == ProjectType.FileProject){
-				this.player.CloseActualSegment();
-				MainClass.DB.UpdateProject(openedProject);
-			}
-			timeline.QueueDraw();			
-		}
-
-		protected virtual void OnPlayListNodeAdded(Play play)
-		{
-			playlist.Add(new PlayListPlay{
-				MediaFile = openedProject.Description.File,
-				Start = play.Start,
-				Stop = play.Stop,
-				Name = play.Name,
-				Rate = 1.0f,
-			});
-		}
-
-		protected virtual void OnPlayListNodeSelected(PlayListPlay plNode, bool hasNext)
-		{
-			if (openedProject == null) {
-				if (plNode.Valid) {
-					player.SetPlayListElement(plNode.MediaFile.FilePath,plNode.Start.MSeconds,plNode.Stop.MSeconds,plNode.Rate,hasNext);
-					selectedTimeNode = plNode;
-				}
-			}
-			else {
-				MessagePopup.PopupMessage(playlist, MessageType.Error,
-				                          Catalog.GetString("Please, close the opened project to play the playlist."));
-				playlist.Stop();
-			}
-		}
-
-		protected virtual void OnPlayListSegmentDone()
-		{
-			playlist.Next();
-		}
-
-		protected virtual void OnSegmentClosedEvent()
-		{
-			selectedTimeNode = null;
-			timeline.SelectedTimeNode = null;
-			notes.Visible = false;
-		}
-
-		protected virtual void OnSnapshotSeries(Play tNode) {
-			SnapshotsDialog sd;
-			uint interval;
-			string seriesName;
-			string outDir;
-
-			player.Pause();
-
-			sd= new SnapshotsDialog();
-			sd.TransientFor= (Gtk.Window) treewidget.Toplevel;
-			sd.Play = tNode.Name;
-
-			if (sd.Run() == (int)ResponseType.Ok) {
-				sd.Destroy();
-				interval = sd.Interval;
-				seriesName = sd.SeriesName;
-				outDir = System.IO.Path.Combine(MainClass.SnapshotsDir(),seriesName);
-				fsc = new FramesSeriesCapturer(openedProject.Description.File.FilePath,
-				                               tNode.Start.MSeconds,tNode.Stop.MSeconds,
-				                               interval,outDir);
-				fcpd = new FramesCaptureProgressDialog(fsc);
-				fcpd.TransientFor=(Gtk.Window) treewidget.Toplevel;
-				fcpd.Run();
-				fcpd.Destroy();
-			}
-			else
-				sd.Destroy();
-		}
-
-		protected virtual void OnNext()
-		{
-			playlist.Next();
-		}
-
-		protected virtual void OnPrev()
-		{
-			if (selectedTimeNode is Play)
-				player.SeekInSegment(selectedTimeNode.Start.MSeconds);
-			else if (selectedTimeNode is PlayListPlay)
-				playlist.Prev();
-			else if (selectedTimeNode == null)
-				player.SeekTo(0,false);
-		}
-
-		protected virtual void OnTick(object o, TickArgs args)
-		{
-			if (args.CurrentTime != 0 && timeline != null && openedProject != null)
-				timeline.CurrentFrame=(uint)(args.CurrentTime * 
-				                             openedProject.Description.File.Fps / 1000);
-		}
-
-		protected virtual void OnTimeline2PositionChanged(Time pos)
-		{
-			player.SeekInSegment(pos.MSeconds);
-		}
-
-		protected virtual void OnApplyRate(PlayListPlay plNode) {
-			plNode.Rate = player.Rate;
-		}
-
-		protected virtual void OnDrawFrame(int time) {
-			Pixbuf pixbuf=null;
-			DrawingTool dialog = new DrawingTool();
-
-			player.Pause();
-			pixbuf = player.CurrentFrame;
-
-			dialog.Image = pixbuf;
-			dialog.TransientFor = (Gtk.Window)player.Toplevel;
-			if (selectedTimeNode != null)
-				dialog.SetPlay((selectedTimeNode as Play),
-				               time);
-			pixbuf.Dispose();
-			dialog.Run();
-			dialog.Destroy();
-		}
-		
-		protected virtual void OnTagPlay(Play tNode){
-			/*TaggerDialog tagger = new TaggerDialog();
-			tagger.ProjectTags = openedProject.Tags;
-			tagger.Tags = tNode.Tags;
-			tagger.TransientFor = (Gtk.Window)player.Toplevel;
-			tagger.Run();
-			tNode.Tags = tagger.Tags;
-			foreach (Tag tag in tagger.Tags){
-				openedProject.Tags.AddTag(tag);
-			}
-			tagsTreeWidget.UpdateTagsList();
-			tagger.Destroy();*/
-		}
-
-		protected virtual void OnPlayersTagged(Play tNode, Team team) {
-		/*
-			PlayersSelectionDialog dialog = new PlayersSelectionDialog();
-			if (team == Team.LOCAL) {
-				dialog.SetPlayersInfo(openedProject.LocalTeamTemplate);
-				dialog.PlayersChecked = tNode.LocalPlayers;
-				if (dialog.Run() == (int) ResponseType.Ok) {
-					tNode.LocalPlayers = dialog.PlayersChecked;
-					localPlayersList.UpdatePlaysList(openedProject.GetLocalTeamModel());
-				}
-			}
-
-			else if (team == Team.VISITOR) {
-				dialog.SetPlayersInfo(openedProject.VisitorTeamTemplate);
-				dialog.PlayersChecked = tNode.VisitorPlayers;
-				if (dialog.Run() == (int) ResponseType.Ok) {
-					tNode.VisitorPlayers = dialog.PlayersChecked;
-					visitorPlayersList.UpdatePlaysList(openedProject.GetVisitorTeamModel());
-				}
-			}
-			dialog.Destroy();
-			*/
-		}
-	}
-}
+// EventsManager.cs
+//
+//  Copyright (C2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System.Collections.Generic;
+using Gdk;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Gui;
+using LongoMatch.Gui.Component;
+using LongoMatch.Gui.Dialog;
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Video.Common;
+using LongoMatch.Video.Editor;
+using LongoMatch.Video.Utils;
+using Mono.Unix;
+
+namespace LongoMatch
+{
+
+
+	public class EventsManager
+	{
+
+		private PlaysListTreeWidget treewidget;
+		private PlayersListTreeWidget localPlayersList,visitorPlayersList;
+		private TagsTreeWidget tagsTreeWidget;
+		private ButtonsWidget buttonswidget;
+		private PlayListWidget playlist;
+		private PlayerBin player;
+		private CapturerBin capturer;
+		private TimeLineWidget timeline;
+		private ProgressBar videoprogressbar;
+		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;
+		// current proyect in use
+		private Project openedProject;
+		private ProjectType projectType;
+		private Time startTime;
+
+		public EventsManager(PlaysListTreeWidget treewidget, PlayersListTreeWidget localPlayersList, 
+		                     PlayersListTreeWidget visitorPlayersList, TagsTreeWidget tagsTreeWidget,
+		                     ButtonsWidget buttonswidget, PlayListWidget playlist, PlayerBin player, 
+		                     TimeLineWidget timeline, ProgressBar videoprogressbar,NotesWidget notes,
+		                     CapturerBin capturer)
+		{
+			this.treewidget = treewidget;
+			this.localPlayersList = localPlayersList;
+			this.visitorPlayersList = visitorPlayersList;
+			this.tagsTreeWidget = tagsTreeWidget;
+			this.buttonswidget = buttonswidget;
+			this.playlist = playlist;
+			this.player = player;
+			this.timeline = timeline;
+			this.videoprogressbar = videoprogressbar;
+			this.notes = notes;
+			this.capturer = capturer;
+			this.drawingManager = new VideoDrawingsManager(player);
+
+			ConnectSignals();
+		}
+
+		public  Project OpenedProject {
+			set {
+				openedProject = value;
+			}
+		}
+		
+		public ProjectType OpenedProjectType{
+			set {
+				projectType = value;
+			}
+		}
+
+		private void ConnectSignals() {
+			/* Adding Handlers for each event */
+
+			/* Connect new mark event */
+			buttonswidget.NewMarkEvent += OnNewMark;
+			buttonswidget.NewMarkStartEvent += OnNewMarkStart;
+			buttonswidget.NewMarkStopEvent += OnNewMarkStop;
+			
+			/* Connect TimeNodeChanged events */
+			treewidget.TimeNodeChanged += OnTimeNodeChanged;
+			localPlayersList.TimeNodeChanged += OnTimeNodeChanged;
+			visitorPlayersList.TimeNodeChanged += OnTimeNodeChanged;
+			tagsTreeWidget.TimeNodeChanged += OnTimeNodeChanged;
+			timeline.TimeNodeChanged += OnTimeNodeChanged;
+			notes.TimeNodeChanged += OnTimeNodeChanged;
+
+			/* Connect TimeNodeDeleted events */
+			treewidget.TimeNodeDeleted += OnTimeNodeDeleted;
+			timeline.TimeNodeDeleted += OnTimeNodeDeleted;
+
+			/* Connect TimeNodeSelected events */
+			treewidget.TimeNodeSelected += OnTimeNodeSelected;
+			localPlayersList.TimeNodeSelected += OnTimeNodeSelected;
+			visitorPlayersList.TimeNodeSelected += OnTimeNodeSelected;
+			tagsTreeWidget.TimeNodeSelected += OnTimeNodeSelected;
+			timeline.TimeNodeSelected += OnTimeNodeSelected;
+
+			/* Connect playlist events */
+			playlist.PlayListNodeSelected += OnPlayListNodeSelected;
+			playlist.Progress += OnProgress;
+			playlist.ApplyCurrentRate += OnApplyRate;
+
+			/* Connect PlayListNodeAdded events */
+			treewidget.PlayListNodeAdded += OnPlayListNodeAdded;
+			localPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
+			visitorPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
+			tagsTreeWidget.PlayListNodeAdded += OnPlayListNodeAdded;
+
+			/* Connect tags events */
+			treewidget.PlayersTagged += OnPlayersTagged;
+			treewidget.TagPlay += OnTagPlay;
+			
+			/* Connect SnapshotSeries events */
+			treewidget.SnapshotSeriesEvent += OnSnapshotSeries;
+			localPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
+			visitorPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
+			tagsTreeWidget.SnapshotSeriesEvent += OnSnapshotSeries;
+
+			/* Connect timeline events */
+			timeline.NewMarkEvent += OnNewMarkAtFrame;
+			
+			/* Connect player events */
+			player.Prev += OnPrev;
+			player.Next += OnNext;
+			player.Tick += OnTick;
+			player.SegmentClosedEvent += OnSegmentClosedEvent;
+			player.DrawFrame += OnDrawFrame;
+		}
+
+		private void ProcessNewMarkEvent(Category category,Time pos) {
+			Time length, startTime, stopTime, start, stop, fStart, fStop;	
+			
+			if (player == null || openedProject == null)
+				return;
+						
+			//Get the default lead and lag time for the section
+			startTime = category.Start;
+			stopTime = category.Stop;
+			// Calculating borders of the segment depnding
+			start = pos - startTime;
+			stop = pos + stopTime;
+			fStart = (start < new Time {MSeconds =0}) ? new Time {MSeconds = 0} : start;
+			
+			if (projectType == ProjectType.FakeCaptureProject || 
+			    projectType == ProjectType.CaptureProject){
+				fStop = stop;					
+			}
+			else {
+				length = new Time {MSeconds = (int)player.StreamLength};
+				fStop = (stop > length) ? length: stop;
+			}	
+			AddNewPlay(fStart, fStop, category);
+		}
+		
+		private void AddNewPlay(Time start, Time stop, Category category){
+			Pixbuf miniature;
+		
+			if (projectType == ProjectType.CaptureProject){
+				if (!capturer.Capturing){
+					MessagePopup.PopupMessage(capturer, MessageType.Info,
+					                          Catalog.GetString("You can't create a new play if the capturer "+
+					                                            "is not recording."));
+					return;
+				}
+				miniature = capturer.CurrentMiniatureFrame;
+			}
+			else if (projectType == ProjectType.FileProject)
+				miniature = player.CurrentMiniatureFrame;
+			else 
+				miniature = null;
+			var play = openedProject.AddPlay(category, start, stop,miniature);
+			treewidget.AddPlay(play);
+			tagsTreeWidget.AddPlay(play);
+			timeline.AddPlay(play);
+			timeline.QueueDraw();
+		}
+
+		protected virtual void OnProgress(float progress) {
+
+			if (progress > (float)EditorState.START && progress <= (float)EditorState.FINISHED && progress > videoprogressbar.Fraction) {
+				videoprogressbar.Fraction = progress;
+			}
+
+			if (progress == (float)EditorState.CANCELED) {
+				videoprogressbar.Hide();
+			}
+
+			else if (progress == (float)EditorState.START) {
+				videoprogressbar.Show();
+				videoprogressbar.Fraction = 0;
+				videoprogressbar.Text = "Creating new video";
+			}
+
+			else if (progress == (float)EditorState.FINISHED) {
+				MessagePopup.PopupMessage(player, MessageType.Info,  Catalog.GetString("The video edition has finished successfully."));
+				videoprogressbar.Hide();
+			}
+
+			else if (progress == (float)EditorState.ERROR) {
+				MessagePopup.PopupMessage(player, MessageType.Error,
+				                          Catalog.GetString("An error has occurred in the video editor.")
+				                          +Catalog.GetString("Please, try again."));
+				videoprogressbar.Hide();
+			}
+		}
+
+		protected virtual void OnNewMarkAtFrame(Category category, int frame) {
+			Time pos = new Time{ MSeconds = frame*1000/openedProject.Description.File.Fps};
+			player.CloseActualSegment();
+			player.SeekTo ((long)pos.MSeconds, true);
+			ProcessNewMarkEvent(category,pos);
+		}
+
+		public virtual void OnNewMark(Category category) {
+			Time pos;
+			
+			if (projectType == ProjectType.FakeCaptureProject || 
+			    projectType == ProjectType.CaptureProject)
+				pos =  new Time { MSeconds = (int)capturer.CurrentTime};
+			else 
+				pos = new Time {MSeconds = (int)player.CurrentTime};
+			ProcessNewMarkEvent(category,pos);
+		}
+		
+		public virtual void OnNewMarkStart(){
+			startTime = new Time {MSeconds = (int)player.CurrentTime};
+		}
+		
+		public virtual void OnNewMarkStop(Category category){
+			int diff;
+			Time stopTime = new Time {MSeconds = (int)player.CurrentTime};
+			
+			diff = stopTime.MSeconds - startTime.MSeconds;
+			
+			if (diff < 0){
+				MessagePopup.PopupMessage(buttonswidget, MessageType.Warning,
+				                          Catalog.GetString("The stop time is smaller than the start time. "+
+				                                            "The play will not be added."));
+				return;
+			}
+			if (diff < 500){
+				int correction = 500 - diff;
+				if (startTime.MSeconds - correction > 0)
+					startTime = startTime - correction;
+				else 
+					stopTime = stopTime + correction;			
+			} 
+			AddNewPlay(startTime, stopTime, category);		
+		}
+
+		protected virtual void OnTimeNodeSelected(Play tNode)
+		{
+			selectedTimeNode = tNode;
+			timeline.SelectedTimeNode = tNode;
+			player.SetStartStop(tNode.Start.MSeconds,tNode.Stop.MSeconds);
+			notes.Visible = true;
+			notes.Play= tNode;
+			drawingManager.Play=tNode;
+		}
+
+		protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
+		{
+			//Si hemos modificado el valor de un nodo de tiempo a través del
+			//widget de ajuste de tiempo posicionamos el reproductor en el punto
+			//
+			if (tNode is Play && val is Time) {
+				if (tNode != selectedTimeNode)
+					OnTimeNodeSelected((Play)tNode);
+				Time pos = (Time)val;
+				if (pos == tNode.Start) {
+					player.UpdateSegmentStartTime(pos.MSeconds);
+				}
+				else {
+					player.UpdateSegmentStopTime(pos.MSeconds);
+				}
+			}
+			else if (tNode is Category) {
+				buttonswidget.Categories = openedProject.Categories;
+			}
+		}
+
+		protected virtual void OnTimeNodeDeleted(List<Play> plays)
+		{
+			treewidget.RemovePlays(plays);
+			timeline.RemovePlays(plays);
+			tagsTreeWidget.RemovePlays(plays);
+
+			localPlayersList.RemovePlays(plays);
+			visitorPlayersList.RemovePlays(plays);
+
+			openedProject.RemovePlays(plays);
+			if (projectType == ProjectType.FileProject){
+				this.player.CloseActualSegment();
+				MainClass.DB.UpdateProject(openedProject);
+			}
+			timeline.QueueDraw();			
+		}
+
+		protected virtual void OnPlayListNodeAdded(Play play)
+		{
+			playlist.Add(new PlayListPlay{
+				MediaFile = openedProject.Description.File,
+				Start = play.Start,
+				Stop = play.Stop,
+				Name = play.Name,
+				Rate = 1.0f,
+			});
+		}
+
+		protected virtual void OnPlayListNodeSelected(PlayListPlay plNode, bool hasNext)
+		{
+			if (openedProject == null) {
+				if (plNode.Valid) {
+					player.SetPlayListElement(plNode.MediaFile.FilePath,plNode.Start.MSeconds,plNode.Stop.MSeconds,plNode.Rate,hasNext);
+					selectedTimeNode = plNode;
+				}
+			}
+			else {
+				MessagePopup.PopupMessage(playlist, MessageType.Error,
+				                          Catalog.GetString("Please, close the opened project to play the playlist."));
+				playlist.Stop();
+			}
+		}
+
+		protected virtual void OnPlayListSegmentDone()
+		{
+			playlist.Next();
+		}
+
+		protected virtual void OnSegmentClosedEvent()
+		{
+			selectedTimeNode = null;
+			timeline.SelectedTimeNode = null;
+			notes.Visible = false;
+		}
+
+		protected virtual void OnSnapshotSeries(Play tNode) {
+			SnapshotsDialog sd;
+			uint interval;
+			string seriesName;
+			string outDir;
+
+			player.Pause();
+
+			sd= new SnapshotsDialog();
+			sd.TransientFor= (Gtk.Window) treewidget.Toplevel;
+			sd.Play = tNode.Name;
+
+			if (sd.Run() == (int)ResponseType.Ok) {
+				sd.Destroy();
+				interval = sd.Interval;
+				seriesName = sd.SeriesName;
+				outDir = System.IO.Path.Combine(MainClass.SnapshotsDir(),seriesName);
+				fsc = new FramesSeriesCapturer(openedProject.Description.File.FilePath,
+				                               tNode.Start.MSeconds,tNode.Stop.MSeconds,
+				                               interval,outDir);
+				fcpd = new FramesCaptureProgressDialog(fsc);
+				fcpd.TransientFor=(Gtk.Window) treewidget.Toplevel;
+				fcpd.Run();
+				fcpd.Destroy();
+			}
+			else
+				sd.Destroy();
+		}
+
+		protected virtual void OnNext()
+		{
+			playlist.Next();
+		}
+
+		protected virtual void OnPrev()
+		{
+			if (selectedTimeNode is Play)
+				player.SeekInSegment(selectedTimeNode.Start.MSeconds);
+			else if (selectedTimeNode is PlayListPlay)
+				playlist.Prev();
+			else if (selectedTimeNode == null)
+				player.SeekTo(0,false);
+		}
+
+		protected virtual void OnTick(object o, TickArgs args)
+		{
+			if (args.CurrentTime != 0 && timeline != null && openedProject != null)
+				timeline.CurrentFrame=(uint)(args.CurrentTime * 
+				                             openedProject.Description.File.Fps / 1000);
+		}
+
+		protected virtual void OnTimeline2PositionChanged(Time pos)
+		{
+			player.SeekInSegment(pos.MSeconds);
+		}
+
+		protected virtual void OnApplyRate(PlayListPlay plNode) {
+			plNode.Rate = player.Rate;
+		}
+
+		protected virtual void OnDrawFrame(int time) {
+			Pixbuf pixbuf=null;
+			DrawingTool dialog = new DrawingTool();
+
+			player.Pause();
+			pixbuf = player.CurrentFrame;
+
+			dialog.Image = pixbuf;
+			dialog.TransientFor = (Gtk.Window)player.Toplevel;
+			if (selectedTimeNode != null)
+				dialog.SetPlay((selectedTimeNode as Play),
+				               time);
+			pixbuf.Dispose();
+			dialog.Run();
+			dialog.Destroy();
+		}
+		
+		protected virtual void OnTagPlay(Play tNode){
+			/*TaggerDialog tagger = new TaggerDialog();
+			tagger.ProjectTags = openedProject.Tags;
+			tagger.Tags = tNode.Tags;
+			tagger.TransientFor = (Gtk.Window)player.Toplevel;
+			tagger.Run();
+			tNode.Tags = tagger.Tags;
+			foreach (Tag tag in tagger.Tags){
+				openedProject.Tags.AddTag(tag);
+			}
+			tagsTreeWidget.UpdateTagsList();
+			tagger.Destroy();*/
+		}
+
+		protected virtual void OnPlayersTagged(Play tNode, Team team) {
+		/*
+			PlayersSelectionDialog dialog = new PlayersSelectionDialog();
+			if (team == Team.LOCAL) {
+				dialog.SetPlayersInfo(openedProject.LocalTeamTemplate);
+				dialog.PlayersChecked = tNode.LocalPlayers;
+				if (dialog.Run() == (int) ResponseType.Ok) {
+					tNode.LocalPlayers = dialog.PlayersChecked;
+					localPlayersList.UpdatePlaysList(openedProject.GetLocalTeamModel());
+				}
+			}
+
+			else if (team == Team.VISITOR) {
+				dialog.SetPlayersInfo(openedProject.VisitorTeamTemplate);
+				dialog.PlayersChecked = tNode.VisitorPlayers;
+				if (dialog.Run() == (int) ResponseType.Ok) {
+					tNode.VisitorPlayers = dialog.PlayersChecked;
+					visitorPlayersList.UpdatePlaysList(openedProject.GetVisitorTeamModel());
+				}
+			}
+			dialog.Destroy();
+			*/
+		}
+	}
+}
diff --git a/LongoMatch/IO/CSVExport.cs b/LongoMatch/IO/CSVExport.cs
index d1909f2..6856c67 100644
--- a/LongoMatch/IO/CSVExport.cs
+++ b/LongoMatch/IO/CSVExport.cs
@@ -1,184 +1,184 @@
-// CSVExport.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.IO;
-using System.Collections.Generic;
-using Gtk;
-using LongoMatch.DB;
-using LongoMatch.Store;
-using LongoMatch.Gui;
-using Mono.Unix;
-
-namespace LongoMatch.IO
-{
-
-
-	public class CSVExport
-	{
-		string outputFile;
-		Project project;
-
-		#region Constructors
-		public CSVExport(Project project,string outputFile)
-		{
-			this.project = project;
-			this.outputFile = outputFile;
-		}
-		#endregion
-
-		#region Public methods
-		public void WriteToFile() {
-			/*List<List<Play>> list;
-			Dictionary<Tag, List<Play>> tagsDic;
-			List<Player> localPlayersList;
-			List<Player> visitorPlayersList;
-			Dictionary<Player, List<object[]>> localPlayersDic;
-			Dictionary<Player, List<object[]>> visitorPlayersDic;
-
-			string[] sectionNames;
-			TextWriter tx;
-
-			tx = new StreamWriter(outputFile);
-			list = project.GetDataArray();
-			sectionNames = project.GetSectionsNames();
-			
-			tagsDic = new Dictionary<Tag, List<Play>>();
-			foreach (Tag tag in project.Tags)
-				tagsDic.Add(tag, new List<Play>());
-			
-			localPlayersList = project.LocalTeamTemplate.GetPlayersList();
-			localPlayersDic = new Dictionary<Player, List<object[]>>();
-			foreach (Player player in localPlayersList)
-				localPlayersDic.Add(player, new List<object[]>());
-			
-			visitorPlayersList =  project.VisitorTeamTemplate.GetPlayersList();
-			visitorPlayersDic = new Dictionary<Player, List<object[]>>();
-			foreach (Player player in visitorPlayersList)
-				visitorPlayersDic.Add(player, new List<object[]>());
-				
-
-			// Write catagories table
-			tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5}",
-			             Catalog.GetString("Section"),
-			             Catalog.GetString("Name"),
-			             Catalog.GetString("Team"),
-			             Catalog.GetString("StartTime"),
-			             Catalog.GetString("StopTime"),
-			             Catalog.GetString("Duration")));
-			for (int i=0; i<list.Count; i++) {
-				string sectionName = sectionNames[i];
-				foreach (Play tn in list[i]) {
-					// Parse Play's tags
-					foreach (Tag t in tn.Tags)
-						tagsDic[t].Add(tn);
-					
-					// Parse Players data
-					foreach (int playerNumber in tn.LocalPlayers){
-						object[] o = new object[2];
-						o[0] = sectionName;
-						o[1] = tn;
-						localPlayersDic[localPlayersList[playerNumber]].Add(o);
-					}					
-					foreach (int playerNumber in tn.VisitorPlayers){
-						object[] o = new object[2];
-						o[0] = sectionName;
-						o[1] = tn;
-						visitorPlayersDic[visitorPlayersList[playerNumber]].Add(o);
-					}
-					
-					tx.WriteLine("\""+sectionName+"\";\""+
-					             tn.Name+"\";\""+
-					             tn.Team+"\";\""+
-					             tn.Start.ToMSecondsString()+"\";\""+
-					             tn.Stop.ToMSecondsString()+"\";\""+
-					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
-				}
-			}
-			tx.WriteLine();
-			tx.WriteLine();			
-			
-			WriteCatagoriesData(tx, tagsDic);
-			
-			// Write local players data
-			WritePlayersData(tx, localPlayersDic);
-			WritePlayersData(tx, visitorPlayersDic);
-			
-			tx.Close();
-			
-			MessagePopup.PopupMessage(null, MessageType.Info, Catalog.GetString("CSV exported successfully."));	*/		
-		}
-		#endregion
-		
-		#region Private Methods
-		
-		private void WriteCatagoriesData(TextWriter tx, Dictionary<Tag, List<Play>> tagsDic){
-			// Write Tags table
-			tx.WriteLine(String.Format("{0};{1};{2};{3};{4}",
-			             Catalog.GetString("Tag"),
-			             Catalog.GetString("Name"),
-			             Catalog.GetString("StartTime"),
-			             Catalog.GetString("StopTime"),
-			             Catalog.GetString("Duration")));
-			foreach (KeyValuePair<Tag,List<Play>> pair in tagsDic){
-				if (pair.Value.Count == 0)
-					continue;				
-				foreach (Play tn in pair.Value) {
-					tx.WriteLine("\""+pair.Key.Value+"\";\""+
-					             tn.Name+"\";\""+
-					             tn.Start.ToMSecondsString()+"\";\""+
-					             tn.Stop.ToMSecondsString()+"\";\""+
-					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
-				}				
-			}
-			tx.WriteLine();
-			tx.WriteLine();			
-		}
-		
-		private void WritePlayersData(TextWriter tx, Dictionary<Player, List<object[]>> playersDic){
-			// Write Tags table
-			tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5};{6}",
-			                           Catalog.GetString("Player"),
-			                           Catalog.GetString("Category"),
-			                           Catalog.GetString("Name"),
-			                           Catalog.GetString("Team"),
-			                           Catalog.GetString("StartTime"),
-			                           Catalog.GetString("StopTime"),
-			                           Catalog.GetString("Duration")));
-			foreach (KeyValuePair<Player,List<object[]>> pair in playersDic){
-				if (pair.Value.Count == 0)
-					continue;			
-				foreach (object[] o in pair.Value) {
-					string sectionName = (string)o[0];
-					Play tn = (Play)o[1];
-					tx.WriteLine("\""+pair.Key.Name+"\";\""+
-					             sectionName+"\";\""+
-					             tn.Name+"\";\""+
-					             tn.Start.ToMSecondsString()+"\";\""+
-					             tn.Stop.ToMSecondsString()+"\";\""+
-					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
-				}				
-			}
-			tx.WriteLine();
-			tx.WriteLine();			
-		}
-		#endregion
-	}
-}
+// CSVExport.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using Gtk;
+using LongoMatch.DB;
+using LongoMatch.Store;
+using LongoMatch.Gui;
+using Mono.Unix;
+
+namespace LongoMatch.IO
+{
+
+
+	public class CSVExport
+	{
+		string outputFile;
+		Project project;
+
+		#region Constructors
+		public CSVExport(Project project,string outputFile)
+		{
+			this.project = project;
+			this.outputFile = outputFile;
+		}
+		#endregion
+
+		#region Public methods
+		public void WriteToFile() {
+			/*List<List<Play>> list;
+			Dictionary<Tag, List<Play>> tagsDic;
+			List<Player> localPlayersList;
+			List<Player> visitorPlayersList;
+			Dictionary<Player, List<object[]>> localPlayersDic;
+			Dictionary<Player, List<object[]>> visitorPlayersDic;
+
+			string[] sectionNames;
+			TextWriter tx;
+
+			tx = new StreamWriter(outputFile);
+			list = project.GetDataArray();
+			sectionNames = project.GetSectionsNames();
+			
+			tagsDic = new Dictionary<Tag, List<Play>>();
+			foreach (Tag tag in project.Tags)
+				tagsDic.Add(tag, new List<Play>());
+			
+			localPlayersList = project.LocalTeamTemplate.GetPlayersList();
+			localPlayersDic = new Dictionary<Player, List<object[]>>();
+			foreach (Player player in localPlayersList)
+				localPlayersDic.Add(player, new List<object[]>());
+			
+			visitorPlayersList =  project.VisitorTeamTemplate.GetPlayersList();
+			visitorPlayersDic = new Dictionary<Player, List<object[]>>();
+			foreach (Player player in visitorPlayersList)
+				visitorPlayersDic.Add(player, new List<object[]>());
+				
+
+			// Write catagories table
+			tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5}",
+			             Catalog.GetString("Section"),
+			             Catalog.GetString("Name"),
+			             Catalog.GetString("Team"),
+			             Catalog.GetString("StartTime"),
+			             Catalog.GetString("StopTime"),
+			             Catalog.GetString("Duration")));
+			for (int i=0; i<list.Count; i++) {
+				string sectionName = sectionNames[i];
+				foreach (Play tn in list[i]) {
+					// Parse Play's tags
+					foreach (Tag t in tn.Tags)
+						tagsDic[t].Add(tn);
+					
+					// Parse Players data
+					foreach (int playerNumber in tn.LocalPlayers){
+						object[] o = new object[2];
+						o[0] = sectionName;
+						o[1] = tn;
+						localPlayersDic[localPlayersList[playerNumber]].Add(o);
+					}					
+					foreach (int playerNumber in tn.VisitorPlayers){
+						object[] o = new object[2];
+						o[0] = sectionName;
+						o[1] = tn;
+						visitorPlayersDic[visitorPlayersList[playerNumber]].Add(o);
+					}
+					
+					tx.WriteLine("\""+sectionName+"\";\""+
+					             tn.Name+"\";\""+
+					             tn.Team+"\";\""+
+					             tn.Start.ToMSecondsString()+"\";\""+
+					             tn.Stop.ToMSecondsString()+"\";\""+
+					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
+				}
+			}
+			tx.WriteLine();
+			tx.WriteLine();			
+			
+			WriteCatagoriesData(tx, tagsDic);
+			
+			// Write local players data
+			WritePlayersData(tx, localPlayersDic);
+			WritePlayersData(tx, visitorPlayersDic);
+			
+			tx.Close();
+			
+			MessagePopup.PopupMessage(null, MessageType.Info, Catalog.GetString("CSV exported successfully."));	*/		
+		}
+		#endregion
+		
+		#region Private Methods
+		
+		private void WriteCatagoriesData(TextWriter tx, Dictionary<Tag, List<Play>> tagsDic){
+			// Write Tags table
+			tx.WriteLine(String.Format("{0};{1};{2};{3};{4}",
+			             Catalog.GetString("Tag"),
+			             Catalog.GetString("Name"),
+			             Catalog.GetString("StartTime"),
+			             Catalog.GetString("StopTime"),
+			             Catalog.GetString("Duration")));
+			foreach (KeyValuePair<Tag,List<Play>> pair in tagsDic){
+				if (pair.Value.Count == 0)
+					continue;				
+				foreach (Play tn in pair.Value) {
+					tx.WriteLine("\""+pair.Key.Value+"\";\""+
+					             tn.Name+"\";\""+
+					             tn.Start.ToMSecondsString()+"\";\""+
+					             tn.Stop.ToMSecondsString()+"\";\""+
+					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
+				}				
+			}
+			tx.WriteLine();
+			tx.WriteLine();			
+		}
+		
+		private void WritePlayersData(TextWriter tx, Dictionary<Player, List<object[]>> playersDic){
+			// Write Tags table
+			tx.WriteLine(String.Format("{0};{1};{2};{3};{4};{5};{6}",
+			                           Catalog.GetString("Player"),
+			                           Catalog.GetString("Category"),
+			                           Catalog.GetString("Name"),
+			                           Catalog.GetString("Team"),
+			                           Catalog.GetString("StartTime"),
+			                           Catalog.GetString("StopTime"),
+			                           Catalog.GetString("Duration")));
+			foreach (KeyValuePair<Player,List<object[]>> pair in playersDic){
+				if (pair.Value.Count == 0)
+					continue;			
+				foreach (object[] o in pair.Value) {
+					string sectionName = (string)o[0];
+					Play tn = (Play)o[1];
+					tx.WriteLine("\""+pair.Key.Name+"\";\""+
+					             sectionName+"\";\""+
+					             tn.Name+"\";\""+
+					             tn.Start.ToMSecondsString()+"\";\""+
+					             tn.Stop.ToMSecondsString()+"\";\""+
+					             (tn.Stop-tn.Start).ToMSecondsString()+"\"");
+				}				
+			}
+			tx.WriteLine();
+			tx.WriteLine();			
+		}
+		#endregion
+	}
+}
diff --git a/LongoMatch/IO/XMLReader.cs b/LongoMatch/IO/XMLReader.cs
index 9d06664..fd5ab4e 100644
--- a/LongoMatch/IO/XMLReader.cs
+++ b/LongoMatch/IO/XMLReader.cs
@@ -1,88 +1,88 @@
-// XMLReader.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.IO;
-using System.Xml;
-
-namespace LongoMatch.IO
-{
-
-
-	public class XMLReader
-	{
-		private XmlDocument configXml;
-
-		#region Constructors
-		public XMLReader(string filePath)
-		{
-			configXml = new XmlDocument();
-			if (!File.Exists(filePath)) {
-				//manejar el error!!!
-			}
-
-			configXml.Load(filePath);
-		}
-		#endregion
-		#region Public methods
-
-		public string GetStringValue(string section, string clave)
-		{
-			XmlNode n;
-			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
-			if (n!=null)
-				return (string)(n.Attributes["value"].Value);
-			else return null;
-		}
-
-		public int GetIntValue(string section, string clave)
-		{
-			XmlNode n;
-			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
-			if (n != null) {
-				object result = n.Attributes["value"].Value;
-				return int.Parse(result.ToString());
-			}
-			else return -1;
-
-		}
-		public bool GetBoolValue(string section, string clave) {
-			XmlNode n;
-			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
-
-			if (n != null) {
-				object result = n.Attributes["value"].Value;
-
-				return bool.Parse(result.ToString());
-			}
-			else return false;
-		}
-		public ushort GetUShortValue(string section, string clave) {
-			XmlNode n;
-			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
-			if (n != null) {
-				object result = n.Attributes["value"].Value;
-				return ushort.Parse(result.ToString());
-			}
-			else return 254;
-		}
-		#endregion
-	}
-}
+// XMLReader.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.IO;
+using System.Xml;
+
+namespace LongoMatch.IO
+{
+
+
+	public class XMLReader
+	{
+		private XmlDocument configXml;
+
+		#region Constructors
+		public XMLReader(string filePath)
+		{
+			configXml = new XmlDocument();
+			if (!File.Exists(filePath)) {
+				//manejar el error!!!
+			}
+
+			configXml.Load(filePath);
+		}
+		#endregion
+		#region Public methods
+
+		public string GetStringValue(string section, string clave)
+		{
+			XmlNode n;
+			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
+			if (n!=null)
+				return (string)(n.Attributes["value"].Value);
+			else return null;
+		}
+
+		public int GetIntValue(string section, string clave)
+		{
+			XmlNode n;
+			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
+			if (n != null) {
+				object result = n.Attributes["value"].Value;
+				return int.Parse(result.ToString());
+			}
+			else return -1;
+
+		}
+		public bool GetBoolValue(string section, string clave) {
+			XmlNode n;
+			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
+
+			if (n != null) {
+				object result = n.Attributes["value"].Value;
+
+				return bool.Parse(result.ToString());
+			}
+			else return false;
+		}
+		public ushort GetUShortValue(string section, string clave) {
+			XmlNode n;
+			n = configXml.SelectSingleNode(section + "/add[ key=\"" + clave + "\"]");
+			if (n != null) {
+				object result = n.Attributes["value"].Value;
+				return ushort.Parse(result.ToString());
+			}
+			else return 254;
+		}
+		#endregion
+	}
+}
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 0b0f1ed..18f3099 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -1,251 +1,251 @@
-// Main.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-
-using System;
-using System.IO;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.DB;
-using LongoMatch.Gui;
-using LongoMatch.IO;
-using LongoMatch.Store.Templates;
-using Mono.Unix;
-
-namespace LongoMatch
-
-{
-
-	class MainClass
-	{
-		private static DataBase db;
-		private static string baseDirectory;
-		private static string homeDirectory;
-		private static string configDirectory;
-		private const string WIN32_CONFIG_FILE = "longomatch.conf";
-
-		public static void Main(string[] args)
-		{
-			SetupBaseDir();
-
-			Log.Debugging = Debugging;
-			Log.Information("Starting " + Constants.SOFTWARE_NAME);
-
-			//Iniciamos la internalización
-			Catalog.Init(Constants.SOFTWARE_NAME.ToLower(),RelativeToPrefix("share/locale"));
-
-			//Iniciamos la aplicación
-			Application.Init();
-
-			GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
-
-			LongoMatch.Video.Player.GstPlayer.InitBackend("");
-
-			//Comprobamos los archivos de inicio
-			CheckDirs();
-			CheckFiles();
-
-			//Iniciamos la base de datos
-			db = new DataBase(Path.Combine(DBDir(),Constants.DB_FILE));
-
-			//Check for previous database
-			CheckOldFiles();
-
-			try {
-				MainWindow win = new MainWindow();
-				win.Show();
-				Application.Run();
-			} catch (Exception ex) {
-				ProcessExecutionError(ex);
-			}
-		}
-
-		public static string RelativeToPrefix(string relativePath) {
-			return System.IO.Path.Combine(baseDirectory, relativePath);
-		}
-
-		public static string HomeDir() {
-			return homeDirectory;
-		}
-
-		public static string PlayListDir() {
-			return System.IO.Path.Combine(homeDirectory, "playlists");
-		}
-
-		public static string SnapshotsDir() {
-			return System.IO.Path.Combine(homeDirectory, "snapshots");
-		}
-
-		public static string TemplatesDir() {
-			return System.IO.Path.Combine(configDirectory, "templates");
-		}
-
-		public static string VideosDir() {
-			return System.IO.Path.Combine(homeDirectory, "videos");
-		}
-
-		public static string TempVideosDir() {
-			return System.IO.Path.Combine(configDirectory, "temp");
-		}
-
-		public static string ImagesDir() {
-			return RelativeToPrefix("share/longomatch/images");
-		}
-
-		public static string DBDir() {
-			return System.IO.Path.Combine(configDirectory, "db");
-		}
-
-		public static void CheckDirs() {
-			if (!System.IO.Directory.Exists(homeDirectory))
-				System.IO.Directory.CreateDirectory(homeDirectory);
-			if (!System.IO.Directory.Exists(TemplatesDir()))
-				System.IO.Directory.CreateDirectory(TemplatesDir());
-			if (!System.IO.Directory.Exists(SnapshotsDir()))
-				System.IO.Directory.CreateDirectory(SnapshotsDir());
-			if (!System.IO.Directory.Exists(PlayListDir()))
-				System.IO.Directory.CreateDirectory(PlayListDir());
-			if (!System.IO.Directory.Exists(DBDir()))
-				System.IO.Directory.CreateDirectory(DBDir());
-			if (!System.IO.Directory.Exists(VideosDir()))
-				System.IO.Directory.CreateDirectory(VideosDir());
-			if (!System.IO.Directory.Exists(TempVideosDir()))
-				System.IO.Directory.CreateDirectory(TempVideosDir());
-		}
-
-		public static void CheckFiles() {
-			string fConfig;
-			fConfig = System.IO.Path.Combine(TemplatesDir(),"default.sct");
-			if (!System.IO.File.Exists(fConfig)) {
-				Categories cat = Categories.DefaultTemplate();
-				cat.Save("default.sct");
-			}
-
-			fConfig = System.IO.Path.Combine(TemplatesDir(),"default.tem");
-			if (!System.IO.File.Exists(fConfig)) {
-				TeamTemplate tt = TeamTemplate.DefaultTemplate(20);
-				tt.Save(fConfig);
-			}
-		}
-
-		public static void CheckOldFiles() {
-			string oldDBFile= System.IO.Path.Combine(homeDirectory, "db/db.yap");
-			//We supose that if the conversion as already be done successfully,
-			//old DB file has been renamed to db.yap.bak
-			if (File.Exists(oldDBFile)) {
-				MessageDialog md = new MessageDialog(null,
-				                                     DialogFlags.Modal,
-				                                     MessageType.Question,
-				                                     Gtk.ButtonsType.YesNo,
-				                                     Catalog.GetString("Some elements from the previous version (database, templates and/or playlists) have been found.")+"\n"+
-				                                     Catalog.GetString("Do you want to import them?"));
-				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
-				if (md.Run()==(int)ResponseType.Yes) {
-					md.Destroy();
-					//Migrator migrator = new Migrator(homeDirectory);
-					//migrator.Run();
-					//migrator.Destroy();
-				}
-				else
-					md.Destroy();
-			}
-		}
-
-		public static DataBase DB {
-			get {
-				return db;
-			}
-		}
-		
-		private static void SetupBaseDir() {
-			string home;
-			
-			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
-				baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../");
-			else
-				baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../../");
-			
-			/* Check for the magic file PORTABLE to check if it's a portable version
-			 * and the config goes in the same folder as the binaries */
-			if (File.Exists(System.IO.Path.Combine(baseDirectory, Constants.PORTABLE_FILE)))
-				home = baseDirectory;
-			else
-				home = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
-			
-			homeDirectory = System.IO.Path.Combine(home,Constants.SOFTWARE_NAME);
-			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
-				configDirectory = homeDirectory;
-			else
-				configDirectory = System.IO.Path.Combine(home,".longomatch");
-		}
-
-		private static bool? debugging = null;	
-		public static bool Debugging {
-			get {
-				if (debugging == null) {
-					debugging = EnvironmentIsSet ("LGM_DEBUG");
-				}
-				return debugging.Value;
-			}
-			set {
-				debugging = value;
-				Log.Debugging = Debugging;
-			}
-		}
-		
-		public static bool EnvironmentIsSet (string env)
-		{
-			return !String.IsNullOrEmpty (Environment.GetEnvironmentVariable (env));
-		}
-		
-		private static void OnException(GLib.UnhandledExceptionArgs args) {
-			ProcessExecutionError((Exception)args.ExceptionObject);
-		}
-
-		private static void ProcessExecutionError(Exception ex) {
-			string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now +".log";
-			string message;
-
-			logFile = logFile.Replace("/","-");
-			logFile = logFile.Replace(" ","-");
-			logFile = logFile.Replace(":","-");
-			logFile = System.IO.Path.Combine(HomeDir(),logFile);
-
-			if (ex.InnerException != null)
-				message = String.Format("{0}\n{1}\n{2}\n{3}\n{4}",ex.Message,ex.InnerException.Message,ex.Source,ex.StackTrace,ex.InnerException.StackTrace);
-			else
-				message = String.Format("{0}\n{1}\n{2}",ex.Message,ex.Source,ex.StackTrace);
-
-			using(StreamWriter s = new StreamWriter(logFile)) {
-				s.WriteLine(message);
-				s.WriteLine("\n\n\nStackTrace:");
-				s.WriteLine(System.Environment.StackTrace);
-			}
-			Log.Exception (ex);
-			//TODO Add bug reports link
-			MessagePopup.PopupMessage(null, MessageType.Error,
-			                          Catalog.GetString("The application has finished with an unexpected error.")+"\n"+
-			                          Catalog.GetString("A log has been saved at: ")+logFile+ "\n"+
-			                          Catalog.GetString("Please, fill a bug report "));
-
-			Application.Quit();
-		}
-	}
-}
+// Main.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+
+using System;
+using System.IO;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.DB;
+using LongoMatch.Gui;
+using LongoMatch.IO;
+using LongoMatch.Store.Templates;
+using Mono.Unix;
+
+namespace LongoMatch
+
+{
+
+	class MainClass
+	{
+		private static DataBase db;
+		private static string baseDirectory;
+		private static string homeDirectory;
+		private static string configDirectory;
+		private const string WIN32_CONFIG_FILE = "longomatch.conf";
+
+		public static void Main(string[] args)
+		{
+			SetupBaseDir();
+
+			Log.Debugging = Debugging;
+			Log.Information("Starting " + Constants.SOFTWARE_NAME);
+
+			//Iniciamos la internalización
+			Catalog.Init(Constants.SOFTWARE_NAME.ToLower(),RelativeToPrefix("share/locale"));
+
+			//Iniciamos la aplicación
+			Application.Init();
+
+			GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
+
+			LongoMatch.Video.Player.GstPlayer.InitBackend("");
+
+			//Comprobamos los archivos de inicio
+			CheckDirs();
+			CheckFiles();
+
+			//Iniciamos la base de datos
+			db = new DataBase(Path.Combine(DBDir(),Constants.DB_FILE));
+
+			//Check for previous database
+			CheckOldFiles();
+
+			try {
+				MainWindow win = new MainWindow();
+				win.Show();
+				Application.Run();
+			} catch (Exception ex) {
+				ProcessExecutionError(ex);
+			}
+		}
+
+		public static string RelativeToPrefix(string relativePath) {
+			return System.IO.Path.Combine(baseDirectory, relativePath);
+		}
+
+		public static string HomeDir() {
+			return homeDirectory;
+		}
+
+		public static string PlayListDir() {
+			return System.IO.Path.Combine(homeDirectory, "playlists");
+		}
+
+		public static string SnapshotsDir() {
+			return System.IO.Path.Combine(homeDirectory, "snapshots");
+		}
+
+		public static string TemplatesDir() {
+			return System.IO.Path.Combine(configDirectory, "templates");
+		}
+
+		public static string VideosDir() {
+			return System.IO.Path.Combine(homeDirectory, "videos");
+		}
+
+		public static string TempVideosDir() {
+			return System.IO.Path.Combine(configDirectory, "temp");
+		}
+
+		public static string ImagesDir() {
+			return RelativeToPrefix("share/longomatch/images");
+		}
+
+		public static string DBDir() {
+			return System.IO.Path.Combine(configDirectory, "db");
+		}
+
+		public static void CheckDirs() {
+			if (!System.IO.Directory.Exists(homeDirectory))
+				System.IO.Directory.CreateDirectory(homeDirectory);
+			if (!System.IO.Directory.Exists(TemplatesDir()))
+				System.IO.Directory.CreateDirectory(TemplatesDir());
+			if (!System.IO.Directory.Exists(SnapshotsDir()))
+				System.IO.Directory.CreateDirectory(SnapshotsDir());
+			if (!System.IO.Directory.Exists(PlayListDir()))
+				System.IO.Directory.CreateDirectory(PlayListDir());
+			if (!System.IO.Directory.Exists(DBDir()))
+				System.IO.Directory.CreateDirectory(DBDir());
+			if (!System.IO.Directory.Exists(VideosDir()))
+				System.IO.Directory.CreateDirectory(VideosDir());
+			if (!System.IO.Directory.Exists(TempVideosDir()))
+				System.IO.Directory.CreateDirectory(TempVideosDir());
+		}
+
+		public static void CheckFiles() {
+			string fConfig;
+			fConfig = System.IO.Path.Combine(TemplatesDir(),"default.sct");
+			if (!System.IO.File.Exists(fConfig)) {
+				Categories cat = Categories.DefaultTemplate();
+				cat.Save("default.sct");
+			}
+
+			fConfig = System.IO.Path.Combine(TemplatesDir(),"default.tem");
+			if (!System.IO.File.Exists(fConfig)) {
+				TeamTemplate tt = TeamTemplate.DefaultTemplate(20);
+				tt.Save(fConfig);
+			}
+		}
+
+		public static void CheckOldFiles() {
+			string oldDBFile= System.IO.Path.Combine(homeDirectory, "db/db.yap");
+			//We supose that if the conversion as already be done successfully,
+			//old DB file has been renamed to db.yap.bak
+			if (File.Exists(oldDBFile)) {
+				MessageDialog md = new MessageDialog(null,
+				                                     DialogFlags.Modal,
+				                                     MessageType.Question,
+				                                     Gtk.ButtonsType.YesNo,
+				                                     Catalog.GetString("Some elements from the previous version (database, templates and/or playlists) have been found.")+"\n"+
+				                                     Catalog.GetString("Do you want to import them?"));
+				md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog);
+				if (md.Run()==(int)ResponseType.Yes) {
+					md.Destroy();
+					//Migrator migrator = new Migrator(homeDirectory);
+					//migrator.Run();
+					//migrator.Destroy();
+				}
+				else
+					md.Destroy();
+			}
+		}
+
+		public static DataBase DB {
+			get {
+				return db;
+			}
+		}
+		
+		private static void SetupBaseDir() {
+			string home;
+			
+			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+				baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../");
+			else
+				baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,"../../");
+			
+			/* Check for the magic file PORTABLE to check if it's a portable version
+			 * and the config goes in the same folder as the binaries */
+			if (File.Exists(System.IO.Path.Combine(baseDirectory, Constants.PORTABLE_FILE)))
+				home = baseDirectory;
+			else
+				home = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
+			
+			homeDirectory = System.IO.Path.Combine(home,Constants.SOFTWARE_NAME);
+			if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+				configDirectory = homeDirectory;
+			else
+				configDirectory = System.IO.Path.Combine(home,".longomatch");
+		}
+
+		private static bool? debugging = null;	
+		public static bool Debugging {
+			get {
+				if (debugging == null) {
+					debugging = EnvironmentIsSet ("LGM_DEBUG");
+				}
+				return debugging.Value;
+			}
+			set {
+				debugging = value;
+				Log.Debugging = Debugging;
+			}
+		}
+		
+		public static bool EnvironmentIsSet (string env)
+		{
+			return !String.IsNullOrEmpty (Environment.GetEnvironmentVariable (env));
+		}
+		
+		private static void OnException(GLib.UnhandledExceptionArgs args) {
+			ProcessExecutionError((Exception)args.ExceptionObject);
+		}
+
+		private static void ProcessExecutionError(Exception ex) {
+			string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now +".log";
+			string message;
+
+			logFile = logFile.Replace("/","-");
+			logFile = logFile.Replace(" ","-");
+			logFile = logFile.Replace(":","-");
+			logFile = System.IO.Path.Combine(HomeDir(),logFile);
+
+			if (ex.InnerException != null)
+				message = String.Format("{0}\n{1}\n{2}\n{3}\n{4}",ex.Message,ex.InnerException.Message,ex.Source,ex.StackTrace,ex.InnerException.StackTrace);
+			else
+				message = String.Format("{0}\n{1}\n{2}",ex.Message,ex.Source,ex.StackTrace);
+
+			using(StreamWriter s = new StreamWriter(logFile)) {
+				s.WriteLine(message);
+				s.WriteLine("\n\n\nStackTrace:");
+				s.WriteLine(System.Environment.StackTrace);
+			}
+			Log.Exception (ex);
+			//TODO Add bug reports link
+			MessagePopup.PopupMessage(null, MessageType.Error,
+			                          Catalog.GetString("The application has finished with an unexpected error.")+"\n"+
+			                          Catalog.GetString("A log has been saved at: ")+logFile+ "\n"+
+			                          Catalog.GetString("Please, fill a bug report "));
+
+			Application.Quit();
+		}
+	}
+}
diff --git a/LongoMatch/Playlist/IPlayList.cs b/LongoMatch/Playlist/IPlayList.cs
index ad41f5c..09336ef 100644
--- a/LongoMatch/Playlist/IPlayList.cs
+++ b/LongoMatch/Playlist/IPlayList.cs
@@ -1,56 +1,56 @@
-// IPlayList.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections;
-using Gtk;
-using LongoMatch.Store;
-
-namespace LongoMatch.Playlist {
-
-	public interface IPlayList:IEnumerable
-	{
-		int Count {
-			get;
-		}
-		
-		void Save(string path);
-		
-		void Add(PlayListPlay play);
-		
-		void Remove(PlayListPlay play);
-		
-		PlayListPlay Next();
-		
-		PlayListPlay Prev();
-		
-		PlayListPlay Select(int index);
-		
-		int GetCurrentIndex();
-		
-		bool HasNext();
-		
-		bool HasPrev();
-		
-		ListStore GetModel();
-		
-		IPlayList Copy();
-	}
-}
+// IPlayList.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections;
+using Gtk;
+using LongoMatch.Store;
+
+namespace LongoMatch.Playlist {
+
+	public interface IPlayList:IEnumerable
+	{
+		int Count {
+			get;
+		}
+		
+		void Save(string path);
+		
+		void Add(PlayListPlay play);
+		
+		void Remove(PlayListPlay play);
+		
+		PlayListPlay Next();
+		
+		PlayListPlay Prev();
+		
+		PlayListPlay Select(int index);
+		
+		int GetCurrentIndex();
+		
+		bool HasNext();
+		
+		bool HasPrev();
+		
+		ListStore GetModel();
+		
+		IPlayList Copy();
+	}
+}
diff --git a/LongoMatch/Playlist/PlayList.cs b/LongoMatch/Playlist/PlayList.cs
index 6933dd7..cbeea59 100644
--- a/LongoMatch/Playlist/PlayList.cs
+++ b/LongoMatch/Playlist/PlayList.cs
@@ -1,169 +1,169 @@
-// PlayList.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Collections;
-using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Xml.Serialization;
-using Gtk;
-using LongoMatch.Store;
-using LongoMatch.Common;
-using Mono.Unix;
-namespace LongoMatch.Playlist
-{
-
-
-	public class PlayList: SerializableObject,IPlayList
-	{
-
-		private  List<PlayListPlay> list;
-		private string filename = null;
-		private int indexSelection = 0;
-		private Version version;
-
-		#region Constructors
-		public PlayList() {
-			list = new List<PlayListPlay>();
-			version = new Version(1,0);
-		}
-
-		public PlayList(string file)
-		{
-			//For new Play List
-			if (!System.IO.File.Exists(file)) {
-				list = new List<PlayListPlay>();
-				filename = file;
-			}
-			else
-				Load(file);
-
-			version = new Version(1,0);
-		}
-		#endregion
-
-		#region Properties
-
-		public int Count {
-			get {
-				return list.Count;
-			}
-		}
-
-		public string File {
-			get {
-				return filename;
-			}
-		}
-
-		public Version Version {
-			get {
-				return version;
-			}
-		}
-		#endregion
-
-		#region Public methods
-		public void Save(){
-			Save(File);
-		}
-
-		public void Save(string filePath){
-			Save(this, filePath);
-		}
-		
-		public static PlayList Load(string filePath) {
-			return Load<PlayList>(filePath);
-		}
-		
-		public bool isLoaded() {
-			return filename != null;
-		}
-
-		public int GetCurrentIndex() {
-			return indexSelection;
-		}
-
-		public PlayListPlay Next() {
-			if (HasNext())
-				indexSelection++;
-			return list[indexSelection];
-		}
-
-		public PlayListPlay Prev() {
-			if (HasPrev())
-				indexSelection--;
-			return list[indexSelection];
-		}
-
-		public void Add(PlayListPlay plNode) {
-			list.Add(plNode);
-		}
-
-		public void Remove(PlayListPlay plNode) {
-
-			list.Remove(plNode);
-			if (GetCurrentIndex() >= list.Count)
-				indexSelection --;
-		}
-
-		public PlayListPlay Select(int index) {
-			indexSelection = index;
-			return list[index];
-		}
-
-		public bool HasNext() {
-			return indexSelection < list.Count-1;
-		}
-
-		public bool HasPrev() {
-			return !indexSelection.Equals(0);
-		}
-
-		public ListStore GetModel() {
-			Gtk.ListStore listStore = new ListStore(typeof(PlayListPlay));
-			foreach (PlayListPlay plNode in list) {
-				listStore.AppendValues(plNode);
-			}
-			return listStore;
-		}
-
-		public void SetModel(ListStore listStore) {
-			TreeIter iter ;
-
-			listStore.GetIterFirst(out iter);
-			list.Clear();
-			while (listStore.IterIsValid(iter)) {
-				list.Add(listStore.GetValue(iter, 0) as PlayListPlay);
-				listStore.IterNext(ref iter);
-			}
-		}
-
-		public IEnumerator GetEnumerator() {
-			return list.GetEnumerator();
-		}
-
-		public IPlayList Copy() {
-			return (IPlayList)(MemberwiseClone());
-		}
-		#endregion
-	}
-}
+// PlayList.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Xml.Serialization;
+using Gtk;
+using LongoMatch.Store;
+using LongoMatch.Common;
+using Mono.Unix;
+namespace LongoMatch.Playlist
+{
+
+
+	public class PlayList: SerializableObject,IPlayList
+	{
+
+		private  List<PlayListPlay> list;
+		private string filename = null;
+		private int indexSelection = 0;
+		private Version version;
+
+		#region Constructors
+		public PlayList() {
+			list = new List<PlayListPlay>();
+			version = new Version(1,0);
+		}
+
+		public PlayList(string file)
+		{
+			//For new Play List
+			if (!System.IO.File.Exists(file)) {
+				list = new List<PlayListPlay>();
+				filename = file;
+			}
+			else
+				Load(file);
+
+			version = new Version(1,0);
+		}
+		#endregion
+
+		#region Properties
+
+		public int Count {
+			get {
+				return list.Count;
+			}
+		}
+
+		public string File {
+			get {
+				return filename;
+			}
+		}
+
+		public Version Version {
+			get {
+				return version;
+			}
+		}
+		#endregion
+
+		#region Public methods
+		public void Save(){
+			Save(File);
+		}
+
+		public void Save(string filePath){
+			Save(this, filePath);
+		}
+		
+		public static PlayList Load(string filePath) {
+			return Load<PlayList>(filePath);
+		}
+		
+		public bool isLoaded() {
+			return filename != null;
+		}
+
+		public int GetCurrentIndex() {
+			return indexSelection;
+		}
+
+		public PlayListPlay Next() {
+			if (HasNext())
+				indexSelection++;
+			return list[indexSelection];
+		}
+
+		public PlayListPlay Prev() {
+			if (HasPrev())
+				indexSelection--;
+			return list[indexSelection];
+		}
+
+		public void Add(PlayListPlay plNode) {
+			list.Add(plNode);
+		}
+
+		public void Remove(PlayListPlay plNode) {
+
+			list.Remove(plNode);
+			if (GetCurrentIndex() >= list.Count)
+				indexSelection --;
+		}
+
+		public PlayListPlay Select(int index) {
+			indexSelection = index;
+			return list[index];
+		}
+
+		public bool HasNext() {
+			return indexSelection < list.Count-1;
+		}
+
+		public bool HasPrev() {
+			return !indexSelection.Equals(0);
+		}
+
+		public ListStore GetModel() {
+			Gtk.ListStore listStore = new ListStore(typeof(PlayListPlay));
+			foreach (PlayListPlay plNode in list) {
+				listStore.AppendValues(plNode);
+			}
+			return listStore;
+		}
+
+		public void SetModel(ListStore listStore) {
+			TreeIter iter ;
+
+			listStore.GetIterFirst(out iter);
+			list.Clear();
+			while (listStore.IterIsValid(iter)) {
+				list.Add(listStore.GetValue(iter, 0) as PlayListPlay);
+				listStore.IterNext(ref iter);
+			}
+		}
+
+		public IEnumerator GetEnumerator() {
+			return list.GetEnumerator();
+		}
+
+		public IPlayList Copy() {
+			return (IPlayList)(MemberwiseClone());
+		}
+		#endregion
+	}
+}
diff --git a/LongoMatch/Store/Category.cs b/LongoMatch/Store/Category.cs
index c8e46b3..e479ff1 100644
--- a/LongoMatch/Store/Category.cs
+++ b/LongoMatch/Store/Category.cs
@@ -1,160 +1,160 @@
-// SectionsTimeNode.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-using Gdk;
-using Mono.Unix;
-using LongoMatch.Common;
-
-namespace LongoMatch.Store
-{
-
-	/// <summary>
-	/// Tag category for the analysis. Contains the default values to creates plays
-	/// tagged in this category
-	/// </summary>
-	[Serializable]
-	public class Category:TimeNode, ISerializable
-	{
-		
-		private Guid _UUID;
-		
-		#region Constructors
-		#endregion
-		public Category (){
-			_UUID = System.Guid.NewGuid();
-			SubCategories = new List<SubCategory>();
-		}
-		
-		#region  Properties
-		
-		/// <summary>
-		/// Unique ID for this category 
-		/// </summary>
-		public Guid UUID{
-			get {
-				return _UUID;
-			}
-		}
-
-		/// <summary>
-		/// A key combination to create plays in this category
-		/// </summary>
-		public HotKey HotKey {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// A color to identify plays in this category
-		/// </summary>
-		public Color Color {
-			get;
-			set;
-		}
-		
-		//// <summary>
-		/// Sort method used to sort plays for this category 
-		/// </summary>
-		public SortMethodType SortMethod{
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// Position of the category in the list of categories 
-		/// </summary>
-		public int Position{
-			get;
-			set;
-		}
-		
-		public List<SubCategory> SubCategories {
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// Sort method string used for the UI
-		/// </summary>
-		public string SortMethodString{
-			get{
-				switch (SortMethod){
-					case SortMethodType.SortByName:
-						return Catalog.GetString("Sort by name");
-					case SortMethodType.SortByStartTime:
-						return Catalog.GetString("Sort by start time");
-					case SortMethodType.SortByStopTime:
-						return Catalog.GetString("Sort by stop time");
-					case SortMethodType.SortByDuration:
-						return Catalog.GetString("Sort by duration");
-					default:
-						return Catalog.GetString("Sort by name");
-				}						
-			}
-			set{			
-				if (value == Catalog.GetString("Sort by start time"))
-					SortMethod = SortMethodType.SortByStartTime;
-				else if (value == Catalog.GetString("Sort by stop time"))
-					SortMethod = SortMethodType.SortByStopTime;
-				else if (value == Catalog.GetString("Sort by duration"))
-					SortMethod = SortMethodType.SortByDuration;
-				else
-					SortMethod = SortMethodType.SortByName;
-			}
-		}
-		
-		// this constructor is automatically called during deserialization
-		public Category(SerializationInfo info, StreamingContext context) {
-			_UUID = (Guid)info.GetValue("uuid", typeof(Guid));
-			Name = info.GetString("name");
-			Start = (Time)info.GetValue("start", typeof(Time));
-			Stop = (Time)info.GetValue("stop", typeof(Time));
-			HotKey = (HotKey)info.GetValue("hotkey", typeof(HotKey));
-			SubCategories = (List<SubCategory>)info.GetValue("subcategories", typeof(List<SubCategory>));
-			Position = info.GetInt32("position");
-			SortMethod = (SortMethodType)info.GetValue("sort_method", typeof(SortMethodType));
-			// read 'red', 'blue' and 'green' values and convert it to Gdk.Color
-			Color c = new Color();
-			c.Red = (ushort)info.GetValue("red", typeof(ushort));
-			c.Green = (ushort)info.GetValue("green", typeof(ushort));
-			c.Blue = (ushort)info.GetValue("blue", typeof(ushort));
-			Color = c;
-		}
-		
-		// this method is automatically called during serialization
-		public void GetObjectData(SerializationInfo info, StreamingContext context) {
-			info.AddValue("uuid", UUID);
-			info.AddValue("name", Name);
-			info.AddValue("start", Start);
-			info.AddValue("stop", Stop);
-			info.AddValue("hotkey", HotKey);
-			info.AddValue("position", Position);
-			info.AddValue("subcategories", SubCategories);
-			info.AddValue("red", Color.Red);
-			info.AddValue("green", Color.Green);
-			info.AddValue("blue", Color.Blue);
-			info.AddValue("sort_method", SortMethod);
-		}
-		#endregion	
-	}
-}
+// SectionsTimeNode.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Gdk;
+using Mono.Unix;
+using LongoMatch.Common;
+
+namespace LongoMatch.Store
+{
+
+	/// <summary>
+	/// Tag category for the analysis. Contains the default values to creates plays
+	/// tagged in this category
+	/// </summary>
+	[Serializable]
+	public class Category:TimeNode, ISerializable
+	{
+		
+		private Guid _UUID;
+		
+		#region Constructors
+		#endregion
+		public Category (){
+			_UUID = System.Guid.NewGuid();
+			SubCategories = new List<SubCategory>();
+		}
+		
+		#region  Properties
+		
+		/// <summary>
+		/// Unique ID for this category 
+		/// </summary>
+		public Guid UUID{
+			get {
+				return _UUID;
+			}
+		}
+
+		/// <summary>
+		/// A key combination to create plays in this category
+		/// </summary>
+		public HotKey HotKey {
+			get;
+			set;
+		}
+
+		/// <summary>
+		/// A color to identify plays in this category
+		/// </summary>
+		public Color Color {
+			get;
+			set;
+		}
+		
+		//// <summary>
+		/// Sort method used to sort plays for this category 
+		/// </summary>
+		public SortMethodType SortMethod{
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Position of the category in the list of categories 
+		/// </summary>
+		public int Position{
+			get;
+			set;
+		}
+		
+		public List<SubCategory> SubCategories {
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Sort method string used for the UI
+		/// </summary>
+		public string SortMethodString{
+			get{
+				switch (SortMethod){
+					case SortMethodType.SortByName:
+						return Catalog.GetString("Sort by name");
+					case SortMethodType.SortByStartTime:
+						return Catalog.GetString("Sort by start time");
+					case SortMethodType.SortByStopTime:
+						return Catalog.GetString("Sort by stop time");
+					case SortMethodType.SortByDuration:
+						return Catalog.GetString("Sort by duration");
+					default:
+						return Catalog.GetString("Sort by name");
+				}						
+			}
+			set{			
+				if (value == Catalog.GetString("Sort by start time"))
+					SortMethod = SortMethodType.SortByStartTime;
+				else if (value == Catalog.GetString("Sort by stop time"))
+					SortMethod = SortMethodType.SortByStopTime;
+				else if (value == Catalog.GetString("Sort by duration"))
+					SortMethod = SortMethodType.SortByDuration;
+				else
+					SortMethod = SortMethodType.SortByName;
+			}
+		}
+		
+		// this constructor is automatically called during deserialization
+		public Category(SerializationInfo info, StreamingContext context) {
+			_UUID = (Guid)info.GetValue("uuid", typeof(Guid));
+			Name = info.GetString("name");
+			Start = (Time)info.GetValue("start", typeof(Time));
+			Stop = (Time)info.GetValue("stop", typeof(Time));
+			HotKey = (HotKey)info.GetValue("hotkey", typeof(HotKey));
+			SubCategories = (List<SubCategory>)info.GetValue("subcategories", typeof(List<SubCategory>));
+			Position = info.GetInt32("position");
+			SortMethod = (SortMethodType)info.GetValue("sort_method", typeof(SortMethodType));
+			// read 'red', 'blue' and 'green' values and convert it to Gdk.Color
+			Color c = new Color();
+			c.Red = (ushort)info.GetValue("red", typeof(ushort));
+			c.Green = (ushort)info.GetValue("green", typeof(ushort));
+			c.Blue = (ushort)info.GetValue("blue", typeof(ushort));
+			Color = c;
+		}
+		
+		// this method is automatically called during serialization
+		public void GetObjectData(SerializationInfo info, StreamingContext context) {
+			info.AddValue("uuid", UUID);
+			info.AddValue("name", Name);
+			info.AddValue("start", Start);
+			info.AddValue("stop", Stop);
+			info.AddValue("hotkey", HotKey);
+			info.AddValue("position", Position);
+			info.AddValue("subcategories", SubCategories);
+			info.AddValue("red", Color.Red);
+			info.AddValue("green", Color.Green);
+			info.AddValue("blue", Color.Blue);
+			info.AddValue("sort_method", SortMethod);
+		}
+		#endregion	
+	}
+}
diff --git a/LongoMatch/Store/PixbufTimeNode.cs b/LongoMatch/Store/PixbufTimeNode.cs
index a9c7e0e..14c8a0f 100644
--- a/LongoMatch/Store/PixbufTimeNode.cs
+++ b/LongoMatch/Store/PixbufTimeNode.cs
@@ -1,77 +1,77 @@
-// PixbufTimeNode.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using Gdk;
-
-namespace LongoMatch.Store
-{
-
-	/// <summary>
-	/// Base class for all the video segments containing a snapshot
-	/// It has a <see cref="Gdk.Pixbuf"/> with a thumbnail of the video segment.
-	/// </summary>
-	[Serializable]
-	public class PixbufTimeNode : TimeNode
-	{
-		private byte[] thumbnailBuf;
-		private const int MAX_WIDTH=100;
-		private const int MAX_HEIGHT=75;
-		#region Contructors
-		public PixbufTimeNode() {
-		}
-		#endregion
-
-		#region Properties
-		/// <summary>
-		/// Segment thumbnail
-		/// </summary>
-		public Pixbuf Miniature {
-			get {
-				if (thumbnailBuf != null)
-					return new Pixbuf(thumbnailBuf);
-				else return null;
-			}set {
-				ScaleAndSave(value);
-			}
-		}
-		#endregion
-
-		private void ScaleAndSave(Pixbuf pixbuf) {
-			int ow,oh,h,w;
-
-			h = ow = pixbuf.Height;
-			w = oh = pixbuf.Width;
-			ow = MAX_WIDTH;
-			oh = MAX_HEIGHT;
-
-			if (w>MAX_WIDTH || h>MAX_HEIGHT) {
-				double rate = (double)w/(double)h;
-				if (h>w)
-					ow = (int)(oh * rate);
-				else
-					oh = (int)(ow / rate);
-				thumbnailBuf = pixbuf.ScaleSimple(ow,oh,Gdk.InterpType.Bilinear).SaveToBuffer("png");
-				pixbuf.Dispose();
-			}
-			else thumbnailBuf =  pixbuf.SaveToBuffer("png");
-		}
-	}
-}
+// PixbufTimeNode.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using Gdk;
+
+namespace LongoMatch.Store
+{
+
+	/// <summary>
+	/// Base class for all the video segments containing a snapshot
+	/// It has a <see cref="Gdk.Pixbuf"/> with a thumbnail of the video segment.
+	/// </summary>
+	[Serializable]
+	public class PixbufTimeNode : TimeNode
+	{
+		private byte[] thumbnailBuf;
+		private const int MAX_WIDTH=100;
+		private const int MAX_HEIGHT=75;
+		#region Contructors
+		public PixbufTimeNode() {
+		}
+		#endregion
+
+		#region Properties
+		/// <summary>
+		/// Segment thumbnail
+		/// </summary>
+		public Pixbuf Miniature {
+			get {
+				if (thumbnailBuf != null)
+					return new Pixbuf(thumbnailBuf);
+				else return null;
+			}set {
+				ScaleAndSave(value);
+			}
+		}
+		#endregion
+
+		private void ScaleAndSave(Pixbuf pixbuf) {
+			int ow,oh,h,w;
+
+			h = ow = pixbuf.Height;
+			w = oh = pixbuf.Width;
+			ow = MAX_WIDTH;
+			oh = MAX_HEIGHT;
+
+			if (w>MAX_WIDTH || h>MAX_HEIGHT) {
+				double rate = (double)w/(double)h;
+				if (h>w)
+					ow = (int)(oh * rate);
+				else
+					oh = (int)(ow / rate);
+				thumbnailBuf = pixbuf.ScaleSimple(ow,oh,Gdk.InterpType.Bilinear).SaveToBuffer("png");
+				pixbuf.Dispose();
+			}
+			else thumbnailBuf =  pixbuf.SaveToBuffer("png");
+		}
+	}
+}
diff --git a/LongoMatch/Store/Play.cs b/LongoMatch/Store/Play.cs
index 1b41a2f..7092967 100644
--- a/LongoMatch/Store/Play.cs
+++ b/LongoMatch/Store/Play.cs
@@ -1,209 +1,209 @@
-// MediaTimeNode.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Mono.Unix;
-using Gdk;
-using LongoMatch.Common;
-
-namespace LongoMatch.Store
-{
-
-	/// <summary>
-	/// Represents a Play in the game.
-	/// </summary>
-
-	[Serializable]
-	public class  Play : PixbufTimeNode
-	{
-
-		#region Constructors
-		public Play(){
-			Drawings = new DrawingsList();
-			Tags = new List<Tag>();
-		}
-		#endregion
-
-		#region Properties
-		
-		/// <summary>
-		/// Category in which this play is tagged 
-		/// </summary>
-		public Category Category {get; set;}
-		
-		/// <summary>
-		/// A string with the play's notes
-		/// </summary>
-		public string Notes {get; set;}
-
-		/// <summary>
-		/// Video framerate in frames per second. This value is taken from the
-		/// video file properties and used to translate from seconds
-		/// to frames: second 100 is equivalent to frame 100*fps
-		/// </summary>
-		public uint Fps {get; set;}
-
-		/// <summary>
-		/// Start frame number
-		/// </summary>
-		public uint StartFrame {
-			get {return (uint) (Start.MSeconds * Fps / 1000);}
-			set {Start = new Time {MSeconds = (int)(1000 * value / Fps)};}
-		}
-
-		/// <summary>
-		/// Stop frame number
-		/// </summary>
-		public uint StopFrame {
-			get {return (uint) (Stop.MSeconds * Fps / 1000);}
-			set {Stop = new Time {MSeconds = (int)(1000 * value / Fps)};}
-		}
-
-		/// <summary>
-		/// Get the key frame number if this play as key frame drawing or 0
-		/// </summary>
-		public uint KeyFrame {
-			get {
-				if (HasDrawings)
-					return (uint) KeyFrameDrawing.RenderTime * Fps / 1000;
-				else return 0;
-			}
-		}
-
-		/// <summary>
-		/// Get/Set wheter this play is actually loaded. Used in  <see cref="LongoMatch.Gui.Component.TimeScale">
-		/// </summary>
-		public bool Selected {get; set;}
-	
-		/// <summary>
-		/// List of drawings for this play
-		/// </summary>
-		public DrawingsList Drawings {get; set;}
-		
-		/* FIXME: Keep this until we support multiple drawings */
-		public Drawing KeyFrameDrawing {
-			get{
-				if (Drawings.Count > 0)
-					return Drawings[0];
-				else
-					return null;
-			}
-		}
-		
-		/// <summary>
-		/// Get wether the play has at least a frame drawing
-		/// </summary>
-		public bool HasDrawings {
-			get {
-				return Drawings.Count > 0;
-			}
-		}
-		
-		/// <summary>
-		/// Central frame number using (stopFrame-startFrame)/2
-		/// </summary>
-		public uint CentralFrame {
-			get {return StopFrame-((TotalFrames)/2);}
-		}
-
-		/// <summary>
-		/// Number of frames inside the play's boundaries
-		/// </summary>
-		public uint TotalFrames {
-			get {return StopFrame-StartFrame;}
-		}
-
-		//// <summary>
-		/// Play's tags 
-		/// </summary>
-		public List<Tag> Tags{get; set;}
-		#endregion
-
-		#region Public methods
-		/// <summary>
-		/// Check if the frame number is inside the play boundaries
-		/// </summary>
-		/// <param name="frame">
-		/// A <see cref="System.Int32"/> with the frame number
-		/// </param>
-		/// <returns>
-		/// A <see cref="System.Boolean"/>
-		/// </returns>
-		public bool HasFrame(int frame) {
-			return (frame>=StartFrame && frame<StopFrame);
-		}
-
-		/// <summary>
-		/// Adds a new tag to the play 
-		/// </summary>
-		/// <param name="tag">
-		/// A <see cref="Tag"/>: the tag to add
-		/// </param>
-		public void AddTag(Tag tag){
-			if (!Tags.Contains(tag))
-				Tags.Add(tag);
-		}
-		
-		/// <summary>
-		/// Removes a tag to the play
-		/// </summary>
-		/// <param name="tag">
-		/// A <see cref="Tag"/>: the tag to remove
-		/// </param>
-		public void RemoveTag(Tag tag){
-			if (Tags.Contains(tag))
-				Tags.Remove(tag);
-		}
-		
-		/// <summary>
-		/// Return True if the play contains a similar tag 
-		/// </summary>
-		/// <param name="name">
-		/// A <see cref="String"/> with the tag name
-		/// </param>
-		/// <param name="val">
-		/// A <see cref="System.Object"/> with tag value
-		/// </param>
-		/// <returns>
-		/// A <see cref="System.Boolean"/>
-		/// </returns>
-		public bool HasTag(String name, object val) {
-			return  (from tag in Tags
-					where (tag.Name == (string)name) && (tag.Value == val) 
-					select tag).Count() > 0;
-		}
-		
-		public override string ToString ()
-		{
-			String[] tags = new String[Tags.Count];
-		
-			for (int i=0; i<Tags.Count; i++)
-				tags[i] = Tags[i].Value.ToString();
-			
-			return  "<b>"+Catalog.GetString("Name")+": </b>"+Name+"\n"+
-					"<b>"+Catalog.GetString("Start")+": </b>"+Start.ToMSecondsString()+"\n"+
-					"<b>"+Catalog.GetString("Stop")+": </b>"+Stop.ToMSecondsString()+"\n"+
-					"<b>"+Catalog.GetString("Tags")+": </b>"+ String.Join(" ; ", tags);
-		}
-		#endregion
-	}
-}
+// MediaTimeNode.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Mono.Unix;
+using Gdk;
+using LongoMatch.Common;
+
+namespace LongoMatch.Store
+{
+
+	/// <summary>
+	/// Represents a Play in the game.
+	/// </summary>
+
+	[Serializable]
+	public class  Play : PixbufTimeNode
+	{
+
+		#region Constructors
+		public Play(){
+			Drawings = new DrawingsList();
+			Tags = new List<Tag>();
+		}
+		#endregion
+
+		#region Properties
+		
+		/// <summary>
+		/// Category in which this play is tagged 
+		/// </summary>
+		public Category Category {get; set;}
+		
+		/// <summary>
+		/// A string with the play's notes
+		/// </summary>
+		public string Notes {get; set;}
+
+		/// <summary>
+		/// Video framerate in frames per second. This value is taken from the
+		/// video file properties and used to translate from seconds
+		/// to frames: second 100 is equivalent to frame 100*fps
+		/// </summary>
+		public uint Fps {get; set;}
+
+		/// <summary>
+		/// Start frame number
+		/// </summary>
+		public uint StartFrame {
+			get {return (uint) (Start.MSeconds * Fps / 1000);}
+			set {Start = new Time {MSeconds = (int)(1000 * value / Fps)};}
+		}
+
+		/// <summary>
+		/// Stop frame number
+		/// </summary>
+		public uint StopFrame {
+			get {return (uint) (Stop.MSeconds * Fps / 1000);}
+			set {Stop = new Time {MSeconds = (int)(1000 * value / Fps)};}
+		}
+
+		/// <summary>
+		/// Get the key frame number if this play as key frame drawing or 0
+		/// </summary>
+		public uint KeyFrame {
+			get {
+				if (HasDrawings)
+					return (uint) KeyFrameDrawing.RenderTime * Fps / 1000;
+				else return 0;
+			}
+		}
+
+		/// <summary>
+		/// Get/Set wheter this play is actually loaded. Used in  <see cref="LongoMatch.Gui.Component.TimeScale">
+		/// </summary>
+		public bool Selected {get; set;}
+	
+		/// <summary>
+		/// List of drawings for this play
+		/// </summary>
+		public DrawingsList Drawings {get; set;}
+		
+		/* FIXME: Keep this until we support multiple drawings */
+		public Drawing KeyFrameDrawing {
+			get{
+				if (Drawings.Count > 0)
+					return Drawings[0];
+				else
+					return null;
+			}
+		}
+		
+		/// <summary>
+		/// Get wether the play has at least a frame drawing
+		/// </summary>
+		public bool HasDrawings {
+			get {
+				return Drawings.Count > 0;
+			}
+		}
+		
+		/// <summary>
+		/// Central frame number using (stopFrame-startFrame)/2
+		/// </summary>
+		public uint CentralFrame {
+			get {return StopFrame-((TotalFrames)/2);}
+		}
+
+		/// <summary>
+		/// Number of frames inside the play's boundaries
+		/// </summary>
+		public uint TotalFrames {
+			get {return StopFrame-StartFrame;}
+		}
+
+		//// <summary>
+		/// Play's tags 
+		/// </summary>
+		public List<Tag> Tags{get; set;}
+		#endregion
+
+		#region Public methods
+		/// <summary>
+		/// Check if the frame number is inside the play boundaries
+		/// </summary>
+		/// <param name="frame">
+		/// A <see cref="System.Int32"/> with the frame number
+		/// </param>
+		/// <returns>
+		/// A <see cref="System.Boolean"/>
+		/// </returns>
+		public bool HasFrame(int frame) {
+			return (frame>=StartFrame && frame<StopFrame);
+		}
+
+		/// <summary>
+		/// Adds a new tag to the play 
+		/// </summary>
+		/// <param name="tag">
+		/// A <see cref="Tag"/>: the tag to add
+		/// </param>
+		public void AddTag(Tag tag){
+			if (!Tags.Contains(tag))
+				Tags.Add(tag);
+		}
+		
+		/// <summary>
+		/// Removes a tag to the play
+		/// </summary>
+		/// <param name="tag">
+		/// A <see cref="Tag"/>: the tag to remove
+		/// </param>
+		public void RemoveTag(Tag tag){
+			if (Tags.Contains(tag))
+				Tags.Remove(tag);
+		}
+		
+		/// <summary>
+		/// Return True if the play contains a similar tag 
+		/// </summary>
+		/// <param name="name">
+		/// A <see cref="String"/> with the tag name
+		/// </param>
+		/// <param name="val">
+		/// A <see cref="System.Object"/> with tag value
+		/// </param>
+		/// <returns>
+		/// A <see cref="System.Boolean"/>
+		/// </returns>
+		public bool HasTag(String name, object val) {
+			return  (from tag in Tags
+					where (tag.Name == (string)name) && (tag.Value == val) 
+					select tag).Count() > 0;
+		}
+		
+		public override string ToString ()
+		{
+			String[] tags = new String[Tags.Count];
+		
+			for (int i=0; i<Tags.Count; i++)
+				tags[i] = Tags[i].Value.ToString();
+			
+			return  "<b>"+Catalog.GetString("Name")+": </b>"+Name+"\n"+
+					"<b>"+Catalog.GetString("Start")+": </b>"+Start.ToMSecondsString()+"\n"+
+					"<b>"+Catalog.GetString("Stop")+": </b>"+Stop.ToMSecondsString()+"\n"+
+					"<b>"+Catalog.GetString("Tags")+": </b>"+ String.Join(" ; ", tags);
+		}
+		#endregion
+	}
+}
diff --git a/LongoMatch/Store/PlayListPlay.cs b/LongoMatch/Store/PlayListPlay.cs
index a3cf33c..eb5aea3 100644
--- a/LongoMatch/Store/PlayListPlay.cs
+++ b/LongoMatch/Store/PlayListPlay.cs
@@ -1,75 +1,75 @@
-// PlayListTimeNode.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Gdk;
-using LongoMatch.Video.Utils;
-
-namespace LongoMatch.Store
-{
-	/// <summary>
-	/// Represents a video segment used by <see cref="LongoMatch.Playlist.Playlist"/>.
-	/// It stores the information of the video file so that it can be used outside a project.
-	/// </summary>
-	[Serializable]
-	public class PlayListPlay : PixbufTimeNode
-	{
-		#region Constructors
-		public PlayListPlay()
-		{
-		}
-		#endregion
-
-		#region Properties
-		/// <summary>
-		/// Media File 
-		/// </summary>
-		public PreviewMediaFile MediaFile {
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// Play rate
-		/// </summary>
-		public float Rate {
-			get;
-			set;
-		}
-
-		//// <summary>
-		/// Defines it the file exists and thus, it can be used in the playlist
-		/// </summary>
-		public bool Valid {
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// List of drawings to be displayed 
-		/// </summary>
-		public DrawingsList Drawings {
-			get;
-			set;
-		} 
-		#endregion
-	}
-}
+// PlayListTimeNode.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Gdk;
+using LongoMatch.Video.Utils;
+
+namespace LongoMatch.Store
+{
+	/// <summary>
+	/// Represents a video segment used by <see cref="LongoMatch.Playlist.Playlist"/>.
+	/// It stores the information of the video file so that it can be used outside a project.
+	/// </summary>
+	[Serializable]
+	public class PlayListPlay : PixbufTimeNode
+	{
+		#region Constructors
+		public PlayListPlay()
+		{
+		}
+		#endregion
+
+		#region Properties
+		/// <summary>
+		/// Media File 
+		/// </summary>
+		public PreviewMediaFile MediaFile {
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Play rate
+		/// </summary>
+		public float Rate {
+			get;
+			set;
+		}
+
+		//// <summary>
+		/// Defines it the file exists and thus, it can be used in the playlist
+		/// </summary>
+		public bool Valid {
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// List of drawings to be displayed 
+		/// </summary>
+		public DrawingsList Drawings {
+			get;
+			set;
+		} 
+		#endregion
+	}
+}
diff --git a/LongoMatch/Store/Player.cs b/LongoMatch/Store/Player.cs
index 543ee68..3174dd6 100644
--- a/LongoMatch/Store/Player.cs
+++ b/LongoMatch/Store/Player.cs
@@ -1,122 +1,122 @@
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-
-using System;
-using Gdk;
-using LongoMatch.Common;
-
-namespace LongoMatch.Store
-{
-	/// <summary>
-	/// Player of a team
-	/// </summary>
-	[Serializable]
-	public class Player
-	{
-		private byte[] photo;
-
-		#region Constructors
-		public Player()
-		{
-		}
-		#endregion
-
-		#region Properties
-		/// <summary>
-		/// My name
-		/// </summary>
-		public string Name {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// My position in the field
-		/// </summary>
-		public string Position {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// My shirt number
-		/// </summary>
-		public int Number {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// My photo
-		/// </summary>
-		public Pixbuf Photo {
-			get {
-				if (photo != null)
-					return new Pixbuf(photo);
-				else
-					return null;
-			}
-			set {
-				photo=value.SaveToBuffer("png");
-			}
-		}
-		
-		/// <summary>
-		/// Date of birth
-		/// </summary>
-		public DateTime Birthday{
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// Nationality
-		/// </summary>
-		public String Nationality{
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using Gdk;
+using LongoMatch.Common;
+
+namespace LongoMatch.Store
+{
+	/// <summary>
+	/// Player of a team
+	/// </summary>
+	[Serializable]
+	public class Player
+	{
+		private byte[] photo;
+
+		#region Constructors
+		public Player()
+		{
+		}
+		#endregion
+
+		#region Properties
+		/// <summary>
+		/// My name
+		/// </summary>
+		public string Name {
 			get;
 			set;
-		}
-		
-		/// <summary>
-		/// Height
-		/// </summary>
-		public float Height{
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Weight
-		/// </summary>
-		public int Weight{
-			get;
-			set;
-		}
-		
-		/// <summary>
-		/// Whether this player is playing or not and shouldn't be added the 
-		/// list of taggable players 
-		/// </summary>
-		public bool Playing{
-			get;
-			set;
-		}
-		
-		#endregion
-	}
-}
+		}
+
+		/// <summary>
+		/// My position in the field
+		/// </summary>
+		public string Position {
+			get;
+			set;
+		}
+
+		/// <summary>
+		/// My shirt number
+		/// </summary>
+		public int Number {
+			get;
+			set;
+		}
+
+		/// <summary>
+		/// My photo
+		/// </summary>
+		public Pixbuf Photo {
+			get {
+				if (photo != null)
+					return new Pixbuf(photo);
+				else
+					return null;
+			}
+			set {
+				photo=value.SaveToBuffer("png");
+			}
+		}
+		
+		/// <summary>
+		/// Date of birth
+		/// </summary>
+		public DateTime Birthday{
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Nationality
+		/// </summary>
+		public String Nationality{
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Height
+		/// </summary>
+		public float Height{
+			get;
+			set;
+		}
+
+		/// <summary>
+		/// Weight
+		/// </summary>
+		public int Weight{
+			get;
+			set;
+		}
+		
+		/// <summary>
+		/// Whether this player is playing or not and shouldn't be added the 
+		/// list of taggable players 
+		/// </summary>
+		public bool Playing{
+			get;
+			set;
+		}
+		
+		#endregion
+	}
+}
diff --git a/LongoMatch/Store/Project.cs b/LongoMatch/Store/Project.cs
index 7f5633b..7228e0f 100644
--- a/LongoMatch/Store/Project.cs
+++ b/LongoMatch/Store/Project.cs
@@ -1,297 +1,297 @@
-// Project.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Gdk;
-using Gtk;
-using LongoMatch.Common;
-using LongoMatch.Store;
-using LongoMatch.Store.Templates;
-using Mono.Unix;
-
-namespace LongoMatch.Store
-{
-
-	/// <summary>
-	/// I hold the information needed by a project and provide persistency using
-	/// the db4o database.
-	/// I'm structured in the following way:
-	/// -Project Description (<see cref="LongoMatch.Utils.PreviewMediaFile"/>
-	/// -1 Categories Template
-	/// -1 Local Team Template
-	/// -1 Visitor Team Template
-	/// -1 list of <see cref="LongoMatch.Store.MediaTimeNode"/> for each category
-	/// </summary>
-	///
-	[Serializable]
-	public class Project : IComparable
-	{
-
-
-		private List<Play> playsList;
-
-
-		#region Constructors
-		public Project(){
-			playsList = new List<Play>();
-			Categories = new Categories();
-			LocalTeamTemplate = new TeamTemplate();
-			VisitorTeamTemplate = new TeamTemplate();
-		}
-		#endregion
-
-		#region Properties
-		
-		public ProjectDescription Description {
-			get;
-			set;
-		}
-
-		/// <value>
-		/// Categories template
-		/// </value>
-		public Categories Categories {
-			get;
-			set;
-		}
-
-		/// <value>
-		/// Local team template
-		/// </value>
-		public TeamTemplate LocalTeamTemplate {
-			get;
-			set;
-		}
-
-		/// <value>
-		/// Visitor team template
-		/// </value>
-		public TeamTemplate VisitorTeamTemplate {
-			get;
-			set;
-		}
-		
-		#endregion
-
-		#region Public Methods
-		/// <summary>
-		/// Frees all the project's resources helping the GC
-		/// </summary>
-		public void Clear() {
-			playsList.Clear();
-			Categories.Clear();
-			VisitorTeamTemplate.Clear();
-			LocalTeamTemplate.Clear();
-		}
-
-
-		/// <summary>
-		/// Adds a new play to a given category
-		/// </summary>
-		/// <param name="dataSection">
-		/// A <see cref="System.Int32"/>: category index
-		/// </param>
-		/// <param name="start">
-		/// A <see cref="Time"/>: start time of the play
-		/// </param>
-		/// <param name="stop">
-		/// A <see cref="Time"/>: stop time of the play
-		/// </param>
-		/// <param name="thumbnail">
-		/// A <see cref="Pixbuf"/>: snapshot of the play
-		/// </param>
-		/// <returns>
-		/// A <see cref="MediaTimeNode"/>: created play
-		/// </returns>
-		public Play AddPlay(Category category, Time start, Time stop,Pixbuf miniature) {
-			string count= String.Format("{0:000}",playsList.Count+1);
-			string name = String.Format("{0} {1}",category.Name, count);
-			// HACK: Used for capture where fps is not specified, asuming PAL 25fps
-			ushort fps = Description.File != null ? Description.File.Fps : (ushort)25;
-
-			var play = new Play {
-				Name = name,
-				Start = start,
-				Stop = stop,
-				Category = category,
-				Notes = "",
-				Miniature = miniature,
-				Fps = fps,
-			};
-			playsList.Add(play);
-			return play;
-		}
-
-		/// <summary>
-		/// Delete a play from the project
-		/// </summary>
-		/// <param name="tNode">
-		/// A <see cref="MediaTimeNode"/>: play to be deleted
-		/// </param>
-		/// <param name="section">
-		/// A <see cref="System.Int32"/>: category the play belongs to
-		/// </param>
-		public void RemovePlays(List<Play> plays) {
-			foreach (Play play in plays)
-				playsList.Remove(play);
-		}
-
-		/// <summary>
-		/// Delete a category
-		/// </summary>
-		/// <param name="sectionIndex">
-		/// A <see cref="System.Int32"/>: category index
-		/// </param>
-		public void RemoveCategory(Category category) {
-			if (Categories.Count == 1)
-				throw new Exception("You can't remove the last Section");
-			Categories.Remove(category);
-			
-			/* query for all the plays with this Category */
-			var plays = 
-				from play in playsList
-					where play.Category.UUID == category.UUID
-					select play;
-			/* Delete them */
-			foreach (var play in plays)
-				playsList.Remove(play);
-		}
-		
-		public List<Play> PlaysInCategory (Category category){
-			return (from play in playsList
-			        where play.Category.UUID == category.UUID
-			        select play).ToList();
-		}
-		
-		public List<Play> AllPlays (){
-			return (from play in playsList
-			        select play).ToList();
-		}
-		
-		public List<Tag> Tags {
-			get {
-				/* FIXME: Fix that when I have decide what to do with tags*/
-				return new List<Tag>();
-			}
-		}
-		
-		/// <summary>
-		/// Returns a <see cref="Gtk.TreeStore"/> in which project categories are
-		/// root nodes and their respectives plays child nodes
-		/// </summary>
-		/// <returns>
-		/// A <see cref="TreeStore"/>
-		/// </returns>
-		public TreeStore GetModel() {
-			Dictionary<Category, TreeIter> itersDic = new Dictionary<Category, TreeIter>();
-			Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof(Play));
-			
-			IEnumerable<IGrouping<Category, Play>> queryPlaysByCategory = 
-				from play in playsList
-					group play by play.Category;
-			
-			foreach (Category cat in Categories){
-				Gtk.TreeIter iter = dataFileListStore.AppendValues(cat);
-				itersDic.Add(cat, iter);
-			} 
-			
-			foreach (var playsGroup in queryPlaysByCategory) {
-				Category cat = playsGroup.Key;
-				if (!itersDic.ContainsKey(cat))
-					continue;
-				foreach (Play play in playsGroup) {
-					dataFileListStore.AppendValues(itersDic[cat],play);
-				}
-			}
-			return dataFileListStore;
-		}
-
-		public bool Equals(Project project) {
-			if (project == null)
-				return false;
-			else
-				return Description.File.FilePath.Equals(project.Description.File.FilePath);
-		}
-
-		public int CompareTo(object obj) {
-			if (obj is Project) {
-				Project project = (Project) obj;
-				return Description.File.FilePath.CompareTo(project.Description.File.FilePath);
-			}
-			else
-				throw new ArgumentException("object is not a Project and cannot be compared");
-		}
-		
-		public static void Export(Project project, string file) {
-			file = Path.ChangeExtension(file,"lpr");
-			SerializableObject.Save(project, file);
-		}
-		
-		public static Project Import(string file) {
-			try {
-				return SerializableObject.Load<Project>(file);
-			}
-			catch {
-				throw new Exception(Catalog.GetString("The file you are trying to load " +
-				                                      "is not a valid project"));
-			}
-		}		
-		#endregion
-		
-		#region Private Methods
-		private void  FillList<T>(List<T> options, String tagName, TreeStore store) {
-			foreach (var tagValue in options){
-				/* Add a root in the tree with the option name */
-				var iter = store.AppendValues(tagName);
-				var queryByTag = 
-					(from play in playsList
-						where play.HasTag(tagName, tagValue) == true 
-						select play);
-				/* Then add as children of the Player in the tree */
-				foreach (Play play in queryByTag)
-					store.AppendValues(iter, play);
-			}
-		}
-		
-		private TreeStore GetSubCategoryModel(TagSubCategory subcat){
-			TreeStore dataFileListStore = new TreeStore(typeof(object));
-			
-			FillList (subcat.Options, subcat.Name, dataFileListStore);
-			return dataFileListStore;
-		}
-		
-		private TreeStore GetSubCategoryModel(PlayerSubCategory subcat){
-			TreeStore dataFileListStore = new TreeStore(typeof(object));
-			TeamTemplate template;
-			
-			foreach (Team team in subcat.Options){
-				if (team == Team.NONE)
-					continue;
-				template = team == Team.LOCAL?LocalTeamTemplate:VisitorTeamTemplate;
-				FillList(template, subcat.Name, dataFileListStore);
-			}
-			return dataFileListStore;
-		}
-#endregion
-	}
-}
+// Project.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Gdk;
+using Gtk;
+using LongoMatch.Common;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+using Mono.Unix;
+
+namespace LongoMatch.Store
+{
+
+	/// <summary>
+	/// I hold the information needed by a project and provide persistency using
+	/// the db4o database.
+	/// I'm structured in the following way:
+	/// -Project Description (<see cref="LongoMatch.Utils.PreviewMediaFile"/>
+	/// -1 Categories Template
+	/// -1 Local Team Template
+	/// -1 Visitor Team Template
+	/// -1 list of <see cref="LongoMatch.Store.MediaTimeNode"/> for each category
+	/// </summary>
+	///
+	[Serializable]
+	public class Project : IComparable
+	{
+
+
+		private List<Play> playsList;
+
+
+		#region Constructors
+		public Project(){
+			playsList = new List<Play>();
+			Categories = new Categories();
+			LocalTeamTemplate = new TeamTemplate();
+			VisitorTeamTemplate = new TeamTemplate();
+		}
+		#endregion
+
+		#region Properties
+		
+		public ProjectDescription Description {
+			get;
+			set;
+		}
+
+		/// <value>
+		/// Categories template
+		/// </value>
+		public Categories Categories {
+			get;
+			set;
+		}
+
+		/// <value>
+		/// Local team template
+		/// </value>
+		public TeamTemplate LocalTeamTemplate {
+			get;
+			set;
+		}
+
+		/// <value>
+		/// Visitor team template
+		/// </value>
+		public TeamTemplate VisitorTeamTemplate {
+			get;
+			set;
+		}
+		
+		#endregion
+
+		#region Public Methods
+		/// <summary>
+		/// Frees all the project's resources helping the GC
+		/// </summary>
+		public void Clear() {
+			playsList.Clear();
+			Categories.Clear();
+			VisitorTeamTemplate.Clear();
+			LocalTeamTemplate.Clear();
+		}
+
+
+		/// <summary>
+		/// Adds a new play to a given category
+		/// </summary>
+		/// <param name="dataSection">
+		/// A <see cref="System.Int32"/>: category index
+		/// </param>
+		/// <param name="start">
+		/// A <see cref="Time"/>: start time of the play
+		/// </param>
+		/// <param name="stop">
+		/// A <see cref="Time"/>: stop time of the play
+		/// </param>
+		/// <param name="thumbnail">
+		/// A <see cref="Pixbuf"/>: snapshot of the play
+		/// </param>
+		/// <returns>
+		/// A <see cref="MediaTimeNode"/>: created play
+		/// </returns>
+		public Play AddPlay(Category category, Time start, Time stop,Pixbuf miniature) {
+			string count= String.Format("{0:000}",playsList.Count+1);
+			string name = String.Format("{0} {1}",category.Name, count);
+			// HACK: Used for capture where fps is not specified, asuming PAL 25fps
+			ushort fps = Description.File != null ? Description.File.Fps : (ushort)25;
+
+			var play = new Play {
+				Name = name,
+				Start = start,
+				Stop = stop,
+				Category = category,
+				Notes = "",
+				Miniature = miniature,
+				Fps = fps,
+			};
+			playsList.Add(play);
+			return play;
+		}
+
+		/// <summary>
+		/// Delete a play from the project
+		/// </summary>
+		/// <param name="tNode">
+		/// A <see cref="MediaTimeNode"/>: play to be deleted
+		/// </param>
+		/// <param name="section">
+		/// A <see cref="System.Int32"/>: category the play belongs to
+		/// </param>
+		public void RemovePlays(List<Play> plays) {
+			foreach (Play play in plays)
+				playsList.Remove(play);
+		}
+
+		/// <summary>
+		/// Delete a category
+		/// </summary>
+		/// <param name="sectionIndex">
+		/// A <see cref="System.Int32"/>: category index
+		/// </param>
+		public void RemoveCategory(Category category) {
+			if (Categories.Count == 1)
+				throw new Exception("You can't remove the last Section");
+			Categories.Remove(category);
+			
+			/* query for all the plays with this Category */
+			var plays = 
+				from play in playsList
+					where play.Category.UUID == category.UUID
+					select play;
+			/* Delete them */
+			foreach (var play in plays)
+				playsList.Remove(play);
+		}
+		
+		public List<Play> PlaysInCategory (Category category){
+			return (from play in playsList
+			        where play.Category.UUID == category.UUID
+			        select play).ToList();
+		}
+		
+		public List<Play> AllPlays (){
+			return (from play in playsList
+			        select play).ToList();
+		}
+		
+		public List<Tag> Tags {
+			get {
+				/* FIXME: Fix that when I have decide what to do with tags*/
+				return new List<Tag>();
+			}
+		}
+		
+		/// <summary>
+		/// Returns a <see cref="Gtk.TreeStore"/> in which project categories are
+		/// root nodes and their respectives plays child nodes
+		/// </summary>
+		/// <returns>
+		/// A <see cref="TreeStore"/>
+		/// </returns>
+		public TreeStore GetModel() {
+			Dictionary<Category, TreeIter> itersDic = new Dictionary<Category, TreeIter>();
+			Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof(Play));
+			
+			IEnumerable<IGrouping<Category, Play>> queryPlaysByCategory = 
+				from play in playsList
+					group play by play.Category;
+			
+			foreach (Category cat in Categories){
+				Gtk.TreeIter iter = dataFileListStore.AppendValues(cat);
+				itersDic.Add(cat, iter);
+			} 
+			
+			foreach (var playsGroup in queryPlaysByCategory) {
+				Category cat = playsGroup.Key;
+				if (!itersDic.ContainsKey(cat))
+					continue;
+				foreach (Play play in playsGroup) {
+					dataFileListStore.AppendValues(itersDic[cat],play);
+				}
+			}
+			return dataFileListStore;
+		}
+
+		public bool Equals(Project project) {
+			if (project == null)
+				return false;
+			else
+				return Description.File.FilePath.Equals(project.Description.File.FilePath);
+		}
+
+		public int CompareTo(object obj) {
+			if (obj is Project) {
+				Project project = (Project) obj;
+				return Description.File.FilePath.CompareTo(project.Description.File.FilePath);
+			}
+			else
+				throw new ArgumentException("object is not a Project and cannot be compared");
+		}
+		
+		public static void Export(Project project, string file) {
+			file = Path.ChangeExtension(file,"lpr");
+			SerializableObject.Save(project, file);
+		}
+		
+		public static Project Import(string file) {
+			try {
+				return SerializableObject.Load<Project>(file);
+			}
+			catch {
+				throw new Exception(Catalog.GetString("The file you are trying to load " +
+				                                      "is not a valid project"));
+			}
+		}		
+		#endregion
+		
+		#region Private Methods
+		private void  FillList<T>(List<T> options, String tagName, TreeStore store) {
+			foreach (var tagValue in options){
+				/* Add a root in the tree with the option name */
+				var iter = store.AppendValues(tagName);
+				var queryByTag = 
+					(from play in playsList
+						where play.HasTag(tagName, tagValue) == true 
+						select play);
+				/* Then add as children of the Player in the tree */
+				foreach (Play play in queryByTag)
+					store.AppendValues(iter, play);
+			}
+		}
+		
+		private TreeStore GetSubCategoryModel(TagSubCategory subcat){
+			TreeStore dataFileListStore = new TreeStore(typeof(object));
+			
+			FillList (subcat.Options, subcat.Name, dataFileListStore);
+			return dataFileListStore;
+		}
+		
+		private TreeStore GetSubCategoryModel(PlayerSubCategory subcat){
+			TreeStore dataFileListStore = new TreeStore(typeof(object));
+			TeamTemplate template;
+			
+			foreach (Team team in subcat.Options){
+				if (team == Team.NONE)
+					continue;
+				template = team == Team.LOCAL?LocalTeamTemplate:VisitorTeamTemplate;
+				FillList(template, subcat.Name, dataFileListStore);
+			}
+			return dataFileListStore;
+		}
+#endregion
+	}
+}
diff --git a/LongoMatch/Store/Time.cs b/LongoMatch/Store/Time.cs
index 1209eb6..9269816 100644
--- a/LongoMatch/Store/Time.cs
+++ b/LongoMatch/Store/Time.cs
@@ -1,157 +1,157 @@
-// Time.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-
-namespace LongoMatch.Store
-{
-
-	/// <summary>
-	/// Represents a time instant. Other objects uses it to keep consistency in the time units consitency.
-	/// It's expressed in miliseconds and provide some helper methods for time conversion and representation
-	/// </summary>
-	[Serializable]
-	public class Time :  IComparable
-	{
-		private const int MS = 1000000 ;
-		public const int SECONDS_TO_TIME = 1000;
-	
-		#region Constructors
-		public Time() {
-		}
-		#endregion
-
-		//// <summary>
-		/// Time in miliseconds
-		/// </summary>
-		#region Properties
-		public int MSeconds {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Time in seconds
-		/// </summary>
-		public int Seconds {
-			get {
-				return MSeconds/SECONDS_TO_TIME;
-			}
-			set {
-				MSeconds = value * SECONDS_TO_TIME;
-			}
-		}
-		#endregion
-
-		#region Public methods
-		/// <summary>
-		/// String representation in seconds
-		/// </summary>
-		/// <returns>
-		/// A <see cref="System.String"/>
-		/// </returns>
-		public  string ToSecondsString()
-		{
-			int _h, _m, _s, _time;
-
-			_time = MSeconds / 1000;
-			_h = (_time / 3600);
-			_m = ((_time % 3600) / 60);
-			_s = ((_time % 3600) % 60);
-
-			if (_h > 0)
-				return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
-				                     _s.ToString("d2"));
-
-			return String.Format("{0}:{1}", _m, _s.ToString("d2"));
-		}
-
-		/// <summary>
-		/// String representation including the milisenconds information
-		/// </summary>
-		/// <returns>
-		/// A <see cref="System.String"/>
-		/// </returns>
-		public  string ToMSecondsString()
-		{
-			int _ms ;
-			_ms = ((MSeconds % 3600000)%60000)%1000;
-
-			return String.Format("{0},{1}", ToSecondsString(), _ms.ToString("d3"));
-		}
-
-		public override bool Equals(object o)
-		{
-			if (o is Time) {
-				return ((Time)o).MSeconds == MSeconds;
-			}
-			else return false;
-		}
-
-		public override int GetHashCode()
-		{
-			return base.GetHashCode();
-		}
-
-		public int CompareTo(object obj) {
-			if (obj is Time)
-			{
-				Time  otherTime = (Time) obj;
-				return MSeconds.CompareTo(otherTime.MSeconds);
-			}
-			else throw new ArgumentException("Object is not a Temperature");
-		}
-		#endregion
-
-		#region Operators
-		public static bool operator < (Time t1,Time t2) {
-			return t1.MSeconds < t2.MSeconds;
-		}
-
-		public static bool operator > (Time t1,Time t2) {
-			return t1.MSeconds > t2.MSeconds;
-		}
-
-		public static bool operator <= (Time t1,Time t2) {
-			return t1.MSeconds <= t2.MSeconds;
-		}
-
-		public static bool operator >= (Time t1,Time t2) {
-			return t1.MSeconds >= t2.MSeconds;
-		}
-
-		public static Time operator +(Time t1,int t2) {
-			return new Time {MSeconds = t1.MSeconds+t2};
-		}
-
-		public static Time operator +(Time t1,Time t2) {
-			return new Time {MSeconds = t1.MSeconds+t2.MSeconds};
-		}
-
-		public  static Time operator -(Time t1,Time t2) {
-			return new Time {MSeconds = t1.MSeconds-t2.MSeconds};
-		}
-
-		public  static Time operator -(Time t1,int t2) {
-			return new Time {MSeconds = t1.MSeconds-t2};
-		}
-		#endregion
-	}
+// Time.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+
+namespace LongoMatch.Store
+{
+
+	/// <summary>
+	/// Represents a time instant. Other objects uses it to keep consistency in the time units consitency.
+	/// It's expressed in miliseconds and provide some helper methods for time conversion and representation
+	/// </summary>
+	[Serializable]
+	public class Time :  IComparable
+	{
+		private const int MS = 1000000 ;
+		public const int SECONDS_TO_TIME = 1000;
+	
+		#region Constructors
+		public Time() {
+		}
+		#endregion
+
+		//// <summary>
+		/// Time in miliseconds
+		/// </summary>
+		#region Properties
+		public int MSeconds {
+			get;
+			set;
+		}
+
+		/// <summary>
+		/// Time in seconds
+		/// </summary>
+		public int Seconds {
+			get {
+				return MSeconds/SECONDS_TO_TIME;
+			}
+			set {
+				MSeconds = value * SECONDS_TO_TIME;
+			}
+		}
+		#endregion
+
+		#region Public methods
+		/// <summary>
+		/// String representation in seconds
+		/// </summary>
+		/// <returns>
+		/// A <see cref="System.String"/>
+		/// </returns>
+		public  string ToSecondsString()
+		{
+			int _h, _m, _s, _time;
+
+			_time = MSeconds / 1000;
+			_h = (_time / 3600);
+			_m = ((_time % 3600) / 60);
+			_s = ((_time % 3600) % 60);
+
+			if (_h > 0)
+				return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
+				                     _s.ToString("d2"));
+
+			return String.Format("{0}:{1}", _m, _s.ToString("d2"));
+		}
+
+		/// <summary>
+		/// String representation including the milisenconds information
+		/// </summary>
+		/// <returns>
+		/// A <see cref="System.String"/>
+		/// </returns>
+		public  string ToMSecondsString()
+		{
+			int _ms ;
+			_ms = ((MSeconds % 3600000)%60000)%1000;
+
+			return String.Format("{0},{1}", ToSecondsString(), _ms.ToString("d3"));
+		}
+
+		public override bool Equals(object o)
+		{
+			if (o is Time) {
+				return ((Time)o).MSeconds == MSeconds;
+			}
+			else return false;
+		}
+
+		public override int GetHashCode()
+		{
+			return base.GetHashCode();
+		}
+
+		public int CompareTo(object obj) {
+			if (obj is Time)
+			{
+				Time  otherTime = (Time) obj;
+				return MSeconds.CompareTo(otherTime.MSeconds);
+			}
+			else throw new ArgumentException("Object is not a Temperature");
+		}
+		#endregion
+
+		#region Operators
+		public static bool operator < (Time t1,Time t2) {
+			return t1.MSeconds < t2.MSeconds;
+		}
+
+		public static bool operator > (Time t1,Time t2) {
+			return t1.MSeconds > t2.MSeconds;
+		}
+
+		public static bool operator <= (Time t1,Time t2) {
+			return t1.MSeconds <= t2.MSeconds;
+		}
+
+		public static bool operator >= (Time t1,Time t2) {
+			return t1.MSeconds >= t2.MSeconds;
+		}
+
+		public static Time operator +(Time t1,int t2) {
+			return new Time {MSeconds = t1.MSeconds+t2};
+		}
+
+		public static Time operator +(Time t1,Time t2) {
+			return new Time {MSeconds = t1.MSeconds+t2.MSeconds};
+		}
+
+		public  static Time operator -(Time t1,Time t2) {
+			return new Time {MSeconds = t1.MSeconds-t2.MSeconds};
+		}
+
+		public  static Time operator -(Time t1,int t2) {
+			return new Time {MSeconds = t1.MSeconds-t2};
+		}
+		#endregion
+	}
 }
\ No newline at end of file
diff --git a/LongoMatch/Updates/Updater.cs b/LongoMatch/Updates/Updater.cs
index 11e8f7c..567d906 100644
--- a/LongoMatch/Updates/Updater.cs
+++ b/LongoMatch/Updates/Updater.cs
@@ -1,102 +1,102 @@
-// Updater.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using System.Reflection;
-using System.Net;
-using System.Threading;
-
-namespace LongoMatch.Updates
-{
-
-
-	public class Updater
-	{
-		public event LongoMatch.Handlers.NewVersionHandler NewVersion;
-
-		private Version actual;
-		private Version update;
-
-		private const string UPDATE_INFO_URL="http://www.ylatuya.es/updates/version.xml";;
-		private string temp_file = null;
-		private string downloadURL;
-
-		#region Constructors
-		public Updater()
-		{
-			this.actual = Assembly.GetExecutingAssembly().GetName().Version;
-			this.temp_file = System.IO.Path.Combine(MainClass.TemplatesDir(),"version.xml");
-		}
-		#endregion
-		#region Private methods
-		private void FetchNewVersion() {
-			WebClient wb = new WebClient();
-			try {
-				wb.DownloadFile(UPDATE_INFO_URL,temp_file);
-				XmlUpdateParser parser = new XmlUpdateParser(temp_file);
-				update = parser.UpdateVersion;
-				downloadURL = parser.DownloadURL;
-			}
-			catch (Exception ex) {
-				Console.WriteLine("Error downloading version file:\n"+ex);
-				update = actual;
-			}
-		}
-
-		private bool ConexionExists() {
-			try {
-				System.Net.Dns.GetHostEntry("www.ylatuya.es");
-				return true;
-			}
-			catch {
-				update = actual;
-				return false;
-			}
-		}
-
-		private bool IsOutDated() {
-			if (update.Major > actual.Major)
-				return true;
-			else if (update.Minor > actual.Minor)
-				return true;
-			else if (update.Build > actual.Build)
-				return true;
-			else
-				return false;
-		}
-
-		private void CheckForUpdates() {
-			if (ConexionExists())
-				this.FetchNewVersion();
-			if (NewVersion != null && IsOutDated()) {
-				Gtk.Application.Invoke(delegate {this.NewVersion(update,downloadURL);});
-			}
-		}
-		#endregion
-
-		#region Public methods
-		public void Run() {
-			Thread thread = new Thread(new ThreadStart(CheckForUpdates));
-			thread.Start();
-		}
-		#endregion
-
-	}
-}
+// Updater.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using System.Reflection;
+using System.Net;
+using System.Threading;
+
+namespace LongoMatch.Updates
+{
+
+
+	public class Updater
+	{
+		public event LongoMatch.Handlers.NewVersionHandler NewVersion;
+
+		private Version actual;
+		private Version update;
+
+		private const string UPDATE_INFO_URL="http://www.ylatuya.es/updates/version.xml";;
+		private string temp_file = null;
+		private string downloadURL;
+
+		#region Constructors
+		public Updater()
+		{
+			this.actual = Assembly.GetExecutingAssembly().GetName().Version;
+			this.temp_file = System.IO.Path.Combine(MainClass.TemplatesDir(),"version.xml");
+		}
+		#endregion
+		#region Private methods
+		private void FetchNewVersion() {
+			WebClient wb = new WebClient();
+			try {
+				wb.DownloadFile(UPDATE_INFO_URL,temp_file);
+				XmlUpdateParser parser = new XmlUpdateParser(temp_file);
+				update = parser.UpdateVersion;
+				downloadURL = parser.DownloadURL;
+			}
+			catch (Exception ex) {
+				Console.WriteLine("Error downloading version file:\n"+ex);
+				update = actual;
+			}
+		}
+
+		private bool ConexionExists() {
+			try {
+				System.Net.Dns.GetHostEntry("www.ylatuya.es");
+				return true;
+			}
+			catch {
+				update = actual;
+				return false;
+			}
+		}
+
+		private bool IsOutDated() {
+			if (update.Major > actual.Major)
+				return true;
+			else if (update.Minor > actual.Minor)
+				return true;
+			else if (update.Build > actual.Build)
+				return true;
+			else
+				return false;
+		}
+
+		private void CheckForUpdates() {
+			if (ConexionExists())
+				this.FetchNewVersion();
+			if (NewVersion != null && IsOutDated()) {
+				Gtk.Application.Invoke(delegate {this.NewVersion(update,downloadURL);});
+			}
+		}
+		#endregion
+
+		#region Public methods
+		public void Run() {
+			Thread thread = new Thread(new ThreadStart(CheckForUpdates));
+			thread.Start();
+		}
+		#endregion
+
+	}
+}
diff --git a/LongoMatch/Updates/XmlUpdateParser.cs b/LongoMatch/Updates/XmlUpdateParser.cs
index 6b5fed4..e44ade8 100644
--- a/LongoMatch/Updates/XmlUpdateParser.cs
+++ b/LongoMatch/Updates/XmlUpdateParser.cs
@@ -1,74 +1,74 @@
-// XmlUpdateParser.cs
-//
-//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-//
-
-using System;
-using LongoMatch.IO;
-
-namespace LongoMatch.Updates
-{
-
-
-	public class XmlUpdateParser
-	{
-		XMLReader reader;
-		Version updateVersion;
-		string downloadURL;
-		string oSVersion;
-
-		#region Constructors
-		public XmlUpdateParser(string file)
-		{
-			if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
-				this.oSVersion = "win32";
-			else
-				this.oSVersion = "unix";
-			reader = new XMLReader(file);
-			ParseVersion();
-			ParseURL();
-		}
-		#endregion
-
-		private void ParseVersion() {
-			int major,minor,build;
-
-			major = reader.GetIntValue("VersionInfo","major_"+oSVersion);
-			minor = reader.GetIntValue("VersionInfo","minor_"+oSVersion);
-			build = reader.GetIntValue("VersionInfo","build_"+oSVersion);
-
-			updateVersion = new Version(major,minor,build);
-		}
-
-		private void ParseURL() {
-			downloadURL = reader.GetStringValue("VersionInfo","url_"+oSVersion);
-		}
-
-		public string DownloadURL {
-			get {
-				return downloadURL;
-			}
-		}
-
-		public Version UpdateVersion {
-			get {
-				return updateVersion;
-			}
-		}
-	}
-}
+// XmlUpdateParser.cs
+//
+//  Copyright (C) 2007-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//
+
+using System;
+using LongoMatch.IO;
+
+namespace LongoMatch.Updates
+{
+
+
+	public class XmlUpdateParser
+	{
+		XMLReader reader;
+		Version updateVersion;
+		string downloadURL;
+		string oSVersion;
+
+		#region Constructors
+		public XmlUpdateParser(string file)
+		{
+			if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
+				this.oSVersion = "win32";
+			else
+				this.oSVersion = "unix";
+			reader = new XMLReader(file);
+			ParseVersion();
+			ParseURL();
+		}
+		#endregion
+
+		private void ParseVersion() {
+			int major,minor,build;
+
+			major = reader.GetIntValue("VersionInfo","major_"+oSVersion);
+			minor = reader.GetIntValue("VersionInfo","minor_"+oSVersion);
+			build = reader.GetIntValue("VersionInfo","build_"+oSVersion);
+
+			updateVersion = new Version(major,minor,build);
+		}
+
+		private void ParseURL() {
+			downloadURL = reader.GetStringValue("VersionInfo","url_"+oSVersion);
+		}
+
+		public string DownloadURL {
+			get {
+				return downloadURL;
+			}
+		}
+
+		public Version UpdateVersion {
+			get {
+				return updateVersion;
+			}
+		}
+	}
+}
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
index 965f069..24f1cf4 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
@@ -60,7 +60,7 @@ namespace LongoMatch.Gui.Component
 			this.nameentry.CanFocus = true;
 			this.nameentry.Name = "nameentry";
 			this.nameentry.IsEditable = true;
-			this.nameentry.InvisibleChar = 'â??';
+			this.nameentry.InvisibleChar = '.ùÅ';
 			this.hbox4.Add (this.nameentry);
 			global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.nameentry]));
 			w2.Position = 1;
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs
index 33aa7ec..ec005be 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs
@@ -230,7 +230,7 @@ namespace LongoMatch.Gui.Component
 			this.nameentry.CanFocus = true;
 			this.nameentry.Name = "nameentry";
 			this.nameentry.IsEditable = true;
-			this.nameentry.InvisibleChar = 'â??';
+			this.nameentry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.nameentry);
 			global::Gtk.Table.TableChild w17 = ((global::Gtk.Table.TableChild)(this.table1[this.nameentry]));
 			w17.LeftAttach = ((uint)(1));
@@ -242,7 +242,7 @@ namespace LongoMatch.Gui.Component
 			this.nationalityentry.CanFocus = true;
 			this.nationalityentry.Name = "nationalityentry";
 			this.nationalityentry.IsEditable = true;
-			this.nationalityentry.InvisibleChar = 'â??';
+			this.nationalityentry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.nationalityentry);
 			global::Gtk.Table.TableChild w18 = ((global::Gtk.Table.TableChild)(this.table1[this.nationalityentry]));
 			w18.TopAttach = ((uint)(6));
@@ -284,7 +284,7 @@ namespace LongoMatch.Gui.Component
 			this.positionentry.CanFocus = true;
 			this.positionentry.Name = "positionentry";
 			this.positionentry.IsEditable = true;
-			this.positionentry.InvisibleChar = 'â??';
+			this.positionentry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.positionentry);
 			global::Gtk.Table.TableChild w21 = ((global::Gtk.Table.TableChild)(this.table1[this.positionentry]));
 			w21.TopAttach = ((uint)(2));
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
index 90c9351..35fdb46 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectDetailsWidget.cs
@@ -120,7 +120,7 @@ namespace LongoMatch.Gui.Component
 			this.competitionentry.CanFocus = true;
 			this.competitionentry.Name = "competitionentry";
 			this.competitionentry.IsEditable = true;
-			this.competitionentry.InvisibleChar = 'â??';
+			this.competitionentry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.competitionentry);
 			global::Gtk.Table.TableChild w1 = ((global::Gtk.Table.TableChild)(this.table1[this.competitionentry]));
 			w1.TopAttach = ((uint)(4));
@@ -148,7 +148,7 @@ namespace LongoMatch.Gui.Component
 			this.fileEntry.CanFocus = true;
 			this.fileEntry.Name = "fileEntry";
 			this.fileEntry.IsEditable = false;
-			this.fileEntry.InvisibleChar = 'â??';
+			this.fileEntry.InvisibleChar = '.ùÅ';
 			this.filehbox.Add (this.fileEntry);
 			global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.filehbox[this.fileEntry]));
 			w3.Position = 0;
@@ -325,7 +325,7 @@ namespace LongoMatch.Gui.Component
 			this.dateEntry.CanFocus = true;
 			this.dateEntry.Name = "dateEntry";
 			this.dateEntry.IsEditable = false;
-			this.dateEntry.InvisibleChar = 'â??';
+			this.dateEntry.InvisibleChar = '.ùÅ';
 			this.hbox5.Add (this.dateEntry);
 			global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox5[this.dateEntry]));
 			w20.Position = 0;
@@ -415,7 +415,7 @@ namespace LongoMatch.Gui.Component
 			this.localTeamEntry.CanFocus = true;
 			this.localTeamEntry.Name = "localTeamEntry";
 			this.localTeamEntry.IsEditable = true;
-			this.localTeamEntry.InvisibleChar = 'â??';
+			this.localTeamEntry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.localTeamEntry);
 			global::Gtk.Table.TableChild w36 = ((global::Gtk.Table.TableChild)(this.table1[this.localTeamEntry]));
 			w36.LeftAttach = ((uint)(1));
@@ -435,7 +435,7 @@ namespace LongoMatch.Gui.Component
 			this.seasonentry.CanFocus = true;
 			this.seasonentry.Name = "seasonentry";
 			this.seasonentry.IsEditable = true;
-			this.seasonentry.InvisibleChar = 'â??';
+			this.seasonentry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.seasonentry);
 			global::Gtk.Table.TableChild w38 = ((global::Gtk.Table.TableChild)(this.table1[this.seasonentry]));
 			w38.TopAttach = ((uint)(3));
@@ -459,7 +459,7 @@ namespace LongoMatch.Gui.Component
 			this.visitorTeamEntry.CanFocus = true;
 			this.visitorTeamEntry.Name = "visitorTeamEntry";
 			this.visitorTeamEntry.IsEditable = true;
-			this.visitorTeamEntry.InvisibleChar = 'â??';
+			this.visitorTeamEntry.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.visitorTeamEntry);
 			global::Gtk.Table.TableChild w40 = ((global::Gtk.Table.TableChild)(this.table1[this.visitorTeamEntry]));
 			w40.TopAttach = ((uint)(1));
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectListWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectListWidget.cs
index c5fc46d..90d3018 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectListWidget.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.ProjectListWidget.cs
@@ -51,7 +51,7 @@ namespace LongoMatch.Gui.Component
 			this.filterEntry.CanFocus = true;
 			this.filterEntry.Name = "filterEntry";
 			this.filterEntry.IsEditable = true;
-			this.filterEntry.InvisibleChar = 'â??';
+			this.filterEntry.InvisibleChar = '.ùÅ';
 			this.hbox1.Add (this.filterEntry);
 			global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.filterEntry]));
 			w3.Position = 1;
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TaggerWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TaggerWidget.cs
index 2942355..0bb973a 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TaggerWidget.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.TaggerWidget.cs
@@ -64,7 +64,7 @@ namespace LongoMatch.Gui.Component
 			this.entry1.CanFocus = true;
 			this.entry1.Name = "entry1";
 			this.entry1.IsEditable = true;
-			this.entry1.InvisibleChar = 'â?¢';
+			this.entry1.InvisibleChar = '.Çó';
 			this.hbox1.Add (this.entry1);
 			global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.entry1]));
 			w6.Position = 0;
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.EntryDialog.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.EntryDialog.cs
index 61634e6..3040e4e 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.EntryDialog.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.EntryDialog.cs
@@ -64,7 +64,7 @@ namespace LongoMatch.Gui.Dialog
 			this.entry1.CanFocus = true;
 			this.entry1.Name = "entry1";
 			this.entry1.IsEditable = true;
-			this.entry1.InvisibleChar = 'â??';
+			this.entry1.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.entry1);
 			global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1[this.entry1]));
 			w3.LeftAttach = ((uint)(1));
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.SnapshotsDialog.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.SnapshotsDialog.cs
index 6be2e54..6535f81 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.SnapshotsDialog.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.SnapshotsDialog.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui.Dialog
 			this.entry1.CanFocus = true;
 			this.entry1.Name = "entry1";
 			this.entry1.IsEditable = true;
-			this.entry1.InvisibleChar = 'â??';
+			this.entry1.InvisibleChar = '.ùÅ';
 			this.table1.Add (this.entry1);
 			global::Gtk.Table.TableChild w2 = ((global::Gtk.Table.TableChild)(this.table1[this.entry1]));
 			w2.TopAttach = ((uint)(1));
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
index 0b51d5e..75546d4 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.VideoEditionProperties.cs
@@ -199,7 +199,7 @@ namespace LongoMatch.Gui.Dialog
 			this.fileentry.CanFocus = true;
 			this.fileentry.Name = "fileentry";
 			this.fileentry.IsEditable = false;
-			this.fileentry.InvisibleChar = 'â??';
+			this.fileentry.InvisibleChar = '.ùÅ';
 			this.hbox3.Add (this.fileentry);
 			global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.hbox3[this.fileentry]));
 			w15.Position = 0;



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