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.
This commit is contained in:
shweet committed 2026-11-22 19:01:26 -05:00
1 parent d2c50b5548
commit 69b6acb9e8
6 files changed
+16 -14

No files matched your search

+4 -2
View File
@@ -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;
}
+8 -5
View File
@@ -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);
+3 -3
View File
@@ -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();
-1
View File
@@ -156,7 +156,6 @@ struct AnimationsPanel
struct FramePropertiesPanel
{
ChangeAllFrameProperties changeAllFrameProperties = {};
bool isBatchMode = false;
};
+1 -2
View File
@@ -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();
-1
View File
@@ -25,7 +25,6 @@ class Taskbar
bool isQueued = false;
};
ChangeAllFrameProperties changeAllFrameProperties = {};
About about = {};
Configure configure = {};
GenerateAnimationFromGrid generateAnimationFromGrid = {};