Example #1
0
        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);
        }
Example #2
0
        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);
            }
        }