mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
Spreadsheet: Add undo/redo implementation
The Spreadsheet application currently does not support undo/redo, and with this update, we are starting the process of adding this feature :-) Additionally, the save dialog has been updated to use GUI::MessageBox::ask_about_unsaved_changes() for system cohesity. Spreadsheet: Add basic undo functinoality The spreadsheet application now has basic support for undo. Testing of this feature is limited, and may not work as intended yet. Spreadsheet: Add callback when a cell's value is changed In addition to the callback being added, this commit also exposes the SheetModel class via a getter in SpreadSheetView. Spreadsheet: Remove debug statements and use cell change callback This commit uses the on_cell_data_change callback from within the SheetModel class. This allows for us to push/pop changes to the undo stack. With this, we have basic Undo/Redo functionality :-) Spreadsheet: Actually add window::set_modified Spreadsheet: Const-correctness :-) Spreadsheet: Reorder the edit menu actions
This commit is contained in:
parent
d00781de36
commit
e41dfa6599
7 changed files with 89 additions and 2 deletions
|
@ -153,7 +153,10 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu
|
|||
return;
|
||||
|
||||
auto& cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
|
||||
auto previous_data = cell.data();
|
||||
cell.set_data(value.to_string());
|
||||
if (on_cell_data_change)
|
||||
on_cell_data_change(cell, previous_data);
|
||||
did_update(UpdateFlag::DontInvalidateIndices);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue