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,7 +454,14 @@ namespace BizHawk.MultiClient
private void FormDragDrop(object sender, DragEventArgs e)
{
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
LoadRom(filePaths[0]);
if (Path.GetExtension(filePaths[0]) == ".tas")
{
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
StartNewMovie(m);
}
else
LoadRom(filePaths[0]);
}
public bool IsNullEmulator()
@ -1713,5 +1720,15 @@ namespace BizHawk.MultiClient
else
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.Text = "Subtitles";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
@ -176,6 +177,7 @@
this.button1.TabIndex = 5;
this.button1.Text = "Comments";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// MovieCount
//

View File

@ -43,7 +43,7 @@ namespace BizHawk.MultiClient
private void MovieView_QueryItemBkColor(int index, int column, ref Color color)
{
}
private void Cancel_Click(object sender, EventArgs e)
@ -53,10 +53,7 @@ namespace BizHawk.MultiClient
private void OK_Click(object sender, EventArgs e)
{
Global.MainForm.UserMovie = MovieList[MovieView.SelectedIndices[0]];
Global.MainForm.LoadRom(Global.MainForm.CurrentlyOpenRom);
Global.MainForm.UserMovie.LoadMovie();
Global.MainForm.UserMovie.StartPlayback();
Global.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]]);
this.Close();
}
@ -125,5 +122,15 @@ namespace BizHawk.MultiClient
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
}
}
}