Exemplo n.º 1
0
        /// <summary>
        /// Find the next term
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFindNext(object sender, EventArgs e)
        {
            if (document == null)
            {
                return;
            }

            if (textBoxFind.Text == "")
            {
                return;
            }

            ScintillaNET.SearchFlags flags = ScintillaNET.SearchFlags.Empty;
            if (checkboxCase.Checked)
            {
                flags |= ScintillaNET.SearchFlags.MatchCase;
            }
            if (checkBoxWord.Checked)
            {
                flags |= ScintillaNET.SearchFlags.WholeWord;
            }
            if (checkBoxRegex.Checked)
            {
                flags |= ScintillaNET.SearchFlags.RegExp;
            }

            ScintillaNET.Range range = document.Scintilla.FindReplace.FindNext(textBoxFind.Text, true, flags);
            if (range != null)
            {
                range.GotoStart();
                range.Select();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Replaces all text
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnReplaceAll(object sender, EventArgs e)
        {
            if (document == null)
            {
                return;
            }

            if (textBoxFind.Text == "")
            {
                return;
            }

            ScintillaNET.SearchFlags flags = ScintillaNET.SearchFlags.Empty;
            if (checkboxCase.Checked)
            {
                flags |= ScintillaNET.SearchFlags.MatchCase;
            }
            if (checkBoxWord.Checked)
            {
                flags |= ScintillaNET.SearchFlags.WholeWord;
            }
            if (checkBoxRegex.Checked)
            {
                flags |= ScintillaNET.SearchFlags.RegExp;
            }

            List <ScintillaNET.Range> ranges = document.Scintilla.FindReplace.ReplaceAll(textBoxFind.Text, textBoxReplace.Text, flags);

            Logger.Singleton.Clear();

            //Log each result
            foreach (ScintillaNET.Range range in ranges)
            {
                Logger.Singleton.Log("'" + range.Text + "' in " + document.Name + " on line " + range.StartingLine.Number, Logger.MessageType.MESSAGE, new SearchResult(range, document.file, document));
            }
        }