diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp index c7bddbe69d..68e79f6c70 100644 --- a/Applications/TextEditor/main.cpp +++ b/Applications/TextEditor/main.cpp @@ -74,6 +74,14 @@ int main(int argc, char** argv) text_editor->write_to_file(path); }); + auto undo_action = GAction::create("Undo", { Mod_Ctrl, Key_Z }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/16x16/undo.rgb", { 16, 16 }), [&] (const GAction&) { + // FIXME: Undo + }); + + auto redo_action = GAction::create("Redo", { Mod_Ctrl, Key_Y }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/16x16/redo.rgb", { 16, 16 }), [&] (const GAction&) { + // FIXME: Redo + }); + auto cut_action = GAction::create("Cut", { Mod_Ctrl, Key_X }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/cut16.rgb", { 16, 16 }), [&] (const GAction&) { text_editor->cut(); }); @@ -101,6 +109,9 @@ int main(int argc, char** argv) menubar->add_menu(move(file_menu)); auto edit_menu = make("Edit"); + edit_menu->add_action(undo_action.copy_ref()); + edit_menu->add_action(redo_action.copy_ref()); + edit_menu->add_separator(); edit_menu->add_action(cut_action.copy_ref()); edit_menu->add_action(copy_action.copy_ref()); edit_menu->add_action(paste_action.copy_ref()); @@ -133,6 +144,11 @@ int main(int argc, char** argv) toolbar->add_action(move(copy_action)); toolbar->add_action(move(paste_action)); + toolbar->add_separator(); + + toolbar->add_action(move(undo_action)); + toolbar->add_action(move(redo_action)); + auto* window = new GWindow; window->set_title(String::format("TextEditor: %s", path.characters())); window->set_rect(20, 200, 640, 400); diff --git a/Base/res/icons/16x16/redo.png b/Base/res/icons/16x16/redo.png new file mode 100644 index 0000000000..57a831010d Binary files /dev/null and b/Base/res/icons/16x16/redo.png differ diff --git a/Base/res/icons/16x16/redo.rgb b/Base/res/icons/16x16/redo.rgb new file mode 100644 index 0000000000..6534f5c346 Binary files /dev/null and b/Base/res/icons/16x16/redo.rgb differ diff --git a/Base/res/icons/16x16/undo.png b/Base/res/icons/16x16/undo.png new file mode 100644 index 0000000000..161cf8e04b Binary files /dev/null and b/Base/res/icons/16x16/undo.png differ diff --git a/Base/res/icons/16x16/undo.rgb b/Base/res/icons/16x16/undo.rgb new file mode 100644 index 0000000000..c743aff593 Binary files /dev/null and b/Base/res/icons/16x16/undo.rgb differ