summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-16 23:16:11 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-16 23:16:11 +0100
commit78039ef057b3251b5db9052483a277c0cf6e535a (patch)
treeb56259973811ff0403d5ccc8e3e277b4c1164415
parent3854e752cb29fec10d76080be011611378590f22 (diff)
downloadserenity-78039ef057b3251b5db9052483a277c0cf6e535a.zip
TextEditor: Add actions for undo and redo. Not hooked up yet.
-rw-r--r--Applications/TextEditor/main.cpp16
-rw-r--r--Base/res/icons/16x16/redo.pngbin0 -> 252 bytes
-rw-r--r--Base/res/icons/16x16/redo.rgbbin0 -> 1024 bytes
-rw-r--r--Base/res/icons/16x16/undo.pngbin0 -> 252 bytes
-rw-r--r--Base/res/icons/16x16/undo.rgbbin0 -> 1024 bytes
5 files changed, 16 insertions, 0 deletions
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<GMenu>("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
--- /dev/null
+++ b/Base/res/icons/16x16/redo.png
Binary files differ
diff --git a/Base/res/icons/16x16/redo.rgb b/Base/res/icons/16x16/redo.rgb
new file mode 100644
index 0000000000..6534f5c346
--- /dev/null
+++ b/Base/res/icons/16x16/redo.rgb
Binary files differ
diff --git a/Base/res/icons/16x16/undo.png b/Base/res/icons/16x16/undo.png
new file mode 100644
index 0000000000..161cf8e04b
--- /dev/null
+++ b/Base/res/icons/16x16/undo.png
Binary files differ
diff --git a/Base/res/icons/16x16/undo.rgb b/Base/res/icons/16x16/undo.rgb
new file mode 100644
index 0000000000..c743aff593
--- /dev/null
+++ b/Base/res/icons/16x16/undo.rgb
Binary files differ