Record Movie Dialog - add header info on record, add author box and hook it up, dialog fix ups

This commit is contained in:
andres.delikat 2011-06-19 14:28:13 +00:00
parent 0e36c7d401
commit fc48e0e4f7
3 changed files with 246 additions and 176 deletions

View File

@ -35,6 +35,10 @@
this.RecordBox = new System.Windows.Forms.TextBox(); this.RecordBox = new System.Windows.Forms.TextBox();
this.StartFromCombo = new System.Windows.Forms.ComboBox(); this.StartFromCombo = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.AuthorBox = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -42,7 +46,7 @@
// //
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(282, 238); this.Cancel.Location = new System.Drawing.Point(394, 139);
this.Cancel.Name = "Cancel"; this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 0; this.Cancel.TabIndex = 0;
@ -53,7 +57,7 @@
// OK // OK
// //
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Location = new System.Drawing.Point(190, 238); this.OK.Location = new System.Drawing.Point(301, 139);
this.OK.Name = "OK"; this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23); this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 1; this.OK.TabIndex = 1;
@ -64,7 +68,7 @@
// Browse // Browse
// //
this.Browse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.Browse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Browse.Location = new System.Drawing.Point(300, 40); this.Browse.Location = new System.Drawing.Point(389, 11);
this.Browse.Name = "Browse"; this.Browse.Name = "Browse";
this.Browse.Size = new System.Drawing.Size(62, 23); this.Browse.Size = new System.Drawing.Size(62, 23);
this.Browse.TabIndex = 2; this.Browse.TabIndex = 2;
@ -77,9 +81,9 @@
this.RecordBox.AllowDrop = true; this.RecordBox.AllowDrop = true;
this.RecordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.RecordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.RecordBox.Location = new System.Drawing.Point(13, 40); this.RecordBox.Location = new System.Drawing.Point(83, 13);
this.RecordBox.Name = "RecordBox"; this.RecordBox.Name = "RecordBox";
this.RecordBox.Size = new System.Drawing.Size(277, 20); this.RecordBox.Size = new System.Drawing.Size(300, 20);
this.RecordBox.TabIndex = 3; this.RecordBox.TabIndex = 3;
this.RecordBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragDrop); this.RecordBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragDrop);
this.RecordBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragEnter); this.RecordBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragEnter);
@ -91,21 +95,65 @@
this.StartFromCombo.Items.AddRange(new object[] { this.StartFromCombo.Items.AddRange(new object[] {
"Power-On", "Power-On",
"Now"}); "Now"});
this.StartFromCombo.Location = new System.Drawing.Point(7, 19); this.StartFromCombo.Location = new System.Drawing.Point(83, 65);
this.StartFromCombo.MaxDropDownItems = 32; this.StartFromCombo.MaxDropDownItems = 32;
this.StartFromCombo.Name = "StartFromCombo"; this.StartFromCombo.Name = "StartFromCombo";
this.StartFromCombo.Size = new System.Drawing.Size(161, 21); this.StartFromCombo.Size = new System.Drawing.Size(199, 21);
this.StartFromCombo.TabIndex = 4; this.StartFromCombo.TabIndex = 4;
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.AuthorBox);
this.groupBox1.Controls.Add(this.StartFromCombo); this.groupBox1.Controls.Add(this.StartFromCombo);
this.groupBox1.Location = new System.Drawing.Point(13, 96); this.groupBox1.Controls.Add(this.Browse);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.RecordBox);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(179, 55); this.groupBox1.Size = new System.Drawing.Size(457, 112);
this.groupBox1.TabIndex = 5; this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Start from"; //
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(36, 41);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Author:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 68);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(71, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Record From:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(51, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(26, 13);
this.label1.TabIndex = 4;
this.label1.Text = "File:";
//
// AuthorBox
//
this.AuthorBox.AllowDrop = true;
this.AuthorBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AuthorBox.Location = new System.Drawing.Point(83, 39);
this.AuthorBox.Name = "AuthorBox";
this.AuthorBox.Size = new System.Drawing.Size(300, 20);
this.AuthorBox.TabIndex = 7;
// //
// RecordMovie // RecordMovie
// //
@ -113,10 +161,8 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel; this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(374, 273); this.ClientSize = new System.Drawing.Size(485, 174);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.RecordBox);
this.Controls.Add(this.Browse);
this.Controls.Add(this.OK); this.Controls.Add(this.OK);
this.Controls.Add(this.Cancel); this.Controls.Add(this.Cancel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@ -126,8 +172,8 @@
this.Text = "Record Movie"; this.Text = "Record Movie";
this.Load += new System.EventHandler(this.RecordMovie_Load); this.Load += new System.EventHandler(this.RecordMovie_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@ -139,5 +185,9 @@
private System.Windows.Forms.TextBox RecordBox; private System.Windows.Forms.TextBox RecordBox;
private System.Windows.Forms.ComboBox StartFromCombo; private System.Windows.Forms.ComboBox StartFromCombo;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox AuthorBox;
} }
} }

View File

@ -12,16 +12,10 @@ namespace BizHawk.MultiClient
{ {
public partial class RecordMovie : Form public partial class RecordMovie : Form
{ {
//TODO: on OK check that the user actually selected a movie (text box != empty?)
//Allow relative paths in record textbox //Allow relative paths in record textbox
//Have an editiable listview for header info and any other settings, or appropriate widgets //Hook up RecordFrom box
//Some header/settings that needs to be editable: //PAL vs NTSC when appropriate (by SystemID)
// System ID //Other platform specific header lines
// Game
// Author (very important)
// Some comments?
// Platform specific bools like PAL vs NTSC or an FDS flag, etc
Movie MovieToRecord; Movie MovieToRecord;
@ -32,6 +26,8 @@ namespace BizHawk.MultiClient
private string MakePath() private string MakePath()
{ {
if (RecordBox.Text.Length == 0)
return "";
string path = RecordBox.Text; string path = RecordBox.Text;
int x = path.LastIndexOf('\\'); int x = path.LastIndexOf('\\');
if (path.LastIndexOf('\\') == -1) if (path.LastIndexOf('\\') == -1)
@ -51,10 +47,29 @@ namespace BizHawk.MultiClient
private void OK_Click(object sender, EventArgs e) private void OK_Click(object sender, EventArgs e)
{ {
string path = MakePath(); string path = MakePath();
if (path.Length > 0)
{
MovieToRecord = new Movie(path, MOVIEMODE.RECORD); MovieToRecord = new Movie(path, MOVIEMODE.RECORD);
//Header
MovieToRecord.SetHeaderLine(MovieHeader.AUTHOR, AuthorBox.Text);
MovieToRecord.SetHeaderLine(MovieHeader.EMULATIONVERSION, MainForm.EMUVERSION);
MovieToRecord.SetHeaderLine(MovieHeader.MOVIEVERSION, MovieHeader.MovieVersion);
MovieToRecord.SetHeaderLine(MovieHeader.GUID, MovieHeader.MakeGUID());
MovieToRecord.SetHeaderLine(MovieHeader.PLATFORM, Global.Emulator.SystemId);
if (Global.Game != null)
MovieToRecord.SetHeaderLine(MovieHeader.GAMENAME, Global.Game.FilesystemSafeName);
else
MovieToRecord.SetHeaderLine(MovieHeader.GAMENAME, "NULL");
Global.MainForm.StartNewMovie(MovieToRecord, true); Global.MainForm.StartNewMovie(MovieToRecord, true);
this.Close(); this.Close();
} }
else
MessageBox.Show("Please select a movie to record", "File selection error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void Cancel_Click(object sender, EventArgs e) private void Cancel_Click(object sender, EventArgs e)
{ {

View File

@ -27,6 +27,11 @@ namespace BizHawk.MultiClient
public static string MovieVersion = "BizHawk v0.0.1"; public static string MovieVersion = "BizHawk v0.0.1";
public static string MakeGUID()
{
return System.Guid.NewGuid().ToString();
}
public MovieHeader() //All required fields will be set to default values public MovieHeader() //All required fields will be set to default values
{ {
HeaderParams.Add(EMULATIONVERSION, MainForm.EMUVERSION); HeaderParams.Add(EMULATIONVERSION, MainForm.EMUVERSION);
@ -35,7 +40,7 @@ namespace BizHawk.MultiClient
HeaderParams.Add(GAMENAME, ""); HeaderParams.Add(GAMENAME, "");
HeaderParams.Add(AUTHOR, ""); HeaderParams.Add(AUTHOR, "");
HeaderParams.Add(RERECORDS, "0"); HeaderParams.Add(RERECORDS, "0");
HeaderParams.Add(GUID, System.Guid.NewGuid().ToString()); HeaderParams.Add(GUID, MakeGUID());
} }
public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName, string Author, int rerecords) public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName, string Author, int rerecords)
@ -46,7 +51,7 @@ namespace BizHawk.MultiClient
HeaderParams.Add(GAMENAME, GameName); HeaderParams.Add(GAMENAME, GameName);
HeaderParams.Add(AUTHOR, Author); HeaderParams.Add(AUTHOR, Author);
HeaderParams.Add(RERECORDS, rerecords.ToString()); HeaderParams.Add(RERECORDS, rerecords.ToString());
HeaderParams.Add(GUID, System.Guid.NewGuid().ToString()); HeaderParams.Add(GUID, MakeGUID());
} }
/// <summary> /// <summary>