Example #1
0
 /// <summary>
 /// 
 /// </summary>
 public static void AddHighlight(ScintillaControl sci, Int32 line, Int32 indicator, Int32 value)
 {
     Int32 start = sci.PositionFromLine(line);
     Int32 length = sci.LineLength(line);
     if (start < 0 || length < 1)
     {
         return;
     }
     // Remember previous EndStyled marker and restore it when we are done.
     Int32 es = sci.EndStyled;
     // Mask for style bits used for restore.
     Int32 mask = (1 << sci.StyleBits) - 1;
     Language lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
     if (indicator == indicatorDebugCurrentLine)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
     }
     else if (indicator == indicatorDebugEnabledBreakpoint)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
     }
     else if (indicator == indicatorDebugDisabledBreakpoint)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
     }
     sci.SetIndicStyle(indicator, 7);
     sci.CurrentIndicator = indicator;
     sci.IndicatorValue = value;
     sci.IndicatorFillRange(start, length);
     sci.StartStyling(es, mask);
 }
        //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);
        }
Example #3
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>
 /// 
 /// </summary>
 public static void RemoveHighlight(ScintillaControl sci, Int32 line, Int32 indicator)
 {
     if (sci == null) return;
     Int32 start = sci.PositionFromLine(line);
     Int32 length = sci.LineLength(line);
     if (start < 0 || length < 1) return;
     Int32 es = sci.EndStyled;
     Int32 mask = (1 << sci.StyleBits) - 1;
     Language lang = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage);
     if (indicator == indicatorDebugCurrentLine)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.DebugLineBack);
         sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
     }
     else if (indicator == indicatorDebugEnabledBreakpoint)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.ErrorLineBack);
         sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
     }
     else if (indicator == indicatorDebugDisabledBreakpoint)
     {
         sci.SetIndicFore(indicator, lang.editorstyle.DisabledLineBack);
         sci.SetIndicSetAlpha(indicator, 40); // Improve contrast
     }
     sci.SetIndicStyle(indicator, 7);
     sci.CurrentIndicator = indicator;
     sci.IndicatorClearRange(start, length);
     sci.StartStyling(es, mask);
 }
Example #5
0
        /// <summary>
        /// 
        /// </summary>
		static public void RemoveHighlight(ScintillaControl sci, Int32 line, Int32 indicator)
		{
			if (sci == null)
				return;

			Int32 start = sci.PositionFromLine(line);

			Int32 length = sci.LineLength(line);
			if (start < 0 || length < 1)
			{
				return;
			}

			// Remember previous EndStyled marker and restore it when we are done.
			Int32 es = sci.EndStyled;
			// Mask for style bits used for restore.
			Int32 mask = (1 << sci.StyleBits) - 1;

			if (indicator == indicatorDebugCurrentLine)
			{
				sci.SetIndicFore(indicator, DataConverter.ColorToInt32(PluginMain.settingObject.DebugLineColor));
			}
			else if (indicator == indicatorDebugEnabledBreakpoint)
			{
				sci.SetIndicFore(indicator, DataConverter.ColorToInt32(PluginMain.settingObject.BreakPointEnableLineColor));
			}
			else if (indicator == indicatorDebugDisabledBreakpoint)
			{
				sci.SetIndicFore(indicator, DataConverter.ColorToInt32(PluginMain.settingObject.BreakPointDisableLineColor));
			}
			sci.SetIndicStyle(indicator, /* (int)ScintillaNet.Enums.IndicatorStyle.RoundBox */ 7);
			sci.CurrentIndicator = indicator;
			sci.IndicatorClearRange(start, length);
			sci.StartStyling(es, mask);
		}
Example #6
0
        /// <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>
 /// 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;
 }
Example #8
0
 /// <summary>
 /// Adds highlights to the correct sci control
 /// </summary>
 private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
 {
     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;
         Language language = MainForm.Instance.SciConfig.GetLanguage(sci.ConfigurationLanguage);
         sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
         sci.SetIndicFore(0, language.editorstyle.HighlightBackColor);
         sci.StartStyling(position, mask);
         sci.SetStyling(end - start, mask);
         sci.StartStyling(es, mask - 1);
     }
 }