Tastudio - make comment editor always in edit mode, make it modeless, add a save button
This commit is contained in:
parent
b10ef0b1a4
commit
829ee72914
|
@ -33,6 +33,7 @@
|
|||
this.OK = new System.Windows.Forms.Button();
|
||||
this.CommentGrid = new System.Windows.Forms.DataGridView();
|
||||
this.Comment = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.SaveBtn = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -40,9 +41,9 @@
|
|||
//
|
||||
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(384, 267);
|
||||
this.Cancel.Location = new System.Drawing.Point(399, 267);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.Size = new System.Drawing.Size(60, 23);
|
||||
this.Cancel.TabIndex = 0;
|
||||
this.Cancel.Text = "&Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
|
@ -51,9 +52,9 @@
|
|||
// 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(303, 267);
|
||||
this.OK.Location = new System.Drawing.Point(333, 267);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.Size = new System.Drawing.Size(60, 23);
|
||||
this.OK.TabIndex = 1;
|
||||
this.OK.Text = "&Ok";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
|
@ -83,6 +84,17 @@
|
|||
this.Comment.MinimumWidth = 100;
|
||||
this.Comment.Name = "Comment";
|
||||
//
|
||||
// SaveBtn
|
||||
//
|
||||
this.SaveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.SaveBtn.Location = new System.Drawing.Point(12, 267);
|
||||
this.SaveBtn.Name = "SaveBtn";
|
||||
this.SaveBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.SaveBtn.TabIndex = 3;
|
||||
this.SaveBtn.Text = "&Save";
|
||||
this.SaveBtn.UseVisualStyleBackColor = true;
|
||||
this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
|
||||
//
|
||||
// EditCommentsForm
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
|
@ -90,6 +102,7 @@
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(471, 302);
|
||||
this.Controls.Add(this.SaveBtn);
|
||||
this.Controls.Add(this.CommentGrid);
|
||||
this.Controls.Add(this.OK);
|
||||
this.Controls.Add(this.Cancel);
|
||||
|
@ -110,5 +123,6 @@
|
|||
private System.Windows.Forms.Button OK;
|
||||
private System.Windows.Forms.DataGridView CommentGrid;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Comment;
|
||||
private System.Windows.Forms.Button SaveBtn;
|
||||
}
|
||||
}
|
|
@ -20,9 +20,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
_sortReverse = false;
|
||||
}
|
||||
|
||||
public bool ForceReadWrite { get; set; }
|
||||
|
||||
private void EditCommentsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.MovieSession.ReadOnly)
|
||||
if (!ForceReadWrite && Global.MovieSession.ReadOnly)
|
||||
{
|
||||
CommentGrid.Columns[0].ReadOnly = true;
|
||||
Text = "View Comments";
|
||||
|
@ -35,6 +37,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
_selectedMovie.Comments.Clear();
|
||||
for (int i = 0; i < CommentGrid.Rows.Count - 1; i++)
|
||||
{
|
||||
var c = CommentGrid.Rows[i].Cells[0];
|
||||
_selectedMovie.Comments.Add(c.Value.ToString());
|
||||
}
|
||||
|
||||
_selectedMovie.Save();
|
||||
}
|
||||
|
||||
public void GetMovie(IMovie m)
|
||||
{
|
||||
_selectedMovie = m;
|
||||
|
@ -58,19 +72,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!Global.MovieSession.ReadOnly)
|
||||
{
|
||||
_selectedMovie.Comments.Clear();
|
||||
for (int i = 0; i < CommentGrid.Rows.Count - 1; i++)
|
||||
{
|
||||
var c = CommentGrid.Rows[i].Cells[0];
|
||||
_selectedMovie.Comments.Add("comment " + c.Value);
|
||||
}
|
||||
_selectedMovie.Save();
|
||||
}
|
||||
Save();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void SaveBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
|
||||
private void OnColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
{
|
||||
SortColumn(CommentGrid.Columns[e.ColumnIndex]);
|
||||
|
|
|
@ -573,7 +573,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var form = new EditCommentsForm();
|
||||
form.GetMovie(CurrentTasMovie);
|
||||
form.ShowDialog();
|
||||
form.ForceReadWrite = true;
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void SubtitlesMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in New Issue