diff --git a/ext/ghoul b/ext/ghoul index 032aec5848..347e2bba03 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 032aec58486a18b64bdfa297dc34091d3fa0badb +Subproject commit 347e2bba03d2788b3ec6ea2031b05675a9dd8dcb diff --git a/modules/imgui/include/guipropertycomponent.h b/modules/imgui/include/guipropertycomponent.h index 860499a69a..e42b048650 100644 --- a/modules/imgui/include/guipropertycomponent.h +++ b/modules/imgui/include/guipropertycomponent.h @@ -29,6 +29,7 @@ #include #include +#include #include @@ -75,9 +76,8 @@ protected: /// are regular, i.e., not containing wildcards, regex, or groups /// This variable only has an impact on which \c setPropertyValue function is called bool _hasOnlyRegularProperties = false; - UseTreeLayout _useTreeLayout; - bool _currentUseTreeLayout; + properties::BoolProperty _useTreeLayout; properties::StringListProperty _treeOrdering; IsTopLevelWindow _isTopLevel; diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index cb087eb80b..b336a4b719 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -37,6 +37,14 @@ namespace { const ImVec2 size = ImVec2(350, 500); + static const openspace::properties::Property::PropertyInfo UseTreeInfo = { + "TreeLayout", + "Use Tree Layout", + "If this value is checked, this component will display the properties using a " + "tree layout, rather than using a flat map. This value should only be set on " + "property windows that display SceneGraphNodes, or the application might crash." + }; + static const openspace::properties::Property::PropertyInfo OrderingInfo = { "Ordering", "Tree Ordering", @@ -157,11 +165,11 @@ namespace openspace::gui { GuiPropertyComponent::GuiPropertyComponent(std::string name, UseTreeLayout useTree, IsTopLevelWindow topLevel) : GuiComponent(std::move(name)) - , _useTreeLayout(useTree) - , _currentUseTreeLayout(useTree) + , _useTreeLayout(UseTreeInfo, useTree) , _treeOrdering(OrderingInfo) , _isTopLevel(topLevel) { + addProperty(_useTreeLayout); addProperty(_treeOrdering); } @@ -259,11 +267,6 @@ void GuiPropertyComponent::render() { } if (_function) { - if (_useTreeLayout) { - ImGui::Checkbox("Use Tree layout", &_currentUseTreeLayout); - } - - std::vector owners = _function(); std::sort( @@ -274,7 +277,7 @@ void GuiPropertyComponent::render() { } ); - if (_currentUseTreeLayout) { + if (_useTreeLayout) { for (properties::PropertyOwner* owner : owners) { ghoul_assert( dynamic_cast(owner), @@ -377,7 +380,7 @@ void GuiPropertyComponent::render() { } }; - if (!_currentUseTreeLayout || noGuiGroups) { + if (!_useTreeLayout || noGuiGroups) { std::for_each(owners.begin(), owners.end(), renderProp); } else { // _useTreeLayout && gui groups exist