diff options
author | electrikmilk <brandonjordan124@gmail.com> | 2022-03-06 22:08:34 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-03-08 22:42:40 +0100 |
commit | 7fe0e7b46b6468dea0601c5b7cfb4912ef69cffc (patch) | |
tree | 3f00cf4b0f21809e5dde0aa63df0c371768e8a9f /Userland/DevTools/HackStudio | |
parent | 89c846a31cf745e6c192e13df58cff9a9e097bb1 (diff) | |
download | serenity-7fe0e7b46b6468dea0601c5b7cfb4912ef69cffc.zip |
HackStudio: Move 'New' Menu to 'File'
Currently we have a 'Project' menu with a 'New' menu in it, this tries
to organize things by just having one 'New...' sub-menu in the 'File'
menu that creates new files, projects and directories.
To solve conflicts, move 'Semantic Highlighting' to the 'View' menu.
As a result of both of these changes, remove 'Project' menu.
Diffstat (limited to 'Userland/DevTools/HackStudio')
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 36 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.h | 1 |
2 files changed, 16 insertions, 21 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index b10bbc7364..b2ea74b256 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -512,7 +512,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action(String const NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_directory_action() { - return GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { + return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { String directory_name; if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:", "Add new folder to project") != GUI::InputBox::ExecOK) return; @@ -623,7 +623,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action() NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_project_action() { - return GUI::Action::create("&New Project...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { + return GUI::Action::create("&Project...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { auto dialog = NewProjectDialog::construct(window()); dialog->set_icon(window()->icon()); auto result = dialog->exec(); @@ -1203,7 +1203,18 @@ void HackStudioWidget::update_recent_projects_submenu() void HackStudioWidget::create_file_menu(GUI::Window& window) { auto& file_menu = window.add_menu("&File"); - file_menu.add_action(*m_new_project_action); + + auto& new_submenu = file_menu.add_submenu("New..."); + new_submenu.add_action(*m_new_project_action); + new_submenu.add_separator(); + for (auto& new_file_action : m_new_file_actions) { + new_submenu.add_action(new_file_action); + } + new_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors()); + new_submenu.add_action(*m_new_plain_file_action); + new_submenu.add_separator(); + new_submenu.add_action(*m_new_directory_action); + file_menu.add_action(*m_open_action); m_recent_projects_submenu = &file_menu.add_submenu("Open Recent"); m_recent_projects_submenu->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-recent.png").release_value_but_fixme_should_propagate_errors()); @@ -1216,22 +1227,6 @@ void HackStudioWidget::create_file_menu(GUI::Window& window) })); } -void HackStudioWidget::create_project_menu(GUI::Window& window) -{ - auto& project_menu = window.add_menu("&Project"); - auto& new_submenu = project_menu.add_submenu("New"); - for (auto& new_file_action : m_new_file_actions) { - new_submenu.add_action(new_file_action); - } - new_submenu.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors()); - new_submenu.add_action(*m_new_plain_file_action); - new_submenu.add_separator(); - new_submenu.add_action(*m_new_directory_action); - - m_toggle_semantic_highlighting_action = create_toggle_syntax_highlighting_mode_action(); - project_menu.add_action(*m_toggle_semantic_highlighting_action); -} - void HackStudioWidget::create_edit_menu(GUI::Window& window) { auto& edit_menu = window.add_menu("&Edit"); @@ -1282,6 +1277,8 @@ void HackStudioWidget::create_view_menu(GUI::Window& window) view_menu.add_action(hide_action_tabs_action); view_menu.add_action(open_locator_action); view_menu.add_action(show_dotfiles_action); + m_toggle_semantic_highlighting_action = create_toggle_syntax_highlighting_mode_action(); + view_menu.add_action(*m_toggle_semantic_highlighting_action); view_menu.add_separator(); m_wrapping_mode_actions.set_exclusive(true); @@ -1356,7 +1353,6 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_stop_action() void HackStudioWidget::initialize_menubar(GUI::Window& window) { create_file_menu(window); - create_project_menu(window); create_edit_menu(window); create_build_menu(window); create_view_menu(window); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index de64454a51..aaeaa0b462 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -133,7 +133,6 @@ private: void create_action_tab(GUI::Widget& parent); void create_file_menu(GUI::Window&); void update_recent_projects_submenu(); - void create_project_menu(GUI::Window&); void create_edit_menu(GUI::Window&); void create_build_menu(GUI::Window&); void create_view_menu(GUI::Window&); |