diff options
-rw-r--r-- | Userland/Applications/TextEditor/MainWidget.cpp | 1 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.cpp | 22 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.h | 2 |
4 files changed, 24 insertions, 13 deletions
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index f7dd185dd1..fd82460f51 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -753,7 +753,6 @@ void MainWidget::set_preview_mode(PreviewMode mode) update_markdown_preview(); } else { m_no_preview_action->set_checked(true); - m_editor->set_fixed_width(-1); set_web_view_visible(false); } } diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index ec6ad5bd52..8af021ad4c 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -693,18 +693,6 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action auto wrapper = m_current_editor_wrapper; m_switch_to_next_editor->activate(); m_editors_splitter->remove_child(*wrapper); - - auto child_editors = m_editors_splitter->child_widgets(); - bool has_child_to_fill_space = false; - for (auto& editor : child_editors) { - if (editor.max_height() == -1) { - has_child_to_fill_space = true; - break; - } - } - if (!has_child_to_fill_space) - child_editors.last().set_max_height(-1); - m_all_editor_wrappers.remove_first_matching([&wrapper](auto& entry) { return entry == wrapper.ptr(); }); update_actions(); }); diff --git a/Userland/Libraries/LibGUI/Splitter.cpp b/Userland/Libraries/LibGUI/Splitter.cpp index 064cc5a082..ea025be234 100644 --- a/Userland/Libraries/LibGUI/Splitter.cpp +++ b/Userland/Libraries/LibGUI/Splitter.cpp @@ -164,6 +164,7 @@ void Splitter::recompute_grabbables() auto child_widgets = this->child_widgets(); child_widgets.remove_all_matching([&](auto& widget) { return !widget.is_visible(); }); + m_last_child_count = child_widgets.size(); if (child_widgets.size() < 2) return; @@ -236,6 +237,27 @@ void Splitter::did_layout() recompute_grabbables(); } +void Splitter::custom_layout() +{ + auto child_widgets = this->child_widgets(); + child_widgets.remove_all_matching([&](auto& widget) { return !widget.is_visible(); }); + + if (!child_widgets.size()) + return; + + if (m_last_child_count > child_widgets.size()) { + bool has_child_to_fill_space = false; + for (auto& child : child_widgets) { + if (child.max_size() == Gfx::IntSize { -1, -1 }) { + has_child_to_fill_space = true; + break; + } + } + if (!has_child_to_fill_space) + child_widgets.last().set_fixed_size({ -1, -1 }); + } +} + void Splitter::mouseup_event(MouseEvent& event) { if (event.button() != MouseButton::Primary) diff --git a/Userland/Libraries/LibGUI/Splitter.h b/Userland/Libraries/LibGUI/Splitter.h index 911c6b5029..ad21a0747f 100644 --- a/Userland/Libraries/LibGUI/Splitter.h +++ b/Userland/Libraries/LibGUI/Splitter.h @@ -37,6 +37,7 @@ protected: virtual void leave_event(Core::Event&) override; virtual void did_layout() override; + virtual void custom_layout() override; FixedResizee fixed_resizee() const { return m_fixed_resizee; } void set_fixed_resizee(FixedResizee resizee) { m_fixed_resizee = resizee; } @@ -56,6 +57,7 @@ private: int m_first_resizee_minimum_size { 0 }; int m_second_resizee_minimum_size { 0 }; FixedResizee m_fixed_resizee { FixedResizee::First }; + size_t m_last_child_count { 0 }; void recompute_grabbables(); |