Exemplo n.º 1
0
		private void OK_Click(object sender, EventArgs e)
		{
			if (!ReadOnly)
			{
				_selectedMovie.Subtitles.Clear();
				for (int i = 0; i < SubGrid.Rows.Count - 1; i++)
				{
					var s = new Subtitle();
					
					var c = SubGrid.Rows[i].Cells[0];
					try { s.Frame = int.Parse(c.Value.ToString()); }
					catch { ShowError(i, 0); return; }
					c = SubGrid.Rows[i].Cells[1];
					try { s.X = int.Parse(c.Value.ToString()); }
					catch { ShowError(i, 1); return; }
					c = SubGrid.Rows[i].Cells[2];
					try { s.Y = int.Parse(c.Value.ToString()); }
					catch { ShowError(i, 2); return; }
					c = SubGrid.Rows[i].Cells[3];
					try { s.Duration = int.Parse(c.Value.ToString()); }
					catch { ShowError(i, 3); return; }
					c = SubGrid.Rows[i].Cells[4];
					try { s.Color = uint.Parse(c.Value.ToString(), NumberStyles.HexNumber); }
					catch { ShowError(i, 4); return; }
					try { c = SubGrid.Rows[i].Cells[5]; }
					catch { ShowError(i, 5); return; }
					s.Message = c.Value.ToString();
					_selectedMovie.Subtitles.Add(s);
				}
				_selectedMovie.Save();
			}
			Close();
		}
Exemplo n.º 2
0
        private void AddSubtitleContextMenuItem_Click(object sender, EventArgs e)
        {
            //TODO: rethink this?
            var subForm = new SubtitleMaker();
            subForm.DisableFrame();

            int index = -1;
            var sub = new Subtitle();
            for (int x = 0; x < Global.MovieSession.Movie.Subtitles.Count; x++)
            {
                sub = Global.MovieSession.Movie.Subtitles[x];
                if (Global.Emulator.Frame == sub.Frame)
                {
                    index = x;
                    break;
                }
            }

            if (index < 0)
            {
                sub = new Subtitle { Frame = Global.Emulator.Frame };
            }

            subForm.Sub = sub;

            if (subForm.ShowDialog() == DialogResult.OK)
            {
                if (index >= 0)
                {
                    Global.MovieSession.Movie.Subtitles.RemoveAt(index);
                }

                Global.MovieSession.Movie.Subtitles.Add(subForm.Sub);
            }
        }
Exemplo n.º 3
0
		public Subtitle(Subtitle s)
		{
			Message = s.Message;
			Frame = s.Frame;
			X = s.X;
			Y = s.Y;
			Duration = s.Duration;
			Color = s.Color;
		}
Exemplo n.º 4
0
 private void ChangeRow(Subtitle s, int index)
 {
     if (index >= SubGrid.Rows.Count) return;
     var c = SubGrid.Rows[index].Cells[0];
     c.Value = s.Frame;
     c = SubGrid.Rows[index].Cells[1];
     c.Value = s.X;
     c = SubGrid.Rows[index].Cells[2];
     c.Value = s.Y;
     c = SubGrid.Rows[index].Cells[3];
     c.Value = s.Duration;
     c = SubGrid.Rows[index].Cells[4];
     c.Value = String.Format("{0:X8}", s.Color);
     c.Style.BackColor = Color.FromArgb((int)s.Color);
     c = SubGrid.Rows[index].Cells[5];
     c.Value = s.Message;
 }
Exemplo n.º 5
0
        private Subtitle GetRow(int index)
        {
            if (index >= SubGrid.Rows.Count) return new Subtitle();

            var s = new Subtitle();
            var c = SubGrid.Rows[index].Cells[0];

            //Empty catch because it should default to subtitle default value
            try { s.Frame = int.Parse(c.Value.ToString()); }
            catch { }
            c = SubGrid.Rows[index].Cells[1];
            try { s.X = int.Parse(c.Value.ToString()); }
            catch { }
            c = SubGrid.Rows[index].Cells[2];
            try { s.Y = int.Parse(c.Value.ToString()); }
            catch { }
            c = SubGrid.Rows[index].Cells[3];
            try { s.Duration = int.Parse(c.Value.ToString()); }
            catch { }
            c = SubGrid.Rows[index].Cells[4];
            try { s.Color = uint.Parse(c.Value.ToString()); }
            catch { }
            c = SubGrid.Rows[index].Cells[5];
            try { s.Message = c.Value.ToString(); }
            catch { }
            _selectedMovie.Subtitles.Add(s);

            return s;
        }