Explorar el Código

Applications+DevTools: Remove fixed sizes from Splitters

And adjust some GML properties. Since a808cfa, splitters grow
opportunistically. Setting them to fixed sizes now quite literally
fixes them in place. Fixes immovable splitters missed in the
aforementioned commit.
thankyouverycool hace 2 años
padre
commit
cce9172cd4

+ 2 - 0
Userland/Applications/HexEditor/HexEditorWindow.gml

@@ -14,6 +14,8 @@
     }
 
     @GUI::HorizontalSplitter {
+        opportunistic_resizee: "First"
+
         @HexEditor::HexEditor {
             name: "editor"
         }

+ 1 - 1
Userland/Applications/Mail/MailWindow.gml

@@ -7,7 +7,7 @@
     @GUI::HorizontalSplitter {
         @GUI::TreeView {
             name: "mailbox_list"
-            fixed_width: 250
+            preferred_width: 250
         }
 
         @GUI::VerticalSplitter {

+ 6 - 4
Userland/Applications/PDFViewer/PDFViewerWidget.cpp

@@ -28,9 +28,11 @@ PDFViewerWidget::PDFViewerWidget()
     auto& toolbar = toolbar_container.add<GUI::Toolbar>();
 
     auto& splitter = add<GUI::HorizontalSplitter>();
+    splitter.layout()->set_spacing(4);
 
     m_sidebar = splitter.add<SidebarWidget>();
-    m_sidebar->set_fixed_width(0);
+    m_sidebar->set_preferred_width(200);
+    m_sidebar->set_visible(false);
 
     m_viewer = splitter.add<PDFViewer>();
     m_viewer->on_page_change = [&](auto new_page) {
@@ -73,7 +75,7 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar)
     auto open_outline_action = GUI::Action::create(
         "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
             m_sidebar_open = !m_sidebar_open;
-            m_sidebar->set_fixed_width(m_sidebar_open ? 200 : 0);
+            m_sidebar->set_visible(m_sidebar_open ? true : false);
         },
         nullptr);
     open_outline_action->set_enabled(false);
@@ -214,11 +216,11 @@ void PDFViewerWidget::open_file(Core::File& file)
     if (document->outline()) {
         auto outline = document->outline();
         m_sidebar->set_outline(outline.release_nonnull());
-        m_sidebar->set_fixed_width(200);
+        m_sidebar->set_visible(true);
         m_sidebar_open = true;
     } else {
         m_sidebar->set_outline({});
-        m_sidebar->set_fixed_width(0);
+        m_sidebar->set_visible(false);
         m_sidebar_open = false;
     }
 }

+ 1 - 1
Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp

@@ -38,7 +38,7 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window
 
     m_playlist_widget = PlaylistWidget::construct();
     m_playlist_widget->set_data_model(playlist().model());
-    m_playlist_widget->set_fixed_width(150);
+    m_playlist_widget->set_preferred_width(150);
 
     m_player_view->set_layout<GUI::VerticalBoxLayout>();
 

+ 1 - 1
Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp

@@ -38,7 +38,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
 
     auto& top_bar = container.add<GUI::Frame>();
     top_bar.set_layout<GUI::HorizontalBoxLayout>().set_spacing(1);
-    top_bar.set_fixed_height(26);
+    top_bar.set_preferred_height(26);
     auto& current_cell_label = top_bar.add<GUI::Label>("");
     current_cell_label.set_fixed_width(50);
 

+ 1 - 1
Userland/Applications/TextEditor/TextEditorWindow.gml

@@ -14,7 +14,7 @@
     }
 
     @GUI::HorizontalSplitter {
-        fixed_resizee: "Second"
+        opportunistic_resizee: "First"
 
         @GUI::TextEditor {
             name: "editor"

+ 5 - 5
Userland/DevTools/HackStudio/HackStudioWidget.cpp

@@ -94,7 +94,7 @@ HackStudioWidget::HackStudioWidget(String path_to_project)
 
     auto& left_hand_splitter = outer_splitter.add<GUI::VerticalSplitter>();
     left_hand_splitter.layout()->set_spacing(6);
-    left_hand_splitter.set_fixed_width(150);
+    left_hand_splitter.set_preferred_width(150);
     create_project_tab(left_hand_splitter);
     m_project_tree_view_context_menu = create_project_tree_view_context_menu();
 
@@ -980,7 +980,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_terminal_action()
 void HackStudioWidget::reveal_action_tab(GUI::Widget& widget)
 {
     if (m_action_tab_widget->effective_min_size().height().as_int() < 200)
-        m_action_tab_widget->set_fixed_height(200);
+        m_action_tab_widget->set_preferred_height(200);
     m_action_tab_widget->set_active_widget(&widget);
 }
 
@@ -1149,7 +1149,7 @@ void HackStudioWidget::run()
 
 void HackStudioWidget::hide_action_tabs()
 {
-    m_action_tab_widget->set_fixed_height(24);
+    m_action_tab_widget->set_preferred_height(24);
 };
 
 Project& HackStudioWidget::project()
@@ -1300,13 +1300,13 @@ void HackStudioWidget::create_action_tab(GUI::Widget& parent)
 {
     m_action_tab_widget = parent.add<GUI::TabWidget>();
 
-    m_action_tab_widget->set_fixed_height(24);
+    m_action_tab_widget->set_preferred_height(24);
     m_action_tab_widget->on_change = [this](auto&) {
         on_action_tab_change();
 
         static bool first_time = true;
         if (!first_time)
-            m_action_tab_widget->set_fixed_height(200);
+            m_action_tab_widget->set_preferred_height(200);
         first_time = false;
     };
 

+ 1 - 1
Userland/DevTools/Inspector/main.cpp

@@ -109,7 +109,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     auto& tree_view = splitter.add<GUI::TreeView>();
     tree_view.set_model(remote_process.object_graph_model());
     tree_view.set_activates_on_selection(true);
-    tree_view.set_fixed_width(286);
+    tree_view.set_preferred_width(286);
 
     auto& properties_tree_view = splitter.add<GUI::TreeView>();
     properties_tree_view.set_should_fill_selected_rows(true);