Inheritance: NetIde.Shell.ServiceObject, INiTextMarker
Beispiel #1
0
        public HResult CreateTextMarker(NiTextMarkerType type, NiTextMarkerHatchStyle hatchStyle, bool extendToBorder, int color, int foreColor, int startLine, int startIndex, int endLine, int endIndex, out INiTextMarker textMarker)
        {
            textMarker = null;

            try
            {
                var range = TranslateOffset(startLine, startIndex, endLine, endIndex);
                var nativeType = GetTextMarkerType(type, extendToBorder);
                var drawingColor = Color.FromArgb(color);
                var drawingForeColor = Color.FromArgb(foreColor);

                TextMarker nativeMarker;

                // The TextMarker interface is crap. We cannot simply call
                // the constructor with all the arguments, because calling
                // the constructor determines whether a property is available.

                if (hatchStyle != NiTextMarkerHatchStyle.Default)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor,
                        drawingForeColor,
                        Enum<HatchStyle>.Parse(hatchStyle.ToString())
                    );
                }
                else if (drawingForeColor.A != 0)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor,
                        drawingForeColor
                    );
                }
                else if (drawingColor.A != 0)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor
                    );
                }
                else
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType
                    );
                }

                OnBeginUpdate(EventArgs.Empty);

                try
                {
                    Document.MarkerStrategy.AddMarker(nativeMarker);
                }
                finally
                {
                    OnEndUpdate(EventArgs.Empty);
                }

                textMarker = new NiTextMarker(this, nativeMarker);

                return HResult.OK;
            }
            catch (Exception ex)
            {
                return ErrorUtil.GetHResult(ex);
            }
        }
Beispiel #2
0
        public HResult CreateTextMarker(NiTextMarkerType type, NiTextMarkerHatchStyle hatchStyle, bool extendToBorder, int color, int foreColor, int startLine, int startIndex, int endLine, int endIndex, out INiTextMarker textMarker)
        {
            textMarker = null;

            try
            {
                var range            = TranslateOffset(startLine, startIndex, endLine, endIndex);
                var nativeType       = GetTextMarkerType(type, extendToBorder);
                var drawingColor     = Color.FromArgb(color);
                var drawingForeColor = Color.FromArgb(foreColor);

                TextMarker nativeMarker;

                // The TextMarker interface is crap. We cannot simply call
                // the constructor with all the arguments, because calling
                // the constructor determines whether a property is available.

                if (hatchStyle != NiTextMarkerHatchStyle.Default)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor,
                        drawingForeColor,
                        Enum <HatchStyle> .Parse(hatchStyle.ToString())
                        );
                }
                else if (drawingForeColor.A != 0)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor,
                        drawingForeColor
                        );
                }
                else if (drawingColor.A != 0)
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType,
                        drawingColor
                        );
                }
                else
                {
                    nativeMarker = new TextMarker(
                        range.Offset,
                        range.Length,
                        nativeType
                        );
                }

                OnBeginUpdate(EventArgs.Empty);

                try
                {
                    Document.MarkerStrategy.AddMarker(nativeMarker);
                }
                finally
                {
                    OnEndUpdate(EventArgs.Empty);
                }

                textMarker = new NiTextMarker(this, nativeMarker);

                return(HResult.OK);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }