Drag & Drop for .tas files, refactor play movie function

This commit is contained in:
andres.delikat 2011-05-13 01:44:20 +00:00
parent d356b2f72f
commit 6825c9f84c
3 changed files with 32 additions and 6 deletions

View File

@ -454,6 +454,13 @@ namespace BizHawk.MultiClient
private void FormDragDrop(object sender, DragEventArgs e) private void FormDragDrop(object sender, DragEventArgs e)
{ {
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (Path.GetExtension(filePaths[0]) == ".tas")
{
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
StartNewMovie(m);
}
else
LoadRom(filePaths[0]); LoadRom(filePaths[0]);
} }
@ -1713,5 +1720,15 @@ namespace BizHawk.MultiClient
else else
Global.RenderPanel.AddMessage("Movie read+write mode"); Global.RenderPanel.AddMessage("Movie read+write mode");
} }
public void StartNewMovie(Movie m)
{
UserMovie = m;
InputLog.StopMovie();
LoadRom(Global.MainForm.CurrentlyOpenRom);
UserMovie.LoadMovie();
UserMovie.StartPlayback();
}
} }
} }

View File

@ -167,6 +167,7 @@
this.button2.TabIndex = 6; this.button2.TabIndex = 6;
this.button2.Text = "Subtitles"; this.button2.Text = "Subtitles";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// button1 // button1
// //
@ -176,6 +177,7 @@
this.button1.TabIndex = 5; this.button1.TabIndex = 5;
this.button1.Text = "Comments"; this.button1.Text = "Comments";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// MovieCount // MovieCount
// //

View File

@ -53,10 +53,7 @@ namespace BizHawk.MultiClient
private void OK_Click(object sender, EventArgs e) private void OK_Click(object sender, EventArgs e)
{ {
Global.MainForm.UserMovie = MovieList[MovieView.SelectedIndices[0]]; Global.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]]);
Global.MainForm.LoadRom(Global.MainForm.CurrentlyOpenRom);
Global.MainForm.UserMovie.LoadMovie();
Global.MainForm.UserMovie.StartPlayback();
this.Close(); this.Close();
} }
@ -125,5 +122,15 @@ namespace BizHawk.MultiClient
DetailsView.Items.Add(item); DetailsView.Items.Add(item);
} }
} }
private void button1_Click(object sender, EventArgs e)
{
//TODO: a comments viewer/editor
}
private void button2_Click(object sender, EventArgs e)
{
//TODO: a subtitle viewer/editor
}
} }
} }