From 84a2208b5cabb80040da188b1ce1ebf22cbad24c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 24 Oct 2019 22:25:26 +0200 Subject: [PATCH] HackStudio: Add some toolbar icons to liven up the UI a bit :^) --- Base/res/icons/16x16/build.png | Bin 0 -> 141 bytes Base/res/icons/16x16/run.png | Bin 0 -> 104 bytes DevTools/HackStudio/main.cpp | 48 ++++++++++++++++++++++++++------- 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 Base/res/icons/16x16/build.png create mode 100644 Base/res/icons/16x16/run.png diff --git a/Base/res/icons/16x16/build.png b/Base/res/icons/16x16/build.png new file mode 100644 index 0000000000000000000000000000000000000000..2e4ec0b526badb1d35cc4f4bf1e76a4ae6b5d8e4 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7LOfj@Lo7}&oqUjw!GOhi z;@|)J<=>BPdEtAkdrR83DfXsa=A0MWSR|XcCd@LPoAh^EXGWE4@C1darvrXP`iLx& u@#ZYN_(uPTbm!6u5r1ZHG}wD9MEpb+zd-lw<01?U3=E#GelF{r5}E*xZ8L@d literal 0 HcmV?d00001 diff --git a/Base/res/icons/16x16/run.png b/Base/res/icons/16x16/run.png new file mode 100644 index 0000000000000000000000000000000000000000..cb0b67d5b468bce98ac5b2fe4f447b08224bde90 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7^gUf1Lo7}wCrGfCF#j*~ zGziS%5MHX6xaf+t&y+UKooog{Nes%WaS2PRtRyNJ7<4zW@#uQ${$*fbVDNPHb6Mw< G&;$U*dm2yx literal 0 HcmV?d00001 diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp index 4f82461468..77bbd53d31 100644 --- a/DevTools/HackStudio/main.cpp +++ b/DevTools/HackStudio/main.cpp @@ -67,6 +67,32 @@ int main(int argc, char** argv) g_text_editor = GTextEditor::construct(GTextEditor::MultiLine, inner_splitter); g_text_editor->set_ruler_visible(true); + auto new_action = GAction::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GAction&) { + // FIXME: Implement. + }); + + auto open_action = GCommonActions::make_open_action([&](auto&) { + // FIXME: Implement. + }); + + auto save_action = GAction::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) { + if (g_currently_open_file.is_empty()) + return; + g_text_editor->write_to_file(g_currently_open_file); + }); + + toolbar->add_action(new_action); + toolbar->add_action(open_action); + toolbar->add_action(save_action); + toolbar->add_separator(); + toolbar->add_action(g_text_editor->cut_action()); + toolbar->add_action(g_text_editor->copy_action()); + toolbar->add_action(g_text_editor->paste_action()); + toolbar->add_separator(); + toolbar->add_action(g_text_editor->undo_action()); + toolbar->add_action(g_text_editor->redo_action()); + toolbar->add_separator(); + g_project_list_view->on_activation = [&](auto& index) { auto filename = g_project_list_view->model()->data(index).to_string(); open_file(filename); @@ -102,11 +128,7 @@ int main(int argc, char** argv) auto menubar = make(); auto app_menu = make("HackStudio"); - app_menu->add_action(GAction::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) { - if (g_currently_open_file.is_empty()) - return; - g_text_editor->write_to_file(g_currently_open_file); - })); + app_menu->add_action(save_action); app_menu->add_action(GCommonActions::make_quit_action([&](auto&) { app.quit(); })); @@ -119,13 +141,19 @@ int main(int argc, char** argv) })); menubar->add_menu(move(edit_menu)); - auto build_menu = make("Build"); - build_menu->add_action(GAction::create("Build", { Mod_Ctrl, Key_B }, [&](auto&) { + auto build_action = GAction::create("Build", { Mod_Ctrl, Key_B }, GraphicsBitmap::load_from_file("/res/icons/16x16/build.png"), [&](auto&) { build(terminal_wrapper); - })); - build_menu->add_action(GAction::create("Run", { Mod_Ctrl, Key_R }, [&](auto&) { + }); + toolbar->add_action(build_action); + + auto run_action = GAction::create("Run", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/run.png"), [&](auto&) { run(terminal_wrapper); - })); + }); + toolbar->add_action(run_action); + + auto build_menu = make("Build"); + build_menu->add_action(build_action); + build_menu->add_action(run_action); menubar->add_menu(move(build_menu)); auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");