From 69b6acb9e85b33a8dea548283df13793b9f82858 Mon Sep 17 00:00:00 2001 From: shweet Date: Sun, 22 Nov 2026 19:01:26 -0500 Subject: [PATCH] Draw frame property changes with a function instead of a one-flag class ChangeAllFrameProperties becomes frame_properties_change_draw, told where it is drawn by ChangeHost and returning whether it applied. --- src/ui/change_all_frame_properties.cpp | 6 ++++-- src/ui/change_all_frame_properties.h | 13 ++++++++----- src/ui/frame_properties.cpp | 6 +++--- src/ui/panel.h | 1 - src/ui/taskbar.cpp | 3 +-- src/ui/taskbar.h | 1 - 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/ui/change_all_frame_properties.cpp b/src/ui/change_all_frame_properties.cpp index 35aa2e1..59d594f 100644 --- a/src/ui/change_all_frame_properties.cpp +++ b/src/ui/change_all_frame_properties.cpp @@ -96,9 +96,10 @@ static void components_draw(const ComponentRow& row, bool isColor) ImGui::TextUnformatted(label); } -void ChangeAllFrameProperties::update(Manager& manager, Document& document, Settings& settings, bool isFromWizard) +bool frame_properties_change_draw(Manager& manager, Document& document, Settings& settings, ChangeHost host) { - isChanged = false; + auto isChanged = false; + auto isFromWizard = host == CHANGE_IN_WIZARD; auto animations = document.animations_selected_get(); auto& destination = settings.changeDestination; @@ -427,4 +428,5 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett tooltip_set(button.tooltip); } ImGui::EndDisabled(); + return isChanged; } diff --git a/src/ui/change_all_frame_properties.h b/src/ui/change_all_frame_properties.h index dbdd7f3..6b0d3a6 100644 --- a/src/ui/change_all_frame_properties.h +++ b/src/ui/change_all_frame_properties.h @@ -8,10 +8,13 @@ inline constexpr StringType INTERPOLATION_LABELS[] = {BASIC_NONE, BASIC_LINEAR, BASIC_EASE_IN_OUT}; inline constexpr StringType CHILD_MODE_LABELS[] = {LABEL_LOOP, LABEL_ONCE, LABEL_HOLD}; -class ChangeAllFrameProperties +// Where the frame property changes are drawn: in the Frame Properties window (applied to the selected frames), or in +// the Change All Frame Properties wizard (applied to chosen frames or items). +enum ChangeHost { -public: - bool isChanged = false; - - void update(Manager&, Document&, Settings&, bool = false); + CHANGE_IN_WINDOW, + CHANGE_IN_WIZARD }; + +// Draws the property changes. True on the frame they were applied. +bool frame_properties_change_draw(Manager&, Document&, Settings&, ChangeHost); diff --git a/src/ui/frame_properties.cpp b/src/ui/frame_properties.cpp index 8bfd6ff..74dce3d 100644 --- a/src/ui/frame_properties.cpp +++ b/src/ui/frame_properties.cpp @@ -42,7 +42,7 @@ constexpr FlipButton FLIP_BUTTONS[] = {{LABEL_FLIP_X, EDIT_FRAME_FLIP_X, TOOLTIP void frame_properties_update(Manager& manager, Settings& settings, FramePropertiesPanel& panel) { - auto& [changeAllFrameProperties, isBatchMode] = panel; + auto& isBatchMode = panel.isBatchMode; auto& document = *manager.get(); auto frameSelectionCount = document.frame_references_get(Document::FrameReferenceFallback::NONE).size(); if (frameSelectionCount == 0 && document.reference_get().frameIndex >= 0) @@ -100,7 +100,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti if (isSingleFrameBatchMode) { - changeAllFrameProperties.update(manager, document, settings); + frame_properties_change_draw(manager, document, settings, CHANGE_IN_WINDOW); mode_selector_draw(); } else if (!isMultiFrameSelection) @@ -409,7 +409,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti mode_selector_draw(); } else - changeAllFrameProperties.update(manager, document, settings); + frame_properties_change_draw(manager, document, settings, CHANGE_IN_WINDOW); } ImGui::End(); diff --git a/src/ui/panel.h b/src/ui/panel.h index 699e8e1..2864860 100644 --- a/src/ui/panel.h +++ b/src/ui/panel.h @@ -156,7 +156,6 @@ struct AnimationsPanel struct FramePropertiesPanel { - ChangeAllFrameProperties changeAllFrameProperties = {}; bool isBatchMode = false; }; diff --git a/src/ui/taskbar.cpp b/src/ui/taskbar.cpp index 248782c..5ec64a0 100644 --- a/src/ui/taskbar.cpp +++ b/src/ui/taskbar.cpp @@ -297,8 +297,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources, { if (document) { - changeAllFrameProperties.update(manager, *document, settings, true); - if (changeAllFrameProperties.isChanged) + if (frame_properties_change_draw(manager, *document, settings, CHANGE_IN_WIZARD)) changePopup.close(); } ImGui::EndPopup(); diff --git a/src/ui/taskbar.h b/src/ui/taskbar.h index cb633d3..0b405c3 100644 --- a/src/ui/taskbar.h +++ b/src/ui/taskbar.h @@ -25,7 +25,6 @@ class Taskbar bool isQueued = false; }; - ChangeAllFrameProperties changeAllFrameProperties = {}; About about = {}; Configure configure = {}; GenerateAnimationFromGrid generateAnimationFromGrid = {};