Exemplo n.º 1
0
        /// <summary>
        /// Changes cell-text in accord with <c><see cref="Undo()">Undo()</see></c> or
        /// <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void RestoreCell()
        {
            //logfile.Log("UndoRedo.RestoreCell()");

            var cell = _it.cell.Clone() as Cell;

            int
                c = _it.cell.x,
                r = _it.cell.y;

            _grid[r, c] = cell;

            _grid.Colwidth(c, r);
            _grid.metricFrozenControls(c);

            _grid.ClearSelects(true);
            cell.selected = true;
            _grid.EnsureDisplayed(cell);

            _grid._f.EnableCelleditOperations();


            int invalid = YataGrid.INVALID_GRID
                          | YataGrid.INVALID_FROZ
                          | YataGrid.INVALID_ROWS;

            if (_grid.Propanel != null && _grid.Propanel.Visible)
            {
                invalid |= YataGrid.INVALID_PROP;
            }

            _grid.Invalidator(invalid);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Overrides the <c>MouseDown</c> handler on this <c>YataPanelCols</c>.
        /// Accepts or cancels the editor based on
        /// <c><see cref="Settings._acceptedit">Settings._acceptedit</see></c>.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
#if Clicks
            logfile.Log("YataPanelCols.OnMouseDown() e.Button= " + e.Button);
#endif
            // Don't bother checking MouseButton or ModifierKeys.

            if (_grid._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid._editor.Visible");
#endif
                _grid._editor.Visible = false;
            }
            else if (_grid.Propanel != null && _grid.Propanel._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid.Propanel._editor.Visible");
#endif
                _grid.Propanel._editor.Visible = false;
            }
            _grid.Select();


            switch (e.Button)
            {
            case MouseButtons.Left:
                IsGrab = ModifierKeys == Keys.None && IsCursorSplit;
#if Clicks
                logfile.Log(". IsGrab= " + IsGrab + " _grabCol= " + _grabCol);
#endif
                break;

            case MouseButtons.Right:
                if (ModifierKeys == Keys.None && IsCursorSplit)
                {
                    Col col = _grid.Cols[_grabCol];
                    if (col.UserSized)
                    {
#if Clicks
                        logfile.Log(". reset col-width _grabCol= " + _grabCol);
#endif
                        col.UserSized = false;
                        _grid.Colwidth(_grabCol);
                        _grid.Invalidator(YataGrid.INVALID_GRID | YataGrid.INVALID_COLS);
                    }
                }
                break;
            }

            _grid.click_ColheadPanel(e);
        }