BizHawk/BizHawk.MultiClient/movie/EditCommentsForm.cs

74 lines
1.5 KiB
C#
Raw Normal View History

2011-07-04 01:57:18 +00:00
using System;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
2011-07-04 01:57:18 +00:00
{
public partial class EditCommentsForm : Form
{
public bool ReadOnly;
private Movie selectedMovie;
2011-07-04 01:57:18 +00:00
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)
{
int x = Height + ((CommentGrid.Rows.Count - 8) * 21);
if (x < 600)
Height = x;
else
Height = 600;
}
2011-07-04 01:57:18 +00:00
}
private void Cancel_Click(object sender, EventArgs e)
{
2013-04-15 02:14:14 +00:00
Close();
2011-07-04 01:57:18 +00:00
}
private void OK_Click(object sender, EventArgs e)
{
if (!ReadOnly)
{
selectedMovie.Header.Comments.Clear();
for (int x = 0; x < CommentGrid.Rows.Count - 1; x++)
{
DataGridViewCell c = CommentGrid.Rows[x].Cells[0];
2013-04-15 02:14:14 +00:00
selectedMovie.Header.Comments.Add("comment " + c.Value);
}
selectedMovie.WriteMovie();
2011-07-04 01:57:18 +00:00
}
2013-04-15 02:14:14 +00:00
Close();
2011-07-04 01:57:18 +00:00
}
public void GetMovie(Movie m)
{
selectedMovie = m;
if (m.Header.Comments.Count == 0) return;
for (int x = 0; x < m.Header.Comments.Count; x++)
2011-07-04 01:57:18 +00:00
{
string str = m.Header.Comments[x];
if (str.Length >= 7 && str.Substring(0, 7) == "comment")
str = str.Remove(0, 7);
CommentGrid.Rows.Add();
DataGridViewCell c = CommentGrid.Rows[x].Cells[0];
c.Value = str;
2011-07-04 01:57:18 +00:00
}
}
}
}