コード例 #1
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     if (this.IsEnabled)
     {
         margin.DrawArrow(g, p.Y);
     }
 }
コード例 #2
0
        void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }

            IconBarMargin marginObj = (IconBarMargin)sender;

            Rectangle    viewRect = marginObj.TextArea.TextView.DrawingPosition;
            TextLocation logicPos = marginObj.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);

            if (logicPos.Y >= 0 && logicPos.Y < marginObj.TextArea.Document.TotalNumberOfLines)
            {
                LineSegment l = marginObj.Document.GetLineSegment(logicPos.Y);

                string s = marginObj.Document.GetText(l);

                if (s.Trim().Length == 0)
                {
                    return;
                }

                int             lineNr = logicPos.Y + 1;
                BookmarkManager bm     = this.currentFile.Editor.Document.BookmarkManager;

                Bookmark mark = new BreakMark(marginObj.Document, logicPos);
                bm.AddMark(mark);
                Breakpoint bp = new Breakpoint(this.currentFile, lineNr, mark);
                this.debugEngine.SetBreakpoint(bp);
                this.currentFile.Breakpoints.Add(lineNr, bp);
                marginObj.TextArea.Refresh();
            }
        }
コード例 #3
0
        protected void MyDrawBreakpoint(Graphics g, int y, bool isEnabled, IconBarMargin margin)
        {
            int       diameter = Math.Min(margin.Size.Width - 2, margin.TextArea.TextView.FontHeight);
            Rectangle rect     = new Rectangle(1,
                                               y + (margin.TextArea.TextView.FontHeight - diameter) / 2,
                                               diameter,
                                               diameter);


            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddEllipse(rect);
                using (PathGradientBrush pthGrBrush = new PathGradientBrush(path))
                {
                    pthGrBrush.CenterPoint    = new PointF(rect.Left + rect.Width / 3, rect.Top + rect.Height / 3);
                    pthGrBrush.CenterColor    = Color.FromArgb(100, Color.MistyRose);
                    pthGrBrush.SurroundColors = new Color[] { Color.FromArgb(100, Color.Firebrick) };


                    if (isEnabled)
                    {
                        g.FillEllipse(pthGrBrush, rect);
                    }
                    else
                    {
                        g.FillEllipse(SystemBrushes.Control, rect);
                        using (Pen pen = new Pen(pthGrBrush))
                        {
                            g.DrawEllipse(pen, new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2));
                        }
                    }
                }
            }
        }
コード例 #4
0
        public CodeView(string decompiledFileName)
        {
            this.adapter = new DecompiledTextEditorAdapter(new SharpDevelopTextEditor {
                IsReadOnly = true
            })
            {
                DecompiledFileName = decompiledFileName
            };
            this.Children.Add(adapter.TextEditor);
            adapter.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");

            // add margin
            this.iconMargin = new IconBarMargin(iconBarManager = new IconBarManager());
            this.adapter.TextEditor.TextArea.LeftMargins.Insert(0, iconMargin);
            this.adapter.TextEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };

            // add marker service
            this.textMarkerService = new TextMarkerService(this);
            this.adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
            this.adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(IBookmarkMargin), iconBarManager);
            // DON'T add the editor in textview ervices - will mess the setting of breakpoints

            // add events
            this.adapter.TextEditor.MouseHover        += TextEditorMouseHover;
            this.adapter.TextEditor.MouseHoverStopped += TextEditorMouseHoverStopped;
            this.adapter.TextEditor.MouseLeave        += TextEditorMouseLeave;

            this.adapter.TextEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(this.adapter.TextEditor.TextArea));
        }
コード例 #5
0
ファイル: DecompilerTextView.cs プロジェクト: rebider/ILSpy
        public DecompilerTextView()
        {
            HighlightingManager.Instance.RegisterHighlighting(
                "ILAsm", new string[] { ".il" },
                delegate
            {
                using (Stream s = typeof(DecompilerTextView).Assembly.GetManifestResourceStream(typeof(DecompilerTextView), "ILAsm-Mode.xshd"))
                {
                    using (XmlTextReader reader = new XmlTextReader(s))
                    {
                        return(HighlightingLoader.Load(reader, HighlightingManager.Instance));
                    }
                }
            });

            this.Loaded += DecompilerTextView_Loaded;
            InitializeComponent();

            this.referenceElementGenerator = new ReferenceElementGenerator(this.JumpToReference, this.IsLink);
            textEditor.TextArea.TextView.ElementGenerators.Add(referenceElementGenerator);
            this.uiElementGenerator = new UIElementGenerator();
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);
            textEditor.Options.RequireControlModifierForHyperlinkClick = false;
            textEditor.TextArea.TextView.MouseHover        += TextViewMouseHover;
            textEditor.TextArea.TextView.MouseHoverStopped += TextViewMouseHoverStopped;
            textEditor.SetBinding(Control.FontFamilyProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFont")
            });
            textEditor.SetBinding(Control.FontSizeProperty, new Binding {
                Source = DisplaySettingsPanel.CurrentDisplaySettings, Path = new PropertyPath("SelectedFontSize")
            });

            // add marker service & margin
            iconMargin        = new IconBarMargin((manager = new IconBarManager()));
            textMarkerService = new TextMarkerService(textEditor);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.ShowLineNumbers = true;
            DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;

            textEditor.TextArea.LeftMargins.Insert(0, iconMargin);
            textEditor.TextArea.TextView.VisualLinesChanged += delegate { iconMargin.InvalidateVisual(); };

            // Bookmarks context menu
            IconMarginActionsProvider.Add(iconMargin);
            // Bookmarks context menu
            textEditor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(textEditor.TextArea));

            ShowLineMargin();

            // add marker service & margin
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);

            this.Loaded += DecompilerTextView_Loaded;
        }
コード例 #6
0
        public override void Draw(IconBarMargin margin, Graphics g, Point p)
        {
            var brush    = Healthy ? Brushes.OrangeRed : Brushes.Gold;
            var diameter = margin.Size.Width / 1.5f;

            if (IsEnabled)
            {
                g.FillEllipse(brush, p.X, p.Y + (diameter / 4), diameter, diameter);
            }
            else
            {
                g.DrawEllipse(new Pen(brush, 1), p.X, p.Y + (diameter / 4), diameter, diameter);
            }
        }
コード例 #7
0
        public override void Draw(IconBarMargin margin, Graphics g, Point p)
        {
            BookmarkManager bm   = margin.TextArea.Document.BookmarkManager;
            Bookmark        next = bm.GetNextMark(this.LineNumber,
                                                  (Bookmark bk) => { return(bk.LineNumber == this.LineNumber && this != bk); });

            if (next == null)
            {
                margin.DrawBreakpoint(g, p.Y, IsEnabled, true);
            }
            else
            {
                MyDrawBreakpoint(g, p.Y, IsEnabled, margin); //arrow active, draw opaque breakpoint
            }
        }
コード例 #8
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     /*var path = new System.Drawing.Drawing2D.GraphicsPath(new []
      * {
      *      new PointF(p.X, p.Y-3),
      *      new PointF(p.X+4, p.Y-3),
      *      new PointF(p.X+4, p.Y-6),
      *      new PointF(p.X+7, p.Y),
      *      new PointF(p.X+4, p.Y+6),
      *      new PointF(p.X+4, p.Y+3),
      *      new PointF(p.X, p.Y+3),
      * }, new Byte[] {
      *      0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
      * });
      * g.FillPath(Brushes.White, path);*/
     margin.DrawArrow(g, p.Y);
 }
コード例 #9
0
        public override void Draw(IconBarMargin margin, Graphics g, Point p)
        {
            int size = Math.Min(16, margin.TextArea.TextView.FontHeight);

            var center = new Point(
                size / 2,
                p.Y + margin.TextArea.TextView.FontHeight / 2
                );

            var bounds = new Rectangle(
                center.X - _image.Width / 2,
                center.Y - _image.Height / 2,
                _image.Width,
                _image.Height
                );

            g.DrawImage(_image, bounds);
        }
コード例 #10
0
ファイル: Bookmark.cs プロジェクト: beritec/fdotoolbox
 public virtual void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     margin.DrawBookmark(g, p.Y, isEnabled);
 }
コード例 #11
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     g.DrawImageUnscaled(ClassBrowserIconService.ImageList.Images[IconIndex], p);
 }
コード例 #12
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     margin.DrawArrow(g, p.Y);
 }
コード例 #13
0
ファイル: Bookmarks.cs プロジェクト: ikvm/pascalabcnet
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     margin.DrawBreakpoint(g, p.Y, IsEnabled, WillBeHit, IsOnCondition);
 }
コード例 #14
0
 public abstract void Draw(IconBarMargin margin, Graphics g, Point p);
コード例 #15
0
 public AnalyzerWarningRenderer(TextView textView, IconBarMargin iconBarMargin)
 {
     _iconBarMargin = iconBarMargin;
     _textView = textView;
 }
コード例 #16
0
ファイル: Bookmark.cs プロジェクト: xuchuansheng/GenXSource
		public virtual void Draw(IconBarMargin margin, Graphics g, Point p)
		{
			margin.DrawBookmark(g, p.Y, isEnabled);
		}
コード例 #17
0
 public ParseErrorRenderer(TextView textView, IconBarMargin iconBarMargin)
 {
     _iconBarMargin = iconBarMargin;
     _textView = textView;
 }
コード例 #18
0
 public DebugMarkerRenderer(TextView textView, IconBarMargin iconBarMargin)
 {
     _iconBarMargin = iconBarMargin;
     _textView      = textView;
 }
コード例 #19
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
     margin.DrawBreakpoint(g, p.Y, IsEnabled, IsHealthy);
 }
コード例 #20
0
 public override void Draw(IconBarMargin margin, Graphics g, Point p)
 {
 }
コード例 #21
0
 public AnalyzerWarningRenderer(TextView textView, IconBarMargin iconBarMargin)
 {
     _iconBarMargin = iconBarMargin;
     _textView      = textView;
 }
コード例 #22
0
 public ParseErrorRenderer(TextView textView, IconBarMargin iconBarMargin)
 {
     _iconBarMargin = iconBarMargin;
     _textView      = textView;
 }
コード例 #23
0
 public override void Draw(IconBarMargin margin, System.Drawing.Graphics g, System.Drawing.Point p)
 {
     margin.DrawArrow(g, p.Y);
 }