示例#1
0
        public static void ShowForReplace(TextEditor editor, bool replace)
        {
            if (theDialog == null)
            {
                theDialog = new FindAndReplaceForm(editor);
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Show();
                theDialog.Activate();
            }
            else
            {
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Activate();
            }

            if (!editor.TextArea.Selection.IsMultiline)
            {
                theDialog.txtFind.Text = theDialog.txtFind2.Text = editor.TextArea.Selection.GetText();
                theDialog.txtFind.SelectAll();
                theDialog.txtFind2.SelectAll();
                theDialog.txtFind2.Focus();
            }

            if (replace)
            {
                theDialog.txtFind2.Focus();
            }
            else
            {
                theDialog.txtFind.Focus();
            }
        }
        public static void ShowForReplace(TextEditor editor, bool replace)
        {
            if (theDialog == null)
            {
                theDialog = new FindAndReplaceForm(editor);
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Show();
                theDialog.Activate();
            }
            else
            {
                theDialog.tabMain.SelectedIndex = replace ? 1 : 0;
                theDialog.Activate();
            }

            if (!editor.TextArea.Selection.IsMultiline)
            {
                theDialog.txtFind.Text = theDialog.txtFind2.Text = editor.TextArea.Selection.GetText();
                theDialog.txtFind.SelectAll();
                theDialog.txtFind2.SelectAll();
                theDialog.txtFind2.Focus();
            }

            if (replace)
            {
                theDialog.txtFind2.Focus();
            }
            else
            {
                theDialog.txtFind.Focus();
            }
        }
        private void FindAndReplaceForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            textToFind = txtFind2.Text;
            caseSensitive = (cbCaseSensitive.Checked);
            wholeWord = (cbWholeWord.Checked);
            useRegex = (cbRegex.Checked);
            useWildcards = (cbWildcards.Checked);
            searchUp = (cbSearchUp.Checked);

            theDialog = null;
        }
示例#4
0
        private void FindAndReplaceForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            textToFind    = txtFind2.Text;
            caseSensitive = (cbCaseSensitive.Checked);
            wholeWord     = (cbWholeWord.Checked);
            useRegex      = (cbRegex.Checked);
            useWildcards  = (cbWildcards.Checked);
            searchUp      = (cbSearchUp.Checked);

            theDialog = null;
        }