public override void Draw(IconBarMargin margin, Graphics g, Point p) { if (this.IsEnabled) { margin.DrawArrow(g, p.Y); } }
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(); } }
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)); } } } } }
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)); }
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; }
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); } }
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 } }
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); }
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); }
public virtual void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawBookmark(g, p.Y, isEnabled); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { g.DrawImageUnscaled(ClassBrowserIconService.ImageList.Images[IconIndex], p); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawArrow(g, p.Y); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawBreakpoint(g, p.Y, IsEnabled, WillBeHit, IsOnCondition); }
public abstract void Draw(IconBarMargin margin, Graphics g, Point p);
public AnalyzerWarningRenderer(TextView textView, IconBarMargin iconBarMargin) { _iconBarMargin = iconBarMargin; _textView = textView; }
public ParseErrorRenderer(TextView textView, IconBarMargin iconBarMargin) { _iconBarMargin = iconBarMargin; _textView = textView; }
public DebugMarkerRenderer(TextView textView, IconBarMargin iconBarMargin) { _iconBarMargin = iconBarMargin; _textView = textView; }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { margin.DrawBreakpoint(g, p.Y, IsEnabled, IsHealthy); }
public override void Draw(IconBarMargin margin, Graphics g, Point p) { }
public override void Draw(IconBarMargin margin, System.Drawing.Graphics g, System.Drawing.Point p) { margin.DrawArrow(g, p.Y); }