From 61e1a7aa7237dd92e86b9cad30a946eef5f9308a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 22 May 2026 23:41:22 -0500 Subject: [PATCH] [studio,nostalgia/gfx/studio] Cleanup --- .../studio/paletteeditor/paletteeditor-imgui.cpp | 6 +++--- .../studio/paletteeditor/paletteeditor-imgui.hpp | 2 +- .../tilesheeteditor/tilesheeteditor-imgui.cpp | 12 ++++++------ .../tilesheeteditor/tilesheeteditor-imgui.hpp | 4 ++-- src/olympic/studio/applib/src/popups/about.cpp | 4 ++-- src/olympic/studio/applib/src/popups/fileinfo.cpp | 4 ++-- src/olympic/studio/applib/src/popups/makecopy.cpp | 2 +- .../studio/modlib/include/studio/imguiutil.hpp | 4 ++-- src/olympic/studio/modlib/src/filepickerpopup.cpp | 2 +- src/olympic/studio/modlib/src/imguiutil.cpp | 14 +++++++------- src/olympic/studio/modlib/src/popup.cpp | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index 8f26b07c..50239974 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -45,11 +45,11 @@ OX_MODEL_BEGIN(PageDragDrop) OX_MODEL_FIELD(page) OX_MODEL_END() -void PaletteEditorImGui::PageRenameDialog::draw(turbine::Context &tctx) noexcept { +void PaletteEditorImGui::PageRenameDialog::draw() noexcept { if (!m_show) { return; } - if (ig::BeginPopup(tctx, "Rename Page", m_show)) { + if (ig::BeginPopup("Rename Page", m_show)) { if (ImGui::IsWindowAppearing()) { ImGui::SetKeyboardFocusHere(); } @@ -91,7 +91,7 @@ void PaletteEditorImGui::draw(studio::Context&) noexcept { drawColorsEditor(); ImGui::EndChild(); } - m_pageRenameDlg.draw(m_tctx); + m_pageRenameDlg.draw(); } ox::Error PaletteEditorImGui::saveItem() noexcept { diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp index 0d167c3f..935b3720 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -29,7 +29,7 @@ class PaletteEditorImGui: public studio::Editor { } [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; } m_pageRenameDlg; studio::Context &m_sctx; turbine::Context &m_tctx; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index 1a7aec98..5e42777c 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -268,8 +268,8 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept { ImGui::EndChild(); } ImGui::EndChild(); - m_subsheetEditor.draw(m_tctx); - m_exportMenu.draw(m_tctx); + m_subsheetEditor.draw(); + m_exportMenu.draw(); if (auto pal = m_palPicker.draw(m_sctx)) { if (*pal != m_model.palPath()) { oxLogError(m_model.setPalette(*pal)); @@ -560,7 +560,7 @@ void TileSheetEditorImGui::SubSheetEditor::show(ox::StringViewCR name, int const m_rows = rows; } -void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept { +void TileSheetEditorImGui::SubSheetEditor::draw() noexcept { constexpr auto popupName = "Edit Subsheet"; if (!m_show) { return; @@ -569,7 +569,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept auto constexpr popupWidth = 235.f; auto const popupHeight = modSize ? 130.f : 85.f; auto const popupSz = ImVec2{popupWidth, popupHeight}; - if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) { + if (ig::BeginPopup(popupName, m_show, popupSz)) { ig::InputText("Name", m_name); if (modSize) { ImGui::InputInt("Columns", &m_cols); @@ -592,7 +592,7 @@ void TileSheetEditorImGui::ExportMenu::show() noexcept { m_scale = 5; } -void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &tctx) noexcept { +void TileSheetEditorImGui::ExportMenu::draw() noexcept { constexpr auto popupName = "Export Tile Sheet"; if (!m_show) { return; @@ -600,7 +600,7 @@ void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &tctx) noexcept { auto constexpr popupWidth = 235.f; auto constexpr popupHeight = 85.f; auto constexpr popupSz = ImVec2{popupWidth, popupHeight}; - if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) { + if (ig::BeginPopup(popupName, m_show, popupSz)) { ImGui::InputInt("Scale", &m_scale); m_scale = ox::clamp(m_scale, 1, 135); if (ig::PopupControlsOkCancel(m_show) == ig::PopupResponse::OK) { diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index b941df31..d02959ff 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -27,7 +27,7 @@ class TileSheetEditorImGui: public studio::Editor { public: ox::Signal inputSubmitted; void show(ox::StringViewCR name, int cols, int rows) noexcept; - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; void close() noexcept; [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } @@ -39,7 +39,7 @@ class TileSheetEditorImGui: public studio::Editor { public: ox::Signal inputSubmitted; void show() noexcept; - void draw(turbine::Context &tctx) noexcept; + void draw() noexcept; void close() noexcept; [[nodiscard]] constexpr bool isOpen() const noexcept { return m_show; } diff --git a/src/olympic/studio/applib/src/popups/about.cpp b/src/olympic/studio/applib/src/popups/about.cpp index 48db9f03..cc3d946f 100644 --- a/src/olympic/studio/applib/src/popups/about.cpp +++ b/src/olympic/studio/applib/src/popups/about.cpp @@ -22,7 +22,7 @@ AboutPopup::AboutPopup(turbine::Context &ctx) noexcept: #endif } -void AboutPopup::draw(Context &sctx) noexcept { +void AboutPopup::draw(Context&) noexcept { if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { close(); return; @@ -37,7 +37,7 @@ void AboutPopup::draw(Context &sctx) noexcept { case Stage::Open: { constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - ig::centerNextWindow(sctx.tctx); + ig::centerNextWindow(); auto open = true; if (ImGui::BeginPopupModal("About", &open, modalFlags)) { ImGui::Text("%s\n\nBuild date: %s", m_text.c_str(), __DATE__); diff --git a/src/olympic/studio/applib/src/popups/fileinfo.cpp b/src/olympic/studio/applib/src/popups/fileinfo.cpp index dbfc9400..b13fc236 100644 --- a/src/olympic/studio/applib/src/popups/fileinfo.cpp +++ b/src/olympic/studio/applib/src/popups/fileinfo.cpp @@ -37,7 +37,7 @@ ox::Error FileInfo::open(ox::StringParam filePath) noexcept { return {}; } -void FileInfo::draw(Context &sctx) noexcept { +void FileInfo::draw(Context&) noexcept { if (ImGui::IsKeyPressed(ImGuiKey_Escape)) { close(); return; @@ -52,7 +52,7 @@ void FileInfo::draw(Context &sctx) noexcept { case Stage::Open: { constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - ig::centerNextWindow(sctx.tctx); + ig::centerNextWindow(); auto open = true; if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) { drawTable(); diff --git a/src/olympic/studio/applib/src/popups/makecopy.cpp b/src/olympic/studio/applib/src/popups/makecopy.cpp index 3c82b248..266d84ef 100644 --- a/src/olympic/studio/applib/src/popups/makecopy.cpp +++ b/src/olympic/studio/applib/src/popups/makecopy.cpp @@ -39,7 +39,7 @@ void MakeCopyPopup::draw(Context &ctx) noexcept { [[fallthrough]]; case Stage::Open: { auto const scale = ig::dpiScale(); - ig::centerNextWindow(ctx.tctx); + ig::centerNextWindow(); ImGui::SetNextWindowSize({250 * scale, 0}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | diff --git a/src/olympic/studio/modlib/include/studio/imguiutil.hpp b/src/olympic/studio/modlib/include/studio/imguiutil.hpp index 23cd7a6c..d1fbc0e5 100644 --- a/src/olympic/studio/modlib/include/studio/imguiutil.hpp +++ b/src/olympic/studio/modlib/include/studio/imguiutil.hpp @@ -157,7 +157,7 @@ class IndentStackItem { ~IndentStackItem() noexcept; }; -void centerNextWindow(turbine::Context &ctx) noexcept; +void centerNextWindow() noexcept; inline void Dummy(ImVec2 const &sz) noexcept { auto const scale = dpiScale(); @@ -252,7 +252,7 @@ PopupResponse PopupControlsOk( ox::CStringViewCR ok); [[nodiscard]] -bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 sz = {285, 0}); +bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz = {285, 0}); /** * diff --git a/src/olympic/studio/modlib/src/filepickerpopup.cpp b/src/olympic/studio/modlib/src/filepickerpopup.cpp index b11ffd56..df868a5b 100644 --- a/src/olympic/studio/modlib/src/filepickerpopup.cpp +++ b/src/olympic/studio/modlib/src/filepickerpopup.cpp @@ -86,7 +86,7 @@ ox::Optional FilePickerPopup::draw(Context &ctx) noexcept { return out; } auto const scale = turbine::scale(ctx.tctx); - if (ig::BeginPopup(ctx.tctx, m_name, m_open, {380, 340})) { + if (ig::BeginPopup(m_name, m_open, {380, 340})) { auto const vp = ImGui::GetContentRegionAvail(); m_explorer.draw(ctx, {vp.x, vp.y - 30 * scale}); if (ig::PopupControlsOkCancel(m_open) == ig::PopupResponse::OK || m_explorer.opened) { diff --git a/src/olympic/studio/modlib/src/imguiutil.cpp b/src/olympic/studio/modlib/src/imguiutil.cpp index 72525ad5..3c16a05c 100644 --- a/src/olympic/studio/modlib/src/imguiutil.cpp +++ b/src/olympic/studio/modlib/src/imguiutil.cpp @@ -60,7 +60,7 @@ IndentStackItem::~IndentStackItem() noexcept { } -void centerNextWindow(turbine::Context&) noexcept { +void centerNextWindow() noexcept { auto const &io = ImGui::GetIO(); auto const sz = io.DisplaySize; ImGui::SetNextWindowPos( @@ -124,10 +124,10 @@ PopupResponse PopupControlsOk( return out; } -bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, ImVec2 sz) { +bool BeginPopup(ox::CStringViewCR popupName, bool &show, ImVec2 sz) { scaleSz(sz); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - centerNextWindow(ctx); + centerNextWindow(); ImGui::OpenPopup(popupName.c_str()); ImGui::SetNextWindowSize(sz); return ImGui::BeginPopupModal(popupName.c_str(), &show, modalFlags); @@ -255,7 +255,7 @@ void FilePicker::draw() noexcept { } auto constexpr popupSz = ImVec2{450.f, 0}; IDStackItem const idStackItem(m_title); - if (BeginPopup(m_sctx.tctx, m_title, m_show, popupSz)) { + if (BeginPopup(m_title, m_show, popupSz)) { auto const &list = m_sctx.project->fileList(m_fileExt); size_t selIdx{}; ComboBox(m_title, list, selIdx); @@ -310,7 +310,7 @@ void QuestionPopup::draw(Context &ctx) noexcept { turbine::requireRefreshFor(ctx.tctx, 1000); [[fallthrough]]; case Stage::Open: - centerNextWindow(ctx.tctx); + centerNextWindow(); ImGui::SetNextWindowSize({}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) { @@ -345,7 +345,7 @@ void MessagePopup::show(ox::StringParam msg) noexcept { open(); } -void MessagePopup::draw(Context &ctx) noexcept { +void MessagePopup::draw(Context&) noexcept { switch (m_stage) { case Stage::Closed: break; @@ -355,7 +355,7 @@ void MessagePopup::draw(Context &ctx) noexcept { m_open = true; [[fallthrough]]; case Stage::Open: - centerNextWindow(ctx.tctx); + centerNextWindow(); ImGui::SetNextWindowSize({}); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) { diff --git a/src/olympic/studio/modlib/src/popup.cpp b/src/olympic/studio/modlib/src/popup.cpp index efa99b67..0221c424 100644 --- a/src/olympic/studio/modlib/src/popup.cpp +++ b/src/olympic/studio/modlib/src/popup.cpp @@ -7,8 +7,8 @@ namespace studio { -void Popup::drawWindow(turbine::Context &ctx, bool &open, std::function const &drawContents) { - ig::centerNextWindow(ctx); +void Popup::drawWindow(turbine::Context&, bool &open, std::function const &drawContents) { + ig::centerNextWindow(); ImGui::SetNextWindowSize(static_cast(m_size * ig::dpiScale())); constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; if (ImGui::BeginPopupModal(m_title.c_str(), &open, modalFlags)) {