From 901c11691b598fec8d20e8715c0291ef99e2b037 Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 3 Oct 2026 18:45:44 -0400 Subject: [PATCH] types.hpp is UI-free: theme moves to util/imgui/theme.hpp, ImGui conversions and dummy values to layout.hpp The model and edit layers no longer include ImGui or localization headers. Co-Authored-By: Claude Opus 5.5 --- src/imgui/toast.cpp | 2 + src/imgui/window/canvas_view.hpp | 2 + src/imgui/window/regions.cpp | 2 + src/imgui/window/spritesheet_editor.cpp | 2 + .../wizard/change_all_frame_properties.cpp | 2 + .../wizard/generate_animation_from_grid.cpp | 2 + src/manager.hpp | 2 + src/settings.hpp | 1 + src/tool.hpp | 2 + src/types.hpp | 46 ------------------- src/util/imgui/layout.hpp | 22 +++++++++ src/util/imgui/popup.cpp | 2 + src/util/imgui/theme.cpp | 2 + src/util/imgui/theme.hpp | 26 ++++++++++- 14 files changed, 68 insertions(+), 47 deletions(-) diff --git a/src/imgui/toast.cpp b/src/imgui/toast.cpp index 460890e..31c9597 100644 --- a/src/imgui/toast.cpp +++ b/src/imgui/toast.cpp @@ -1,5 +1,7 @@ #include "toast.hpp" +#include "util/imgui/layout.hpp" + #include #include diff --git a/src/imgui/window/canvas_view.hpp b/src/imgui/window/canvas_view.hpp index a14b0d7..88b1b92 100644 --- a/src/imgui/window/canvas_view.hpp +++ b/src/imgui/window/canvas_view.hpp @@ -6,6 +6,8 @@ #include #include +#include + #include "canvas.hpp" #include "manager.hpp" #include "settings.hpp" diff --git a/src/imgui/window/regions.cpp b/src/imgui/window/regions.cpp index fc5ba25..8aabf58 100644 --- a/src/imgui/window/regions.cpp +++ b/src/imgui/window/regions.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include "math.hpp" #include "path.hpp" #include "util/imgui/draw.hpp" diff --git a/src/imgui/window/spritesheet_editor.cpp b/src/imgui/window/spritesheet_editor.cpp index 65771e7..e7973a7 100644 --- a/src/imgui/window/spritesheet_editor.cpp +++ b/src/imgui/window/spritesheet_editor.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include "actions.hpp" #include "imgui_internal.h" #include "math.hpp" diff --git a/src/imgui/wizard/change_all_frame_properties.cpp b/src/imgui/wizard/change_all_frame_properties.cpp index 951a62d..156245f 100644 --- a/src/imgui/wizard/change_all_frame_properties.cpp +++ b/src/imgui/wizard/change_all_frame_properties.cpp @@ -1,5 +1,7 @@ #include "change_all_frame_properties.hpp" +#include + #include #include #include diff --git a/src/imgui/wizard/generate_animation_from_grid.cpp b/src/imgui/wizard/generate_animation_from_grid.cpp index ed0c492..7ccc56d 100644 --- a/src/imgui/wizard/generate_animation_from_grid.cpp +++ b/src/imgui/wizard/generate_animation_from_grid.cpp @@ -1,5 +1,7 @@ #include "generate_animation_from_grid.hpp" +#include + #include "math.hpp" #include "model/frames.hpp" #include "types.hpp" diff --git a/src/manager.hpp b/src/manager.hpp index 764d2f4..43d7a00 100644 --- a/src/manager.hpp +++ b/src/manager.hpp @@ -6,6 +6,8 @@ #include #include +#include + #include "document.hpp" #include "settings.hpp" #include "strings.hpp" diff --git a/src/settings.hpp b/src/settings.hpp index fae888b..0535fe8 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -9,6 +9,7 @@ #include "render.hpp" #include "strings.hpp" #include "types.hpp" +#include "util/imgui/theme.hpp" namespace anm2ed { diff --git a/src/tool.hpp b/src/tool.hpp index 586d253..fa0459c 100644 --- a/src/tool.hpp +++ b/src/tool.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "icon.hpp" #include "settings.hpp" #include "strings.hpp" diff --git a/src/types.hpp b/src/types.hpp index abad17c..624582a 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -1,34 +1,6 @@ #pragma once #include -#include -#include - -#include "strings.hpp" - -namespace anm2ed::types::theme -{ -#define THEMES \ - X(LIGHT, LABEL_THEME_LIGHT) \ - X(DARK, LABEL_THEME_DARK) \ - X(CLASSIC, LABEL_THEME_CLASSIC) - - enum Type - { -#define X(symbol, string) symbol, - THEMES -#undef X - COUNT - }; - - constexpr StringType STRINGS[] = { -#define X(symbol, string) string, - THEMES -#undef X - }; - -#undef THEMES -} namespace anm2ed::types::shortcut { @@ -112,22 +84,4 @@ namespace anm2ed::types }; constexpr auto ID_NONE = -1; - - constexpr ImVec2 to_imvec2(const glm::vec2& v) noexcept { return {v.x, v.y}; } - constexpr glm::vec2 to_vec2(const ImVec2& v) noexcept { return {v.x, v.y}; } - constexpr glm::ivec2 to_ivec2(const ImVec2& v) noexcept { return {v.x, v.y}; } - constexpr ImVec4 to_imvec4(const glm::vec4& v) noexcept { return {v.x, v.y, v.z, v.w}; } - constexpr glm::vec4 to_vec4(const ImVec4& v) noexcept { return {v.x, v.y, v.z, v.w}; } - - template constexpr T& dummy_value() - { - static T value{}; - return value; - } - - template constexpr T& dummy_value_negative() - { - static T value{-1}; - return value; - } } diff --git a/src/util/imgui/layout.hpp b/src/util/imgui/layout.hpp index ff88f46..2eabc3a 100644 --- a/src/util/imgui/layout.hpp +++ b/src/util/imgui/layout.hpp @@ -2,8 +2,30 @@ #include +#include #include +namespace anm2ed::types +{ + constexpr ImVec2 to_imvec2(const glm::vec2& v) noexcept { return {v.x, v.y}; } + constexpr glm::vec2 to_vec2(const ImVec2& v) noexcept { return {v.x, v.y}; } + constexpr glm::ivec2 to_ivec2(const ImVec2& v) noexcept { return {v.x, v.y}; } + constexpr ImVec4 to_imvec4(const glm::vec4& v) noexcept { return {v.x, v.y, v.z, v.w}; } + constexpr glm::vec4 to_vec4(const ImVec4& v) noexcept { return {v.x, v.y, v.z, v.w}; } + + template constexpr T& dummy_value() + { + static T value{}; + return value; + } + + template constexpr T& dummy_value_negative() + { + static T value{-1}; + return value; + } +} + namespace anm2ed::imgui { float row_widget_width_get(int, float = ImGui::GetContentRegionAvail().x); diff --git a/src/util/imgui/popup.cpp b/src/util/imgui/popup.cpp index 1d14342..2817089 100644 --- a/src/util/imgui/popup.cpp +++ b/src/util/imgui/popup.cpp @@ -1,5 +1,7 @@ #include "popup.hpp" +#include "layout.hpp" + #include #include "types.hpp" diff --git a/src/util/imgui/theme.cpp b/src/util/imgui/theme.cpp index fa3af51..a2055e3 100644 --- a/src/util/imgui/theme.cpp +++ b/src/util/imgui/theme.cpp @@ -1,5 +1,7 @@ #include "theme.hpp" +#include + namespace anm2ed::imgui { constexpr ImVec4 COLOR_LIGHT_BUTTON{0.98f, 0.98f, 0.98f, 1.0f}; diff --git a/src/util/imgui/theme.hpp b/src/util/imgui/theme.hpp index 29062d2..a8f1318 100644 --- a/src/util/imgui/theme.hpp +++ b/src/util/imgui/theme.hpp @@ -1,6 +1,30 @@ #pragma once -#include "types.hpp" +#include "strings.hpp" + +namespace anm2ed::types::theme +{ +#define THEMES \ + X(LIGHT, LABEL_THEME_LIGHT) \ + X(DARK, LABEL_THEME_DARK) \ + X(CLASSIC, LABEL_THEME_CLASSIC) + + enum Type + { +#define X(symbol, string) symbol, + THEMES +#undef X + COUNT + }; + + constexpr StringType STRINGS[] = { +#define X(symbol, string) string, + THEMES +#undef X + }; + +#undef THEMES +} namespace anm2ed::imgui {