From 15fd3a30217669d765ef7b712a1241b9adc5ab25 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 6 Mar 2015 01:02:26 +0000 Subject: [PATCH] MultiHawk - add recent move menu (with autoload), context menu item with record movie and load last movie --- BizHawk.Client.MultiHawk/Mainform.Designer.cs | 70 ++++++++++++++++--- BizHawk.Client.MultiHawk/Mainform.cs | 36 ++++++++++ BizHawk.Client.MultiHawk/Mainform.resx | 6 ++ 3 files changed, 104 insertions(+), 8 deletions(-) diff --git a/BizHawk.Client.MultiHawk/Mainform.Designer.cs b/BizHawk.Client.MultiHawk/Mainform.Designer.cs index 7c8ed9d9c2..f75be87141 100644 --- a/BizHawk.Client.MultiHawk/Mainform.Designer.cs +++ b/BizHawk.Client.MultiHawk/Mainform.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.MainformMenu = new MenuStripEx(); this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.NewSessionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -53,6 +54,8 @@ this.RecordMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PlayMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.StopMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.RecentMovieSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.ToggleReadonlyMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -64,11 +67,15 @@ this.MainStatusBar = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.FameStatusBarLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.StatusBarMessageLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.PlayRecordStatusButton = new System.Windows.Forms.ToolStripDropDownButton(); + this.StatusBarMessageLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.LoadLastMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.RecordMovieContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainformMenu.SuspendLayout(); this.WorkspacePanel.SuspendLayout(); this.MainStatusBar.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // // MainformMenu @@ -173,7 +180,7 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(57, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // toolStripSeparator5 // @@ -246,6 +253,7 @@ this.RecordMovieMenuItem, this.PlayMovieMenuItem, this.StopMovieMenuItem, + this.RecentMovieSubMenu, this.toolStripSeparator2, this.ToggleReadonlyMenuItem}); this.MovieSubMenu.Name = "MovieSubMenu"; @@ -277,6 +285,20 @@ this.StopMovieMenuItem.Text = "&Stop Movie"; this.StopMovieMenuItem.Click += new System.EventHandler(this.StopMovieMenuItem_Click); // + // RecentMovieSubMenu + // + this.RecentMovieSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripSeparator8}); + this.RecentMovieSubMenu.Name = "RecentMovieSubMenu"; + this.RecentMovieSubMenu.Size = new System.Drawing.Size(168, 22); + this.RecentMovieSubMenu.Text = "Recent"; + this.RecentMovieSubMenu.DropDownOpened += new System.EventHandler(this.RecentMovieSubMenu_DropDownOpened); + // + // toolStripSeparator8 + // + this.toolStripSeparator8.Name = "toolStripSeparator8"; + this.toolStripSeparator8.Size = new System.Drawing.Size(57, 6); + // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; @@ -367,12 +389,6 @@ this.FameStatusBarLabel.Size = new System.Drawing.Size(13, 17); this.FameStatusBarLabel.Text = "0"; // - // StatusBarMessageLabel - // - this.StatusBarMessageLabel.Name = "StatusBarMessageLabel"; - this.StatusBarMessageLabel.Size = new System.Drawing.Size(35, 17); - this.StatusBarMessageLabel.Text = "Hello"; - // // PlayRecordStatusButton // this.PlayRecordStatusButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -382,11 +398,43 @@ this.PlayRecordStatusButton.Size = new System.Drawing.Size(29, 20); this.PlayRecordStatusButton.Text = "No movie is active"; // + // StatusBarMessageLabel + // + this.StatusBarMessageLabel.Name = "StatusBarMessageLabel"; + this.StatusBarMessageLabel.Size = new System.Drawing.Size(35, 17); + this.StatusBarMessageLabel.Text = "Hello"; + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.LoadLastMovieContextMenuItem, + this.RecordMovieContextMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(161, 48); + this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); + // + // LoadLastMovieContextMenuItem + // + this.LoadLastMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.Recent; + this.LoadLastMovieContextMenuItem.Name = "LoadLastMovieContextMenuItem"; + this.LoadLastMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.LoadLastMovieContextMenuItem.Text = "Load Last Movie"; + this.LoadLastMovieContextMenuItem.Click += new System.EventHandler(this.LoadLastMovieMenuItem_Click); + // + // RecordMovieContextMenuItem + // + this.RecordMovieContextMenuItem.Image = global::BizHawk.Client.MultiHawk.Properties.Resources.RecordHS; + this.RecordMovieContextMenuItem.Name = "RecordMovieContextMenuItem"; + this.RecordMovieContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.RecordMovieContextMenuItem.Text = "Record Movie"; + this.RecordMovieContextMenuItem.Click += new System.EventHandler(this.RecordMovieMenuItem_Click); + // // Mainform // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(655, 431); + this.ContextMenuStrip = this.contextMenuStrip1; this.Controls.Add(this.WorkspacePanel); this.Controls.Add(this.MainformMenu); this.MainMenuStrip = this.MainformMenu; @@ -399,6 +447,7 @@ this.WorkspacePanel.PerformLayout(); this.MainStatusBar.ResumeLayout(false); this.MainStatusBar.PerformLayout(); + this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -444,6 +493,11 @@ private System.Windows.Forms.ToolStripMenuItem _2xMenuItem; private System.Windows.Forms.ToolStripMenuItem _3xMenuItem; private System.Windows.Forms.ToolStripMenuItem _4xMenuItem; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem LoadLastMovieContextMenuItem; + private System.Windows.Forms.ToolStripMenuItem RecentMovieSubMenu; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; + private System.Windows.Forms.ToolStripMenuItem RecordMovieContextMenuItem; } } diff --git a/BizHawk.Client.MultiHawk/Mainform.cs b/BizHawk.Client.MultiHawk/Mainform.cs index fe34dd0725..a45ac89b6d 100644 --- a/BizHawk.Client.MultiHawk/Mainform.cs +++ b/BizHawk.Client.MultiHawk/Mainform.cs @@ -118,6 +118,11 @@ namespace BizHawk.Client.MultiHawk if (Global.Config.RecentRomSessions.AutoLoad) { LoadRomSessionFromRecent(Global.Config.RecentRomSessions.MostRecent); + + if (Global.Config.RecentMovies.AutoLoad && !Global.Config.RecentMovies.Empty) + { + LoadMoviesFromRecent(Global.Config.RecentMovies.MostRecent); + } } if (Global.Config.SaveWindowPosition && Global.Config.MainWidth > 0 && Global.Config.MainHeight > 0) @@ -1115,6 +1120,20 @@ namespace BizHawk.Client.MultiHawk } } + private void LoadMoviesFromRecent(string path) + { + if (File.Exists(path)) + { + var movie = MovieService.Get(path); + Global.MovieSession.ReadOnly = true; + StartNewMovie(movie, false); + } + else + { + Global.Config.RecentMovies.HandleLoadError(path); + } + } + public void SetMainformMovieInfo() { if (Global.MovieSession.Movie.IsPlaying) @@ -1460,5 +1479,22 @@ namespace BizHawk.Client.MultiHawk ew.Render(); } } + + private void LoadLastMovieMenuItem_Click(object sender, EventArgs e) + { + LoadMoviesFromRecent(Global.Config.RecentMovies.MostRecent); + } + + private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) + { + LoadLastMovieContextMenuItem.Enabled = !Global.Config.RecentMovies.Empty; + } + + private void RecentMovieSubMenu_DropDownOpened(object sender, EventArgs e) + { + RecentMovieSubMenu.DropDownItems.Clear(); + RecentMovieSubMenu.DropDownItems.AddRange( + Global.Config.RecentMovies.RecentMenu(LoadMoviesFromRecent, autoload: true)); + } } } diff --git a/BizHawk.Client.MultiHawk/Mainform.resx b/BizHawk.Client.MultiHawk/Mainform.resx index f0e0413d85..bdf629369a 100644 --- a/BizHawk.Client.MultiHawk/Mainform.resx +++ b/BizHawk.Client.MultiHawk/Mainform.resx @@ -123,4 +123,10 @@ 153, 17 + + 153, 17 + + + 283, 17 + \ No newline at end of file