mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									89c846a31c
								
							
						
					
					
						commit
						7fe0e7b46b
					
				
					 2 changed files with 16 additions and 21 deletions
				
			
		|  | @ -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); | ||||
|  |  | |||
|  | @ -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&); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 electrikmilk
						electrikmilk