示例#1
0
文件: UndoRedo.cs 项目: kevL/yata
        /// <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();
            }
        }