Start movie comments editor

This commit is contained in:
andres.delikat 2011-07-04 01:57:18 +00:00
parent bf5fa3356a
commit 384a4a61b6
7 changed files with 414 additions and 72 deletions

View File

@ -138,6 +138,12 @@
<Compile Include="Input\ControllerBinding.cs" />
<Compile Include="Input\GamePad.cs" />
<Compile Include="Input\Input.cs" />
<Compile Include="movie\EditCommentsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="movie\EditCommentsForm.Designer.cs">
<DependentUpon>EditCommentsForm.cs</DependentUpon>
</Compile>
<Compile Include="movie\InputAdapters.cs" />
<Compile Include="Input\Keyboard.cs" />
<Compile Include="LuaImplementation.cs" />
@ -407,6 +413,9 @@
<EmbeddedResource Include="images\BuilderDialog_moveup.bmp" />
<EmbeddedResource Include="images\InserSeparator.bmp" />
<EmbeddedResource Include="images\search.ico" />
<EmbeddedResource Include="movie\EditCommentsForm.resx">
<DependentUpon>EditCommentsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="movie\EditSubtitlesForm.resx">
<DependentUpon>EditSubtitlesForm.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,111 @@
namespace BizHawk.MultiClient.movie
{
partial class EditCommentsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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<string> comments = m.GetComments();
for (int x = 0; x < c.Count; x++)
{
DataGridViewCell c = CommentGrid.Rows[x].Cells[0];
c.Value = comments[x];
}
}
}
}

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Comment.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA////AP64aABQUFAAwNjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAIABAADABwAA8AMAAOAD
AADAAQAAwAEAAOABAADgAAAA8AAAAPgxAAA=
</value>
</data>
</root>

View File

@ -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()
{

View File

@ -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<string> GetComments()
{
return Header.Comments;
}
}
}

View File

@ -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<string, string> HeaderParams = new Dictionary<string, string>(); //Platform specific options go here
public List<string> Comments = new List<string>();
public Dictionary<string, string> HeaderParams = new Dictionary<string, string>(); //Platform specific options go here
public List<string> Comments = new List<string>();
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());
}
/// <summary>
/// Adds the key value pair to header params. If key already exists, value will be updated
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
public void AddHeaderLine(string key, string value)
{
string temp = value;
/// <summary>
/// Adds the key value pair to header params. If key already exists, value will be updated
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
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;
}
}
}