From 27f1df8f3326cbe7dae886423a3bf1a8563f40b9 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 23 Mar 2024 16:07:49 -0500 Subject: [PATCH] [nostalgia,olympic] Further reduce use of applicationData --- .../paletteeditor/paletteeditor-imgui.cpp | 2 +- .../paletteeditor/paletteeditor-imgui.hpp | 2 +- .../tilesheeteditor/tilesheeteditor-imgui.cpp | 12 ++++----- .../tilesheeteditor/tilesheeteditor-imgui.hpp | 6 ++--- .../scene/src/studio/sceneeditor-imgui.cpp | 2 +- .../scene/src/studio/sceneeditor-imgui.hpp | 2 +- src/olympic/studio/applib/src/aboutpopup.cpp | 4 +-- src/olympic/studio/applib/src/aboutpopup.hpp | 2 +- src/olympic/studio/applib/src/clawviewer.cpp | 2 +- src/olympic/studio/applib/src/clawviewer.hpp | 2 +- src/olympic/studio/applib/src/newmenu.cpp | 27 +++++++++---------- src/olympic/studio/applib/src/newmenu.hpp | 10 +++---- src/olympic/studio/applib/src/newproject.cpp | 10 +++---- src/olympic/studio/applib/src/newproject.hpp | 6 ++--- .../studio/applib/src/projectexplorer.cpp | 4 +-- .../studio/applib/src/projectexplorer.hpp | 2 +- src/olympic/studio/applib/src/studioapp.cpp | 8 +++--- .../modlib/include/studio/itemmaker.hpp | 13 ++++----- .../studio/modlib/include/studio/popup.hpp | 2 +- .../studio/modlib/include/studio/widget.hpp | 4 ++- 20 files changed, 62 insertions(+), 60 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index 832d3545..37377a9a 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -42,7 +42,7 @@ void PaletteEditorImGui::keyStateChanged(turbine::Key key, bool down) { } -void PaletteEditorImGui::draw(turbine::Context&) noexcept { +void PaletteEditorImGui::draw(studio::StudioContext&) noexcept { auto const paneSize = ImGui::GetContentRegionAvail(); { ImGui::BeginChild("Pages", ImVec2(250, paneSize.y), true); diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp index 8f022467..d8d5982f 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -25,7 +25,7 @@ class PaletteEditorImGui: public studio::Editor { void keyStateChanged(turbine::Key key, bool down) override; - void draw(turbine::Context&) noexcept final; + void draw(studio::StudioContext&) noexcept final; protected: ox::Error saveItem() noexcept final; diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index faabe8a0..3d3a0687 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -157,7 +157,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) { } } -void TileSheetEditorImGui::draw(turbine::Context&) noexcept { +void TileSheetEditorImGui::draw(studio::StudioContext&) noexcept { auto const paneSize = ImGui::GetContentRegionAvail(); auto const tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y); auto const fbSize = ox::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16); @@ -237,7 +237,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept { } ImGui::EndChild(); m_subsheetEditor.draw(m_tctx); - m_exportMenu.draw(m_tctx); + m_exportMenu.draw(m_sctx); } void TileSheetEditorImGui::drawSubsheetSelector( @@ -481,7 +481,7 @@ ox::Error TileSheetEditorImGui::markUnsavedChanges(studio::UndoCommand const*) n return {}; } -void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &ctx) noexcept { +void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &sctx) noexcept { constexpr auto popupName = "Edit Subsheet"; if (!m_show) { return; @@ -490,7 +490,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &ctx) noexcept auto constexpr popupWidth = 235.f; auto const popupHeight = modSize ? 130.f : 85.f; auto const popupSz = ImVec2(popupWidth, popupHeight); - if (ig::BeginPopup(ctx, popupName, m_show, popupSz)) { + if (ig::BeginPopup(sctx, popupName, m_show, popupSz)) { ImGui::InputText("Name", m_name.data(), m_name.cap()); if (modSize) { ImGui::InputInt("Columns", &m_cols); @@ -507,7 +507,7 @@ void TileSheetEditorImGui::SubSheetEditor::close() noexcept { m_show = false; } -void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &ctx) noexcept { +void TileSheetEditorImGui::ExportMenu::draw(studio::StudioContext &sctx) noexcept { constexpr auto popupName = "Export Tile Sheet"; if (!m_show) { return; @@ -515,7 +515,7 @@ void TileSheetEditorImGui::ExportMenu::draw(turbine::Context &ctx) noexcept { constexpr auto popupWidth = 235.f; constexpr auto popupHeight = 85.f; constexpr auto popupSz = ImVec2(popupWidth, popupHeight); - if (ig::BeginPopup(ctx, popupName, m_show, popupSz)) { + if (ig::BeginPopup(sctx.tctx, popupName, m_show, popupSz)) { ImGui::InputInt("Scale", &m_scale); m_scale = ox::clamp(m_scale, 1, 50); if (ig::PopupControlsOkCancel(popupWidth, m_show) == ig::PopupResponse::OK) { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index 529bba9a..6a545873 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -40,7 +40,7 @@ class TileSheetEditorImGui: public studio::Editor { m_cols = cols; m_rows = rows; } - void draw(turbine::Context &ctx) noexcept; + void draw(turbine::Context &sctx) noexcept; void close() noexcept; [[nodiscard]] inline bool isOpen() const noexcept { return m_show; } @@ -55,7 +55,7 @@ class TileSheetEditorImGui: public studio::Editor { m_show = true; m_scale = 5; } - void draw(turbine::Context &ctx) noexcept; + void draw(studio::StudioContext &sctx) noexcept; void close() noexcept; [[nodiscard]] inline bool isOpen() const noexcept { return m_show; } @@ -88,7 +88,7 @@ class TileSheetEditorImGui: public studio::Editor { void keyStateChanged(turbine::Key key, bool down) override; - void draw(turbine::Context&) noexcept override; + void draw(studio::StudioContext&) noexcept override; void drawSubsheetSelector(TileSheet::SubSheet&, TileSheet::SubSheetIdx &path); diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp index 83dd413d..beef45fb 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.cpp @@ -18,7 +18,7 @@ SceneEditorImGui::SceneEditorImGui(studio::StudioContext &ctx, ox::StringView pa setRequiresConstantRefresh(false); } -void SceneEditorImGui::draw(turbine::Context&) noexcept { +void SceneEditorImGui::draw(studio::StudioContext&) noexcept { auto const paneSize = ImGui::GetContentRegionAvail(); m_view.draw(ox::Size{static_cast(paneSize.x), static_cast(paneSize.y)}); auto &fb = m_view.framebuffer(); diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp index 0508f424..24bc0b65 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditor-imgui.hpp @@ -23,7 +23,7 @@ class SceneEditorImGui: public studio::Editor { public: SceneEditorImGui(studio::StudioContext &ctx, ox::StringView path); - void draw(turbine::Context&) noexcept final; + void draw(studio::StudioContext&) noexcept final; void onActivated() noexcept override; diff --git a/src/olympic/studio/applib/src/aboutpopup.cpp b/src/olympic/studio/applib/src/aboutpopup.cpp index ebd93ddc..6bbd2c7e 100644 --- a/src/olympic/studio/applib/src/aboutpopup.cpp +++ b/src/olympic/studio/applib/src/aboutpopup.cpp @@ -29,7 +29,7 @@ bool AboutPopup::isOpen() const noexcept { return m_stage == Stage::Open; } -void AboutPopup::draw(turbine::Context &ctx) noexcept { +void AboutPopup::draw(studio::StudioContext &sctx) noexcept { switch (m_stage) { case Stage::Closed: break; @@ -41,7 +41,7 @@ void AboutPopup::draw(turbine::Context &ctx) noexcept { constexpr auto modalFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; ImGui::SetNextWindowSize(ImVec2(215, 90)); - studio::ig::centerNextWindow(ctx); + studio::ig::centerNextWindow(sctx.tctx); auto open = true; if (ImGui::BeginPopupModal("About", &open, modalFlags)) { ImGui::Text("%s", m_text.c_str()); diff --git a/src/olympic/studio/applib/src/aboutpopup.hpp b/src/olympic/studio/applib/src/aboutpopup.hpp index 155bef66..39e8c407 100644 --- a/src/olympic/studio/applib/src/aboutpopup.hpp +++ b/src/olympic/studio/applib/src/aboutpopup.hpp @@ -35,7 +35,7 @@ class AboutPopup: public studio::Popup { [[nodiscard]] bool isOpen() const noexcept override; - void draw(turbine::Context &ctx) noexcept override; + void draw(studio::StudioContext &sctx) noexcept override; }; diff --git a/src/olympic/studio/applib/src/clawviewer.cpp b/src/olympic/studio/applib/src/clawviewer.cpp index 58df6d6e..861a04b0 100644 --- a/src/olympic/studio/applib/src/clawviewer.cpp +++ b/src/olympic/studio/applib/src/clawviewer.cpp @@ -13,7 +13,7 @@ ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept: m_obj(std::move(obj)) { } -void ClawEditor::draw(turbine::Context&) noexcept { +void ClawEditor::draw(studio::StudioContext&) noexcept { ImGui::BeginChild("PaletteEditor"); static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody; if (ImGui::BeginTable("ObjTree", 3, flags)) { diff --git a/src/olympic/studio/applib/src/clawviewer.hpp b/src/olympic/studio/applib/src/clawviewer.hpp index ed6697e9..5441ac30 100644 --- a/src/olympic/studio/applib/src/clawviewer.hpp +++ b/src/olympic/studio/applib/src/clawviewer.hpp @@ -18,7 +18,7 @@ class ClawEditor: public studio::Editor { public: ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept; - void draw(turbine::Context&) noexcept final; + void draw(studio::StudioContext&) noexcept final; private: static void drawRow(ox::ModelValue const&value) noexcept; diff --git a/src/olympic/studio/applib/src/newmenu.cpp b/src/olympic/studio/applib/src/newmenu.cpp index e5786cac..7fea9923 100644 --- a/src/olympic/studio/applib/src/newmenu.cpp +++ b/src/olympic/studio/applib/src/newmenu.cpp @@ -33,7 +33,7 @@ bool NewMenu::isOpen() const noexcept { return m_open; } -void NewMenu::draw(turbine::Context &ctx) noexcept { +void NewMenu::draw(studio::StudioContext &sctx) noexcept { switch (m_stage) { case Stage::Opening: ImGui::OpenPopup(title().c_str()); @@ -41,10 +41,10 @@ void NewMenu::draw(turbine::Context &ctx) noexcept { m_open = true; [[fallthrough]]; case Stage::NewItemType: - drawNewItemType(ctx); + drawNewItemType(sctx); break; case Stage::NewItemName: - drawNewItemName(ctx); + drawNewItemName(sctx); break; case Stage::Closed: m_open = false; @@ -61,8 +61,8 @@ void NewMenu::addItemMaker(ox::UniquePtr &&im) noexcept { }); } -void NewMenu::drawNewItemType(turbine::Context &ctx) noexcept { - drawWindow(ctx, &m_open, [this] { +void NewMenu::drawNewItemType(studio::StudioContext &sctx) noexcept { + drawWindow(sctx.tctx, &m_open, [this] { auto items = ox_malloca(m_types.size() * sizeof(char const*), char const*, nullptr); for (auto i = 0u; auto const&im : m_types) { items.get()[i] = im->typeName.c_str(); @@ -73,13 +73,13 @@ void NewMenu::drawNewItemType(turbine::Context &ctx) noexcept { }); } -void NewMenu::drawNewItemName(turbine::Context &ctx) noexcept { - drawWindow(ctx, &m_open, [this, &ctx] { +void NewMenu::drawNewItemName(studio::StudioContext &sctx) noexcept { + drawWindow(sctx.tctx, &m_open, [this, &sctx] { auto const typeIdx = static_cast(m_selectedType); if (typeIdx < m_types.size()) { ImGui::InputText("Name", m_itemName.data(), m_itemName.cap()); } - drawLastPageButtons(ctx); + drawLastPageButtons(sctx); }); } @@ -97,7 +97,7 @@ void NewMenu::drawFirstPageButtons() noexcept { } } -void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept { +void NewMenu::drawLastPageButtons(studio::StudioContext &sctx) noexcept { ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 138); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); if (ImGui::Button("Back")) { @@ -105,7 +105,7 @@ void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept { } ImGui::SameLine(); if (ImGui::Button("Finish")) { - finish(ctx); + finish(sctx); } ImGui::SameLine(); if (ImGui::Button("Quit")) { @@ -114,17 +114,16 @@ void NewMenu::drawLastPageButtons(turbine::Context &ctx) noexcept { } } -void NewMenu::finish(turbine::Context &ctx) noexcept { +void NewMenu::finish(studio::StudioContext &sctx) noexcept { if (m_itemName.len() == 0) { return; } - auto const sctx = turbine::applicationData(ctx); auto const&typeMaker = *m_types[static_cast(m_selectedType)]; - if (sctx->project->exists(typeMaker.itemPath(m_itemName))) { + if (sctx.project->exists(typeMaker.itemPath(m_itemName))) { oxLogError(OxError(1, "New file error: File already exists")); return; } - auto const [path, err] = typeMaker.write(ctx, m_itemName); + auto const [path, err] = typeMaker.write(sctx, m_itemName); if (err) { oxLogError(err); return; diff --git a/src/olympic/studio/applib/src/newmenu.hpp b/src/olympic/studio/applib/src/newmenu.hpp index cf2ef516..2852ddc9 100644 --- a/src/olympic/studio/applib/src/newmenu.hpp +++ b/src/olympic/studio/applib/src/newmenu.hpp @@ -43,7 +43,7 @@ class NewMenu: public studio::Popup { [[nodiscard]] bool isOpen() const noexcept override; - void draw(turbine::Context &ctx) noexcept override; + void draw(studio::StudioContext &sctx) noexcept override; template void addItemType(ox::String name, ox::String parentDir, ox::String fileExt, T itemTempl, ox::ClawFormat pFmt = ox::ClawFormat::Metal) noexcept; @@ -54,15 +54,15 @@ class NewMenu: public studio::Popup { void addItemMaker(ox::UniquePtr &&im) noexcept; private: - void drawNewItemType(turbine::Context &ctx) noexcept; + void drawNewItemType(studio::StudioContext &sctx) noexcept; - void drawNewItemName(turbine::Context &ctx) noexcept; + void drawNewItemName(studio::StudioContext &sctx) noexcept; void drawFirstPageButtons() noexcept; - void drawLastPageButtons(turbine::Context &ctx) noexcept; + void drawLastPageButtons(studio::StudioContext &sctx) noexcept; - void finish(turbine::Context &ctx) noexcept; + void finish(studio::StudioContext &sctx) noexcept; }; diff --git a/src/olympic/studio/applib/src/newproject.cpp b/src/olympic/studio/applib/src/newproject.cpp index 647dd25c..284810ad 100644 --- a/src/olympic/studio/applib/src/newproject.cpp +++ b/src/olympic/studio/applib/src/newproject.cpp @@ -32,7 +32,7 @@ bool NewProject::isOpen() const noexcept { return m_open; } -void NewProject::draw(turbine::Context &ctx) noexcept { +void NewProject::draw(studio::StudioContext &ctx) noexcept { switch (m_stage) { case Stage::Opening: ImGui::OpenPopup(title().c_str()); @@ -48,14 +48,14 @@ void NewProject::draw(turbine::Context &ctx) noexcept { } } -void NewProject::drawNewProjectName(turbine::Context &ctx) noexcept { - drawWindow(ctx, &m_open, [this, &ctx] { +void NewProject::drawNewProjectName(studio::StudioContext &sctx) noexcept { + drawWindow(sctx.tctx, &m_open, [this, &sctx] { ImGui::InputText("Name", m_projectName.data(), m_projectName.cap()); ImGui::Text("Path: %s", m_projectPath.c_str()); if (ImGui::Button("Browse")) { oxLogError(studio::chooseDirectory().moveTo(m_projectPath)); } - drawLastPageButtons(ctx); + drawLastPageButtons(sctx); }); } @@ -73,7 +73,7 @@ void NewProject::drawFirstPageButtons() noexcept { } } -void NewProject::drawLastPageButtons(turbine::Context&) noexcept { +void NewProject::drawLastPageButtons(studio::StudioContext&) noexcept { ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 95); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); if (ImGui::Button("Finish")) { diff --git a/src/olympic/studio/applib/src/newproject.hpp b/src/olympic/studio/applib/src/newproject.hpp index bd08776f..6aad38e0 100644 --- a/src/olympic/studio/applib/src/newproject.hpp +++ b/src/olympic/studio/applib/src/newproject.hpp @@ -42,14 +42,14 @@ class NewProject: public studio::Popup { [[nodiscard]] bool isOpen() const noexcept override; - void draw(turbine::Context &ctx) noexcept override; + void draw(studio::StudioContext &ctx) noexcept override; private: - void drawNewProjectName(turbine::Context &ctx) noexcept; + void drawNewProjectName(studio::StudioContext &ctx) noexcept; void drawFirstPageButtons() noexcept; - void drawLastPageButtons(turbine::Context &ctx) noexcept; + void drawLastPageButtons(studio::StudioContext &ctx) noexcept; void finish() noexcept; diff --git a/src/olympic/studio/applib/src/projectexplorer.cpp b/src/olympic/studio/applib/src/projectexplorer.cpp index 3cc779e5..8961c4c0 100644 --- a/src/olympic/studio/applib/src/projectexplorer.cpp +++ b/src/olympic/studio/applib/src/projectexplorer.cpp @@ -37,12 +37,12 @@ static ox::Result> buildProjectTreeModel( ProjectExplorer::ProjectExplorer(turbine::Context &ctx) noexcept: m_ctx(ctx) { } -void ProjectExplorer::draw(turbine::Context &ctx) noexcept { +void ProjectExplorer::draw(studio::StudioContext &ctx) noexcept { auto const viewport = ImGui::GetContentRegionAvail(); ImGui::BeginChild("ProjectExplorer", ImVec2(300, viewport.y), true); ImGui::SetNextItemOpen(true); if (m_treeModel) { - m_treeModel->draw(ctx); + m_treeModel->draw(ctx.tctx); } ImGui::EndChild(); } diff --git a/src/olympic/studio/applib/src/projectexplorer.hpp b/src/olympic/studio/applib/src/projectexplorer.hpp index 50051f69..b7c15a45 100644 --- a/src/olympic/studio/applib/src/projectexplorer.hpp +++ b/src/olympic/studio/applib/src/projectexplorer.hpp @@ -19,7 +19,7 @@ class ProjectExplorer: public studio::Widget { public: explicit ProjectExplorer(turbine::Context &ctx) noexcept; - void draw(turbine::Context &ctx) noexcept override; + void draw(studio::StudioContext &ctx) noexcept override; void setModel(ox::UPtr &&model) noexcept; diff --git a/src/olympic/studio/applib/src/studioapp.cpp b/src/olympic/studio/applib/src/studioapp.cpp index 790e9944..d4b86789 100644 --- a/src/olympic/studio/applib/src/studioapp.cpp +++ b/src/olympic/studio/applib/src/studioapp.cpp @@ -159,15 +159,15 @@ void StudioUI::draw() noexcept { ImGui::Begin("MainWindow##Studio", nullptr, windowFlags); { if (m_showProjectExplorer) { - m_projectExplorer.draw(m_ctx); + m_projectExplorer.draw(m_sctx); ImGui::SameLine(); } drawTabBar(); for (auto &w: m_widgets) { - w->draw(m_ctx); + w->draw(m_sctx); } for (auto p: m_popups) { - p->draw(m_ctx); + p->draw(m_sctx); } } ImGui::End(); @@ -261,7 +261,7 @@ void StudioUI::drawTabs() noexcept { m_activeEditor->onActivated(); turbine::setConstantRefresh(m_ctx, m_activeEditor->requiresConstantRefresh()); } - e->draw(m_ctx); + e->draw(m_sctx); m_activeEditorOnLastDraw = e.get(); ImGui::EndTabItem(); } diff --git a/src/olympic/studio/modlib/include/studio/itemmaker.hpp b/src/olympic/studio/modlib/include/studio/itemmaker.hpp index 2102f3d0..1f7bf10d 100644 --- a/src/olympic/studio/modlib/include/studio/itemmaker.hpp +++ b/src/olympic/studio/modlib/include/studio/itemmaker.hpp @@ -18,7 +18,8 @@ class ItemMaker { ox::String const typeName; ox::String const parentDir; ox::String const fileExt; - constexpr explicit ItemMaker(ox::StringView pName, ox::StringView pParentDir, ox::CRStringView pFileExt) noexcept: + constexpr explicit ItemMaker( + ox::StringView pName, ox::StringView pParentDir, ox::CRStringView pFileExt) noexcept: typeName(pName), parentDir(pParentDir), fileExt(pFileExt) { @@ -36,7 +37,8 @@ class ItemMaker { * @param pName * @return path of file or error in Result */ - virtual ox::Result write(turbine::Context &ctx, ox::CRStringView pName) const noexcept = 0; + virtual ox::Result write( + studio::StudioContext &ctx, ox::CRStringView pName) const noexcept = 0; }; template @@ -73,11 +75,10 @@ class ItemMakerT: public ItemMaker { m_item(std::move(pItem)), m_fmt(pFmt) { } - ox::Result write(turbine::Context &ctx, ox::CRStringView pName) const noexcept override { + ox::Result write(studio::StudioContext &sctx, ox::CRStringView pName) const noexcept override { auto const path = itemPath(pName); - auto const sctx = turbine::applicationData(ctx); - keel::createUuidMapping(keelCtx(ctx), path, ox::UUID::generate().unwrap()); - oxReturnError(sctx->project->writeObj(path, m_item, m_fmt)); + keel::createUuidMapping(keelCtx(sctx.tctx), path, ox::UUID::generate().unwrap()); + oxReturnError(sctx.project->writeObj(path, m_item, m_fmt)); return path; } }; diff --git a/src/olympic/studio/modlib/include/studio/popup.hpp b/src/olympic/studio/modlib/include/studio/popup.hpp index d9a7aff9..1fb0891c 100644 --- a/src/olympic/studio/modlib/include/studio/popup.hpp +++ b/src/olympic/studio/modlib/include/studio/popup.hpp @@ -32,7 +32,7 @@ class Popup { [[nodiscard]] virtual bool isOpen() const noexcept = 0; - virtual void draw(turbine::Context &ctx) noexcept = 0; + virtual void draw(studio::StudioContext &ctx) noexcept = 0; protected: constexpr void setSize(ox::Size sz) noexcept { diff --git a/src/olympic/studio/modlib/include/studio/widget.hpp b/src/olympic/studio/modlib/include/studio/widget.hpp index 54365bd1..0b08ddfd 100644 --- a/src/olympic/studio/modlib/include/studio/widget.hpp +++ b/src/olympic/studio/modlib/include/studio/widget.hpp @@ -8,12 +8,14 @@ #include +#include "context.hpp" + namespace studio { class Widget: public ox::SignalHandler { public: ~Widget() noexcept override = default; - virtual void draw(turbine::Context&) noexcept = 0; + virtual void draw(studio::StudioContext&) noexcept = 0; }; }