[studio] Rename StudioContext to Context
All checks were successful
Build / build (push) Successful in 1m16s

This commit is contained in:
2025-05-06 22:36:49 -05:00
parent 7da2f68d30
commit e773d6f0ee
42 changed files with 89 additions and 89 deletions

View File

@ -29,7 +29,7 @@ bool AboutPopup::isOpen() const noexcept {
return m_stage == Stage::Open;
}
void AboutPopup::draw(StudioContext &sctx) noexcept {
void AboutPopup::draw(Context &sctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;

View File

@ -35,7 +35,7 @@ class AboutPopup: public studio::Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(studio::StudioContext &sctx) noexcept override;
void draw(studio::Context &sctx) noexcept override;
};

View File

@ -28,7 +28,7 @@ class StudioUIDrawer: public turbine::gl::Drawer {
};
static void keyEventHandler(turbine::Context &ctx, turbine::Key key, bool down) noexcept {
auto sctx = turbine::applicationData<studio::StudioContext>(ctx);
auto sctx = turbine::applicationData<studio::Context>(ctx);
sctx->ui.handleKeyEvent(key, down);
}

View File

@ -8,12 +8,12 @@
namespace studio {
ClawEditor::ClawEditor(StudioContext &sctx, ox::StringParam path):
ClawEditor::ClawEditor(Context &sctx, ox::StringParam path):
Editor(sctx, std::move(path)),
m_obj(sctx.project->loadObj<ox::ModelObject>(itemPath()).unwrapThrow()) {
}
void ClawEditor::draw(StudioContext&) noexcept {
void ClawEditor::draw(Context&) noexcept {
ImGui::BeginChild("PaletteEditor");
static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody;
if (ImGui::BeginTable("ObjTree", 3, flags)) {

View File

@ -16,9 +16,9 @@ class ClawEditor: public Editor {
using ObjPath = ox::Vector<ox::StringView, 8>;
ox::ModelObject m_obj;
public:
ClawEditor(StudioContext &sctx, ox::StringParam path);
ClawEditor(Context &sctx, ox::StringParam path);
void draw(StudioContext&) noexcept final;
void draw(Context&) noexcept final;
private:
static void drawRow(ox::ModelValue const&value) noexcept;

View File

@ -31,7 +31,7 @@ bool DeleteConfirmation::isOpen() const noexcept {
return m_open;
}
void DeleteConfirmation::draw(StudioContext &ctx) noexcept {
void DeleteConfirmation::draw(Context &ctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;

View File

@ -36,7 +36,7 @@ class DeleteConfirmation final: public Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(StudioContext &ctx) noexcept override;
void draw(Context &ctx) noexcept override;
};

View File

@ -28,7 +28,7 @@ bool MakeCopyPopup::isOpen() const noexcept {
return m_open;
}
void MakeCopyPopup::draw(StudioContext &ctx) noexcept {
void MakeCopyPopup::draw(Context &ctx) noexcept {
switch (m_stage) {
case Stage::Closed:
break;
@ -70,7 +70,7 @@ void MakeCopyPopup::draw(StudioContext &ctx) noexcept {
}
}
void MakeCopyPopup::accept(StudioContext const &ctx) noexcept {
void MakeCopyPopup::accept(Context const &ctx) noexcept {
auto const p = sfmt("{}{}", m_dirPath, m_fileName);
if (!ctx.project->exists(p)) {
makeCopy.emit(m_srcPath, p);

View File

@ -37,10 +37,10 @@ class MakeCopyPopup: public Widget {
[[nodiscard]]
bool isOpen() const noexcept;
void draw(StudioContext &ctx) noexcept override;
void draw(Context &ctx) noexcept override;
private:
void accept(StudioContext const &ctx) noexcept;
void accept(Context const &ctx) noexcept;
};
}

View File

@ -32,7 +32,7 @@ bool NewDir::isOpen() const noexcept {
return m_open;
}
void NewDir::draw(StudioContext &ctx) noexcept {
void NewDir::draw(Context &ctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;

View File

@ -37,7 +37,7 @@ class NewDir final: public Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(StudioContext &ctx) noexcept override;
void draw(Context &ctx) noexcept override;
[[nodiscard]]
constexpr ox::CStringView value() const noexcept {

View File

@ -44,7 +44,7 @@ bool NewMenu::isOpen() const noexcept {
return m_open;
}
void NewMenu::draw(StudioContext &sctx) noexcept {
void NewMenu::draw(Context &sctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;
@ -88,7 +88,7 @@ void NewMenu::installItemTemplate(ox::UPtr<ItemTemplate> &tmplt) noexcept {
}
}
void NewMenu::drawNewItemType(StudioContext const&sctx) noexcept {
void NewMenu::drawNewItemType(Context const&sctx) noexcept {
setSize({280, 180});
drawWindow(sctx.tctx, m_open, [this] {
ig::ListBox("Item Type", [&](size_t const i) -> ox::CStringView {
@ -105,7 +105,7 @@ void NewMenu::drawNewItemType(StudioContext const&sctx) noexcept {
});
}
void NewMenu::drawNewItemTemplate(StudioContext const&sctx) noexcept {
void NewMenu::drawNewItemTemplate(Context const&sctx) noexcept {
setSize({280, 180});
drawWindow(sctx.tctx, m_open, [this] {
auto const&templates =
@ -117,7 +117,7 @@ void NewMenu::drawNewItemTemplate(StudioContext const&sctx) noexcept {
});
}
void NewMenu::drawNewItemPath(StudioContext &sctx) noexcept {
void NewMenu::drawNewItemPath(Context &sctx) noexcept {
setSize({380, 340});
drawWindow(sctx.tctx, m_open, [this, &sctx] {
if (m_stage == Stage::NewItemTransitioningToPath) [[unlikely]] {
@ -170,7 +170,7 @@ void NewMenu::drawFirstPageButtons(Stage const next) noexcept {
}
}
void NewMenu::drawLastPageButtons(StudioContext &sctx) noexcept {
void NewMenu::drawLastPageButtons(Context &sctx) noexcept {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20);
constexpr ImVec2 btnSz{60, 20};
@ -191,7 +191,7 @@ void NewMenu::drawLastPageButtons(StudioContext &sctx) noexcept {
}
}
void NewMenu::finish(StudioContext &sctx) noexcept {
void NewMenu::finish(Context &sctx) noexcept {
if (m_itemName.len() == 0) {
oxLogError(ox::Error{1, "New file error: no file name"});
return;

View File

@ -53,7 +53,7 @@ class NewMenu final: public Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(StudioContext &sctx) noexcept override;
void draw(Context &sctx) noexcept override;
template<typename T>
void addItemType(
@ -75,19 +75,19 @@ class NewMenu final: public Popup {
void installItemTemplate(ox::UPtr<ItemTemplate> &tmplt) noexcept;
private:
void drawNewItemType(StudioContext const&sctx) noexcept;
void drawNewItemType(Context const&sctx) noexcept;
void drawNewItemPath(StudioContext &sctx) noexcept;
void drawNewItemPath(Context &sctx) noexcept;
void drawNewItemTemplate(StudioContext const &sctx) noexcept;
void drawNewItemTemplate(Context const &sctx) noexcept;
void drawButtons(Stage next) noexcept;
void drawFirstPageButtons(Stage next) noexcept;
void drawLastPageButtons(StudioContext &sctx) noexcept;
void drawLastPageButtons(Context &sctx) noexcept;
void finish(StudioContext &sctx) noexcept;
void finish(Context &sctx) noexcept;
};

View File

@ -33,7 +33,7 @@ bool NewProject::isOpen() const noexcept {
return m_open;
}
void NewProject::draw(StudioContext &ctx) noexcept {
void NewProject::draw(Context &ctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;
@ -53,7 +53,7 @@ void NewProject::draw(StudioContext &ctx) noexcept {
}
}
void NewProject::drawNewProjectName(StudioContext &sctx) noexcept {
void NewProject::drawNewProjectName(Context &sctx) noexcept {
drawWindow(sctx.tctx, m_open, [this, &sctx] {
ig::InputText("Name", m_projectName);
ImGui::Text("Path: %s", m_projectPath.c_str());
@ -64,7 +64,7 @@ void NewProject::drawNewProjectName(StudioContext &sctx) noexcept {
});
}
void NewProject::drawLastPageButtons(StudioContext&) noexcept {
void NewProject::drawLastPageButtons(Context&) noexcept {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 110);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22);
if (ig::PushButton("Finish")) {

View File

@ -42,12 +42,12 @@ class NewProject: public studio::Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(studio::StudioContext &ctx) noexcept override;
void draw(studio::Context &ctx) noexcept override;
private:
void drawNewProjectName(studio::StudioContext &ctx) noexcept;
void drawNewProjectName(studio::Context &ctx) noexcept;
void drawLastPageButtons(studio::StudioContext &ctx) noexcept;
void drawLastPageButtons(studio::Context &ctx) noexcept;
void finish() noexcept;

View File

@ -34,7 +34,7 @@ bool RenameFile::isOpen() const noexcept {
return m_open;
}
void RenameFile::draw(StudioContext &ctx) noexcept {
void RenameFile::draw(Context &ctx) noexcept {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
close();
return;

View File

@ -38,7 +38,7 @@ class RenameFile: public Popup {
[[nodiscard]]
bool isOpen() const noexcept override;
void draw(StudioContext &ctx) noexcept override;
void draw(Context &ctx) noexcept override;
};

View File

@ -26,11 +26,11 @@
namespace studio {
static bool shutdownHandler(turbine::Context &ctx) {
auto sctx = turbine::applicationData<StudioContext>(ctx);
auto sctx = turbine::applicationData<Context>(ctx);
return sctx->ui.handleShutdown();
}
void navigateTo(StudioContext &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
void navigateTo(Context &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
ctx.ui.navigateTo(std::move(filePath), std::move(navArgs));
}

View File

@ -29,7 +29,7 @@ class StudioUI: public ox::SignalHandler {
friend class StudioUIDrawer;
private:
StudioContext m_sctx;
Context m_sctx;
turbine::Context &m_tctx;
ox::String m_projectDataDir;
ox::UPtr<Project> m_project;