Tastudio - make comment editor always in edit mode, make it modeless, add a save button
This commit is contained in:
parent
b10ef0b1a4
commit
829ee72914
|
@ -28,79 +28,92 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditCommentsForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditCommentsForm));
|
||||||
this.Cancel = new System.Windows.Forms.Button();
|
this.Cancel = new System.Windows.Forms.Button();
|
||||||
this.OK = new System.Windows.Forms.Button();
|
this.OK = new System.Windows.Forms.Button();
|
||||||
this.CommentGrid = new System.Windows.Forms.DataGridView();
|
this.CommentGrid = new System.Windows.Forms.DataGridView();
|
||||||
this.Comment = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.Comment = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).BeginInit();
|
this.SaveBtn = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).BeginInit();
|
||||||
//
|
this.SuspendLayout();
|
||||||
// Cancel
|
//
|
||||||
//
|
// 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.Cancel.Location = new System.Drawing.Point(384, 267);
|
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.Cancel.Name = "Cancel";
|
this.Cancel.Location = new System.Drawing.Point(399, 267);
|
||||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
this.Cancel.Name = "Cancel";
|
||||||
this.Cancel.TabIndex = 0;
|
this.Cancel.Size = new System.Drawing.Size(60, 23);
|
||||||
this.Cancel.Text = "&Cancel";
|
this.Cancel.TabIndex = 0;
|
||||||
this.Cancel.UseVisualStyleBackColor = true;
|
this.Cancel.Text = "&Cancel";
|
||||||
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
|
this.Cancel.UseVisualStyleBackColor = true;
|
||||||
//
|
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
|
||||||
// OK
|
//
|
||||||
//
|
// 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.OK.Name = "OK";
|
this.OK.Location = new System.Drawing.Point(333, 267);
|
||||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
this.OK.Name = "OK";
|
||||||
this.OK.TabIndex = 1;
|
this.OK.Size = new System.Drawing.Size(60, 23);
|
||||||
this.OK.Text = "&Ok";
|
this.OK.TabIndex = 1;
|
||||||
this.OK.UseVisualStyleBackColor = true;
|
this.OK.Text = "&Ok";
|
||||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
this.OK.UseVisualStyleBackColor = true;
|
||||||
//
|
this.OK.Click += new System.EventHandler(this.OK_Click);
|
||||||
// CommentGrid
|
//
|
||||||
//
|
// CommentGrid
|
||||||
this.CommentGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
//
|
||||||
|
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.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.CommentGrid.BackgroundColor = System.Drawing.SystemColors.ControlLight;
|
this.CommentGrid.BackgroundColor = System.Drawing.SystemColors.ControlLight;
|
||||||
this.CommentGrid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
this.CommentGrid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||||
this.CommentGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.CommentGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.CommentGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
this.CommentGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||||
this.Comment});
|
this.Comment});
|
||||||
this.CommentGrid.Location = new System.Drawing.Point(12, 12);
|
this.CommentGrid.Location = new System.Drawing.Point(12, 12);
|
||||||
this.CommentGrid.Name = "CommentGrid";
|
this.CommentGrid.Name = "CommentGrid";
|
||||||
this.CommentGrid.Size = new System.Drawing.Size(447, 249);
|
this.CommentGrid.Size = new System.Drawing.Size(447, 249);
|
||||||
this.CommentGrid.TabIndex = 2;
|
this.CommentGrid.TabIndex = 2;
|
||||||
this.CommentGrid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.OnColumnHeaderMouseClick);
|
this.CommentGrid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.OnColumnHeaderMouseClick);
|
||||||
//
|
//
|
||||||
// Comment
|
// Comment
|
||||||
//
|
//
|
||||||
this.Comment.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
this.Comment.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||||
this.Comment.HeaderText = "Comment";
|
this.Comment.HeaderText = "Comment";
|
||||||
this.Comment.MaxInputLength = 512;
|
this.Comment.MaxInputLength = 512;
|
||||||
this.Comment.MinimumWidth = 100;
|
this.Comment.MinimumWidth = 100;
|
||||||
this.Comment.Name = "Comment";
|
this.Comment.Name = "Comment";
|
||||||
//
|
//
|
||||||
// EditCommentsForm
|
// SaveBtn
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.OK;
|
this.SaveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.SaveBtn.Location = new System.Drawing.Point(12, 267);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.SaveBtn.Name = "SaveBtn";
|
||||||
this.CancelButton = this.Cancel;
|
this.SaveBtn.Size = new System.Drawing.Size(75, 23);
|
||||||
this.ClientSize = new System.Drawing.Size(471, 302);
|
this.SaveBtn.TabIndex = 3;
|
||||||
this.Controls.Add(this.CommentGrid);
|
this.SaveBtn.Text = "&Save";
|
||||||
this.Controls.Add(this.OK);
|
this.SaveBtn.UseVisualStyleBackColor = true;
|
||||||
this.Controls.Add(this.Cancel);
|
this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
//
|
||||||
this.MinimumSize = new System.Drawing.Size(188, 121);
|
// EditCommentsForm
|
||||||
this.Name = "EditCommentsForm";
|
//
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.AcceptButton = this.OK;
|
||||||
this.Text = "Edit Comments";
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.Load += new System.EventHandler(this.EditCommentsForm_Load);
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).EndInit();
|
this.CancelButton = this.Cancel;
|
||||||
this.ResumeLayout(false);
|
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);
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MinimumSize = new System.Drawing.Size(188, 121);
|
||||||
|
this.Name = "EditCommentsForm";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Edit Comments";
|
||||||
|
this.Load += new System.EventHandler(this.EditCommentsForm_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.CommentGrid)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,5 +123,6 @@
|
||||||
private System.Windows.Forms.Button OK;
|
private System.Windows.Forms.Button OK;
|
||||||
private System.Windows.Forms.DataGridView CommentGrid;
|
private System.Windows.Forms.DataGridView CommentGrid;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn Comment;
|
private System.Windows.Forms.DataGridViewTextBoxColumn Comment;
|
||||||
|
private System.Windows.Forms.Button SaveBtn;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,9 +20,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_sortReverse = false;
|
_sortReverse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ForceReadWrite { get; set; }
|
||||||
|
|
||||||
private void EditCommentsForm_Load(object sender, EventArgs e)
|
private void EditCommentsForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.ReadOnly)
|
if (!ForceReadWrite && Global.MovieSession.ReadOnly)
|
||||||
{
|
{
|
||||||
CommentGrid.Columns[0].ReadOnly = true;
|
CommentGrid.Columns[0].ReadOnly = true;
|
||||||
Text = "View Comments";
|
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)
|
public void GetMovie(IMovie m)
|
||||||
{
|
{
|
||||||
_selectedMovie = m;
|
_selectedMovie = m;
|
||||||
|
@ -58,19 +72,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!Global.MovieSession.ReadOnly)
|
Save();
|
||||||
{
|
|
||||||
_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();
|
|
||||||
}
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
private void OnColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
{
|
{
|
||||||
SortColumn(CommentGrid.Columns[e.ColumnIndex]);
|
SortColumn(CommentGrid.Columns[e.ColumnIndex]);
|
||||||
|
|
|
@ -573,7 +573,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var form = new EditCommentsForm();
|
var form = new EditCommentsForm();
|
||||||
form.GetMovie(CurrentTasMovie);
|
form.GetMovie(CurrentTasMovie);
|
||||||
form.ShowDialog();
|
form.ForceReadWrite = true;
|
||||||
|
form.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubtitlesMenuItem_Click(object sender, EventArgs e)
|
private void SubtitlesMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue