Subtitle editor touchups - Make color cells the color they are representing, display color in hex, put try/catches + error messages if trying to parse erroneous data, tooltips for columns
This commit is contained in:
parent
26569dab58
commit
fed74b17b2
|
@ -36,7 +36,7 @@
|
||||||
this.X = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.X = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Length = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Length = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Color = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.DispColor = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.Message = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Message = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.SubGrid)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.SubGrid)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
this.X,
|
this.X,
|
||||||
this.Y,
|
this.Y,
|
||||||
this.Length,
|
this.Length,
|
||||||
this.Color,
|
this.DispColor,
|
||||||
this.Message});
|
this.Message});
|
||||||
this.SubGrid.Location = new System.Drawing.Point(12, 12);
|
this.SubGrid.Location = new System.Drawing.Point(12, 12);
|
||||||
this.SubGrid.Name = "SubGrid";
|
this.SubGrid.Name = "SubGrid";
|
||||||
|
@ -89,6 +89,7 @@
|
||||||
this.Frame.HeaderText = "Frame";
|
this.Frame.HeaderText = "Frame";
|
||||||
this.Frame.MaxInputLength = 7;
|
this.Frame.MaxInputLength = 7;
|
||||||
this.Frame.Name = "Frame";
|
this.Frame.Name = "Frame";
|
||||||
|
this.Frame.ToolTipText = "The first frame the subtitle will be displayed (integer)";
|
||||||
this.Frame.Width = 75;
|
this.Frame.Width = 75;
|
||||||
//
|
//
|
||||||
// X
|
// X
|
||||||
|
@ -96,6 +97,7 @@
|
||||||
this.X.HeaderText = "X";
|
this.X.HeaderText = "X";
|
||||||
this.X.MaxInputLength = 3;
|
this.X.MaxInputLength = 3;
|
||||||
this.X.Name = "X";
|
this.X.Name = "X";
|
||||||
|
this.X.ToolTipText = "Screen coordinate (absolute)";
|
||||||
this.X.Width = 30;
|
this.X.Width = 30;
|
||||||
//
|
//
|
||||||
// Y
|
// Y
|
||||||
|
@ -103,6 +105,7 @@
|
||||||
this.Y.HeaderText = "Y";
|
this.Y.HeaderText = "Y";
|
||||||
this.Y.MaxInputLength = 3;
|
this.Y.MaxInputLength = 3;
|
||||||
this.Y.Name = "Y";
|
this.Y.Name = "Y";
|
||||||
|
this.Y.ToolTipText = "Screen coordinate (absolute)";
|
||||||
this.Y.Width = 30;
|
this.Y.Width = 30;
|
||||||
//
|
//
|
||||||
// Length
|
// Length
|
||||||
|
@ -110,14 +113,16 @@
|
||||||
this.Length.HeaderText = "Length";
|
this.Length.HeaderText = "Length";
|
||||||
this.Length.MaxInputLength = 5;
|
this.Length.MaxInputLength = 5;
|
||||||
this.Length.Name = "Length";
|
this.Length.Name = "Length";
|
||||||
|
this.Length.ToolTipText = "How long subtitle will be displayed";
|
||||||
this.Length.Width = 50;
|
this.Length.Width = 50;
|
||||||
//
|
//
|
||||||
// Color
|
// DispColor
|
||||||
//
|
//
|
||||||
this.Color.HeaderText = "Color";
|
this.DispColor.HeaderText = "Color";
|
||||||
this.Color.MaxInputLength = 8;
|
this.DispColor.MaxInputLength = 8;
|
||||||
this.Color.Name = "Color";
|
this.DispColor.Name = "DispColor";
|
||||||
this.Color.Width = 60;
|
this.DispColor.ToolTipText = "Color of subtitle text";
|
||||||
|
this.DispColor.Width = 60;
|
||||||
//
|
//
|
||||||
// Message
|
// Message
|
||||||
//
|
//
|
||||||
|
@ -126,6 +131,7 @@
|
||||||
this.Message.MaxInputLength = 255;
|
this.Message.MaxInputLength = 255;
|
||||||
this.Message.MinimumWidth = 25;
|
this.Message.MinimumWidth = 25;
|
||||||
this.Message.Name = "Message";
|
this.Message.Name = "Message";
|
||||||
|
this.Message.ToolTipText = "What will be displayed";
|
||||||
//
|
//
|
||||||
// EditSubtitlesForm
|
// EditSubtitlesForm
|
||||||
//
|
//
|
||||||
|
@ -155,7 +161,7 @@
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn X;
|
private System.Windows.Forms.DataGridViewTextBoxColumn X;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Y;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Y;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Length;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Length;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Color;
|
private System.Windows.Forms.DataGridViewTextBoxColumn DispColor;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Message;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,10 +14,7 @@ namespace BizHawk.MultiClient
|
||||||
public bool ReadOnly;
|
public bool ReadOnly;
|
||||||
private Movie selectedMovie = new Movie();
|
private Movie selectedMovie = new Movie();
|
||||||
|
|
||||||
//TODO: Tooltips on cells explaining format
|
|
||||||
//TODO: Parse hex on color when saving
|
//TODO: Parse hex on color when saving
|
||||||
//TODO: try/catch on parsing int
|
|
||||||
//TODO: display color in hex when loading from movie
|
|
||||||
//TODO: color if color cell = value of color cell
|
//TODO: color if color cell = value of color cell
|
||||||
|
|
||||||
public EditSubtitlesForm()
|
public EditSubtitlesForm()
|
||||||
|
@ -44,6 +41,14 @@ namespace BizHawk.MultiClient
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowError(int row, int column)
|
||||||
|
{
|
||||||
|
DataGridViewCell c = SubGrid.Rows[row].Cells[column];
|
||||||
|
string error = "Unable to parse value: " + c.Value.ToString();
|
||||||
|
string caption = "Parse Error Row " + row.ToString() + " Column " + column.ToString();
|
||||||
|
MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!ReadOnly)
|
if (!ReadOnly)
|
||||||
|
@ -52,18 +57,24 @@ namespace BizHawk.MultiClient
|
||||||
for (int x = 0; x < SubGrid.Rows.Count - 1; x++)
|
for (int x = 0; x < SubGrid.Rows.Count - 1; x++)
|
||||||
{
|
{
|
||||||
Subtitle s = new Subtitle();
|
Subtitle s = new Subtitle();
|
||||||
|
|
||||||
DataGridViewCell c = SubGrid.Rows[x].Cells[0];
|
DataGridViewCell c = SubGrid.Rows[x].Cells[0];
|
||||||
//TODO: try/catch parsing
|
try { s.Frame = int.Parse(c.Value.ToString()); }
|
||||||
s.Frame = int.Parse(c.Value.ToString());
|
catch { ShowError(x, 0); return; }
|
||||||
c = SubGrid.Rows[x].Cells[1];
|
c = SubGrid.Rows[x].Cells[1];
|
||||||
s.X = int.Parse(c.Value.ToString());
|
try { s.X = int.Parse(c.Value.ToString()); }
|
||||||
|
catch { ShowError(x, 1); return; }
|
||||||
c = SubGrid.Rows[x].Cells[2];
|
c = SubGrid.Rows[x].Cells[2];
|
||||||
s.Y = int.Parse(c.Value.ToString());
|
try { s.Y = int.Parse(c.Value.ToString()); }
|
||||||
|
catch { ShowError(x, 2); return; }
|
||||||
c = SubGrid.Rows[x].Cells[3];
|
c = SubGrid.Rows[x].Cells[3];
|
||||||
s.Duration = int.Parse(c.Value.ToString());
|
try { s.Duration = int.Parse(c.Value.ToString()); }
|
||||||
|
catch { ShowError(x, 3); return; }
|
||||||
c = SubGrid.Rows[x].Cells[4];
|
c = SubGrid.Rows[x].Cells[4];
|
||||||
s.Color = uint.Parse(c.Value.ToString());
|
try { s.Color = uint.Parse(c.Value.ToString()); }
|
||||||
c = SubGrid.Rows[x].Cells[5];
|
catch { ShowError(x, 4); return; }
|
||||||
|
try { c = SubGrid.Rows[x].Cells[5]; }
|
||||||
|
catch { ShowError(x, 5); return; }
|
||||||
s.Message = c.Value.ToString();
|
s.Message = c.Value.ToString();
|
||||||
selectedMovie.Subtitles.AddSubtitle(s);
|
selectedMovie.Subtitles.AddSubtitle(s);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +102,8 @@ namespace BizHawk.MultiClient
|
||||||
c = SubGrid.Rows[x].Cells[3];
|
c = SubGrid.Rows[x].Cells[3];
|
||||||
c.Value = s.Duration;
|
c.Value = s.Duration;
|
||||||
c = SubGrid.Rows[x].Cells[4];
|
c = SubGrid.Rows[x].Cells[4];
|
||||||
c.Value = s.Color; //TODO: view in hex
|
c.Value = String.Format("{0:X8}", s.Color);
|
||||||
|
c.Style.BackColor = Color.FromArgb((int)s.Color);
|
||||||
c = SubGrid.Rows[x].Cells[5];
|
c = SubGrid.Rows[x].Cells[5];
|
||||||
c.Value = s.Message;
|
c.Value = s.Message;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +121,8 @@ namespace BizHawk.MultiClient
|
||||||
c = SubGrid.Rows[index].Cells[3];
|
c = SubGrid.Rows[index].Cells[3];
|
||||||
c.Value = s.Duration;
|
c.Value = s.Duration;
|
||||||
c = SubGrid.Rows[index].Cells[4];
|
c = SubGrid.Rows[index].Cells[4];
|
||||||
c.Value = s.Color; //TODO: view in hex
|
c.Value = String.Format("{0:X8}", s.Color);
|
||||||
|
c.Style.BackColor = Color.FromArgb((int)s.Color);
|
||||||
c = SubGrid.Rows[index].Cells[5];
|
c = SubGrid.Rows[index].Cells[5];
|
||||||
c.Value = s.Message;
|
c.Value = s.Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
<metadata name="Length.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="Length.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="Color.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="DispColor.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="Message.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="Message.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
|
|
@ -145,11 +145,6 @@
|
||||||
this.DurationNumeric.Name = "DurationNumeric";
|
this.DurationNumeric.Name = "DurationNumeric";
|
||||||
this.DurationNumeric.Size = new System.Drawing.Size(56, 20);
|
this.DurationNumeric.Size = new System.Drawing.Size(56, 20);
|
||||||
this.DurationNumeric.TabIndex = 30;
|
this.DurationNumeric.TabIndex = 30;
|
||||||
this.DurationNumeric.Value = new decimal(new int[] {
|
|
||||||
9999,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue