Beispiel #1
0
 protected internal FindReplace(Scintilla scintilla)
     : base(scintilla)
 {
     _marker = scintilla.Markers[10];
     _marker.SetSymbolInternal(MarkerSymbol.Arrows);
     _indicator = scintilla.Indicators[16];
     _indicator.Color = Color.Purple;
     _indicator.Style = IndicatorStyle.RoundBox;
 }
Beispiel #2
0
        /// <summary>
        ///     Determines whether the specified indicator is equal to the current indicator.
        /// </summary>
        /// <param name="i">The indicator to compare with the current indicator.</param>
        /// <returns>true if the specified indicator is equal to the current indicator; otherwise, false.</returns>
        public bool Equals(Indicator i)
        {
            if ((object)i != null)
            {
                return _scintilla.Equals(_scintilla)
                    && _index.Equals(i._index);
            }

            return false;
        }
Beispiel #3
0
        void _diagnosticTimer_Tick(object sender, EventArgs e)
        {
            if (this.IsDisposed)
            {
                _diagnosticTimer.Stop();
                return;
            }

            int offset = CodePositionMapper != null?CodePositionMapper(this.Text, 0) : 0;

            string fullCode = GetCode == null ? this.Text : GetCode();

            if (fullCode == string.Empty)
            {
                return;
            }

            var cas         = new CodeAnalysisService();
            var diagnostics = cas.GetDiagnostics(fullCode);

            this.Indicators.Reset();
            foreach (var d in diagnostics)
            {
                int start = d.Location.SourceSpan.Start - offset;
                if (start < 0)
                {
                    continue;
                }

                int length = d.Location.SourceSpan.IsEmpty ? 1 : d.Location.SourceSpan.Length;
                var r      = new Range(start, start + length, this);
                ScintillaNET.Indicator ind = null;

                if (d.Severity == DiagnosticSeverity.Error)
                {
                    ind       = this.Indicators[0];
                    ind.Style = IndicatorStyle.Squiggle;
                    ind.Color = Color.Red;
                }
                else if (d.Severity == DiagnosticSeverity.Info)
                {
                    ind       = this.Indicators[1];
                    ind.Style = IndicatorStyle.Plain;
                    ind.Color = Color.Green;
                }

                if (ind != null)
                {
                    r.SetIndicator(ind.Index);
                }
            }
        }
Beispiel #4
0
        internal FindReplace(Scintilla scintilla) : base(scintilla) 
        {
            _marker = scintilla.Markers[10];
            _marker.SetSymbolInternal(MarkerSymbol.Arrows);
            _indicator = scintilla.Indicators[16];
            _indicator.Color = Color.Purple;
            _indicator.Style = IndicatorStyle.RoundBox;

            _window = new FindReplaceDialog();
            _window.Scintilla = scintilla;

            _incrementalSearcher = new IncrementalSearcher();
            _incrementalSearcher.Scintilla = scintilla;
            _incrementalSearcher.Visible = false;
            scintilla.Controls.Add(_incrementalSearcher);
        }
 /// <summary>
 /// Returns the text that's indicated with <paramref name="indicator"/>
 /// at position <paramref name="position"/>
 /// </summary>
 /// <param name="indicator">Indicator used to style the text</param>
 /// <param name="position">Position to query</param>
 /// <returns>The complete text that was styled with this indicator</returns>
 private string getIndicatorText(Indicator indicator, int position)
 {
     var startPos = indicator.Start(position);
     var endPos = indicator.End(position);
     return this.textBox.GetTextRange(startPos, endPos - startPos);
 }
Beispiel #6
0
 public void ClearIndicator(Indicator indicator)
 {
     NativeScintilla.SetIndicatorCurrent(indicator.Index);
     NativeScintilla.IndicatorClearRange(_start, Length);
 }