Record movie dialog - use filesystem safe name of game when choosing a default name. Fix regression that made default filename not populate in the savefile dialog.

This commit is contained in:
adelikat 2012-06-25 00:06:07 +00:00
parent 7e8752a5b9
commit 4d91471bab
3 changed files with 82 additions and 71 deletions

View File

@ -119,22 +119,34 @@ namespace BizHawk.MultiClient
private void button1_Click(object sender, EventArgs e)
{
string fileName = Movie.SaveRecordingAs();
string filename = "";
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
sfd.DefaultExt = "." + Global.Config.MovieExtension;
sfd.FileName = RecordBox.Text;
sfd.Filter = "Generic Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|" + Global.MainForm.GetMovieExtName() + "|All Files (*.*)|*.*";
if ("" != fileName)
Global.Sound.StopSound();
var result = sfd.ShowDialog();
Global.Sound.StartSound();
if (result == DialogResult.OK)
{
RecordBox.Text = fileName;
filename = sfd.FileName;
}
if ("" != filename)
{
RecordBox.Text = filename;
}
}
private void RecordMovie_Load(object sender, EventArgs e)
{
RecordBox.Text = Global.Game.Name;
RecordBox.Text = PathManager.FilesystemSafeName(Global.Game);
StartFromCombo.SelectedIndex = 0;
DefaultAuthorCheckBox.Checked = Global.Config.UseDefaultAuthor;
if (Global.Config.UseDefaultAuthor)
AuthorBox.Text = Global.Config.DefaultAuthor;
//TODO: populate combo with savestate slots that currently exist
}
private void RecordBox_DragEnter(object sender, DragEventArgs e)

View File

@ -198,26 +198,6 @@ namespace BizHawk.MultiClient
if(truncate) Log.Clear();
}
public static string SaveRecordingAs()
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
sfd.DefaultExt = "." + Global.Config.MovieExtension;
//sfd.FileName = RecordBox.Text;
sfd.FileName = Global.MovieSession.Movie.Filename;
sfd.Filter = "Generic Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|" + Global.MainForm.GetMovieExtName() + "|All Files (*.*)|*.*";
Global.Sound.StopSound();
var result = sfd.ShowDialog();
Global.Sound.StartSound();
if (result == DialogResult.OK)
{
return sfd.FileName;
}
return "";
}
public void StartPlayback()
{
ClearSaveRAM();

View File

@ -140,7 +140,7 @@ namespace BizHawk.MultiClient
//If we're at the end of the movie add one to show the cursor as a blank frame
TASView.ItemCount++;
}
TASView.ensureVisible(Global.Emulator.Frame-1);
TASView.ensureVisible(Global.Emulator.Frame - 1);
}
public void Restart()
@ -427,7 +427,7 @@ namespace BizHawk.MultiClient
private void saveProjectAsToolStripMenuItem_Click(object sender, EventArgs e)
{
string fileName = Movie.SaveRecordingAs();
string fileName = SaveRecordingAs();
if ("" != fileName)
{
@ -504,5 +504,24 @@ namespace BizHawk.MultiClient
Global.MovieSession.Movie.DeleteFrame(list[index]);
}
}
private static string SaveRecordingAs()
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
sfd.DefaultExt = "." + Global.Config.MovieExtension;
//sfd.FileName = RecordBox.Text;
sfd.FileName = Global.MovieSession.Movie.Filename;
sfd.Filter = "Generic Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|" + Global.MainForm.GetMovieExtName() + "|All Files (*.*)|*.*";
Global.Sound.StopSound();
var result = sfd.ShowDialog();
Global.Sound.StartSound();
if (result == DialogResult.OK)
{
return sfd.FileName;
}
return "";
}
}
}