/// <summary>
        /// Initializes a new instance of the <see cref="ModifySelection"/> class.
        /// </summary>
        /// <param name="subtitle">
        /// The subtitle.
        /// </param>
        /// <param name="subtitleListView">
        /// The subtitle list view.
        /// </param>
        public ModifySelection(Subtitle subtitle, SubtitleListView subtitleListView)
        {
            this.InitializeComponent();
            this._loading = true;
            this._subtitle = subtitle;
            this._subtitleListView = subtitleListView;
            this.labelInfo.Text = string.Empty;
            this.comboBoxRule.SelectedIndex = 0;
            this.Text = Configuration.Settings.Language.ModifySelection.Title;
            this.buttonOK.Text = Configuration.Settings.Language.General.Ok;
            this.buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
            this.buttonApply.Text = Configuration.Settings.Language.General.Apply;
            this.groupBoxRule.Text = Configuration.Settings.Language.ModifySelection.Rule;
            this.groupBoxWhatToDo.Text = Configuration.Settings.Language.ModifySelection.DoWithMatches;
            this.checkBoxCaseSensitive.Text = Configuration.Settings.Language.ModifySelection.CaseSensitive;
            this.radioButtonNewSelection.Text = Configuration.Settings.Language.ModifySelection.MakeNewSelection;
            this.radioButtonAddToSelection.Text = Configuration.Settings.Language.ModifySelection.AddToCurrentSelection;
            this.radioButtonSubtractFromSelection.Text = Configuration.Settings.Language.ModifySelection.SubtractFromCurrentSelection;
            this.radioButtonIntersect.Text = Configuration.Settings.Language.ModifySelection.IntersectWithCurrentSelection;
            this.columnHeaderApply.Text = Configuration.Settings.Language.General.Apply;
            this.columnHeaderLine.Text = Configuration.Settings.Language.General.LineNumber;
            this.columnHeaderText.Text = Configuration.Settings.Language.General.Text;

            Utilities.FixLargeFonts(this, this.buttonOK);

            this.comboBoxRule.Items.Clear();
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.Contains);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.StartsWith);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.EndsWith);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.NoContains);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.RegEx);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.UnequalLines);
            this.comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.EqualLines);

            this.checkBoxCaseSensitive.Checked = Configuration.Settings.Tools.ModifySelectionCaseSensitive;
            this.textBox1.Text = Configuration.Settings.Tools.ModifySelectionText;
            if (Configuration.Settings.Tools.ModifySelectionRule == "Starts with")
            {
                this.comboBoxRule.SelectedIndex = FunctionStartsWith;
            }
            else if (Configuration.Settings.Tools.ModifySelectionRule == "Ends with")
            {
                this.comboBoxRule.SelectedIndex = FunctionEndsWith;
            }
            else if (Configuration.Settings.Tools.ModifySelectionRule == "Not contains")
            {
                this.comboBoxRule.SelectedIndex = FunctionNotContains;
            }
            else if (Configuration.Settings.Tools.ModifySelectionRule == "RegEx")
            {
                this.comboBoxRule.SelectedIndex = FunctionRegEx;
            }
            else
            {
                this.comboBoxRule.SelectedIndex = 0;
            }

            this._loading = false;
            this.Preview();
        }
        public ModifySelection(Subtitle subtitle, SubtitleListView subtitleListView)
        {
            InitializeComponent();
            _loading = true;
            _subtitle = subtitle;
            _subtitleListView = subtitleListView;
            labelInfo.Text = string.Empty;
            comboBoxRule.SelectedIndex = 0;
            Text = Configuration.Settings.Language.ModifySelection.Title;
            buttonOK.Text = Configuration.Settings.Language.General.OK;
            buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
            buttonApply.Text = Configuration.Settings.Language.General.Apply;
            groupBoxRule.Text = Configuration.Settings.Language.ModifySelection.Rule;
            groupBoxWhatToDo.Text = Configuration.Settings.Language.ModifySelection.DoWithMatches;
            checkBoxCaseSensitive.Text = Configuration.Settings.Language.ModifySelection.CaseSensitive;
            radioButtonNewSelection.Text = Configuration.Settings.Language.ModifySelection.MakeNewSelection;
            radioButtonAddToSelection.Text = Configuration.Settings.Language.ModifySelection.AddToCurrentSelection;
            radioButtonSubtractFromSelection.Text = Configuration.Settings.Language.ModifySelection.SubtractFromCurrentSelection;
            radioButtonIntersect.Text = Configuration.Settings.Language.ModifySelection.IntersectWithCurrentSelection;
            columnHeaderApply.Text = Configuration.Settings.Language.General.Apply;
            columnHeaderLine.Text = Configuration.Settings.Language.General.LineNumber;
            columnHeaderText.Text = Configuration.Settings.Language.General.Text;

            FixLargeFonts();

            if (!string.IsNullOrEmpty(Configuration.Settings.Language.ModifySelection.Contains)) //TODO: Remove in SE 3.4
            {
                comboBoxRule.Items.Clear();
                comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.Contains);
                comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.StartsWith);
                comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.EndsWith);
                comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.NoContains);
                comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.RegEx);
                if (!string.IsNullOrEmpty(Configuration.Settings.Language.ModifySelection.UnequalLines))
                    comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.UnequalLines);
                if (!string.IsNullOrEmpty(Configuration.Settings.Language.ModifySelection.EqualLines))
                    comboBoxRule.Items.Add(Configuration.Settings.Language.ModifySelection.EqualLines);
            }

            checkBoxCaseSensitive.Checked = Configuration.Settings.Tools.ModifySelectionCaseSensitive;
            textBox1.Text = Configuration.Settings.Tools.ModifySelectionText;
            if (Configuration.Settings.Tools.ModifySelectionRule == "Starts with")
                comboBoxRule.SelectedIndex = 1;
            else if (Configuration.Settings.Tools.ModifySelectionRule == "Ends with")
                comboBoxRule.SelectedIndex = 2;
            else if (Configuration.Settings.Tools.ModifySelectionRule == "Not contains")
                comboBoxRule.SelectedIndex = 3;
            else if (Configuration.Settings.Tools.ModifySelectionRule == "RegEx")
                comboBoxRule.SelectedIndex = 4;
            else
                comboBoxRule.SelectedIndex = 0;
            _loading = false;
            Preview();
        }
 private void SyncListViews(ListView listViewSelected, SubtitleListView listViewOther)
 {
     if (listViewSelected.SelectedItems.Count > 0)
     {
         var first = listViewSelected.TopItem.Index;
         int index = listViewSelected.SelectedItems[0].Index;
         if (index < listViewOther.Items.Count)
         {
             listViewOther.SelectIndexAndEnsureVisible(index, false);
             if (first >= 0)
                 listViewOther.TopItem = listViewOther.Items[first];
         }
     }
 }