Recent Movies menu implemented

This commit is contained in:
andres.delikat 2011-05-19 18:50:09 +00:00
parent 917a9db83f
commit c15c9217f7
5 changed files with 154 additions and 79 deletions

View File

@ -225,6 +225,7 @@
//Movie Settings
public RecentFiles RecentMovies = new RecentFiles(8);
public bool AutoLoadMostRecentMovie = false;
//TI83
public bool TI83disableSaveSlotKeys = true;

View File

@ -123,6 +123,7 @@
this.displayFrameCounterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayLagCounterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayRerecordCountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.controllersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hotkeysToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -185,7 +186,6 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.EmuStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.displayRerecordCountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
@ -233,7 +233,7 @@
// openROMToolStripMenuItem
//
this.openROMToolStripMenuItem.Name = "openROMToolStripMenuItem";
this.openROMToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.openROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openROMToolStripMenuItem.Text = "Open ROM";
this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click);
//
@ -245,7 +245,7 @@
this.clearToolStripMenuItem,
this.autoloadMostRecentToolStripMenuItem});
this.recentROMToolStripMenuItem.Name = "recentROMToolStripMenuItem";
this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.recentROMToolStripMenuItem.Text = "Recent ROM";
this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened);
//
@ -277,14 +277,14 @@
// closeROMToolStripMenuItem
//
this.closeROMToolStripMenuItem.Name = "closeROMToolStripMenuItem";
this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.closeROMToolStripMenuItem.Text = "&Close ROM";
this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(137, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
//
// saveStateToolStripMenuItem
//
@ -302,7 +302,7 @@
this.toolStripSeparator6,
this.saveNamedStateToolStripMenuItem});
this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem";
this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveStateToolStripMenuItem.Text = "Save State";
this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened);
//
@ -404,7 +404,7 @@
this.toolStripSeparator7,
this.loadNamedStateToolStripMenuItem});
this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem";
this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.loadStateToolStripMenuItem.Text = "Load State";
this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened);
//
@ -509,7 +509,7 @@
this.saveToCurrentSlotToolStripMenuItem,
this.loadCurrentSlotToolStripMenuItem});
this.saveSlotToolStripMenuItem.Name = "saveSlotToolStripMenuItem";
this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveSlotToolStripMenuItem.Text = "SaveSlot";
this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened);
//
@ -619,7 +619,7 @@
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(137, 6);
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
//
// movieToolStripMenuItem
//
@ -634,7 +634,7 @@
this.toolStripSeparator14,
this.replayInputLogToolStripMenuItem});
this.movieToolStripMenuItem.Name = "movieToolStripMenuItem";
this.movieToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.movieToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.movieToolStripMenuItem.Text = "Movie";
this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened);
//
@ -660,6 +660,7 @@
this.recentToolStripMenuItem.Name = "recentToolStripMenuItem";
this.recentToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.recentToolStripMenuItem.Text = "Recent";
this.recentToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentToolStripMenuItem_DropDownOpened);
//
// noneToolStripMenuItem1
//
@ -727,20 +728,20 @@
// screenshotF12ToolStripMenuItem
//
this.screenshotF12ToolStripMenuItem.Name = "screenshotF12ToolStripMenuItem";
this.screenshotF12ToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.screenshotF12ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.screenshotF12ToolStripMenuItem.Text = "Screenshot";
this.screenshotF12ToolStripMenuItem.Click += new System.EventHandler(this.screenshotF12ToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(137, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
this.exitToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@ -761,33 +762,33 @@
// pauseToolStripMenuItem
//
this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem";
this.pauseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.pauseToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.pauseToolStripMenuItem.Text = "&Pause";
this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(136, 6);
//
// powerToolStripMenuItem
//
this.powerToolStripMenuItem.Name = "powerToolStripMenuItem";
this.powerToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.powerToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.powerToolStripMenuItem.Text = "Power Cycle";
this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click);
//
// resetToolStripMenuItem
//
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.resetToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.resetToolStripMenuItem.Text = "&Reset";
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator8.Size = new System.Drawing.Size(136, 6);
//
// sega8bitToolStripMenuItem
//
@ -796,7 +797,7 @@
this.overclockWhenKnownSafeToolStripMenuItem,
this.forceStereoSeparationToolStripMenuItem});
this.sega8bitToolStripMenuItem.Name = "sega8bitToolStripMenuItem";
this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
this.sega8bitToolStripMenuItem.Text = "Sega 8-bit";
//
// enableFMChipToolStripMenuItem
@ -931,6 +932,13 @@
this.displayInputToolStripMenuItem.Text = "Display Input";
this.displayInputToolStripMenuItem.Click += new System.EventHandler(this.displayInputToolStripMenuItem_Click);
//
// displayRerecordCountToolStripMenuItem
//
this.displayRerecordCountToolStripMenuItem.Name = "displayRerecordCountToolStripMenuItem";
this.displayRerecordCountToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.displayRerecordCountToolStripMenuItem.Text = "Display Rerecord Count";
this.displayRerecordCountToolStripMenuItem.Click += new System.EventHandler(this.displayRerecordCountToolStripMenuItem_Click);
//
// configToolStripMenuItem
//
this.configToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1417,13 +1425,6 @@
this.EmuStatus.Size = new System.Drawing.Size(162, 17);
this.EmuStatus.Text = "Currently emulating: ur mom";
//
// displayRerecordCountToolStripMenuItem
//
this.displayRerecordCountToolStripMenuItem.Name = "displayRerecordCountToolStripMenuItem";
this.displayRerecordCountToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.displayRerecordCountToolStripMenuItem.Text = "Display Rerecord Count";
this.displayRerecordCountToolStripMenuItem.Click += new System.EventHandler(this.displayRerecordCountToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);

View File

@ -570,5 +570,84 @@ namespace BizHawk.MultiClient
{
Global.Config.DisplayRerecordCount ^= true;
}
private void recentROMToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
//Clear out recent Roms list
//repopulate it with an up to date list
recentROMToolStripMenuItem.DropDownItems.Clear();
if (Global.Config.RecentRoms.IsEmpty())
{
recentROMToolStripMenuItem.DropDownItems.Add("None");
}
else
{
for (int x = 0; x < Global.Config.RecentRoms.Length(); x++)
{
string path = Global.Config.RecentRoms.GetRecentFileByPosition(x);
var item = new ToolStripMenuItem();
item.Text = path;
item.Click += (o, ev) => LoadRomFromRecent(path);
recentROMToolStripMenuItem.DropDownItems.Add(item);
}
}
recentROMToolStripMenuItem.DropDownItems.Add("-");
var clearitem = new ToolStripMenuItem();
clearitem.Text = "&Clear";
clearitem.Click += (o, ev) => Global.Config.RecentRoms.Clear();
recentROMToolStripMenuItem.DropDownItems.Add(clearitem);
var auto = new ToolStripMenuItem();
auto.Text = "&Autoload Most Recent";
auto.Click += (o, ev) => UpdateAutoLoadRecentRom();
if (Global.Config.AutoLoadMostRecentRom == true)
auto.Checked = true;
else
auto.Checked = false;
recentROMToolStripMenuItem.DropDownItems.Add(auto);
}
private void recentToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
//Clear out recent Movies list
//repopulate it with an up to date list
recentToolStripMenuItem.DropDownItems.Clear();
if (Global.Config.RecentMovies.IsEmpty())
{
recentToolStripMenuItem.DropDownItems.Add("None");
}
else
{
for (int x = 0; x < Global.Config.RecentMovies.Length(); x++)
{
string path = Global.Config.RecentMovies.GetRecentFileByPosition(x);
var item = new ToolStripMenuItem();
item.Text = path;
item.Click += (o, ev) => LoadMoviesFromRecent(path);
recentToolStripMenuItem.DropDownItems.Add(item);
}
}
recentToolStripMenuItem.DropDownItems.Add("-");
var clearitem = new ToolStripMenuItem();
clearitem.Text = "&Clear";
clearitem.Click += (o, ev) => Global.Config.RecentMovies.Clear();
recentToolStripMenuItem.DropDownItems.Add(clearitem);
var auto = new ToolStripMenuItem();
auto.Text = "&Autoload Most Recent";
auto.Click += (o, ev) => UpdateAutoLoadRecentRom();
if (Global.Config.AutoLoadMostRecentMovie == true)
auto.Checked = true;
else
auto.Checked = false;
recentToolStripMenuItem.DropDownItems.Add(auto);
}
}
}

View File

@ -259,6 +259,24 @@ namespace BizHawk.MultiClient
}
}
private void LoadMoviesFromRecent(string movie)
{
Movie m = new Movie(movie, MOVIEMODE.PLAY);
ReadOnly = true;
StartNewMovie(m, false);
/*
bool r = true; // LoadRom(rom);
if (!r)
{
Global.Sound.StopSound();
DialogResult result = MessageBox.Show("Could not open " + movie + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result == DialogResult.Yes)
Global.Config.RecentMovies.Remove(movie);
Global.Sound.StartSound();
}
*/ //TODO: make StartNewMovie or Movie constructor
}
public static ControllerDefinition ClientControlsDef = new ControllerDefinition
{
Name = "Emulator Frontend Controls",
@ -1281,6 +1299,20 @@ namespace BizHawk.MultiClient
}
}
private void UpdateAutoLoadRecentMovie()
{
if (Global.Config.AutoLoadMostRecentMovie == true)
{
autoloadMostRecentToolStripMenuItem1.Checked = false;
Global.Config.AutoLoadMostRecentMovie = false;
}
else
{
autoloadMostRecentToolStripMenuItem1.Checked = true;
Global.Config.AutoLoadMostRecentMovie = true;
}
}
private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
if (IsNullEmulator())
@ -1400,58 +1432,6 @@ namespace BizHawk.MultiClient
closeROMToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.CloseROM;
}
private void recentROMToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
//Clear out recent Roms list
//repopulate it with an up to date list
recentROMToolStripMenuItem.DropDownItems.Clear();
if (Global.Config.RecentRoms.IsEmpty())
{
recentROMToolStripMenuItem.DropDownItems.Add("None");
}
else
{
for (int x = 0; x < Global.Config.RecentRoms.Length(); x++)
{
string path = Global.Config.RecentRoms.GetRecentFileByPosition(x);
var item = new ToolStripMenuItem();
item.Text = path;
item.Click += (o, ev) => LoadRomFromRecent(path);
recentROMToolStripMenuItem.DropDownItems.Add(item);
}
}
recentROMToolStripMenuItem.DropDownItems.Add("-");
var clearitem = new ToolStripMenuItem();
clearitem.Text = "&Clear";
clearitem.Click += (o, ev) => Global.Config.RecentRoms.Clear();
recentROMToolStripMenuItem.DropDownItems.Add(clearitem);
var auto = new ToolStripMenuItem();
auto.Text = "&Autoload Most Recent";
auto.Click += (o, ev) => UpdateAutoLoadRecentRom();
if (Global.Config.AutoLoadMostRecentRom == true)
auto.Checked = true;
else
auto.Checked = false;
recentROMToolStripMenuItem.DropDownItems.Add(auto);
}
public void LoadRamWatch()
{
if (!RamWatch1.IsHandleCreated || RamWatch1.IsDisposed)
{
RamWatch1 = new RamWatch();
if (Global.Config.AutoLoadRamWatch && Global.Config.RecentWatches.Length() > 0)
RamWatch1.LoadWatchFromRecent(Global.Config.RecentWatches.GetRecentFileByPosition(0));
RamWatch1.Show();
}
else
RamWatch1.Focus();
}
public void LoadRamSearch()
{
if (!RamSearch1.IsHandleCreated || RamSearch1.IsDisposed)
@ -1866,6 +1846,7 @@ namespace BizHawk.MultiClient
InputLog.StopMovie();
LoadRom(Global.MainForm.CurrentlyOpenRom);
UserMovie.LoadMovie();
Global.Config.RecentMovies.Add(m.GetFilePath());
if (record)
{
UserMovie.StartNewRecording();
@ -1915,5 +1896,18 @@ namespace BizHawk.MultiClient
UserMovie.StartPlayback();
}
}
public void LoadRamWatch()
{
if (!RamWatch1.IsHandleCreated || RamWatch1.IsDisposed)
{
RamWatch1 = new RamWatch();
if (Global.Config.AutoLoadRamWatch && Global.Config.RecentWatches.Length() > 0)
RamWatch1.LoadWatchFromRecent(Global.Config.RecentWatches.GetRecentFileByPosition(0));
RamWatch1.Show();
}
else
RamWatch1.Focus();
}
}
}

View File

@ -16,7 +16,7 @@ namespace BizHawk.MultiClient
//This is a modal dialog, implement it as modeless
// Option to include subdirectories
// Option to include savestate files (that have an input log)
//Clicking column headers should sort info
List<Movie> MovieList = new List<Movie>();