public static TextMark Create(IMappingTagSpan <IVsVisibleTextMarkerTag> tag) { uint flags; int hr = tag.Tag.StreamMarker.GetVisualStyle(out flags); if (ErrorHandler.Succeeded(hr) && ((flags & (uint)MARKERVISUAL.MV_GLYPH) != 0) && ((flags & ((uint)MARKERVISUAL.MV_COLOR_ALWAYS | (uint)MARKERVISUAL.MV_COLOR_LINE_IF_NO_MARGIN)) != 0)) { COLORINDEX[] foreground = new COLORINDEX[1]; COLORINDEX[] background = new COLORINDEX[1]; hr = tag.Tag.MarkerType.GetDefaultColors(foreground, background); if (ErrorHandler.Succeeded(hr)) { ITextBuffer buffer = tag.Span.BufferGraph.TopBuffer; SnapshotPoint?pos = tag.Span.Start.GetPoint(buffer, PositionAffinity.Successor); if (pos.HasValue) { var text_mark = new TextMark(); text_mark.line = buffer.CurrentSnapshot.GetLineNumberFromPosition(pos.Value.Position); text_mark.brush = ColorExtractor.GetBrushFromIndex(background[0]); return(text_mark); } } } return(null); }
public int GetDefaultLineStyle(COLORINDEX[] piLineColor, LINESTYLE[] piLineIndex) { piLineColor[0] = COLORINDEX.CI_DARKBLUE; piLineIndex[0] = LINESTYLE.LI_SOLID; return VSConstants.S_OK; }
public SquirrelColorableItem(string displayName, COLORINDEX foreground, COLORINDEX background) : base(displayName, displayName, foreground, background, System.Drawing.Color.Gray, System.Drawing.Color.Black, FONTFLAGS.FF_DEFAULT) { this.displayName = displayName; this.background = background; this.foreground = foreground; }
public ColorableItem(string description, COLORINDEX foreColor, COLORINDEX backColor, FONTFLAGS fontFlags) { this.description = description; this.foreColor = foreColor; this.backColor = backColor; this.fontFlags = fontFlags; }
private uint DecodeColorIndex(uint index) { var indices = new COLORINDEX[1]; Marshal.ThrowExceptionForHR(fncUtils.GetEncodedIndex(index, indices)); Marshal.ThrowExceptionForHR(fncUtils.GetRGBOfIndex(indices[0], out var color)); return(color); }
public NShaderColorableItem(VisualStudioTheme theme, string name, string displayName, COLORINDEX foreColorLight, COLORINDEX foreColorDark, COLORINDEX backColor, Color hiForeColorLight, Color hiForeColorDark, Color hiBackColor, FONTFLAGS fontFlags) : base(name, displayName, theme == VisualStudioTheme.Dark ? foreColorDark : foreColorLight, backColor, theme == VisualStudioTheme.Dark ? hiForeColorDark : hiForeColorLight, hiBackColor, fontFlags) { ForeColorLight = foreColorLight; ForeColorDark = foreColorDark; HiForeColorLight = hiForeColorLight; HiForeColorDark = hiForeColorDark; }
public NemerleColorableItem( string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor, FONTFLAGS fontFlags) : base(displayName, displayName, foreColor, backColor, hiForeColor, hiBackColor, fontFlags) { }
internal ColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor, FONTFLAGS fontFlags) { this.name = name; this.displayName = displayName; this.foreColor = foreColor; this.backColor = backColor; this.fontFlags = fontFlags; this.hiForeColor = hiForeColor; this.hiBackColor = hiBackColor; }
public int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { piForeground[0] = COLORINDEX.CI_DARKBLUE; piBackground[0] = COLORINDEX.CI_WHITE; return VSConstants.S_OK; // This method won't be called as we implement the IVsHiColorItem interfacce. // return VSConstants.E_NOTIMPL; }
public static Color GetColorFromIndex(COLORINDEX color) { UInt32 w32color; Marshal.ThrowExceptionForHR(Common.FontAndColorUtilities.GetRGBOfIndex(color, out w32color)); System.Drawing.Color gdiColor = System.Drawing.ColorTranslator.FromWin32((int)w32color); return(Color.FromArgb(gdiColor.A, gdiColor.R, gdiColor.G, gdiColor.B)); }
public NemerleColorableItem( string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor) : this(displayName, foreColor, backColor, hiForeColor, hiBackColor, FONTFLAGS.FF_DEFAULT) { }
public NemerleColorableItem( string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor, FONTFLAGS fontFlags) : base( displayName, displayName, foreColor, backColor, hiForeColor, hiBackColor, fontFlags) { }
public static Brush GetBrushFromIndex(COLORINDEX color_index) { UInt32 w32color; Marshal.ThrowExceptionForHR(FontAndColorUtilities.GetRGBOfIndex(color_index, out w32color)); System.Drawing.Color gdiColor = System.Drawing.ColorTranslator.FromWin32((int)w32color); Color color = Color.FromArgb(gdiColor.A, gdiColor.R, gdiColor.G, gdiColor.B); return new SolidColorBrush(color); }
public ColorableItem(string displayName, COLORINDEX foreground, COLORINDEX background, bool bold, bool strikethrough) { this.displayName = displayName; this.background = background; this.foreground = foreground; if (bold) this.fontFlags = this.fontFlags | (uint)FONTFLAGS.FF_BOLD; if (strikethrough) this.fontFlags = this.fontFlags | (uint)FONTFLAGS.FF_STRIKETHROUGH; }
public NemerleColorableItem( string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor) : this( displayName, foreColor, backColor, hiForeColor, hiBackColor, FONTFLAGS.FF_DEFAULT) { }
private static IVsColorableItem MakeColorableItem(string name, COLORINDEX foreColor, Color foreColorRgb, COLORINDEX backColor, Color backColorRgb, FONTFLAGS style) { return(new ColorableItem( name, name, foreColor, backColor, foreColorRgb, backColorRgb, style )); }
private Color FromColorIndex(ColorStorage storage, uint colorRef) { COLORINDEX[] index = new COLORINDEX[1]; var hr = storage.Utilities.GetEncodedIndex(colorRef, index); ErrorHandler.ThrowOnFailure(hr); uint rgb; hr = storage.Utilities.GetRGBOfIndex(index[0], out rgb); ErrorHandler.ThrowOnFailure(hr); return(FromWin32(rgb)); }
public ColorableItem(string displayName, COLORINDEX foreground, COLORINDEX background, bool bold, bool strikethrough) { this.displayName = displayName; this.background = background; this.foreground = foreground; if (bold) { this.fontFlags = this.fontFlags | (uint)FONTFLAGS.FF_BOLD; } if (strikethrough) { this.fontFlags = this.fontFlags | (uint)FONTFLAGS.FF_STRIKETHROUGH; } }
private Color FromColorIndex(ColorStorage storage, uint colorRef) { COLORINDEX[] index = new COLORINDEX[1]; var hr = storage.Utilities.GetEncodedIndex(colorRef, index); ErrorHandler.ThrowOnFailure(hr); // useful when the color is marked as "automatic" in VS if (index[0] == COLORINDEX.CI_SYSTEXT_BK || index[0] == COLORINDEX.CI_SYSTEXT_FG) { return(Color.Transparent); } hr = storage.Utilities.GetRGBOfIndex(index[0], out uint rgb); ErrorHandler.ThrowOnFailure(hr); return(FromWin32(rgb)); }
private void DecodePlainTextColor(ref uint color, COLORINDEX automaticIndex) { Marshal.ThrowExceptionForHR(fncUtils.GetColorType(color, out var type)); switch ((__VSCOLORTYPE)type) { case __VSCOLORTYPE.CT_COLORINDEX: color = DecodeColorIndex(color); break; case __VSCOLORTYPE.CT_SYSCOLOR: color = DecodeSystemColor(color); break; case __VSCOLORTYPE.CT_AUTOMATIC: Marshal.ThrowExceptionForHR(fncUtils.GetRGBOfIndex(automaticIndex, out color)); break; } }
public SoalLanguageColorableItem(string displayName, TokenType tokenType, COLORINDEX foregroundIndex, COLORINDEX backgroundIndex, Color foregroundColor, Color backgroundColor, bool bold, bool strikethrough) { this.DisplayName = displayName; this.TokenType = tokenType; this.BackgroundIndex = backgroundIndex; this.ForegroundIndex = foregroundIndex; this.BackgroundColor = (uint)System.Drawing.ColorTranslator.ToWin32(backgroundColor); this.ForegroundColor = (uint)System.Drawing.ColorTranslator.ToWin32(foregroundColor); this.FontFlags = (uint)FONTFLAGS.FF_DEFAULT; if (bold) { this.FontFlags = this.FontFlags | (uint)FONTFLAGS.FF_BOLD; } if (strikethrough) { this.FontFlags = this.FontFlags | (uint)FONTFLAGS.FF_STRIKETHROUGH; } }
private Color FromColorRef(IVsFontAndColorStorage vsStorage, uint colorValue) { var vsUtil = (IVsFontAndColorUtilities)vsStorage; int type; ErrorHandler.ThrowOnFailure(vsUtil.GetColorType(colorValue, out type)); switch ((__VSCOLORTYPE)type) { case __VSCOLORTYPE.CT_SYSCOLOR: case __VSCOLORTYPE.CT_RAW: return(ColorTranslator.FromWin32((int)colorValue)); case __VSCOLORTYPE.CT_COLORINDEX: { var array = new COLORINDEX[1]; ErrorHandler.ThrowOnFailure(vsUtil.GetEncodedIndex(colorValue, array)); uint rgb; ErrorHandler.ThrowOnFailure(vsUtil.GetRGBOfIndex(array[0], out rgb)); return(ColorTranslator.FromWin32((int)rgb)); }; case __VSCOLORTYPE.CT_VSCOLOR: { var vsUIShell = (IVsUIShell2)GetService(typeof(SVsUIShell)); int index; ErrorHandler.ThrowOnFailure(vsUtil.GetEncodedVSColor(colorValue, out index)); uint rgbValue; ErrorHandler.ThrowOnFailure(vsUIShell.GetVSSysColorEx(index, out rgbValue)); return(ColorTranslator.FromWin32((int)rgbValue)); }; case __VSCOLORTYPE.CT_AUTOMATIC: case __VSCOLORTYPE.CT_TRACK_BACKGROUND: case __VSCOLORTYPE.CT_TRACK_FOREGROUND: case __VSCOLORTYPE.CT_INVALID: // These values should never show up because we passed the FCSF_NOAUTOCOLORS flag. Everything // should be CT_RAW / CT_SYSCOLOR throw new Exception("Invalid color value"); default: Contract.GetInvalidEnumException((__VSCOLORTYPE)type); return(default(Color)); } }
public int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { if (null == piForeground) { throw new ArgumentNullException("piForeground"); } if (0 == piForeground.Length) { throw new ArgumentOutOfRangeException("piForeground"); } piForeground[0] = foreground; if (null == piBackground) { throw new ArgumentNullException("piBackground"); } if (0 == piBackground.Length) { throw new ArgumentOutOfRangeException("piBackground"); } piBackground[0] = background; return Microsoft.VisualStudio.VSConstants.S_OK; }
private static System.Drawing.Color FromColorRef(IServiceProvider Site, IVsFontAndColorStorage vsStorage, uint colorValue) { ThreadHelper.ThrowIfNotOnUIThread(); var vsUtil = (IVsFontAndColorUtilities)vsStorage; ErrorHandler.ThrowOnFailure(vsUtil.GetColorType(colorValue, out int type)); switch ((__VSCOLORTYPE)type) { case __VSCOLORTYPE.CT_SYSCOLOR: case __VSCOLORTYPE.CT_RAW: return(ColorTranslator.FromWin32((int)colorValue)); case __VSCOLORTYPE.CT_COLORINDEX: { var array = new COLORINDEX[1]; ErrorHandler.ThrowOnFailure(vsUtil.GetEncodedIndex(colorValue, array)); ErrorHandler.ThrowOnFailure(vsUtil.GetRGBOfIndex(array[0], out uint rgb)); return(ColorTranslator.FromWin32((int)rgb)); }; case __VSCOLORTYPE.CT_VSCOLOR: { var vsUIShell = (IVsUIShell2)Site.GetService(typeof(SVsUIShell)); ErrorHandler.ThrowOnFailure(vsUtil.GetEncodedVSColor(colorValue, out int index)); ErrorHandler.ThrowOnFailure(vsUIShell.GetVSSysColorEx(index, out uint rgbValue)); return(ColorTranslator.FromWin32((int)rgbValue)); }; case __VSCOLORTYPE.CT_AUTOMATIC: case __VSCOLORTYPE.CT_TRACK_BACKGROUND: case __VSCOLORTYPE.CT_TRACK_FOREGROUND: case __VSCOLORTYPE.CT_INVALID: return(System.Drawing.Color.Transparent); default: return(System.Drawing.Color.Black); } }
public NShaderColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor) : base(name, displayName, foreColor, backColor, hiForeColor, hiBackColor, FONTFLAGS.FF_DEFAULT) { }
/// <summary> /// Returns the default foreground and background colors for a marker. /// </summary> /// <returns> /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code. /// </returns> /// <param name="piForeground">[out] Pointer to the default foreground color. For a list of <paramref name="piForeground"/> values, see COLORINDEX4C54D3F1-4AEB-497F-8311-2AB027C8BAD8. /// </param><param name="piBackground">[out] Pointer to the default background color. For a list of <paramref name="piBackground"/> values, see COLORINDEX4C54D3F1-4AEB-497F-8311-2AB027C8BAD8. /// </param> public virtual int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { piForeground[0] = COLORINDEX.CI_USERTEXT_FG; piBackground[0] = COLORINDEX.CI_USERTEXT_BK; return VSConstants.S_OK; }
public AsmHighlighterColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor, Color hiForeColor, Color hiBackColor, FONTFLAGS fontFlags) : base(name, displayName, foreColor, backColor, hiForeColor, hiBackColor, fontFlags) { }
public static TokenColor CreateColor(string name, COLORINDEX foreground, COLORINDEX background, bool bold, bool strikethrough) { colorableItems.Add(new ColorableItem(name, foreground, background, bold, strikethrough)); return((TokenColor)colorableItems.Count); }
public NShaderColorableItem(VisualStudioTheme theme, string name, string displayName, COLORINDEX foreColorLight, COLORINDEX foreColorDark, COLORINDEX backColor) : base(name, displayName, theme == VisualStudioTheme.Dark ? foreColorDark : foreColorLight, backColor, Color.Empty, Color.Empty, FONTFLAGS.FF_DEFAULT) { ForeColorLight = foreColorLight; ForeColorDark = foreColorDark; }
public int GetDefaultLineStyle(COLORINDEX[] piLineColor, LINESTYLE[] piLineIndex) { // These values are requested by the IDE although they are not used. They // would be used if we would want a border around the text. piLineColor[0] = COLORINDEX.CI_BLACK; piLineIndex[0] = LINESTYLE.LI_SOLID; return VSConstants.S_OK; }
public NemerleColorableItem(string displayName, COLORINDEX foreColor, Color hiForeColor, FONTFLAGS fontFlags) : this(displayName, foreColor, COLORINDEX.CI_USERTEXT_BK, hiForeColor, Color.Empty, fontFlags) { }
public int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { throw new NotImplementedException(); }
public NemerleColorableItem(string displayName, COLORINDEX foreColor, Color hiForeColor) : this(displayName, foreColor, COLORINDEX.CI_USERTEXT_BK, hiForeColor, Color.Empty) { }
private static IVsColorableItem MakeColorableItem(string name, COLORINDEX foreColor, Color foreColorRgb, COLORINDEX backColor, Color backColorRgb) { return(MakeColorableItem(name, foreColor, foreColorRgb, backColor, backColorRgb, FONTFLAGS.FF_DEFAULT)); }
protected TokenColor CreateColor(string name, TokenType type, COLORINDEX foregroundIndex, bool bold, bool strikethrough) { colorableItems.Add(new MetaModelLanguageColorableItem(name, type, foregroundIndex, COLORINDEX.CI_USERTEXT_BK, Color.Black, Color.White, bold, strikethrough)); return (TokenColor)colorableItems.Count; }
protected TokenColor CreateColor(string name, TokenType type, COLORINDEX foregroundIndex) { return CreateColor(name, type, foregroundIndex, false, false); }
public NShaderColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor) : base(name, displayName, foreColor, backColor, Color.Empty, Color.Empty, FONTFLAGS.FF_DEFAULT) { }
public virtual int GetDefaultColors(COLORINDEX[] foreColor, COLORINDEX[] backColor) { if (foreColor != null) foreColor[0] = this.foreColor; if (backColor != null) backColor[0] = this.backColor; return NativeMethods.S_OK; }
public NShaderColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor, FONTFLAGS fontFlags) : base(name, displayName, foreColor, backColor, Color.Empty, Color.Empty, fontFlags) { }
public int GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { // This method won't be called as we implement the IVsHiColorItem interface. return VSConstants.E_NOTIMPL; }
public override int GetDefaultColors(COLORINDEX[] foreColor, COLORINDEX[] backColor) { return base.GetDefaultColors(foreColor, backColor); }
public NemerleColorableItem(string displayName, int n, COLORINDEX foreColor) : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, Color.Empty, QuotationBackColor[n]) { }
public NShaderColorableItem(VisualStudioTheme theme, string name, COLORINDEX foreColorLight, COLORINDEX foreColorDark, COLORINDEX backColor, FONTFLAGS fontFlags) : base(name, name, theme == VisualStudioTheme.Dark ? foreColorDark : foreColorLight, backColor, Color.Empty, Color.Empty, fontFlags) { ForeColorLight = foreColorLight; ForeColorDark = foreColorDark; }
public NemerleColorableItem(string displayName, int n, COLORINDEX foreColor, Color hiForeColor, FONTFLAGS fontFlags) : this(displayName, foreColor, COLORINDEX.CI_SYSWIDGETMGN_BK, hiForeColor, QuotationBackColor[n], fontFlags) { }
public AsmHighlighterColorableItem(string name, COLORINDEX foreColor, COLORINDEX backColor, FONTFLAGS fontFlags) : base(name, name, foreColor, backColor, Color.Empty, Color.Empty, fontFlags) { }
protected TokenColor CreateColor(string name, TokenType type, COLORINDEX foregroundIndex, COLORINDEX backgroundIndex, Color foregroundColor, Color backgroundColor, bool bold, bool strikethrough) { colorableItems.Add(new MetaModelLanguageColorableItem(name, type, foregroundIndex, backgroundIndex, foregroundColor, backgroundColor, bold, strikethrough)); return (TokenColor)colorableItems.Count; }
public static TokenColor CreateColor(string name, COLORINDEX foreground, COLORINDEX background) { return(CreateColor(name, foreground, background, false, false)); }
public static TokenColor CreateColor(string name, COLORINDEX foreground, COLORINDEX background) { return CreateColor(name, foreground, background, false, false); }
public static TokenColor CreateColor(string name, COLORINDEX foreground, COLORINDEX background, bool bold, bool strikethrough) { colorableItems.Add(new ColorableItem(name, foreground, background, bold, strikethrough)); return (TokenColor)colorableItems.Count; }
public AsmHighlighterColorableItem(string name, string displayName, COLORINDEX foreColor, COLORINDEX backColor) : base(name, displayName, foreColor, backColor, Color.Empty, Color.Empty, FONTFLAGS.FF_DEFAULT) { }
private static IVsColorableItem MakeColorableItem(string name, COLORINDEX foreColor, Color foreColorRgb, COLORINDEX backColor, Color backColorRgb, FONTFLAGS style) { return new ColorableItem( name, name, foreColor, backColor, foreColorRgb, backColorRgb, style ); }
private static IVsColorableItem MakeColorableItem(string name, COLORINDEX foreColor, Color foreColorRgb, COLORINDEX backColor, Color backColorRgb) { return MakeColorableItem(name, foreColor, foreColorRgb, backColor, backColorRgb, FONTFLAGS.FF_DEFAULT); }
public MetaModelLanguageColorableItem(string displayName, TokenType tokenType, COLORINDEX foregroundIndex, COLORINDEX backgroundIndex, Color foregroundColor, Color backgroundColor, bool bold, bool strikethrough) { this.DisplayName = displayName; this.TokenType = tokenType; this.BackgroundIndex = backgroundIndex; this.ForegroundIndex = foregroundIndex; this.BackgroundColor = (uint)System.Drawing.ColorTranslator.ToWin32(backgroundColor); this.ForegroundColor = (uint)System.Drawing.ColorTranslator.ToWin32(foregroundColor); this.FontFlags = (uint)FONTFLAGS.FF_DEFAULT; if (bold) this.FontFlags = this.FontFlags | (uint)FONTFLAGS.FF_BOLD; if (strikethrough) this.FontFlags = this.FontFlags | (uint)FONTFLAGS.FF_STRIKETHROUGH; }
/// <summary> /// Returns the default line attributes for a custom marker type. /// </summary> /// <returns> /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code. /// </returns> /// <param name="piLineColor">[out] Pointer to the default line color. For a list of <paramref name="piLineColor"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.COLORINDEX"/>. /// </param><param name="piLineIndex">[out] Pointer to the default line style. For a list of <paramref name="piLineIndex"/> values, see <see cref="T:Microsoft.VisualStudio.TextManager.Interop.LINESTYLE"/>. /// </param> public virtual int GetDefaultLineStyle(COLORINDEX[] piLineColor, LINESTYLE[] piLineIndex) { piLineIndex[0] = LINESTYLE.LI_SOLID; piLineColor[0] = COLORINDEX.CI_MAGENTA; return VSConstants.S_OK; }
public MyColorableItem(string displayName, COLORINDEX foreground, COLORINDEX background) : base(displayName, displayName, foreground, background, System.Drawing.Color.Empty, System.Drawing.Color.Empty, FONTFLAGS.FF_DEFAULT) { }
int IVsColorableItem.GetDefaultColors(COLORINDEX[] piForeground, COLORINDEX[] piBackground) { piForeground[0] = (COLORINDEX)mySetting.ForegroundColor; piBackground[0] = (COLORINDEX)mySetting.BackgroundColor; return VSConstants.S_OK; }