Esempio n. 1
0
        /// <summary>
        /// Deletes an array of rows in accord with
        /// <c><see cref="Undo()">Undo()</see></c> or
        /// <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void DeleteArray()
        {
            //logfile.Log("UndoRedo.DeleteArray()");

            _grid._f.Obfuscate();
            DrawRegulator.SuspendDrawing(_grid);


            for (int a = _it.array.Length - 1; a != -1; --a)             // reverse delete.
            {
                _grid.Delete(_it.array[a]._id, false);
            }

            _grid.Calibrate();

            _grid.ClearSelects();
            int r = _it.array[0]._id;

            if (r >= _grid.RowCount)
            {
                r = _grid.RowCount - 1;
            }
            _grid.EnsureDisplayedRow(r);

            _grid._f.EnableRoweditOperations();


            DrawRegulator.ResumeDrawing(_grid);
            _grid._f.Obfuscate(false);

            if (Settings._autorder && Yata.order() != 0)
            {
                _grid._f.layout();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes a row in accord with <c><see cref="Undo()">Undo()</see></c>
        /// or <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void DeleteRow()
        {
            //logfile.Log("UndoRedo.DeleteRow()");

            int r = _it.r._id;

            _grid.Delete(r);

            _grid.ClearSelects();
            if (r >= _grid.RowCount)
            {
                r = _grid.RowCount - 1;
            }
            _grid.EnsureDisplayedRow(r);

            _grid._f.EnableRoweditOperations();


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

            if (Settings._autorder && Yata.order() != 0)
            {
                _grid._f.layout();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Inserts an array of rows in accord with
        /// <c><see cref="Undo()">Undo()</see></c> or
        /// <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void InsertArray()
        {
            //logfile.Log("UndoRedo.InsertArray()");

            _grid._f.Obfuscate();
            DrawRegulator.SuspendDrawing(_grid);


            int cols   = _it.array[0].Length;
            var fields = new string[cols];

            Row row;

            for (int a = 0; a != _it.array.Length; ++a)
            {
                row = _it.array[a];
                for (int c = 0; c != cols; ++c)
                {
                    fields[c] = String.Copy(row[c].text);
                }

                _grid.Insert(row._id, fields, false, row._brush);

                for (int c = 0; c != row.Length; ++c)
                {
                    _grid[row._id, c].loadchanged = row[c].loadchanged;
                }
            }
            _grid.Calibrate(0, _grid.RowCount - 1);


            _grid.ClearSelects(false, true);
            int r = _it.array[0]._id;

            _grid.Rows[r].selected = true;
//			_grid.RangeSelect = _it.array.Length - 1;	// that's problematic ... wrt/ re-Sorted cols
            // and since only 1 row shall ever be selected you can't just select them all either.

            _grid.EnsureDisplayedRow(r);             // TODO: EnsureDisplayedRows()
            // NOTE: Does not select the row's cells.


            DrawRegulator.ResumeDrawing(_grid);
            _grid._f.Obfuscate(false);

            if (Settings._autorder && Yata.order() != 0)
            {
                _grid._f.layout();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Inserts a row in accord with <c><see cref="Undo()">Undo()</see></c>
        /// or <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void InsertRow()
        {
            //logfile.Log("UndoRedo.InsertRow()");

            Row row = _it.r;

            var fields = new string[row.Length];

            for (int c = 0; c != row.Length; ++c)
            {
                fields[c] = String.Copy(row[c].text);
            }

            int r = row._id;

            _grid.Insert(r, fields, true, row._brush);

            for (int c = 0; c != row.Length; ++c)
            {
                _grid[r, c].loadchanged = row[c].loadchanged;
            }

            _grid.ClearSelects(false, true);
            _grid.Rows[r].selected = true;
            _grid.EnsureDisplayedRow(r);


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

            if (Settings._autorder && Yata.order() != 0)
            {
                _grid._f.layout();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Overwrites a row in accord with
        /// <c><see cref="Undo()">Undo()</see></c> or
        /// <c><see cref="Redo()">Redo()</see></c>.
        /// </summary>
        void Overwrite()
        {
            //logfile.Log("UndoRedo.Overwrite()");

            Row row = _it.r;
            int r   = row._id;

            _grid.Rows[r] = row.Clone() as Row;
            _grid.Calibrate(r);

            _grid.ClearSelects(false, true);
            _grid.Rows[r].selected = true;
            _grid.EnsureDisplayedRow(r);


            _grid.Invalidator(YataGrid.INVALID_GRID
                              | YataGrid.INVALID_ROWS);

            if (Settings._autorder && Yata.order() != 0)
            {
                _grid._f.layout();
            }
        }