private void ButtonStylesClick(object sender, EventArgs e) { if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name) { var sub = new Subtitle(); var form = new SubStationAlphaStyles(sub, new AdvancedSubStationAlpha()); form.MakeOnlyOneStyle(); if (form.ShowDialog(this) == DialogResult.OK) { _assStyle = form.Header; } } else if (comboBoxSubtitleFormats.Text == new SubStationAlpha().Name) { var sub = new Subtitle(); var form = new SubStationAlphaStyles(sub, new SubStationAlpha()); if (form.ShowDialog(this) == DialogResult.OK) { _ssaStyle = form.Header; } } }
private void toolStripMenuItemAssStyles_Click(object sender, EventArgs e) { var formatType = GetCurrentSubtitleFormat().GetType(); if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha)) { var styles = new SubStationAlphaStyles(_subtitle, GetCurrentSubtitleFormat()); if (styles.ShowDialog(this) == DialogResult.OK) { _subtitle.Header = styles.Header; var styleList = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header); if (styleList.Count > 0) { for (int i=0; i<_subtitle.Paragraphs.Count; i++) { Paragraph p = _subtitle.Paragraphs[i]; if (p.Extra == null) { p.Extra = styleList[0]; SubtitleListview1.SetExtraText(i, p.Extra, SubtitleListview1.ForeColor); } else { bool found = false; foreach (string s in styleList) { if (s.ToLower() == p.Extra.ToLower()) found = true; } if (!found) { p.Extra = styleList[0]; SubtitleListview1.SetExtraText(i, p.Extra, SubtitleListview1.ForeColor); } } } } } } else if (formatType == typeof(TimedText10) || formatType == typeof(ItunesTimedText)) { var styles = new TimedTextStyles(_subtitle, GetCurrentSubtitleFormat()); if (styles.ShowDialog(this) == DialogResult.OK) _subtitle.Header = styles.Header; } }