protected override bool OnButtonReleaseEvent(EventButton evnt) { if (isRectSelection) { // remove scrolling and rectangular selection if (scroll_timeout != 0) { GLib.Source.Remove(scroll_timeout); scroll_timeout = 0; } isRectSelection = false; if (BinWindow != null) { BinWindow.InvalidateRect(rect_select, false); BinWindow.ProcessUpdates(true); } rect_select = new Rectangle(); } else if (!isDragDrop) { int cell_num = CellAtPosition((int)evnt.X, (int)evnt.Y); if (cell_num != -1) { if ((evnt.State & ModifierType.ControlMask) != 0) { Selection.ToggleCell(cell_num); } else if ((evnt.State & ModifierType.ShiftMask) != 0) { Selection.Add(FocusCell, cell_num); } else { Selection.Clear(); Selection.Add(cell_num); } FocusCell = cell_num; } } isDragDrop = false; return(true); }
private void SetSize(int x, int y, int width, int height) { Hadjustment.Upper = Math.Max(Allocation.Width, width); Vadjustment.Upper = Math.Max(Allocation.Height, height); bool xchange = scroll && (int)(Hadjustment.Value) != x; bool ychange = scroll && (int)(Vadjustment.Value) != y; // reset scroll scroll = false; if (IsRealized) { BinWindow.FreezeUpdates(); } if (xchange || ychange) { if (IsRealized) { BinWindow.MoveResize(-x, -y, (int)(Hadjustment.Upper), (int)(Vadjustment.Upper)); } Vadjustment.Value = y; Hadjustment.Value = x; } if (this.Width != Allocation.Width || this.Height != Allocation.Height) { SetSize((uint)Allocation.Width, (uint)height); } if (xchange || ychange) { Vadjustment.ChangeValue(); Hadjustment.ChangeValue(); } if (IsRealized) { BinWindow.ThawUpdates(); BinWindow.ProcessUpdates(true); } }
public void InvalidateCell(int cell_num) { Rectangle cell_area = CellBounds(cell_num); // FIXME where are we computing the bounds incorrectly cell_area.Width -= 1; cell_area.Height -= 1; Gdk.Rectangle visible = new Gdk.Rectangle((int)Hadjustment.Value, (int)Vadjustment.Value, Allocation.Width, Allocation.Height); Gdk.Rectangle intersection; if (BinWindow != null && cell_area.Intersect(visible, out intersection)) { BinWindow.InvalidateRect(intersection, false); } }
// during pointer motion, select/toggle pictures between initial x/y (param) // and current x/y (get pointer) private void UpdateRubberband() { // determine old and new selection var old_selection = rect_select; selection_end = GetPointer(); var new_selection = BoundedRectangle(selection_start, selection_end); // determine region to invalidate var region = Region.Rectangle(old_selection); region.Xor(Region.Rectangle(new_selection)); region.Shrink(-1, -1); BinWindow.InvalidateRegion(region, true); rect_select = new_selection; UpdateRubberbandSelection(); }