@@ -1977,10 +1977,10 @@ void ProjectManager::_notification(int p_what) {
1977
1977
real_t size = get_size ().x / EDSCALE;
1978
1978
// Adjust names of tabs to fit the new size.
1979
1979
if (size < 650 ) {
1980
- local_projects_hb ->set_name (TTR (" Local" ));
1980
+ local_projects_vb ->set_name (TTR (" Local" ));
1981
1981
asset_library->set_name (TTR (" Asset Library" ));
1982
1982
} else {
1983
- local_projects_hb ->set_name (TTR (" Local Projects" ));
1983
+ local_projects_vb ->set_name (TTR (" Local Projects" ));
1984
1984
asset_library->set_name (TTR (" Asset Library Projects" ));
1985
1985
}
1986
1986
}
@@ -2845,19 +2845,39 @@ ProjectManager::ProjectManager() {
2845
2845
tabs->set_anchors_and_offsets_preset (Control::PRESET_FULL_RECT);
2846
2846
tabs->connect (" tab_changed" , callable_mp (this , &ProjectManager::_on_tab_changed));
2847
2847
2848
- local_projects_hb = memnew (HBoxContainer );
2849
- local_projects_hb ->set_name (TTR (" Local Projects" ));
2850
- tabs->add_child (local_projects_hb );
2848
+ local_projects_vb = memnew (VBoxContainer );
2849
+ local_projects_vb ->set_name (TTR (" Local Projects" ));
2850
+ tabs->add_child (local_projects_vb );
2851
2851
2852
2852
{
2853
- // Projects + search bar
2854
- VBoxContainer *search_tree_vb = memnew (VBoxContainer);
2855
- local_projects_hb->add_child (search_tree_vb);
2856
- search_tree_vb->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2857
-
2853
+ // A bar at top with buttons and options.
2858
2854
HBoxContainer *hb = memnew (HBoxContainer);
2859
2855
hb->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2860
- search_tree_vb->add_child (hb);
2856
+ local_projects_vb->add_child (hb);
2857
+
2858
+ create_btn = memnew (Button );
2859
+ create_btn->set_text (TTR (" New" ));
2860
+ create_btn->set_shortcut (ED_SHORTCUT (" project_manager/new_project" , TTR (" New Project" ), KeyModifierMask::CMD_OR_CTRL | Key::N));
2861
+ create_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_new_project));
2862
+ hb->add_child (create_btn);
2863
+
2864
+ import_btn = memnew (Button );
2865
+ import_btn->set_text (TTR (" Import" ));
2866
+ import_btn->set_shortcut (ED_SHORTCUT (" project_manager/import_project" , TTR (" Import Project" ), KeyModifierMask::CMD_OR_CTRL | Key::I));
2867
+ import_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_import_project));
2868
+ hb->add_child (import_btn);
2869
+
2870
+ scan_btn = memnew (Button );
2871
+ scan_btn->set_text (TTR (" Scan" ));
2872
+ scan_btn->set_shortcut (ED_SHORTCUT (" project_manager/scan_projects" , TTR (" Scan Projects" ), KeyModifierMask::CMD_OR_CTRL | Key::S));
2873
+ scan_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_scan_projects));
2874
+ hb->add_child (scan_btn);
2875
+
2876
+ loading_label = memnew (Label (TTR (" Loading, please wait..." )));
2877
+ loading_label->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2878
+ hb->add_child (loading_label);
2879
+ // The loading label is shown later.
2880
+ loading_label->hide ();
2861
2881
2862
2882
search_box = memnew (LineEdit);
2863
2883
search_box->set_placeholder (TTR (" Filter Projects" ));
@@ -2867,19 +2887,14 @@ ProjectManager::ProjectManager() {
2867
2887
search_box->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2868
2888
hb->add_child (search_box);
2869
2889
2870
- loading_label = memnew (Label (TTR (" Loading, please wait..." )));
2871
- loading_label->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2872
- hb->add_child (loading_label);
2873
- // The loading label is shown later.
2874
- loading_label->hide ();
2875
-
2876
2890
Label *sort_label = memnew (Label);
2877
2891
sort_label->set_text (TTR (" Sort:" ));
2878
2892
hb->add_child (sort_label);
2879
2893
2880
2894
filter_option = memnew (OptionButton);
2881
2895
filter_option->set_clip_text (true );
2882
2896
filter_option->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2897
+ filter_option->set_stretch_ratio (0.3 );
2883
2898
filter_option->connect (" item_selected" , callable_mp (this , &ProjectManager::_on_order_option_changed));
2884
2899
hb->add_child (filter_option);
2885
2900
@@ -2892,41 +2907,28 @@ ProjectManager::ProjectManager() {
2892
2907
for (int i = 0 ; i < sort_filter_titles.size (); i++) {
2893
2908
filter_option->add_item (sort_filter_titles[i]);
2894
2909
}
2910
+ }
2911
+
2912
+ {
2913
+ // A container for the project list and for the side bar with buttons.
2914
+ HBoxContainer *search_tree_hb = memnew (HBoxContainer);
2915
+ local_projects_vb->add_child (search_tree_hb);
2916
+ search_tree_hb->set_v_size_flags (Control::SIZE_EXPAND_FILL);
2895
2917
2896
2918
search_panel = memnew (PanelContainer);
2897
- search_panel->set_v_size_flags (Control::SIZE_EXPAND_FILL);
2898
- search_tree_vb ->add_child (search_panel);
2919
+ search_panel->set_h_size_flags (Control::SIZE_EXPAND_FILL);
2920
+ search_tree_hb ->add_child (search_panel);
2899
2921
2900
2922
_project_list = memnew (ProjectList);
2901
2923
_project_list->connect (ProjectList::SIGNAL_SELECTION_CHANGED, callable_mp (this , &ProjectManager::_update_project_buttons));
2902
2924
_project_list->connect (ProjectList::SIGNAL_PROJECT_ASK_OPEN, callable_mp (this , &ProjectManager::_open_selected_projects_ask));
2903
2925
_project_list->set_horizontal_scroll_mode (ScrollContainer::SCROLL_MODE_DISABLED);
2904
2926
search_panel->add_child (_project_list);
2905
- }
2906
2927
2907
- {
2908
- // Project tab side bar
2928
+ // The side bar with the edit, run, rename, etc. buttons.
2909
2929
VBoxContainer *tree_vb = memnew (VBoxContainer);
2910
2930
tree_vb->set_custom_minimum_size (Size2 (120 , 120 ));
2911
- local_projects_hb->add_child (tree_vb);
2912
-
2913
- create_btn = memnew (Button );
2914
- create_btn->set_text (TTR (" New Project" ));
2915
- create_btn->set_shortcut (ED_SHORTCUT (" project_manager/new_project" , TTR (" New Project" ), KeyModifierMask::CMD_OR_CTRL | Key::N));
2916
- create_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_new_project));
2917
- tree_vb->add_child (create_btn);
2918
-
2919
- import_btn = memnew (Button );
2920
- import_btn->set_text (TTR (" Import" ));
2921
- import_btn->set_shortcut (ED_SHORTCUT (" project_manager/import_project" , TTR (" Import Project" ), KeyModifierMask::CMD_OR_CTRL | Key::I));
2922
- import_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_import_project));
2923
- tree_vb->add_child (import_btn);
2924
-
2925
- scan_btn = memnew (Button );
2926
- scan_btn->set_text (TTR (" Scan" ));
2927
- scan_btn->set_shortcut (ED_SHORTCUT (" project_manager/scan_projects" , TTR (" Scan Projects" ), KeyModifierMask::CMD_OR_CTRL | Key::S));
2928
- scan_btn->connect (" pressed" , callable_mp (this , &ProjectManager::_scan_projects));
2929
- tree_vb->add_child (scan_btn);
2931
+ search_tree_hb->add_child (tree_vb);
2930
2932
2931
2933
tree_vb->add_child (memnew (HSeparator));
2932
2934
0 commit comments