From 2638a94094f50ced165ec3d24e73f59f8d3d1ea8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Oct 2019 22:13:20 +0200 Subject: [PATCH] HackStudio: Add a simple app icon and some initial menus --- Base/res/icons/16x16/app-hack-studio.png | Bin 0 -> 327 bytes DevTools/HackStudio/main.cpp | 44 +++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 Base/res/icons/16x16/app-hack-studio.png diff --git a/Base/res/icons/16x16/app-hack-studio.png b/Base/res/icons/16x16/app-hack-studio.png new file mode 100644 index 0000000000000000000000000000000000000000..a3df80bf36b7a7c5c6cfc4858e728fee83366128 GIT binary patch literal 327 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7`8-`5Lo7~DoxIVD*-)l^ zzf5hzDcO=Q^BycaxBWz54I_Ku+c24yiam?diSMfay^p0A=GzttefP52P{it$m;K(iM*Vt_lqbuIyZ;y(?p(9dP=0yn zr|-%{v(4TNqKqc*-7kGUqW$sU*-wpyGPfmpJe>>+(YFm^tn?Y3OZ=yZ=;6UE8K|%ZA^4I-WaEeO0?S iwdCRdy2SUt%zNa@&i$RA=ET6jz~JfX=d#Wzp$P!5Y>-O; literal 0 HcmV?d00001 diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp index f77f16ba4e..52b3dd1e41 100644 --- a/DevTools/HackStudio/main.cpp +++ b/DevTools/HackStudio/main.cpp @@ -1,11 +1,14 @@ #include "Project.h" #include "TerminalWrapper.h" #include +#include #include #include #include #include #include +#include +#include #include #include #include @@ -68,17 +71,38 @@ int main(int argc, char** argv) statusbar->set_text(String::format("Line: %d, Column: %d", text_editor->cursor().line(), text_editor->cursor().column())); }; - text_editor->add_custom_context_menu_action(GAction::create("Go to line...", { Mod_Ctrl, Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [&](auto&) { - auto input_box = GInputBox::construct("Line:", "Go to line", window); - auto result = input_box->exec(); - if (result == GInputBox::ExecOK) { - bool ok; - auto line_number = input_box->text_value().to_uint(ok); - if (ok) { - text_editor->set_cursor(line_number - 1, 0); + text_editor->add_custom_context_menu_action(GAction::create( + "Go to line...", { Mod_Ctrl, Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [&](auto&) { + auto input_box = GInputBox::construct("Line:", "Go to line", window); + auto result = input_box->exec(); + if (result == GInputBox::ExecOK) { + bool ok; + auto line_number = input_box->text_value().to_uint(ok); + if (ok) { + text_editor->set_cursor(line_number - 1, 0); + } } - } - }, text_editor)); + }, + text_editor)); + + auto menubar = make(); + auto app_menu = make("HackStudio"); + app_menu->add_action(GCommonActions::make_quit_action([&](auto&) { + app.quit(); + })); + menubar->add_menu(move(app_menu)); + + auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"); + + auto help_menu = make("Help"); + help_menu->add_action(GAction::create("About", [&](auto&) { + GAboutDialog::show("HackStudio", small_icon, window); + })); + menubar->add_menu(move(help_menu)); + + app.set_menubar(move(menubar)); + + window->set_icon(small_icon); window->show(); return app.exec();