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.Location = new System.Drawing.Point(0, 0);
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.Text = "menuStrip1";
this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate);
@ -285,7 +285,7 @@
//
this.openROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile;
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.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click);
//
@ -298,7 +298,7 @@
this.autoloadMostRecentToolStripMenuItem});
this.recentROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Recent;
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.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened);
//
@ -331,14 +331,14 @@
//
this.closeROMToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Close;
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.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
//
// saveStateToolStripMenuItem
//
@ -356,7 +356,7 @@
this.toolStripSeparator6,
this.saveNamedStateToolStripMenuItem});
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.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened);
//
@ -458,7 +458,7 @@
this.toolStripSeparator7,
this.loadNamedStateToolStripMenuItem});
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.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened);
//
@ -563,7 +563,7 @@
this.saveToCurrentSlotToolStripMenuItem,
this.loadCurrentSlotToolStripMenuItem});
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.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened);
//
@ -673,7 +673,7 @@
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(142, 6);
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
//
// movieToolStripMenuItem
//
@ -689,7 +689,7 @@
this.bindSavestatesToMoviesToolStripMenuItem,
this.automaticallyBackupMoviesToolStripMenuItem});
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.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened);
//
@ -744,6 +744,7 @@
//
// recordMovieToolStripMenuItem
//
this.recordMovieToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.RecordHS;
this.recordMovieToolStripMenuItem.Name = "recordMovieToolStripMenuItem";
this.recordMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22);
this.recordMovieToolStripMenuItem.Text = "&Record Movie...";
@ -751,6 +752,7 @@
//
// playMovieToolStripMenuItem
//
this.playMovieToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Play;
this.playMovieToolStripMenuItem.Name = "playMovieToolStripMenuItem";
this.playMovieToolStripMenuItem.Size = new System.Drawing.Size(222, 22);
this.playMovieToolStripMenuItem.Text = "&Play Movie...";
@ -797,7 +799,7 @@
this.screenshotF12ToolStripMenuItem,
this.screenshotAsToolStripMenuItem});
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";
//
// screenshotF12ToolStripMenuItem
@ -818,13 +820,13 @@
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(142, 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(145, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//

View File

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

View File

@ -12,11 +12,10 @@ namespace BizHawk.MultiClient
{
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 savestate files (that have an input log)
//AddMovieToList should check for duplicates and not add them
List<Movie> MovieList = new List<Movie>();
bool sortReverse;
string sortedCol;
@ -56,7 +55,8 @@ namespace BizHawk.MultiClient
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);
}
@ -83,32 +83,49 @@ namespace BizHawk.MultiClient
return;
else
{
AddMovieToList(ofd.FileName);
int x = AddMovieToList(ofd.FileName);
if (x > 0)
{
MovieView.SelectedIndices.Clear();
MovieView.setSelection(x);
MovieView.SelectItem(x, true);
}
}
MovieView.SelectedIndices.Clear();
MovieView.setSelection(MovieList.Count - 1);
MovieView.SelectItem(MovieView.Items.Count - 1, true);
}
}
private void AddMovieToList(string filename)
private int AddMovieToList(string filename)
{
using (var file = new HawkFile(filename))
{
if (!file.Exists)
return;
return 0;
else
{
PreLoadMovieFile(file);
MovieView.ItemCount = MovieList.Count;
UpdateList();
sortReverse = false;
sortedCol = "";
int x = IsDuplicate(filename);
if (x == 0)
{
PreLoadMovieFile(file);
MovieView.ItemCount = MovieList.Count;
UpdateList();
sortReverse = false;
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)
{
Movie m = new Movie(path.CanonicalFullPath, MOVIEMODE.INACTIVE);
@ -176,7 +193,8 @@ namespace BizHawk.MultiClient
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();
c.ReadOnly = true;
c.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
@ -185,7 +203,8 @@ namespace BizHawk.MultiClient
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();
s.ReadOnly = true;
s.GetMovie(MovieList[MovieView.SelectedIndices[0]]);