From a5d11c0a262c5e7a0306f94f431e8f7c5970e527 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 6 Feb 2024 16:08:14 +0000 Subject: [PATCH] HexEditor: Convert panels to DynamicWidgetContainer This lets the user swap them around and pop them out as separate windows as desired. We do lose the ability to individually resize them though, until DynamicWidgetContainer supports that. --- .../HexEditor/HexEditorWidget.cpp | 5 +++- .../HexEditor/HexEditorWidget.gml | 24 +++++++++++++------ .../Applications/HexEditor/HexEditorWidget.h | 3 ++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index d257914198..dff09fd358 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -56,10 +56,13 @@ ErrorOr HexEditorWidget::setup() m_annotations_container = *find_descendant_of_type_named("annotations_container"); m_search_results = *find_descendant_of_type_named("search_results"); m_search_results_container = *find_descendant_of_type_named("search_results_container"); - m_side_panel_container = *find_descendant_of_type_named("side_panel_container"); + m_side_panel_container = *find_descendant_of_type_named("side_panel_container"); m_value_inspector_container = *find_descendant_of_type_named("value_inspector_container"); m_value_inspector = *find_descendant_of_type_named("value_inspector"); + // FIXME: Set this in GML once the compiler supports it. + m_side_panel_container->set_container_with_individual_order(true); + m_value_inspector->on_activation = [this](GUI::ModelIndex const& index) { if (!index.is_valid()) return; diff --git a/Userland/Applications/HexEditor/HexEditorWidget.gml b/Userland/Applications/HexEditor/HexEditorWidget.gml index f9faaf5fe9..f80073cc56 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.gml +++ b/Userland/Applications/HexEditor/HexEditorWidget.gml @@ -20,24 +20,32 @@ name: "editor" } - @GUI::VerticalSplitter { + @GUI::DynamicWidgetContainer { name: "side_panel_container" visible: false + section_label: "Panels" + config_domain: "HexEditor" + preferred_height: "grow" + show_controls: false - @GUI::Widget { + @GUI::DynamicWidgetContainer { name: "search_results_container" + section_label: "Search Results" + config_domain: "HexEditor" + preferred_height: "grow" visible: false - layout: @GUI::VerticalBoxLayout {} @GUI::TableView { name: "search_results" } } - @GUI::Widget { + @GUI::DynamicWidgetContainer { name: "value_inspector_container" + section_label: "Value Inspector" + config_domain: "HexEditor" + preferred_height: "grow" visible: false - layout: @GUI::VerticalBoxLayout {} @GUI::TableView { name: "value_inspector" @@ -45,10 +53,12 @@ } } - @GUI::Widget { + @GUI::DynamicWidgetContainer { name: "annotations_container" + section_label: "Annotations" + config_domain: "HexEditor" + preferred_height: "grow" visible: false - layout: @GUI::VerticalBoxLayout {} @GUI::TableView { name: "annotations" diff --git a/Userland/Applications/HexEditor/HexEditorWidget.h b/Userland/Applications/HexEditor/HexEditorWidget.h index 71ba357991..714ed76457 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.h +++ b/Userland/Applications/HexEditor/HexEditorWidget.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -93,7 +94,7 @@ private: RefPtr m_toolbar_container; RefPtr m_search_results; RefPtr m_search_results_container; - RefPtr m_side_panel_container; + RefPtr m_side_panel_container; RefPtr m_value_inspector_container; RefPtr m_value_inspector; RefPtr m_annotations_container;