Ejemplo n.º 1
0
        /// <summary>
        /// Finds the previous match based on the current position
        /// </summary>
        private void FindPrev(String text, Boolean refreshHighlights)
        {
            if (text == "")
            {
                return;
            }
            ScintillaControl sci = Globals.SciControl;

            this.findTextBox.BackColor = SystemColors.Window;
            List <SearchMatch> matches = this.GetResults(sci, text);

            if (matches != null && matches.Count != 0)
            {
                SearchMatch match = FRDialogGenerics.GetNextDocumentMatch(sci, matches, false, false);
                if (match != null)
                {
                    FRDialogGenerics.SelectMatch(sci, match);
                }
                if (refreshHighlights)
                {
                    this.RefreshHighlights(sci, matches);
                }
                String message   = TextHelper.GetString("Info.ShowingResult");
                Int32  index     = FRDialogGenerics.GetMatchIndex(match, matches);
                String formatted = String.Format(message, index, matches.Count);
                this.infoLabel.Text = formatted;
            }
            else
            {
                this.findTextBox.BackColor = Color.Salmon;
                sci.SetSel(sci.SelectionStart, sci.SelectionStart);
                String message = TextHelper.GetString("Info.NoMatchesFound");
                this.infoLabel.Text = message;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Finds the correct match based on the current position
        /// </summary>
        private void FindCorrect(String text, Boolean refreshHighlights)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            ScintillaControl sci = Globals.SciControl;

            this.findTextBox.BackColor = this.backColor;
            List <SearchMatch> matches = this.GetResults(sci, text);

            if (matches != null && matches.Count != 0)
            {
                SearchMatch match = FRDialogGenerics.GetNextDocumentMatch(sci, matches, true, true);
                if (match != null)
                {
                    FRDialogGenerics.SelectMatch(sci, match);
                }
                if (refreshHighlights)
                {
                    this.RefreshHighlights(sci, matches);
                }
                String message   = TextHelper.GetString("Info.ShowingResult");
                Int32  index     = FRDialogGenerics.GetMatchIndex(match, matches);
                String formatted = String.Format(message, index, matches.Count);
                this.infoLabel.Text = formatted;
            }
            else
            {
                this.findTextBox.BackColor = Globals.MainForm.GetThemeColor("QuickFind.ErrorBack", Color.Salmon);
                sci.SetSel(sci.SelectionStart, sci.SelectionStart);
                String message = TextHelper.GetString("Info.NoMatchesFound");
                this.infoLabel.Text = message;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Finds the next result based on direction
        /// </summary>
        public void FindNext(Boolean forward, Boolean update, Boolean simple)
        {
            this.currentMatch = null;
            if (update)
            {
                this.UpdateFindText();
            }
            if (Globals.SciControl == null)
            {
                return;
            }
            ScintillaControl   sci     = Globals.SciControl;
            List <SearchMatch> matches = this.GetResults(sci, simple);

            if (matches != null && matches.Count != 0)
            {
                FRDialogGenerics.UpdateComboBoxItems(this.findComboBox);
                SearchMatch match = FRDialogGenerics.GetNextDocumentMatch(sci, matches, forward, false);
                if (match != null)
                {
                    this.currentMatch = match;
                    FRDialogGenerics.SelectMatch(sci, match);
                    this.lookupIsDirty = false;
                }
                if (this.Visible)
                {
                    Int32  index     = FRDialogGenerics.GetMatchIndex(match, matches);
                    String message   = TextHelper.GetString("Info.ShowingResult");
                    String formatted = String.Format(message, index, matches.Count);
                    this.ShowMessage(formatted, 0);
                }
            }
            else
            {
                if (this.Visible)
                {
                    String message = TextHelper.GetString("Info.NoMatchesFound");
                    this.ShowMessage(message, 0);
                }
            }
            this.SelectText();
        }