From 6a1c2ba924895b4eccebb7fdd940212682360dc9 Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 28 Jan 2016 13:29:51 +0300 Subject: [PATCH] movie: save as menu item (mainform and context menu) --- BizHawk.Client.EmuHawk/MainForm.Designer.cs | 86 +++++++++++++-------- BizHawk.Client.EmuHawk/MainForm.Events.cs | 22 ++++++ 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 5cf4346cd1..10fd359a5f 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -85,6 +85,7 @@ this.PlayFromBeginningMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ImportMoviesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveMovieAsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.StopMovieWithoutSavingMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); this.AutomaticallyBackupMoviesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -193,6 +194,7 @@ this.SaveConfigMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveConfigAsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.LoadConfigMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.LoadConfigFromMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ToolsSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ToolBoxMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); @@ -414,7 +416,7 @@ this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator(); this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timerMouseIdle = new System.Windows.Forms.Timer(this.components); - this.LoadConfigFromMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveMovieAsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainformMenu.SuspendLayout(); this.MainStatusBar.SuspendLayout(); this.MainFormContextMenu.SuspendLayout(); @@ -450,7 +452,7 @@ this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.MainformMenu.Location = new System.Drawing.Point(0, 0); this.MainformMenu.Name = "MainformMenu"; - this.MainformMenu.Size = new System.Drawing.Size(470, 57); + this.MainformMenu.Size = new System.Drawing.Size(470, 55); this.MainformMenu.TabIndex = 0; this.MainformMenu.Text = "menuStrip1"; this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate); @@ -903,6 +905,7 @@ this.PlayFromBeginningMenuItem, this.ImportMoviesMenuItem, this.SaveMovieMenuItem, + this.SaveMovieAsMenuItem, this.StopMovieWithoutSavingMenuItem, this.toolStripSeparator14, this.AutomaticallyBackupMoviesMenuItem, @@ -989,6 +992,14 @@ this.SaveMovieMenuItem.Text = "&Save Movie"; this.SaveMovieMenuItem.Click += new System.EventHandler(this.SaveMovieMenuItem_Click); // + // SaveMovieAsMenuItem + // + this.SaveMovieAsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; + this.SaveMovieAsMenuItem.Name = "SaveMovieAsMenuItem"; + this.SaveMovieAsMenuItem.Size = new System.Drawing.Size(222, 22); + this.SaveMovieAsMenuItem.Text = "Save Movie As..."; + this.SaveMovieAsMenuItem.Click += new System.EventHandler(this.SaveMovieAsMenuItem_Click); + // // StopMovieWithoutSavingMenuItem // this.StopMovieWithoutSavingMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; @@ -1851,6 +1862,13 @@ this.LoadConfigMenuItem.Text = "Load Config"; this.LoadConfigMenuItem.Click += new System.EventHandler(this.LoadConfigMenuItem_Click); // + // LoadConfigFromMenuItem + // + this.LoadConfigFromMenuItem.Name = "LoadConfigFromMenuItem"; + this.LoadConfigFromMenuItem.Size = new System.Drawing.Size(181, 22); + this.LoadConfigFromMenuItem.Text = "Load Config From..."; + this.LoadConfigFromMenuItem.Click += new System.EventHandler(this.LoadConfigFromMenuItem_Click); + // // ToolsSubMenu // this.ToolsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -3292,6 +3310,7 @@ this.AddSubtitleContextMenuItem, this.ViewCommentsContextMenuItem, this.SaveMovieContextMenuItem, + this.SaveMovieAsContextMenuItem, this.ContextSeparator_AfterMovie, this.UndoSavestateContextMenuItem, this.ContextSeparator_AfterUndo, @@ -3302,7 +3321,7 @@ this.ShowMenuContextMenuSeparator, this.ShowMenuContextMenuItem}); this.MainFormContextMenu.Name = "contextMenuStrip1"; - this.MainFormContextMenu.Size = new System.Drawing.Size(217, 468); + this.MainFormContextMenu.Size = new System.Drawing.Size(213, 512); this.MainFormContextMenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.MainFormContextMenu_Closing); this.MainFormContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.MainFormContextMenu_Opening); // @@ -3310,7 +3329,7 @@ // this.OpenRomContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; this.OpenRomContextMenuItem.Name = "OpenRomContextMenuItem"; - this.OpenRomContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.OpenRomContextMenuItem.Size = new System.Drawing.Size(212, 22); this.OpenRomContextMenuItem.Text = "Open Rom"; this.OpenRomContextMenuItem.Click += new System.EventHandler(this.OpenRomMenuItem_Click); // @@ -3318,7 +3337,7 @@ // this.LoadLastRomContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.LoadLastRomContextMenuItem.Name = "LoadLastRomContextMenuItem"; - this.LoadLastRomContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.LoadLastRomContextMenuItem.Size = new System.Drawing.Size(212, 22); this.LoadLastRomContextMenuItem.Text = "Load Last ROM"; this.LoadLastRomContextMenuItem.Click += new System.EventHandler(this.LoadLastRomContextMenuItem_Click); // @@ -3326,20 +3345,20 @@ // this.StopAVContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.StopAVContextMenuItem.Name = "StopAVContextMenuItem"; - this.StopAVContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.StopAVContextMenuItem.Size = new System.Drawing.Size(212, 22); this.StopAVContextMenuItem.Text = "Stop AVI/WAV"; this.StopAVContextMenuItem.Click += new System.EventHandler(this.StopAVMenuItem_Click); // // ContextSeparator_AfterROM // this.ContextSeparator_AfterROM.Name = "ContextSeparator_AfterROM"; - this.ContextSeparator_AfterROM.Size = new System.Drawing.Size(213, 6); + this.ContextSeparator_AfterROM.Size = new System.Drawing.Size(209, 6); // // RecordMovieContextMenuItem // this.RecordMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.RecordHS; this.RecordMovieContextMenuItem.Name = "RecordMovieContextMenuItem"; - this.RecordMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.RecordMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.RecordMovieContextMenuItem.Text = "Record Movie"; this.RecordMovieContextMenuItem.Click += new System.EventHandler(this.RecordMovieMenuItem_Click); // @@ -3347,7 +3366,7 @@ // this.PlayMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Play; this.PlayMovieContextMenuItem.Name = "PlayMovieContextMenuItem"; - this.PlayMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.PlayMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.PlayMovieContextMenuItem.Text = "Play Movie"; this.PlayMovieContextMenuItem.Click += new System.EventHandler(this.PlayMovieMenuItem_Click); // @@ -3355,7 +3374,7 @@ // this.RestartMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.restart; this.RestartMovieContextMenuItem.Name = "RestartMovieContextMenuItem"; - this.RestartMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.RestartMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.RestartMovieContextMenuItem.Text = "Restart Movie"; this.RestartMovieContextMenuItem.Click += new System.EventHandler(this.PlayFromBeginningMenuItem_Click); // @@ -3363,7 +3382,7 @@ // this.StopMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.StopMovieContextMenuItem.Name = "StopMovieContextMenuItem"; - this.StopMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.StopMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.StopMovieContextMenuItem.Text = "Stop Movie"; this.StopMovieContextMenuItem.Click += new System.EventHandler(this.StopMovieMenuItem_Click); // @@ -3371,14 +3390,14 @@ // this.LoadLastMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.LoadLastMovieContextMenuItem.Name = "LoadLastMovieContextMenuItem"; - this.LoadLastMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.LoadLastMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.LoadLastMovieContextMenuItem.Text = "Load Last Movie"; this.LoadLastMovieContextMenuItem.Click += new System.EventHandler(this.LoadLastMovieContextMenuItem_Click); // // BackupMovieContextMenuItem // this.BackupMovieContextMenuItem.Name = "BackupMovieContextMenuItem"; - this.BackupMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.BackupMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.BackupMovieContextMenuItem.Text = "Backup Movie"; this.BackupMovieContextMenuItem.Click += new System.EventHandler(this.BackupMovieContextMenuItem_Click); // @@ -3386,28 +3405,28 @@ // this.StopNoSaveContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.StopNoSaveContextMenuItem.Name = "StopNoSaveContextMenuItem"; - this.StopNoSaveContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.StopNoSaveContextMenuItem.Size = new System.Drawing.Size(212, 22); this.StopNoSaveContextMenuItem.Text = "Stop Movie without Saving"; this.StopNoSaveContextMenuItem.Click += new System.EventHandler(this.StopMovieWithoutSavingMenuItem_Click); // // ViewSubtitlesContextMenuItem // this.ViewSubtitlesContextMenuItem.Name = "ViewSubtitlesContextMenuItem"; - this.ViewSubtitlesContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ViewSubtitlesContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ViewSubtitlesContextMenuItem.Text = "View Subtitles"; this.ViewSubtitlesContextMenuItem.Click += new System.EventHandler(this.ViewSubtitlesContextMenuItem_Click); // // AddSubtitleContextMenuItem // this.AddSubtitleContextMenuItem.Name = "AddSubtitleContextMenuItem"; - this.AddSubtitleContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.AddSubtitleContextMenuItem.Size = new System.Drawing.Size(212, 22); this.AddSubtitleContextMenuItem.Text = "Add Subtitle"; this.AddSubtitleContextMenuItem.Click += new System.EventHandler(this.AddSubtitleContextMenuItem_Click); // // ViewCommentsContextMenuItem // this.ViewCommentsContextMenuItem.Name = "ViewCommentsContextMenuItem"; - this.ViewCommentsContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ViewCommentsContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ViewCommentsContextMenuItem.Text = "View Comments"; this.ViewCommentsContextMenuItem.Click += new System.EventHandler(this.ViewCommentsContextMenuItem_Click); // @@ -3415,27 +3434,27 @@ // this.SaveMovieContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMovieContextMenuItem.Name = "SaveMovieContextMenuItem"; - this.SaveMovieContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.SaveMovieContextMenuItem.Size = new System.Drawing.Size(212, 22); this.SaveMovieContextMenuItem.Text = "Save Movie"; this.SaveMovieContextMenuItem.Click += new System.EventHandler(this.SaveMovieMenuItem_Click); // // ContextSeparator_AfterMovie // this.ContextSeparator_AfterMovie.Name = "ContextSeparator_AfterMovie"; - this.ContextSeparator_AfterMovie.Size = new System.Drawing.Size(213, 6); + this.ContextSeparator_AfterMovie.Size = new System.Drawing.Size(209, 6); // // UndoSavestateContextMenuItem // this.UndoSavestateContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.undo; this.UndoSavestateContextMenuItem.Name = "UndoSavestateContextMenuItem"; - this.UndoSavestateContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.UndoSavestateContextMenuItem.Size = new System.Drawing.Size(212, 22); this.UndoSavestateContextMenuItem.Text = "Undo Savestate"; this.UndoSavestateContextMenuItem.Click += new System.EventHandler(this.UndoSavestateContextMenuItem_Click); // // ContextSeparator_AfterUndo // this.ContextSeparator_AfterUndo.Name = "ContextSeparator_AfterUndo"; - this.ContextSeparator_AfterUndo.Size = new System.Drawing.Size(213, 6); + this.ContextSeparator_AfterUndo.Size = new System.Drawing.Size(209, 6); // // ConfigContextMenuItem // @@ -3458,7 +3477,7 @@ this.toolStripMenuItem66, this.toolStripMenuItem67}); this.ConfigContextMenuItem.Name = "ConfigContextMenuItem"; - this.ConfigContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ConfigContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ConfigContextMenuItem.Text = "Config"; // // toolStripMenuItem6 @@ -3630,7 +3649,7 @@ // this.ScreenshotContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.camera; this.ScreenshotContextMenuItem.Name = "ScreenshotContextMenuItem"; - this.ScreenshotContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ScreenshotContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ScreenshotContextMenuItem.Text = "Screenshot"; this.ScreenshotContextMenuItem.Click += new System.EventHandler(this.ScreenshotMenuItem_Click); // @@ -3638,26 +3657,26 @@ // this.CloseRomContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Close; this.CloseRomContextMenuItem.Name = "CloseRomContextMenuItem"; - this.CloseRomContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.CloseRomContextMenuItem.Size = new System.Drawing.Size(212, 22); this.CloseRomContextMenuItem.Text = "Close ROM"; this.CloseRomContextMenuItem.Click += new System.EventHandler(this.CloseRomMenuItem_Click); // // ClearSRAMContextMenuItem // this.ClearSRAMContextMenuItem.Name = "ClearSRAMContextMenuItem"; - this.ClearSRAMContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ClearSRAMContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ClearSRAMContextMenuItem.Text = "Close and Clear SRAM"; this.ClearSRAMContextMenuItem.Click += new System.EventHandler(this.ClearSRAMContextMenuItem_Click); // // ShowMenuContextMenuSeparator // this.ShowMenuContextMenuSeparator.Name = "ShowMenuContextMenuSeparator"; - this.ShowMenuContextMenuSeparator.Size = new System.Drawing.Size(213, 6); + this.ShowMenuContextMenuSeparator.Size = new System.Drawing.Size(209, 6); // // ShowMenuContextMenuItem // this.ShowMenuContextMenuItem.Name = "ShowMenuContextMenuItem"; - this.ShowMenuContextMenuItem.Size = new System.Drawing.Size(216, 22); + this.ShowMenuContextMenuItem.Size = new System.Drawing.Size(212, 22); this.ShowMenuContextMenuItem.Text = "Show Menu"; this.ShowMenuContextMenuItem.Click += new System.EventHandler(this.ShowMenuContextMenuItem_Click); // @@ -3667,12 +3686,13 @@ this.timerMouseIdle.Interval = 2000; this.timerMouseIdle.Tick += new System.EventHandler(this.timerMouseIdle_Tick); // - // LoadConfigFromMenuItem + // SaveMovieAsContextMenuItem // - this.LoadConfigFromMenuItem.Name = "LoadConfigFromMenuItem"; - this.LoadConfigFromMenuItem.Size = new System.Drawing.Size(181, 22); - this.LoadConfigFromMenuItem.Text = "Load Config From..."; - this.LoadConfigFromMenuItem.Click += new System.EventHandler(this.LoadConfigFromMenuItem_Click); + this.SaveMovieAsContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; + this.SaveMovieAsContextMenuItem.Name = "SaveMovieAsContextMenuItem"; + this.SaveMovieAsContextMenuItem.Size = new System.Drawing.Size(212, 22); + this.SaveMovieAsContextMenuItem.Text = "Save Movie As..."; + this.SaveMovieAsContextMenuItem.Click += new System.EventHandler(this.SaveMovieAsMenuItem_Click); // // MainForm // @@ -4100,5 +4120,7 @@ private System.Windows.Forms.ToolStripMenuItem NewHexEditorMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveConfigAsMenuItem; private System.Windows.Forms.ToolStripMenuItem LoadConfigFromMenuItem; + private System.Windows.Forms.ToolStripMenuItem SaveMovieAsMenuItem; + private System.Windows.Forms.ToolStripMenuItem SaveMovieAsContextMenuItem; } } diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index fde02b6643..36aa25f384 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -551,6 +551,28 @@ namespace BizHawk.Client.EmuHawk SaveMovie(); } + private void SaveMovieAsMenuItem_Click(object sender, EventArgs e) + { + var filename = Global.MovieSession.Movie.Filename; + if (string.IsNullOrWhiteSpace(filename)) + { + filename = PathManager.FilesystemSafeName(Global.Game); + } + + var file = ToolHelpers.SaveFileDialog( + filename, + PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), + "Movie Files", + Global.MovieSession.Movie.PreferredExtension); + + if (file != null) + { + Global.MovieSession.Movie.Filename = file.FullName; + Global.Config.RecentMovies.Add(Global.MovieSession.Movie.Filename); + SaveMovie(); + } + } + private void StopMovieWithoutSavingMenuItem_Click(object sender, EventArgs e) { if (Global.Config.EnableBackupMovies)