private void SetTag(string tag) { if (listViewFixes.SelectedItems.Count == 0) { return; } listViewFixes.BeginUpdate(); string closeTag = $"</{tag[1]}>"; foreach (ListViewItem lvi in listViewFixes.SelectedItems) { var p = (Paragraph)lvi.Tag; string value = _fixedTexts[p.ID]; value = HtmlUtils.RemoveOpenCloseTags(value, tag[1].ToString()); value = $"{tag}{value}{closeTag}"; // refresh fixed values lvi.SubItems[AfterTextIndex].Text = StringUtils.GetListViewString(value, noTag: false); _fixedTexts[p.ID] = value; } if (listViewFixes.SelectedItems.Count > 0) { textBoxParagraphText.Text = _fixedTexts[((Paragraph)listViewFixes.SelectedItems[0].Tag).ID]; } listViewFixes.EndUpdate(); }
private void ButtonRemove_Click(object sender, EventArgs e) { foreach (Paragraph p in _subtitle.Paragraphs) { var text = p.Text; if (!text.ContainsColor()) { continue; } text = HtmlUtils.RemoveOpenCloseTags(text, HtmlUtils.TagFont); if (text.ContainsColor() == false) { p.Text = text; } } Subtitle = _subtitle.ToText(); DialogResult = DialogResult.OK; }
private void ButtonOK_Click(object sender, EventArgs e) { if (!checkBoxEnabledMoods.Checked && !checkBoxEnabledNarrator.Checked) { DialogResult = DialogResult.Cancel; return; } // take out all <font tags // (warning: this may cause some problems if subtitle already contain 'font face' attribute) foreach (Paragraph p in _subtitle.Paragraphs) { p.Text = HtmlUtils.RemoveOpenCloseTags(p.Text, HtmlUtils.TagFont); } foreach (Artist artist in GetArtists()) { artist.Paint(_subtitle); } Subtitle = _subtitle.ToText(); DialogResult = DialogResult.OK; }