1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:47:36 +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:
Zack Penn 2022-02-19 14:03:50 -06:00 committed by Ali Mohammad Pur
parent d00781de36
commit e41dfa6599
7 changed files with 89 additions and 2 deletions

View file

@ -42,6 +42,10 @@ public:
void initialize_menubar(GUI::Window&);
void undo();
void redo();
auto& undo_stack() { return m_undo_stack; }
private:
virtual void resize_event(GUI::ResizeEvent&) override;
@ -60,6 +64,7 @@ private:
RefPtr<GUI::Menu> m_tab_context_menu;
RefPtr<SpreadsheetView> m_tab_context_menu_sheet_view;
bool m_should_change_selected_cells { false };
GUI::UndoStack m_undo_stack;
OwnPtr<Workbook> m_workbook;
@ -69,11 +74,16 @@ private:
RefPtr<GUI::Action> m_save_action;
RefPtr<GUI::Action> m_save_as_action;
RefPtr<GUI::Action> m_quit_action;
RefPtr<GUI::Action> m_cut_action;
RefPtr<GUI::Action> m_copy_action;
RefPtr<GUI::Action> m_paste_action;
RefPtr<GUI::Action> m_undo_action;
RefPtr<GUI::Action> m_redo_action;
RefPtr<GUI::Action> m_functions_help_action;
RefPtr<GUI::Action> m_about_action;
RefPtr<GUI::Action> m_rename_action;
};