From 653f01616ce3ea434d6ce9d21b3c7ba1ecea608e Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Sun, 20 Feb 2022 09:50:44 -0500 Subject: LibGUI+Apps: Adjust Splitter spacings Different thread highlights between widgets lead to different visual weights between splitters, even when they have the same width or height. This means some splitters look best at odd sizes while others even. This sets the default spacing to the most commonly used, depending on orientation, and adjusts spacing for a few apps based on the new paint rect. The most consistent look across apps requires some manual tweaking occassionally. Knurlheads, use your discretion! --- Userland/Applications/Help/main.cpp | 2 +- Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml | 4 +++- Userland/DevTools/HackStudio/HackStudioWidget.cpp | 5 ++--- Userland/Libraries/LibGUI/Splitter.cpp | 5 ++++- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'Userland') diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 23e63f4be3..5956e29237 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -100,7 +100,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto toolbar = TRY(toolbar_container->try_add()); auto splitter = TRY(widget->try_add()); - splitter->layout()->set_spacing(5); + splitter->layout()->set_spacing(4); auto manual_model = ManualModel::create(); diff --git a/Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml b/Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml index 3dbecab2dd..e9ba1fa4ca 100644 --- a/Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml +++ b/Userland/Demos/WidgetGallery/GalleryGML/BasicsTab.gml @@ -11,7 +11,9 @@ } @GUI::HorizontalSplitter { - layout: @GUI::HorizontalBoxLayout {} + layout: @GUI::HorizontalBoxLayout { + spacing: 4 + } @GUI::Frame { name: "label_frame" diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 8af021ad4c..d134ba1e80 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -91,10 +91,10 @@ HackStudioWidget::HackStudioWidget(String path_to_project) auto& toolbar_container = add(); auto& outer_splitter = add(); - outer_splitter.layout()->set_spacing(5); + outer_splitter.layout()->set_spacing(4); auto& left_hand_splitter = outer_splitter.add(); - left_hand_splitter.layout()->set_spacing(5); + left_hand_splitter.layout()->set_spacing(6); left_hand_splitter.set_fixed_width(150); create_project_tab(left_hand_splitter); m_project_tree_view_context_menu = create_project_tree_view_context_menu(); @@ -110,7 +110,6 @@ HackStudioWidget::HackStudioWidget(String path_to_project) m_diff_viewer = m_right_hand_stack->add(); m_editors_splitter = m_right_hand_stack->add(); - m_editors_splitter->layout()->set_spacing(5); m_editors_splitter->layout()->set_margins({ 3, 0, 0 }); add_new_editor(*m_editors_splitter); diff --git a/Userland/Libraries/LibGUI/Splitter.cpp b/Userland/Libraries/LibGUI/Splitter.cpp index ea025be234..0571b47d4c 100644 --- a/Userland/Libraries/LibGUI/Splitter.cpp +++ b/Userland/Libraries/LibGUI/Splitter.cpp @@ -27,7 +27,10 @@ Splitter::Splitter(Orientation orientation) set_background_role(ColorRole::Button); set_layout(orientation); set_fill_with_background_color(true); - layout()->set_spacing(3); + if (m_orientation == Gfx::Orientation::Horizontal) + layout()->set_spacing(3); + else + layout()->set_spacing(4); } Splitter::~Splitter() -- cgit v1.2.3