// <summary>
 /// Removes the highlights from the correct sci control
 /// </summary>
 public static void RemoveHighlights(ScintillaControl sci)
 {
     Int32 es = sci.EndStyled;
     Int32 mask = (1 << sci.StyleBits);
     sci.StartStyling(0, mask);
     sci.SetStyling(sci.TextLength, 0);
     sci.StartStyling(es, mask - 1);
 }
        //public static void AddHighlights(ScintillaControl sci, int posText, string textToHigh, System.Drawing.Color color)
        //{
        //        //Int32 start = sci.MBSafePosition(posText);
        //        Int32 start = posText;
        //        Int32 end = start + sci.MBSafeTextLength(textToHigh);
        //        Int32 position = start;
        //        Int32 mask = 1 << sci.StyleBits;
        //        sci.SetIndicStyle(0, (Int32)IndicatorStyle.Plain);
        //        sci.SetIndicFore(0, DataConverter.ColorToInt32(color));
        //        sci.StartStyling(position, mask);
        //        sci.SetStyling(end - start, mask);
        //}
        public static void AddHighlights(ScintillaControl sci, Int32 posText, Int32 length, System.Drawing.Color color, IndicatorStyle indicator)
        {
            if (length == 0) return;

            Int32 mask = 1 << sci.StyleBits;

            sci.SetIndicStyle(0, (Int32)indicator);
            sci.SetIndicFore(0, DataConverter.ColorToInt32(color));

            sci.StartStyling(posText, mask);
            sci.SetStyling(length, mask);
        }
Exemple #3
0
 /// <summary>
 /// Adds highlights to the correct sci control
 /// </summary>
 private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
 {
     ITabbedDocument doc = DocumentManager.FindDocument(sci);
     Language language = MainForm.Instance.SciConfig.GetLanguage(sci.ConfigurationLanguage);
     foreach (SearchMatch match in matches)
     {
         Int32 start = sci.MBSafePosition(match.Index);
         Int32 end = start + sci.MBSafeTextLength(match.Value);
         Int32 line = sci.LineFromPosition(start);
         Int32 position = start;
         Int32 es = sci.EndStyled;
         Int32 mask = 1 << sci.StyleBits;
         // Define indics in both controls...
         doc.SplitSci1.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
         doc.SplitSci1.SetIndicFore(0, language.editorstyle.HighlightBackColor);
         doc.SplitSci2.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
         doc.SplitSci2.SetIndicFore(0, language.editorstyle.HighlightBackColor);
         sci.StartStyling(position, mask);
         sci.SetStyling(end - start, mask);
         sci.StartStyling(es, mask - 1);
     }
 }
Exemple #4
0
 /// <summary>
 /// Highlight a regexp match group
 /// </summary>
 /// <param name="sci"></param>
 /// <param name="matches"></param>
 private void AddHighlight(ScintillaControl sci, SearchMatch match)
 {
     Int32 start = sci.MBSafePosition(match.Index); // wchar to byte position
     Int32 end = start + sci.MBSafeTextLength(match.Value); // wchar to byte text length
     Int32 line = sci.LineFromPosition(start);
     Int32 position = start;
     Int32 es = sci.EndStyled;
     Int32 mask = 1 << sci.StyleBits;
     sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.Max);
     sci.SetIndicFore(0, 0xff0000);
     sci.StartStyling(position, mask);
     sci.SetStyling(end - start, mask);
     sci.StartStyling(es, mask - 1);
 }
        /// <summary>
        /// Removes the highlights from the correct sci control
        /// </summary>
        private void RemoveHighlights(ScintillaControl sci)
        {
            Int32 es = sci.EndStyled;
            Int32 mask = (1 << sci.StyleBits);
            sci.StartStyling(0, mask);
            sci.SetStyling(sci.TextLength, 0);
            sci.StartStyling(es, mask - 1);

            if (this.settingObject.addLineMarker)
            {
                sci.MarkerDeleteAll(2);
            }
        }
        /// <summary>
        /// Adds highlights to the correct sci control
        /// </summary>
        private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
        {
            if (matches == null)
            {
                return;
            }

            foreach (SearchMatch match in matches)
            {
                Int32 start = sci.MBSafePosition(match.Index);
                Int32 end = start + sci.MBSafeTextLength(match.Value);
                Int32 line = sci.LineFromPosition(start);
                Int32 position = start;
                Int32 es = sci.EndStyled;
                Int32 mask = 1 << sci.StyleBits;

                sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
                sci.SetIndicFore(0, DataConverter.ColorToInt32(this.settingObject.highlightColor));
                sci.StartStyling(position, mask);
                sci.SetStyling(end - start, mask);
                sci.StartStyling(es, mask - 1);

                if (this.settingObject.addLineMarker)
                {
                    sci.MarkerAdd(line, 2);
                    sci.MarkerSetBack(2, DataConverter.ColorToInt32(this.settingObject.highlightColor));
                }
            }
        }
 /// <summary>
 /// Removes the highlights from the correct sci control
 /// </summary>
 private void RemoveHighlights(ScintillaControl sci)
 {
     if (sci != null)
     {
         int es = sci.EndStyled;
         int mask = 1 << sci.StyleBits;
         sci.StartStyling(0, mask);
         sci.SetStyling(sci.TextLength, 0);
         sci.StartStyling(es, mask - 1);
         if (settings.AddLineMarker) sci.MarkerDeleteAll(MARKER_NUMBER);
     }
     prevPos = -1;
     prevToken = string.Empty;
     prevResult = null;
 }
 /// <summary>
 /// Adds highlights to the correct sci control
 /// </summary>
 private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
 {
     if (matches == null) return;
     int style = (int)settings.HighlightStyle;
     int color = DataConverter.ColorToInt32(settings.HighlightColor);
     if (settings.HighlightUnderCursorEnabled && prevResult != null)
     {
         if (prevResult.IsPackage) color = DataConverter.ColorToInt32(settings.PackageColor);
         else
         {
             FlagType flags;
             if (prevResult.Type != null && prevResult.Member == null)
             {
                 flags = prevResult.Type.Flags;
                 if ((flags & FlagType.Abstract) > 0) color = DataConverter.ColorToInt32(settings.AbstractColor);
                 else if ((flags & FlagType.TypeDef) > 0) color = DataConverter.ColorToInt32(settings.TypeDefColor);
                 else if ((flags & FlagType.Enum) > 0) color = DataConverter.ColorToInt32(settings.EnumColor);
                 else if ((flags & FlagType.Class) > 0) color = DataConverter.ColorToInt32(settings.ClassColor);
             }
             else if (prevResult.Member != null)
             {
                 flags = prevResult.Member.Flags;
                 if ((flags & FlagType.Constant) > 0) color = DataConverter.ColorToInt32(settings.ConstantColor);
                 else if ((flags & FlagType.ParameterVar) > 0) color = DataConverter.ColorToInt32(settings.MemberFunctionColor);
                 else if ((flags & FlagType.LocalVar) > 0) color = DataConverter.ColorToInt32(settings.LocalVariableColor);
                 else if ((flags & FlagType.Static) == 0)
                 {
                     if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.VariableColor);
                     else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.AccessorColor);
                     else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.MethodColor);
                 }
                 else
                 {
                     if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.StaticVariableColor);
                     else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.StaticAccessorColor);
                     else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.StaticMethodColor);
                 }
             }
         }
     }
     int es = sci.EndStyled;
     int mask = 1 << sci.StyleBits;
     bool addLineMarker = settings.AddLineMarker;
     foreach (SearchMatch match in matches)
     {
         int start = sci.MBSafePosition(match.Index);
         int end = start + sci.MBSafeTextLength(match.Value);
         int line = sci.LineFromPosition(start);
         int position = start;
         sci.SetIndicStyle(0, style);
         sci.SetIndicFore(0, color);
         sci.StartStyling(position, mask);
         sci.SetStyling(end - start, mask);
         sci.StartStyling(es, mask - 1);
         if (addLineMarker)
         {
             sci.MarkerAdd(line, MARKER_NUMBER);
             sci.MarkerSetBack(MARKER_NUMBER, color);
         }
     }
     prevPos = sci.CurrentPos;
 }