public MarginMouseMovedEventArgs (HexEditor editor, Margin margin, MouseMovedEventArgs args) { this.margin = margin; this.Editor = editor; this.Args = args; }
static void OnSelected (long start, long end, Margin margin, LayoutOffsetPair arg) { var style = ((TextEditorMargin)margin).Style; arg.Layout.SetForeground (style.Selection, (int)(start - arg.StartOffset) / 2, (int)(end - start) / 2); arg.Layout.SetBackground (style.SelectionBg, (int)(start - arg.StartOffset) / 2, (int)(end - start) / 2); }
public MarginMouseEventArgs (HexEditor editor, Margin margin, ButtonEventArgs args) { this.Editor = editor; this.margin = margin; this.Args = args; }
public RedrawRequest (Margin margin, Gdk.Rectangle area) { this.Margin = margin; this.Area = area; }
public void RepaintMarginArea (Margin margin, double x, double y, double width, double height) { QueueDraw (new Rectangle (x, y, width, height)); }
public void RepaintMarginArea (Margin margin, int x, int y, int width, int height) { if (this.buffer == null) return; y = System.Math.Max (0, y); height = System.Math.Min (height, Allocation.Height - y); x = System.Math.Max (0, x); width = System.Math.Min (width, Allocation.Width - x); if (height < 0 || width < 0) return; lock (redrawList) { redrawList.Add (new RedrawRequest (margin, new Gdk.Rectangle (x, y, width, height))); } QueueDrawArea (x, y, width, height); }
void RenderMargins (Gdk.Drawable win, Gdk.Rectangle area, Margin marginToRender) { int reminder = (int)HexEditorData.VAdjustment.Value % LineHeight; long firstLine = (long)(HexEditorData.VAdjustment.Value / (long)LineHeight); long startLine = (area.Top + reminder) / this.LineHeight; long endLine = (area.Bottom + reminder) / this.LineHeight - 1; if ((area.Bottom + reminder) % this.LineHeight != 0) endLine++; // Initialize the rendering of the margins. Determine wether each margin has to be // rendered or not and calculate the X offset. List<Margin> marginsToRender = new List<Margin> (); if (marginToRender != null) { marginsToRender.Add (marginToRender); } else { int curX = 0; foreach (Margin margin in this.margins) { if (margin.IsVisible) { margin.XOffset = curX; if (curX >= area.X || margin.Width < 0) marginsToRender.Add (margin); curX += margin.Width; } } } int curY = (int)(startLine * this.LineHeight - reminder); for (long visualLineNumber = startLine; visualLineNumber <= endLine; visualLineNumber++) { long logicalLineNumber = visualLineNumber + firstLine; foreach (Margin margin in marginsToRender) { try { margin.Draw (win, area, logicalLineNumber, margin.XOffset, curY); } catch (Exception e) { System.Console.WriteLine (e); } } curY += LineHeight; if (curY > area.Bottom) break; } }
public MarginMouseMovedEventArgs(HexEditor editor, Margin margin, MouseMovedEventArgs args) { this.margin = margin; this.Editor = editor; this.Args = args; }
public MarginMouseEventArgs(HexEditor editor, Margin margin, ButtonEventArgs args) { this.Editor = editor; this.margin = margin; this.Args = args; }
protected static void HandleSelection <T> (long selectionStart, long selectionEnd, long startOffset, long endOffset, Margin margin, T args, HandleSelectionArgsDelegate <T> handleNotSelected, HandleSelectionArgsDelegate <T> handleSelected) { if (startOffset >= selectionStart && endOffset <= selectionEnd) { if (handleSelected != null) { handleSelected(startOffset, endOffset, margin, args); } } else if (startOffset >= selectionStart && startOffset < selectionEnd && endOffset > selectionEnd) { if (handleSelected != null) { handleSelected(startOffset, selectionEnd, margin, args); } if (handleNotSelected != null) { handleNotSelected(selectionEnd, endOffset, margin, args); } } else if (startOffset < selectionStart && endOffset > selectionStart && endOffset <= selectionEnd) { if (handleNotSelected != null) { handleNotSelected(startOffset, selectionStart, margin, args); } if (handleSelected != null) { handleSelected(selectionStart, endOffset, margin, args); } } else if (startOffset < selectionStart && endOffset > selectionEnd) { if (handleNotSelected != null) { handleNotSelected(startOffset, selectionStart, margin, args); } if (handleSelected != null) { handleSelected(selectionStart, selectionEnd, margin, args); } if (handleNotSelected != null) { handleNotSelected(selectionEnd, endOffset, margin, args); } } else { if (handleNotSelected != null) { handleNotSelected(startOffset, endOffset, margin, args); } } }