diff options
author | Zack Penn <zack@sysdevs.org> | 2022-02-19 14:03:50 -0600 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-02-21 16:04:48 +0330 |
commit | e41dfa6599c9768e81147c04cd4f5d1c697a4d54 (patch) | |
tree | 741782ba2124c02bad43d5b90aad6661096d6a9a /Userland/Applications/Spreadsheet/SpreadsheetModel.cpp | |
parent | d00781de36f8f9c22d77ad2e1f2d6d3279a9b8f5 (diff) | |
download | serenity-e41dfa6599c9768e81147c04cd4f5d1c697a4d54.zip |
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
Diffstat (limited to 'Userland/Applications/Spreadsheet/SpreadsheetModel.cpp')
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetModel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 51b1c5cca4..e7980430f0 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -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); } |