private void buttonGo_Click(object sender, EventArgs e) { int activeLongLineCount = this.getNumberOfLongActiveLines(previewWorkerVars.CombinedAll); if (activeLongLineCount > 0) { bool cont = UtilsMsg.showConfirm(String.Format("There are {0} active lines that have a long duration (> {1} seconds).\r\n\r\n" + "Do you wish to continue?\r\n\r\n" + "(These long lines are colored red. See \"Preferences > Misc > Long Clip Warning\" to configure threshold.)", activeLongLineCount, ConstantSettings.LongClipWarningSeconds)); if (!cont) { return; } } SubsProcessor subsProcessor = new SubsProcessor(); if ((previewWorkerVars != null) && (previewWorkerVars.CombinedAll != null)) { subsProcessor.start(previewWorkerVars.CombinedAll); } }
/// <summary> /// Reprocess the subtitles and discard active/inactive and text changes made by the user. /// </summary> private void buttonRegenerate_Click(object sender, EventArgs e) { string oldSubs1 = "-----"; string oldSubs2 = "-----"; if (changesHaveBeenMade) { bool confirmed = UtilsMsg.showConfirm("Regenerate the preview and discard the changes that you have made?"); if (!confirmed) { return; } } changesHaveBeenMade = false; // Save the currently selected item if (currentInfoComb != null) { InfoCombined selectedComb = currentInfoComb; oldSubs1 = selectedComb.Subs1.Text; oldSubs2 = selectedComb.Subs2.Text; } generatePreview(); int indexOfItemToSelect = 0; // Try to select the saved item for (int i = 0; i < listViewLines.Items.Count; i++) { InfoCombined curComb = (InfoCombined)listViewLines.Items[i].Tag; if (curComb.Subs1.Text == oldSubs1 && curComb.Subs2.Text == oldSubs2) { indexOfItemToSelect = i; break; } } if (listViewLines.Items.Count > 0) { listViewLines.Focus(); listViewLines.Items[indexOfItemToSelect].Selected = true; listViewLines.EnsureVisible(indexOfItemToSelect); } }