From 384a4a61b6d83d87968795197f08b41dba911f44 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Mon, 4 Jul 2011 01:57:18 +0000 Subject: [PATCH] Start movie comments editor --- .../BizHawk.MultiClient.csproj | 9 ++ .../movie/EditCommentsForm.Designer.cs | 111 +++++++++++++ BizHawk.MultiClient/movie/EditCommentsForm.cs | 59 +++++++ .../movie/EditCommentsForm.resx | 152 ++++++++++++++++++ .../movie/EditSubtitlesForm.cs | 1 + BizHawk.MultiClient/movie/Movie.cs | 10 ++ BizHawk.MultiClient/movie/MovieHeader.cs | 144 ++++++++--------- 7 files changed, 414 insertions(+), 72 deletions(-) create mode 100644 BizHawk.MultiClient/movie/EditCommentsForm.Designer.cs create mode 100644 BizHawk.MultiClient/movie/EditCommentsForm.cs create mode 100644 BizHawk.MultiClient/movie/EditCommentsForm.resx diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 6ac340cc93..1a8986cf08 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -138,6 +138,12 @@ + + Form + + + EditCommentsForm.cs + @@ -407,6 +413,9 @@ + + EditCommentsForm.cs + EditSubtitlesForm.cs diff --git a/BizHawk.MultiClient/movie/EditCommentsForm.Designer.cs b/BizHawk.MultiClient/movie/EditCommentsForm.Designer.cs new file mode 100644 index 0000000000..f8a4ee25e4 --- /dev/null +++ b/BizHawk.MultiClient/movie/EditCommentsForm.Designer.cs @@ -0,0 +1,111 @@ +namespace BizHawk.MultiClient.movie +{ + partial class EditCommentsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditCommentsForm)); + this.Cancel = new System.Windows.Forms.Button(); + this.OK = new System.Windows.Forms.Button(); + this.CommentGrid = new System.Windows.Forms.DataGridView(); + this.Comment = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).BeginInit(); + this.SuspendLayout(); + // + // Cancel + // + 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.Location = new System.Drawing.Point(405, 216); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 0; + this.Cancel.Text = "&Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.Click += new System.EventHandler(this.Cancel_Click); + // + // OK + // + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OK.Location = new System.Drawing.Point(324, 216); + this.OK.Name = "OK"; + this.OK.Size = new System.Drawing.Size(75, 23); + this.OK.TabIndex = 1; + this.OK.Text = "&Ok"; + this.OK.UseVisualStyleBackColor = true; + this.OK.Click += new System.EventHandler(this.OK_Click); + // + // CommentGrid + // + this.CommentGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.CommentGrid.BackgroundColor = System.Drawing.SystemColors.ControlLight; + this.CommentGrid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; + this.CommentGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.CommentGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Comment}); + this.CommentGrid.Location = new System.Drawing.Point(12, 12); + this.CommentGrid.Name = "CommentGrid"; + this.CommentGrid.Size = new System.Drawing.Size(468, 198); + this.CommentGrid.TabIndex = 2; + // + // Comment + // + this.Comment.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Comment.HeaderText = "Comment"; + this.Comment.MaxInputLength = 512; + this.Comment.MinimumWidth = 100; + this.Comment.Name = "Comment"; + // + // EditCommentsForm + // + this.AcceptButton = this.OK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(492, 251); + this.Controls.Add(this.CommentGrid); + this.Controls.Add(this.OK); + this.Controls.Add(this.Cancel); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "EditCommentsForm"; + this.Text = "Edit Comments"; + this.Load += new System.EventHandler(this.EditCommentsForm_Load); + ((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button Cancel; + private System.Windows.Forms.Button OK; + private System.Windows.Forms.DataGridView CommentGrid; + private System.Windows.Forms.DataGridViewTextBoxColumn Comment; + } +} \ No newline at end of file diff --git a/BizHawk.MultiClient/movie/EditCommentsForm.cs b/BizHawk.MultiClient/movie/EditCommentsForm.cs new file mode 100644 index 0000000000..7b4c02921b --- /dev/null +++ b/BizHawk.MultiClient/movie/EditCommentsForm.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.MultiClient.movie +{ + public partial class EditCommentsForm : Form + { + public bool ReadOnly; + private Movie selectedMovie = new Movie(); + + public EditCommentsForm() + { + InitializeComponent(); + } + + private void EditCommentsForm_Load(object sender, EventArgs e) + { + if (ReadOnly) + { + CommentGrid.Columns[0].ReadOnly = true; + Text = "View Comments"; + } + + if (CommentGrid.Rows.Count > 8) + this.Height = Height + ((CommentGrid.Rows.Count - 8) * 21); + } + + private void Cancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void OK_Click(object sender, EventArgs e) + { + if (!ReadOnly) + { + + } + this.Close(); + } + + public void GetMovie(Movie m) + { + selectedMovie = m; + List comments = m.GetComments(); + for (int x = 0; x < c.Count; x++) + { + DataGridViewCell c = CommentGrid.Rows[x].Cells[0]; + c.Value = comments[x]; + } + } + } +} diff --git a/BizHawk.MultiClient/movie/EditCommentsForm.resx b/BizHawk.MultiClient/movie/EditCommentsForm.resx new file mode 100644 index 0000000000..7ce68561f1 --- /dev/null +++ b/BizHawk.MultiClient/movie/EditCommentsForm.resx @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + + + AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA////AP64aABQUFAAwNjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAA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AAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAMDAAMDAwAAAAAAAAAAAAMCAgMDAwMDAwAAAAMDAAADAgICAwMDAwMDAwMCAgMAAAMCAwMD + AwMDAwMDAgIDAAMEBAQDAgMDAwMDAwICAgMDBAQEAwICAwQDAwQDAgIDAAMDAwICAgMCAgIDAwMDAAAA + AwICAgMCAgIDAgMAAAAAAAAAAwMEBAQEBAQCAwAAAAAAAwMEBAQDAwMDAwMAAAAAAwQEAwMEBAMEBAQC + AwAAAAMEBAMDBAMEBAQEAgMAAAAAAwMDBAQDBAMDAwIDAAAAAAMCAgICAgICAgMEBAMAAAAAAwICAgIC + AwMEBAQDAAAAAAADAwMDAwAAAwMDAJH/AAAAcwAAAAEAAIABAAAAAAAAAAAAAIABAADABwAA8AMAAOAD + AADAAQAAwAEAAOABAADgAAAA8AAAAPgxAAA= + + + \ No newline at end of file diff --git a/BizHawk.MultiClient/movie/EditSubtitlesForm.cs b/BizHawk.MultiClient/movie/EditSubtitlesForm.cs index caa831e1ae..970a25a00d 100644 --- a/BizHawk.MultiClient/movie/EditSubtitlesForm.cs +++ b/BizHawk.MultiClient/movie/EditSubtitlesForm.cs @@ -17,6 +17,7 @@ namespace BizHawk.MultiClient //TODO: Tooltips on cells explaining format //TODO: Parse hex on color when saving //TODO: try/catch on parsing int + //TODO: display color in hex when loading from movie public EditSubtitlesForm() { diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index b226bb6a5b..13a8b1af10 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -191,6 +191,11 @@ namespace BizHawk.MultiClient sw.WriteLine(kvp.Key + " " + kvp.Value); } + for (int x = 0; x < Header.Comments.Count; x++) + { + sw.WriteLine(Header.Comments[x]); + } + for (int x = 0; x < Subtitles.Count(); x++) { sw.WriteLine(Subtitles.GetSubtitleText(x)); @@ -700,5 +705,10 @@ namespace BizHawk.MultiClient else return 0; } + + public List GetComments() + { + return Header.Comments; + } } } diff --git a/BizHawk.MultiClient/movie/MovieHeader.cs b/BizHawk.MultiClient/movie/MovieHeader.cs index 58a3118ef3..3808a9c448 100644 --- a/BizHawk.MultiClient/movie/MovieHeader.cs +++ b/BizHawk.MultiClient/movie/MovieHeader.cs @@ -5,93 +5,93 @@ using System.Text; namespace BizHawk.MultiClient { - class MovieHeader - { - //Required Header Params - //Emulation - Core version, will be 1.0.0 until there is a versioning system - //Movie - Versioning for the Movie code itself, or perhaps this could be changed client version? - //Platform - Must know what platform we are making a movie on! - //GameName - Which game - //TODO: GUID, checksum of game, other stuff + class MovieHeader + { + //Required Header Params + //Emulation - Core version, will be 1.0.0 until there is a versioning system + //Movie - Versioning for the Movie code itself, or perhaps this could be changed client version? + //Platform - Must know what platform we are making a movie on! + //GameName - Which game + //TODO: GUID, checksum of game, other stuff - public Dictionary HeaderParams = new Dictionary(); //Platform specific options go here - public List Comments = new List(); + public Dictionary HeaderParams = new Dictionary(); //Platform specific options go here + public List Comments = new List(); - public const string EMULATIONVERSION = "emuVersion"; - public const string MOVIEVERSION = "MovieVersion"; - public const string PLATFORM = "Platform"; - public const string GAMENAME = "GameName"; - public const string AUTHOR = "Author"; - public const string RERECORDS = "rerecordCount"; - public const string GUID = "GUID"; + public const string EMULATIONVERSION = "emuVersion"; + public const string MOVIEVERSION = "MovieVersion"; + public const string PLATFORM = "Platform"; + public const string GAMENAME = "GameName"; + public const string AUTHOR = "Author"; + public const string RERECORDS = "rerecordCount"; + public const string GUID = "GUID"; - 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 - { - HeaderParams.Add(EMULATIONVERSION, MainForm.EMUVERSION); - HeaderParams.Add(MOVIEVERSION, MovieVersion); - HeaderParams.Add(PLATFORM, ""); - HeaderParams.Add(GAMENAME, ""); - HeaderParams.Add(AUTHOR, ""); - HeaderParams.Add(RERECORDS, "0"); - HeaderParams.Add(GUID, MakeGUID()); - } + public MovieHeader() //All required fields will be set to default values + { + HeaderParams.Add(EMULATIONVERSION, MainForm.EMUVERSION); + HeaderParams.Add(MOVIEVERSION, MovieVersion); + HeaderParams.Add(PLATFORM, ""); + HeaderParams.Add(GAMENAME, ""); + HeaderParams.Add(AUTHOR, ""); + HeaderParams.Add(RERECORDS, "0"); + HeaderParams.Add(GUID, MakeGUID()); + } - public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName, string Author, int rerecords) - { - HeaderParams.Add(EMULATIONVERSION, EmulatorVersion); - HeaderParams.Add(MOVIEVERSION, MovieVersion); - HeaderParams.Add(PLATFORM, Platform); - HeaderParams.Add(GAMENAME, GameName); - HeaderParams.Add(AUTHOR, Author); - HeaderParams.Add(RERECORDS, rerecords.ToString()); - HeaderParams.Add(GUID, MakeGUID()); - } + public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName, string Author, int rerecords) + { + HeaderParams.Add(EMULATIONVERSION, EmulatorVersion); + HeaderParams.Add(MOVIEVERSION, MovieVersion); + HeaderParams.Add(PLATFORM, Platform); + HeaderParams.Add(GAMENAME, GameName); + HeaderParams.Add(AUTHOR, Author); + HeaderParams.Add(RERECORDS, rerecords.ToString()); + HeaderParams.Add(GUID, MakeGUID()); + } - /// - /// Adds the key value pair to header params. If key already exists, value will be updated - /// - /// - /// - public void AddHeaderLine(string key, string value) - { - string temp = value; + /// + /// Adds the key value pair to header params. If key already exists, value will be updated + /// + /// + /// + public void AddHeaderLine(string key, string value) + { + string temp = value; - if(!HeaderParams.TryGetValue(key, out temp)) //TODO: does a failed attempt mess with value? - HeaderParams.Add(key, value); - } + if (!HeaderParams.TryGetValue(key, out temp)) //TODO: does a failed attempt mess with value? + HeaderParams.Add(key, value); + } - public void UpdateRerecordCount(int count) - { - HeaderParams[RERECORDS] = count.ToString(); - } + public void UpdateRerecordCount(int count) + { + HeaderParams[RERECORDS] = count.ToString(); + } - public bool RemoveHeaderLine(string key) - { - return HeaderParams.Remove(key); - } + public bool RemoveHeaderLine(string key) + { + return HeaderParams.Remove(key); + } - public void Clear() - { - HeaderParams.Clear(); - } + public void Clear() + { + HeaderParams.Clear(); + } - public string GetHeaderLine(string key) - { - string value = ""; - HeaderParams.TryGetValue(key, out value); - return value; - } + public string GetHeaderLine(string key) + { + string value = ""; + HeaderParams.TryGetValue(key, out value); + return value; + } - public void SetHeaderLine(string key, string value) - { - HeaderParams[key] = value; - } - } + public void SetHeaderLine(string key, string value) + { + HeaderParams[key] = value; + } + } }