[longomatch/fakelive] Refactor to clean up MainWindow



commit 320a3f5335f3dbdf8729cc7fad1c45cfd3ba3320
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Mar 15 22:36:12 2010 +0100

    Refactor to clean up MainWindow

 LongoMatch/Gui/Dialog/ProjectsManager.cs |   12 +-
 LongoMatch/Gui/MainWindow.cs             |  454 +++++++++---------------------
 LongoMatch/LongoMatch.mdp                |    2 +
 LongoMatch/Makefile.am                   |    3 +-
 4 files changed, 142 insertions(+), 329 deletions(-)
---
diff --git a/LongoMatch/Gui/Dialog/ProjectsManager.cs b/LongoMatch/Gui/Dialog/ProjectsManager.cs
index e1a7ad6..9675213 100644
--- a/LongoMatch/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch/Gui/Dialog/ProjectsManager.cs
@@ -34,11 +34,13 @@ namespace LongoMatch.Gui.Dialog
 	public partial class ProjectsManager : Gtk.Dialog
 	{
 
-		private string originalFilePath;
+		private string originalFilePath;
+		private Project openedProject;
 
-		public ProjectsManager()
+		public ProjectsManager(Project openedProject)
 		{
-			this.Build();
+			this.Build();
+			this.openedProject = openedProject;
 			this.Fill();
 			this.projectdetails.Use = ProjectType.EditProject;
 			projectdetails.Edited = false;
@@ -95,7 +97,7 @@ namespace LongoMatch.Gui.Dialog
 		{
 			ProjectDescription selectedProject = projectlistwidget1.GetSelection();
 			if (selectedProject != null) {
-				if (MainWindow.OpenedProject() != null &&selectedProject.File == MainWindow.OpenedProject().File.FilePath) {
+				if (openedProject != null && selectedProject.File == openedProject.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"));
@@ -138,7 +140,7 @@ namespace LongoMatch.Gui.Dialog
 				PromptToSaveEditedProject();
 			}
 			
-			if (MainWindow.OpenedProject() != null && project.File == MainWindow.OpenedProject().File.FilePath) {
+			if (openedProject != null && project.File == openedProject.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"));
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index c6b06e9..af2bee2 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -35,6 +35,7 @@ using LongoMatch.Video.Capturer;
 using LongoMatch.Video.Player;
 using LongoMatch.Video.Utils;
 using LongoMatch.Updates;
+using LongoMatch.Utils;
 using LongoMatch.IO;
 using LongoMatch.Handlers;
 using System.Reflection;
@@ -105,8 +106,6 @@ namespace LongoMatch.Gui
 		}
 
 		#endregion
-
-
 		
 		#region Private Methods
 		private void SetProject(Project project, ProjectType projectType) {
@@ -120,10 +119,10 @@ namespace LongoMatch.Gui
 					// Check if the file associated to the project exists
 					if (!File.Exists(project.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."));
+						                          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);
-					}
-					else {
+					} else {
 						Title = System.IO.Path.GetFileNameWithoutExtension(project.File.FilePath) + " - LongoMatch";
 						try {
 							playerbin1.Open(project.File.FilePath);							
@@ -188,8 +187,7 @@ namespace LongoMatch.Gui
 				eManager.Capturer = null;
 				if (capturerBin != null)
 					capturerBin.Destroy();
-			}
-			else {
+			} else {
 				playerbin1.Close();
 				playerbin1.LogoMode = true;
 			}
@@ -249,9 +247,9 @@ namespace LongoMatch.Gui
 
 		private void SaveProject() {
 			if (openedProject != null && projectType == ProjectType.NewFileProject) {
-				MainClass.DB.UpdateProject(OpenedProject());
+				MainClass.DB.UpdateProject(openedProject);
 			} else if (projectType == ProjectType.NewFakeCaptureProject)
-				SaveFakeLiveProject(openedProject);
+				ProjectUtils.SaveFakeLiveProject(openedProject, this);
 		}
 		
 		private bool PromptCloseProject(){
@@ -273,77 +271,40 @@ namespace LongoMatch.Gui
 			if (res == (int)EndCaptureResponse.Quit){
 				CloseOpenedProject(false);
 				return true;
-			}
-			/* Close and save project */
-			else if (res == (int)EndCaptureResponse.Save){
+			} else if (res == (int)EndCaptureResponse.Save){
+				/* Close and save project */
 				CloseOpenedProject(true);
 				return true;
-			}
-			else
+			} else
 				/* Continue with the current project */
 				return false;			
 		}
 		
-		private void SaveFakeLiveProject(Project project){
-			MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
-			                                     Catalog.GetString("The project will be saved to a file. You can insert it later into the database using the "+
-			                                                       "\"Import project\" function once you copied the video file to your computer"));			                                           
-			if (md.Run() == (int)ResponseType.Cancel){
-				md.Destroy();
+		private void CloseAndQuit(){
+			if (!PromptCloseProject())
 				return;
-			}else
-				md.Destroy();
-			                                                                       
-			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 = "LongoMatch Project";
-			filter.AddPattern("*.lpr");
-
-			fChooser.AddFilter(filter);
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				Project.Export(project, fChooser.Filename);
-				MessagePopup.PopupMessage(this.Toplevel, MessageType.Info, 
-				                          Catalog.GetString("Project saved successfully."));			  
-			}
-			fChooser.Destroy();
-		}
-
-		#endregion
-
-		#region Public Methods
-		public static Project OpenedProject() {
-			return openedProject;
-		}
-
-		#endregion
-
-		#region Callbacks
-
-		protected virtual void OnUnrealized(object sender, System.EventArgs e) {
-			Destroy();
+			playlistwidget2.StopEdition();
+			SaveProject();
+			playerbin1.Dispose();
 			Application.Quit();
 		}
+		#endregion	
 
-
-		protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
-		{
-			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.SectionsTemplate);
-			tManager.TransientFor = this;
-			tManager.Show();
-		}
-
-		protected virtual void OnTeamsTemplatesManagerActionActivated(object sender, System.EventArgs e)
+		#region Callbacks
+		#region File
+		protected virtual void OnNewActivated(object sender, System.EventArgs e)
 		{
-			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.TeamTemplate);
-			tManager.TransientFor = this;
-			tManager.Show();
+			Project project;
+			ProjectType projectType;
+			
+			if (!PromptCloseProject())
+				return;
+			
+			ProjectUtils.CreateNewProject(this, out project, out projectType);	
+			if (project != null)
+				SetProject(project, projectType);
 		}
-
+		
 		protected virtual void OnOpenActivated(object sender, System.EventArgs e)
 		{
 			if (!PromptCloseProject())
@@ -359,56 +320,12 @@ namespace LongoMatch.Gui
 			if (project != null)
 				SetProject(MainClass.DB.GetProject(project.File), ProjectType.NewFileProject);
 		}
-
-		protected virtual void OnNewActivated(object sender, System.EventArgs e)
+		
+		protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
 		{
-			Project project;
-			ProjectType type;
-			ProjectSelectionDialog psd;
-			NewProjectDialog npd;
-			
-			if (!PromptCloseProject())
-				return;
-			
-			// Show the project selection dialog
-			psd = new ProjectSelectionDialog();
-			psd.TransientFor = this;
-			if (psd.Run() != (int)ResponseType.Ok){		
-				psd.Destroy();
-				return;
-			}
-			type = psd.Type;
-			psd.Destroy();
-			
-			// Show the new project dialog and wait the get a valid project or for the 
-			// the user cancelling the creation of a new project;
-			npd = new NewProjectDialog();
-			npd.TransientFor = this;
-			npd.Use = type;
-			int response = npd.Run();
-			while (response == (int)ResponseType.Ok && npd.Project == null) {
-				MessagePopup.PopupMessage(this, MessageType.Info,
-				                          Catalog.GetString("Please, select a video file."));
-				response=npd.Run();
-			}
-			npd.Destroy();
-			// Si se cumplen las condiciones y se ha pulsado el botón aceptar continuamos
-			if (response ==(int)ResponseType.Ok) {
-				project = npd.Project;
-				if (type == ProjectType.NewFileProject) {
-					try {
-						MainClass.DB.AddProject(project);
-					}
-					catch {
-						MessagePopup.PopupMessage(this, MessageType.Error,
-						                          Catalog.GetString("This file is already used in a Project.")+"\n"+Catalog.GetString("Open the project, please."));
-						return;
-					}					
-				}
-				SetProject(project, type);				
-			}
+			SaveProject();
 		}
-
+		
 		protected virtual void OnCloseActivated(object sender, System.EventArgs e)
 		{
 			PromptCloseProject();
@@ -416,113 +333,47 @@ namespace LongoMatch.Gui
 		
 		protected virtual void OnImportProjectActionActivated (object sender, System.EventArgs e)
 		{
-			NewProjectDialog npd=null;
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Import Project"),
-			                (Gtk.Window)Toplevel,
-			                FileChooserAction.Open,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-open",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.HomeDir());
-			FileFilter filter = new FileFilter();
-			filter.Name = "LongoMatch Project";
-			filter.AddPattern("*.lpr");
-			
-			fChooser.AddFilter(filter);
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				Project project;
-				string fileName = fChooser.Filename;				
-				fChooser.Destroy();
-				try{
-					project = Project.Import(fileName);
-				}
-				catch (Exception ex){
-					MessagePopup.PopupMessage(this, MessageType.Error, ex.Message);					
-					return;
-				}
-				// If it's a fake live project prompt for a video file and
-				// create a new PreviewMediaFile for this project
-				if (project.File.FilePath == Constants.FAKE_PROJECT){
-					project.File = null;
-					npd = new NewProjectDialog();						
-					npd.TransientFor = this;
-					npd.Use = ProjectType.EditProject;
-					npd.Project = project;
-					int response = npd.Run();
-					while (response == (int)ResponseType.Ok && npd.Project == null) {
-						MessagePopup.PopupMessage(this, MessageType.Info,
-						                          Catalog.GetString("Please, select a video file."));
-						response=npd.Run();
-					}
-					if (response ==(int)ResponseType.Ok) {
-						project = npd.Project;
-						npd.Destroy();										
-					} else {							
-						npd.Destroy();
-						return;
-					}
-				}
-				// Try to add the project to the database and warn if a project 
-				// already exists in the database with the same file path
-				if (!MainClass.DB.Exists(project)){
-					MainClass.DB.AddProject(project);
-					MessagePopup.PopupMessage(this, MessageType.Info, 
-					                          Catalog.GetString("Project successfully imported."));
-				}
-				else{
-					MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel,
-					                                     DialogFlags.Modal,
-					                                     MessageType.Question,
-					                                     Gtk.ButtonsType.YesNo,
-					                                     Catalog.GetString("A project already exists for the file:")+project.File.FilePath+
-					                                     "\n"+Catalog.GetString("Do you want to overwrite it?"));
-					md.Icon=Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog, 48);
-					if (md.Run() == (int)ResponseType.Yes){
-						MainClass.DB.UpdateProject(project);
-					}
-					md.Destroy();						
-					
-				}				
-			} else
-				fChooser.Destroy();
+			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();
+			ProjectsManager pm = new ProjectsManager(openedProject);
 			pm.TransientFor = this;
 			pm.Show();
 		}
-
-		protected virtual void OnTimeprecisionadjustwidget1SizeRequested(object o, Gtk.SizeRequestedArgs args)
+		
+		protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
 		{
-			if (args.Requisition.Width>= hpaned.Position)
-				hpaned.Position = args.Requisition.Width;
+			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.SectionsTemplate);
+			tManager.TransientFor = this;
+			tManager.Show();
 		}
 
-		protected virtual void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
+		protected virtual void OnTeamsTemplatesManagerActionActivated(object sender, System.EventArgs e)
 		{
-			if (!PromptCloseProject())
-				return;
-			playlistwidget2.StopEdition();
-			SaveProject();
-			// We never know...
-			System.Threading.Thread.Sleep(1000);
-			playerbin1.Dispose();
-			Application.Quit();
+			TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.TeamTemplate);
+			tManager.TransientFor = this;
+			tManager.Show();
 		}
-
-		protected virtual void OnQuitActivated(object sender, System.EventArgs e)
+		
+		protected virtual void OnExportProjectToCSVFileActionActivated(object sender, System.EventArgs e)
 		{
-			if (!PromptCloseProject())
-				return;
-			playlistwidget2.StopEdition();
-			SaveProject();
-			// We never know...
-			System.Threading.Thread.Sleep(1000);
-			playerbin1.Dispose();
-			Application.Quit();
+			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;
@@ -537,37 +388,21 @@ namespace LongoMatch.Gui
 			else if (visible) {
 				rightvbox.Visible = true;
 			}
-		}
-
-		protected virtual void OnOpenPlaylistActionActivated(object sender, System.EventArgs e)
+		}	
+		
+		protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
 		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Open playlist"),
-			                (Gtk.Window)Toplevel,
-			                FileChooserAction.Open,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-open",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.PlayListDir());
-			FileFilter filter = new FileFilter();
-			filter.Name = "LGM playlist";
-			filter.AddPattern("*.lgm");
-
-			fChooser.AddFilter(filter);
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				if (openedProject != null)
-					CloseOpenedProject(true);
-				playlistwidget2.Load(fChooser.Filename);
-				PlaylistAction.Active = true;
+			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;
+				if (((Gtk.ToggleAction)sender).Active)
+					rightvbox.Visible = false;
+				else if (!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
+					rightvbox.Visible = true;
 			}
-			fChooser.Destroy();
-		}
-
-		protected virtual void OnPlayerbin1Error(object o,LongoMatch.Video.Handlers.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 virtual void OnCaptureModeActionToggled(object sender, System.EventArgs e)
 		{
 			if (((Gtk.ToggleAction)sender).Active) {
@@ -578,55 +413,16 @@ namespace LongoMatch.Gui
 				buttonswidget1.Hide();
 				timelinewidget1.Show();
 			}
-		}
-
-		protected virtual void OnFullScreenActionToggled(object sender, System.EventArgs e)
-		{
-			playerbin1.FullScreen = ((Gtk.ToggleAction)sender).Active;
-		}
-
-		protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
-		{
-			SaveProject();
-		}
-
-		protected override bool OnKeyPressEvent(EventKey evnt)
-		{
-			if (openedProject != null && evnt.State == ModifierType.None) {
-				Gdk.Key key = evnt.Key;
-				if (key == Gdk.Key.z)
-					playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
-				if (key == Gdk.Key.x)
-					playerbin1.SeekToNextFrame(selectedTimeNode != null);
-			}
-			return base.OnKeyPressEvent(evnt);
-		}
-
-		protected virtual void OnTimeNodeSelected(LongoMatch.TimeNodes.MediaTimeNode tNode)
-		{
-			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)
+		}		
+		#endregion
+		#region Help
+		protected virtual void OnHelpAction1Activated(object sender, System.EventArgs e)
 		{
-			drawingtoolbox1.Visible = DrawingToolAction.Active;
-			drawingtoolbox1.DrawingVisibility = DrawingToolAction.Active;
+			try {
+				System.Diagnostics.Process.Start("http://www.longomatch.ylatuya.es/documentation/manual.html";);
+			} catch {}
 		}
-
+		
 		protected virtual void OnAboutActionActivated(object sender, System.EventArgs e)
 		{
 			Version version = Assembly.GetExecutingAssembly().GetName().Version;
@@ -648,7 +444,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.";
 			about.Authors = new string[] {"Andoni Morales Alastruey"};
 			about.Artists = new string[] {"Bencomo González Marrero"};
-			about.TranslatorCredits = Constants.TRANSLATORS;
+			about.TranslatorCredits = Constants.TRANSLATORS;
 			about.TransientFor = this;
 			Gtk.AboutDialog.SetUrlHook(delegate(AboutDialog dialog,string url) {
 				try {
@@ -659,54 +455,66 @@ GNU General Public License for more details.";
 			about.Destroy();
 
 		}
+		#endregion			
 
-		protected virtual void OnExportProjectToCSVFileActionActivated(object sender, System.EventArgs e)
+		protected virtual void OnTimeprecisionadjustwidget1SizeRequested(object o, Gtk.SizeRequestedArgs args)
 		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Select Export File"),
-			                (Gtk.Window)Toplevel,
-			                FileChooserAction.Save,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(MainClass.HomeDir());
-			fChooser.DoOverwriteConfirmation = true;
-			FileFilter filter = new FileFilter();
-			filter.Name = "CSV File";
-			filter.AddPattern("*.csv");
-			fChooser.AddFilter(filter);
-			if (fChooser.Run() == (int)ResponseType.Accept) {
-				string outputFile=fChooser.Filename;
-				outputFile = System.IO.Path.ChangeExtension(outputFile,"csv");
-				CSVExport export = new CSVExport(openedProject, outputFile);
-				export.WriteToFile();
-			}
-			fChooser.Destroy();
+			if (args.Requisition.Width>= hpaned.Position)
+				hpaned.Position = args.Requisition.Width;
+		}		
 
+		protected virtual void OnPlayerbin1Error(object o,LongoMatch.Video.Handlers.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 OnConfigureEvent(Gdk.EventConfigure evnt)
+		protected override bool OnKeyPressEvent(EventKey evnt)
 		{
-			return base.OnConfigureEvent(evnt);
+			if (openedProject != null && evnt.State == ModifierType.None) {
+				Gdk.Key key = evnt.Key;
+				if (key == Gdk.Key.z)
+					playerbin1.SeekToPreviousFrame(selectedTimeNode != null);
+				if (key == Gdk.Key.x)
+					playerbin1.SeekToNextFrame(selectedTimeNode != null);
+			}
+			return base.OnKeyPressEvent(evnt);
 		}
 
-		protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
+		protected virtual void OnTimeNodeSelected(LongoMatch.TimeNodes.MediaTimeNode tNode)
 		{
-			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;
-				if (((Gtk.ToggleAction)sender).Active)
-					rightvbox.Visible = false;
-				else if (!((Gtk.ToggleAction)sender).Active && (playlistwidget2.Visible || noteswidget1.Visible))
-					rightvbox.Visible = true;
-			}
+			rightvbox.Visible=true;
 		}
-		protected virtual void OnHelpAction1Activated(object sender, System.EventArgs e)
+
+		protected virtual void OnSegmentClosedEvent()
 		{
-			try {
-				System.Diagnostics.Process.Start("http://www.longomatch.ylatuya.es/documentation/manual.html";);
-			} catch {}
+			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();
 		}
 
-		#endregion}
+		protected virtual void OnDrawingToolActionToggled(object sender, System.EventArgs e)
+		{
+			drawingtoolbox1.Visible = DrawingToolAction.Active;
+			drawingtoolbox1.DrawingVisibility = DrawingToolAction.Active;
+		}		
+	
+		protected virtual void OnUnrealized(object sender, System.EventArgs e) {
+			CloseAndQuit();
+		}
+
+		protected virtual void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
+		{
+			CloseAndQuit();
+		}
+		#endregion		
 	}
-}
+}
\ No newline at end of file
diff --git a/LongoMatch/LongoMatch.mdp b/LongoMatch/LongoMatch.mdp
index 6a8da4f..177552e 100644
--- a/LongoMatch/LongoMatch.mdp
+++ b/LongoMatch/LongoMatch.mdp
@@ -181,6 +181,8 @@
     <File name="Gui/Dialog/ProjectSelectionDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="Gui/Dialog/EndCaptureDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="gtk-gui/LongoMatch.Gui.Dialog.EndCaptureDialog.cs" subtype="Code" buildaction="Compile" />
+    <File name="Utils" subtype="Directory" buildaction="Compile" />
+    <File name="Utils/ProjectUtils.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
diff --git a/LongoMatch/Makefile.am b/LongoMatch/Makefile.am
index c37191e..679028a 100644
--- a/LongoMatch/Makefile.am
+++ b/LongoMatch/Makefile.am
@@ -215,7 +215,8 @@ FILES = \
 	Time/Time.cs \
 	Time/TimeNode.cs \
 	Updates/Updater.cs \
-	Updates/XmlUpdateParser.cs
+	Updates/XmlUpdateParser.cs \
+	Utils/ProjectUtils.cs
 	
 DATA_FILES = 
 



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