Ejemplo n.º 1
0
        public override void DrawItem(Graphics graphics)
        {
            base.DrawItem(graphics);
            ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator;

            if (lineDecorator != null)
            {
                throw new ArgumentException("Line is not a valid Container");
            }
            else
            {
                IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator;
                if (style != null)
                {
                    base.FillShape(graphics, style.Shape);
                    BaseLine baseLine = null;
                    if (style.BackColor == GlobalValues.DefaultBackColor)
                    {
                        baseLine = new BaseLine(style.ForeColor, style.DashStyle, style.Thickness);
                    }
                    else
                    {
                        baseLine = new BaseLine(style.BackColor, style.DashStyle, style.Thickness);
                    }
                    style.Shape.DrawShape(graphics,
                                          baseLine,
                                          style.DisplayRectangle);
                }
                Items.ForEach(item => item.DrawItem(graphics));
            }
        }
Ejemplo n.º 2
0
        public override void DrawItem(Graphics graphics)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }
            base.DrawItem(graphics);
            ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator;

            if (lineDecorator != null)
            {
                GraphicsLineDrawer(graphics);
            }
            else
            {
                IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator;
                if (style != null)
                {
                    base.FillShape(graphics, style.Shape);
                    BaseLine baseLine = null;
                    if (style.BackColor == GlobalValues.DefaultBackColor)
                    {
                        baseLine = new BaseLine(style.ForeColor, style.DashStyle, style.Thickness);
                    }
                    else
                    {
                        baseLine = new BaseLine(style.BackColor, style.DashStyle, style.Thickness);
                    }
                    style.Shape.DrawShape(graphics,
                                          baseLine,
                                          style.DisplayRectangle);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Indent"/> class.
        /// </summary>
        /// <param name="view">Text view to create the adornment for</param>
        //Ignoring warning since this adornment is always on UI thread
#pragma warning disable VSTHRD010
        public Indent(IWpfTextView view, ITextDocumentFactoryService textDocumentFactory)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }
            if (textDocumentFactory == null)
            {
                throw new ArgumentNullException(nameof(textDocumentFactory));
            }
            layer = view.GetAdornmentLayer("Indent");

            this.view = view;
            this.view.LayoutChanged += OnLayoutChanged;
            drawer = new BackgroundTextIndexDrawer(layer, this.view);

            colorGetter = new RainbowBrushGetter(OptionsManager.brushes.Get(), OptionsManager.errorBrush.Get());
            validator   = new IndentValidator(
                OptionsManager.indentSize.Get()
                );


            bool result = textDocumentFactory.TryGetTextDocument(this.view.TextBuffer, out ITextDocument textDocument);

            if (result)
            {
                string   filePath      = textDocument.FilePath;
                string[] filePathSplit = filePath.Split('.');
                string   extension     = filePathSplit[filePathSplit.Length - 1];
                if (OptionsManager.fileExtensionsDictionary.Get().ContainsKey(extension))
                {
                    validator = new IndentValidator(OptionsManager.fileExtensionsDictionary.Get()[extension]);
                }
            }

            if (OptionsManager.highlightingMode.Get() == HighlightingMode.Alternating)
            {
                decorator = new AlternatingLineDecorator(
                    drawer, colorGetter, validator)
                {
                    detectErrors = OptionsManager.detectErrors.Get()
                };
            }
            if (OptionsManager.highlightingMode.Get() == HighlightingMode.Monocolor)
            {
                decorator = new MonocolorLineDecorator(
                    drawer, colorGetter, validator)
                {
                    detectErrors = OptionsManager.detectErrors.Get()
                };
            }
        }
Ejemplo n.º 4
0
        public override void DrawItem(PdfWriter pdfWriter,
                                      ICSharpCode.Reports.Core.Exporter.ExportRenderer.PdfUnitConverter converter)
        {
            base.DrawItem(pdfWriter, converter);
            ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator;

            if (lineDecorator != null)
            {
                PdfLineDrawer();
            }
            else
            {
//				http://www.mikesdotnetting.com/Article/88/iTextSharp-Drawing-shapes-and-Graphics
                IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator;
                style.Shape.DrawShape(base.PdfWriter.DirectContent,
                                      new BaseLine(style.ForeColor, style.DashStyle, style.Thickness),
                                      style,
                                      base.ConvertToPdfRectangle());
            }
        }
Ejemplo n.º 5
0
        public override void DrawItem(PdfWriter pdfWriter,
                                      ICSharpCode.Reports.Core.Exporter.ExportRenderer.PdfUnitConverter converter)
        {
            base.DrawItem(pdfWriter, converter);
            ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator;

            if (lineDecorator != null)
            {
                PdfLineDrawer(pdfWriter);
            }
            else
            {
                IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator;
                if (style != null)
                {
                    style.Shape.DrawShape(base.PdfWriter.DirectContent,
                                          new BaseLine(style.ForeColor, style.DashStyle, style.Thickness),
                                          style,
                                          base.ConvertToPdfRectangle());
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Indent"/> class.
        /// </summary>
        /// <param name="view">Text view to create the adornment for</param>
        //Ignoring warning since this adornment is always on UI thread
#pragma warning disable VSTHRD010
        public Indent(IWpfTextView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            this.layer = view.GetAdornmentLayer("Indent");

            this.view = view;
            this.view.LayoutChanged += this.OnLayoutChanged;
            this.drawer              = new BackgroundTextIndexDrawer(this.layer, this.view);

            this.colorGetter = new RainbowBrushGetter()
            {
                brushes = OptionsManager.GetColors()
            };
            this.validator = new IndentValidator(
                OptionsManager.GetIndentSize()
                );
            this.decorator = new LineDecorator(
                this.drawer, this.colorGetter, this.validator
                );
        }
Ejemplo n.º 7
0
 public void AddDecorator(ILineDecorator decorator)
 {
     m_Decorators.Add(decorator);
 }