/// <summary> /// Applies a text-edit via <c><see cref="_editor"/></c>. /// </summary> /// <param name="select"><c>true</c> to focus the <c>YataGrid</c></param> /// <seealso cref="YataGrid.editresultaccept()"><c>YataGrid.editresultaccept()</c></seealso> internal void editresultaccept(bool @select = false) { //logfile.Log("Propanel.editresultaccept()"); bool sanitized = false; Cell cell = _grid[_r, _c]; if (_editor.Text != cell.text) { sanitized = _grid.ChangeCellText(cell, _editor); // does a text-check _grid.Invalidator(YataGrid.INVALID_GRID | YataGrid.INVALID_FROZ); } else if (cell.loadchanged) { _grid.ClearLoadchanged(cell); } editresultcancel(@select); if (sanitized) { using (var ib = new Infobox(Infobox.Title_warni, "The text that was submitted has been altered.", null, InfoboxType.Warn)) { ib.ShowDialog(_grid._f); } } }
/// <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); }
/// <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); }