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
        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);
            }
        }