Play Movie Dialog - various cleanups

This commit is contained in:
andres.delikat 2011-07-10 17:04:24 +00:00
parent 4ba6fb4122
commit a3fd68ac35
3 changed files with 54 additions and 31 deletions

View File

@ -255,7 +255,7 @@
this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(470, 21); this.menuStrip1.Size = new System.Drawing.Size(470, 40);
this.menuStrip1.TabIndex = 0; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate); this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate);
@ -285,7 +285,7 @@
// //
this.openROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile; this.openROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile;
this.openROMToolStripMenuItem.Name = "openROMToolStripMenuItem"; this.openROMToolStripMenuItem.Name = "openROMToolStripMenuItem";
this.openROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.openROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openROMToolStripMenuItem.Text = "Open ROM"; this.openROMToolStripMenuItem.Text = "Open ROM";
this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click); this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click);
// //
@ -298,7 +298,7 @@
this.autoloadMostRecentToolStripMenuItem}); this.autoloadMostRecentToolStripMenuItem});
this.recentROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Recent; this.recentROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Recent;
this.recentROMToolStripMenuItem.Name = "recentROMToolStripMenuItem"; this.recentROMToolStripMenuItem.Name = "recentROMToolStripMenuItem";
this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.recentROMToolStripMenuItem.Text = "Recent ROM"; this.recentROMToolStripMenuItem.Text = "Recent ROM";
this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened); this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened);
// //
@ -331,14 +331,14 @@
// //
this.closeROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Close; this.closeROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Close;
this.closeROMToolStripMenuItem.Name = "closeROMToolStripMenuItem"; this.closeROMToolStripMenuItem.Name = "closeROMToolStripMenuItem";
this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.closeROMToolStripMenuItem.Text = "&Close ROM"; this.closeROMToolStripMenuItem.Text = "&Close ROM";
this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click); this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6); this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
// //
// saveStateToolStripMenuItem // saveStateToolStripMenuItem
// //
@ -356,7 +356,7 @@
this.toolStripSeparator6, this.toolStripSeparator6,
this.saveNamedStateToolStripMenuItem}); this.saveNamedStateToolStripMenuItem});
this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem"; this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem";
this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveStateToolStripMenuItem.Text = "Save State"; this.saveStateToolStripMenuItem.Text = "Save State";
this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened); this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened);
// //
@ -458,7 +458,7 @@
this.toolStripSeparator7, this.toolStripSeparator7,
this.loadNamedStateToolStripMenuItem}); this.loadNamedStateToolStripMenuItem});
this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem"; this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem";
this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.loadStateToolStripMenuItem.Text = "Load State"; this.loadStateToolStripMenuItem.Text = "Load State";
this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened); this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened);
// //
@ -563,7 +563,7 @@
this.saveToCurrentSlotToolStripMenuItem, this.saveToCurrentSlotToolStripMenuItem,
this.loadCurrentSlotToolStripMenuItem}); this.loadCurrentSlotToolStripMenuItem});
this.saveSlotToolStripMenuItem.Name = "saveSlotToolStripMenuItem"; this.saveSlotToolStripMenuItem.Name = "saveSlotToolStripMenuItem";
this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveSlotToolStripMenuItem.Text = "SaveSlot"; this.saveSlotToolStripMenuItem.Text = "SaveSlot";
this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened); this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened);
// //
@ -673,7 +673,7 @@
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(142, 6); this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
// //
// movieToolStripMenuItem // movieToolStripMenuItem
// //
@ -689,7 +689,7 @@
this.bindSavestatesToMoviesToolStripMenuItem, this.bindSavestatesToMoviesToolStripMenuItem,
this.automaticallyBackupMoviesToolStripMenuItem}); this.automaticallyBackupMoviesToolStripMenuItem});
this.movieToolStripMenuItem.Name = "movieToolStripMenuItem"; this.movieToolStripMenuItem.Name = "movieToolStripMenuItem";
this.movieToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.movieToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.movieToolStripMenuItem.Text = "Movie"; this.movieToolStripMenuItem.Text = "Movie";
this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened); this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened);
// //
@ -744,6 +744,7 @@
// //
// recordMovieToolStripMenuItem // recordMovieToolStripMenuItem
// //
this.recordMovieToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.RecordHS;
this.recordMovieToolStripMenuItem.Name = "recordMovieToolStripMenuItem"; this.recordMovieToolStripMenuItem.Name = "recordMovieToolStripMenuItem";
this.recordMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.recordMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22);
this.recordMovieToolStripMenuItem.Text = "&Record Movie..."; this.recordMovieToolStripMenuItem.Text = "&Record Movie...";
@ -751,6 +752,7 @@
// //
// playMovieToolStripMenuItem // playMovieToolStripMenuItem
// //
this.playMovieToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Play;
this.playMovieToolStripMenuItem.Name = "playMovieToolStripMenuItem"; this.playMovieToolStripMenuItem.Name = "playMovieToolStripMenuItem";
this.playMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.playMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22);
this.playMovieToolStripMenuItem.Text = "&Play Movie..."; this.playMovieToolStripMenuItem.Text = "&Play Movie...";
@ -797,7 +799,7 @@
this.screenshotF12ToolStripMenuItem, this.screenshotF12ToolStripMenuItem,
this.screenshotAsToolStripMenuItem}); this.screenshotAsToolStripMenuItem});
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem"; this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem";
this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.screenshotToolStripMenuItem.Text = "Screenshot"; this.screenshotToolStripMenuItem.Text = "Screenshot";
// //
// screenshotF12ToolStripMenuItem // screenshotF12ToolStripMenuItem
@ -818,13 +820,13 @@
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(142, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //

View File

@ -168,6 +168,7 @@
// //
// button2 // button2
// //
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(125, 251); this.button2.Location = new System.Drawing.Point(125, 251);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
@ -178,6 +179,7 @@
// //
// button1 // button1
// //
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(15, 251); this.button1.Location = new System.Drawing.Point(15, 251);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);

View File

@ -12,10 +12,9 @@ namespace BizHawk.MultiClient
{ {
public partial class PlayMovie : Form public partial class PlayMovie : Form
{ {
//TODO: after browse & update, focus on the movie just added, and show stats //Highlight movie on load that maches rom name
// Option to include subdirectories // Option to include subdirectories
// Option to include savestate files (that have an input log) // Option to include savestate files (that have an input log)
//AddMovieToList should check for duplicates and not add them
List<Movie> MovieList = new List<Movie>(); List<Movie> MovieList = new List<Movie>();
bool sortReverse; bool sortReverse;
@ -56,7 +55,8 @@ namespace BizHawk.MultiClient
private void Run() private void Run()
{ {
//TODO: check for selected index! ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
if (indexes.Count == 0) return;
Global.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]], false); Global.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]], false);
} }
@ -83,21 +83,27 @@ namespace BizHawk.MultiClient
return; return;
else else
{ {
AddMovieToList(ofd.FileName); int x = AddMovieToList(ofd.FileName);
} if (x > 0)
{
MovieView.SelectedIndices.Clear(); MovieView.SelectedIndices.Clear();
MovieView.setSelection(MovieList.Count - 1); MovieView.setSelection(x);
MovieView.SelectItem(MovieView.Items.Count - 1, true); MovieView.SelectItem(x, true);
}
}
} }
} }
private void AddMovieToList(string filename) private int AddMovieToList(string filename)
{ {
using (var file = new HawkFile(filename)) using (var file = new HawkFile(filename))
{ {
if (!file.Exists) if (!file.Exists)
return; return 0;
else else
{
int x = IsDuplicate(filename);
if (x == 0)
{ {
PreLoadMovieFile(file); PreLoadMovieFile(file);
MovieView.ItemCount = MovieList.Count; MovieView.ItemCount = MovieList.Count;
@ -105,10 +111,21 @@ namespace BizHawk.MultiClient
sortReverse = false; sortReverse = false;
sortedCol = ""; sortedCol = "";
x = MovieList.Count - 1;
}
return x;
} }
} }
} }
private int IsDuplicate(string filename)
{
for (int x = 0; x < MovieList.Count; x++)
if (MovieList[x].GetFilePath() == filename)
return x;
return 0;
}
private void PreLoadMovieFile(HawkFile path) private void PreLoadMovieFile(HawkFile path)
{ {
Movie m = new Movie(path.CanonicalFullPath, MOVIEMODE.INACTIVE); Movie m = new Movie(path.CanonicalFullPath, MOVIEMODE.INACTIVE);
@ -176,7 +193,8 @@ namespace BizHawk.MultiClient
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
//TODO: check for selected index first! ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
if (indexes.Count == 0) return;
EditCommentsForm c = new EditCommentsForm(); EditCommentsForm c = new EditCommentsForm();
c.ReadOnly = true; c.ReadOnly = true;
c.GetMovie(MovieList[MovieView.SelectedIndices[0]]); c.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
@ -185,7 +203,8 @@ namespace BizHawk.MultiClient
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
//TODO: check for selected index first! ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
if (indexes.Count == 0) return;
EditSubtitlesForm s = new EditSubtitlesForm(); EditSubtitlesForm s = new EditSubtitlesForm();
s.ReadOnly = true; s.ReadOnly = true;
s.GetMovie(MovieList[MovieView.SelectedIndices[0]]); s.GetMovie(MovieList[MovieView.SelectedIndices[0]]);