From cce9172cd42aa581206329d2a6aa825322f50bbe Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Tue, 30 Aug 2022 07:38:20 -0400 Subject: [PATCH] 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. --- Userland/Applications/HexEditor/HexEditorWindow.gml | 2 ++ Userland/Applications/Mail/MailWindow.gml | 2 +- Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 10 ++++++---- .../SoundPlayer/SoundPlayerWidgetAdvancedView.cpp | 2 +- .../Applications/Spreadsheet/SpreadsheetWidget.cpp | 2 +- Userland/Applications/TextEditor/TextEditorWindow.gml | 2 +- Userland/DevTools/HackStudio/HackStudioWidget.cpp | 10 +++++----- Userland/DevTools/Inspector/main.cpp | 2 +- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Userland/Applications/HexEditor/HexEditorWindow.gml b/Userland/Applications/HexEditor/HexEditorWindow.gml index e673aff099..0b7a4e89ee 100644 --- a/Userland/Applications/HexEditor/HexEditorWindow.gml +++ b/Userland/Applications/HexEditor/HexEditorWindow.gml @@ -14,6 +14,8 @@ } @GUI::HorizontalSplitter { + opportunistic_resizee: "First" + @HexEditor::HexEditor { name: "editor" } diff --git a/Userland/Applications/Mail/MailWindow.gml b/Userland/Applications/Mail/MailWindow.gml index 602bf7d609..5f6cadd85e 100644 --- a/Userland/Applications/Mail/MailWindow.gml +++ b/Userland/Applications/Mail/MailWindow.gml @@ -7,7 +7,7 @@ @GUI::HorizontalSplitter { @GUI::TreeView { name: "mailbox_list" - fixed_width: 250 + preferred_width: 250 } @GUI::VerticalSplitter { diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 0f388d922d..73600f3867 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -28,9 +28,11 @@ PDFViewerWidget::PDFViewerWidget() auto& toolbar = toolbar_container.add(); auto& splitter = add(); + splitter.layout()->set_spacing(4); m_sidebar = splitter.add(); - m_sidebar->set_fixed_width(0); + m_sidebar->set_preferred_width(200); + m_sidebar->set_visible(false); m_viewer = splitter.add(); 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; } } diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index b05d97119e..1a0d9cdaeb 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/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(); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index f35fc2a34e..33fc5a0633 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -38,7 +38,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe auto& top_bar = container.add(); top_bar.set_layout().set_spacing(1); - top_bar.set_fixed_height(26); + top_bar.set_preferred_height(26); auto& current_cell_label = top_bar.add(""); current_cell_label.set_fixed_width(50); diff --git a/Userland/Applications/TextEditor/TextEditorWindow.gml b/Userland/Applications/TextEditor/TextEditorWindow.gml index b8556df9a8..1a1c3b1d85 100644 --- a/Userland/Applications/TextEditor/TextEditorWindow.gml +++ b/Userland/Applications/TextEditor/TextEditorWindow.gml @@ -14,7 +14,7 @@ } @GUI::HorizontalSplitter { - fixed_resizee: "Second" + opportunistic_resizee: "First" @GUI::TextEditor { name: "editor" diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index e4a3127501..cbac2156cc 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -94,7 +94,7 @@ HackStudioWidget::HackStudioWidget(String path_to_project) auto& left_hand_splitter = outer_splitter.add(); 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 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(); - 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; }; diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index bf0fce471c..cedb75537f 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -109,7 +109,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto& tree_view = splitter.add(); 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(); properties_tree_view.set_should_fill_selected_rows(true);