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:
1 parent
d2c50b5548
commit
69b6acb9e8
6 files changed
+16
-14
No files matched your search
@@ -96,9 +96,10 @@ static void components_draw(const ComponentRow& row, bool isColor)
|
|||||||
ImGui::TextUnformatted(label);
|
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 animations = document.animations_selected_get();
|
||||||
auto& destination = settings.changeDestination;
|
auto& destination = settings.changeDestination;
|
||||||
@@ -427,4 +428,5 @@ void ChangeAllFrameProperties::update(Manager& manager, Document& document, Sett
|
|||||||
tooltip_set(button.tooltip);
|
tooltip_set(button.tooltip);
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
return isChanged;
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,13 @@ inline constexpr StringType INTERPOLATION_LABELS[] = {BASIC_NONE, BASIC_LINEAR,
|
|||||||
BASIC_EASE_IN_OUT};
|
BASIC_EASE_IN_OUT};
|
||||||
inline constexpr StringType CHILD_MODE_LABELS[] = {LABEL_LOOP, LABEL_ONCE, LABEL_HOLD};
|
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:
|
CHANGE_IN_WINDOW,
|
||||||
bool isChanged = false;
|
CHANGE_IN_WIZARD
|
||||||
|
|
||||||
void update(Manager&, Document&, Settings&, bool = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Draws the property changes. True on the frame they were applied.
|
||||||
|
bool frame_properties_change_draw(Manager&, Document&, Settings&, ChangeHost);
|
||||||
@@ -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)
|
void frame_properties_update(Manager& manager, Settings& settings, FramePropertiesPanel& panel)
|
||||||
{
|
{
|
||||||
auto& [changeAllFrameProperties, isBatchMode] = panel;
|
auto& isBatchMode = panel.isBatchMode;
|
||||||
auto& document = *manager.get();
|
auto& document = *manager.get();
|
||||||
auto frameSelectionCount = document.frame_references_get(Document::FrameReferenceFallback::NONE).size();
|
auto frameSelectionCount = document.frame_references_get(Document::FrameReferenceFallback::NONE).size();
|
||||||
if (frameSelectionCount == 0 && document.reference_get().frameIndex >= 0)
|
if (frameSelectionCount == 0 && document.reference_get().frameIndex >= 0)
|
||||||
@@ -100,7 +100,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
|||||||
|
|
||||||
if (isSingleFrameBatchMode)
|
if (isSingleFrameBatchMode)
|
||||||
{
|
{
|
||||||
changeAllFrameProperties.update(manager, document, settings);
|
frame_properties_change_draw(manager, document, settings, CHANGE_IN_WINDOW);
|
||||||
mode_selector_draw();
|
mode_selector_draw();
|
||||||
}
|
}
|
||||||
else if (!isMultiFrameSelection)
|
else if (!isMultiFrameSelection)
|
||||||
@@ -409,7 +409,7 @@ void frame_properties_update(Manager& manager, Settings& settings, FrameProperti
|
|||||||
mode_selector_draw();
|
mode_selector_draw();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
changeAllFrameProperties.update(manager, document, settings);
|
frame_properties_change_draw(manager, document, settings, CHANGE_IN_WINDOW);
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ struct AnimationsPanel
|
|||||||
|
|
||||||
struct FramePropertiesPanel
|
struct FramePropertiesPanel
|
||||||
{
|
{
|
||||||
ChangeAllFrameProperties changeAllFrameProperties = {};
|
|
||||||
bool isBatchMode = false;
|
bool isBatchMode = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -297,8 +297,7 @@ void Taskbar::update(Manager& manager, Settings& settings, Resources& resources,
|
|||||||
{
|
{
|
||||||
if (document)
|
if (document)
|
||||||
{
|
{
|
||||||
changeAllFrameProperties.update(manager, *document, settings, true);
|
if (frame_properties_change_draw(manager, *document, settings, CHANGE_IN_WIZARD))
|
||||||
if (changeAllFrameProperties.isChanged)
|
|
||||||
changePopup.close();
|
changePopup.close();
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class Taskbar
|
|||||||
bool isQueued = false;
|
bool isQueued = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
ChangeAllFrameProperties changeAllFrameProperties = {};
|
|
||||||
About about = {};
|
About about = {};
|
||||||
Configure configure = {};
|
Configure configure = {};
|
||||||
GenerateAnimationFromGrid generateAnimationFromGrid = {};
|
GenerateAnimationFromGrid generateAnimationFromGrid = {};
|
||||||
|
|||||||
Reference in new issue
Block a user