[studio] Put StudioAppLib in studio namespace

This commit is contained in:
Gary Talent 2023-06-03 19:35:40 -05:00
parent 6137a2b892
commit ff242e3488
16 changed files with 61 additions and 14 deletions

View File

@ -7,6 +7,8 @@
#include <studio/imguiuitl.hpp> #include <studio/imguiuitl.hpp>
#include "aboutpopup.hpp" #include "aboutpopup.hpp"
namespace studio {
AboutPopup::AboutPopup(turbine::Context &ctx) noexcept { AboutPopup::AboutPopup(turbine::Context &ctx) noexcept {
m_text = ox::sfmt("{} - dev build", ctx.appName); m_text = ox::sfmt("{} - dev build", ctx.appName);
} }
@ -55,3 +57,5 @@ void AboutPopup::draw(turbine::Context *ctx) noexcept {
} }
} }
} }
}

View File

@ -11,6 +11,8 @@
#include <studio/popup.hpp> #include <studio/popup.hpp>
namespace studio {
class AboutPopup: public studio::Popup { class AboutPopup: public studio::Popup {
public: public:
enum class Stage { enum class Stage {
@ -35,4 +37,6 @@ class AboutPopup: public studio::Popup {
void draw(turbine::Context *ctx) noexcept override; void draw(turbine::Context *ctx) noexcept override;
}; };
}

View File

@ -6,6 +6,8 @@
#include "clawviewer.hpp" #include "clawviewer.hpp"
namespace studio {
ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept: ClawEditor::ClawEditor(ox::CRStringView path, ox::ModelObject obj) noexcept:
m_itemName(path), m_itemName(path),
m_itemDisplayName(pathToItemName(path)), m_itemDisplayName(pathToItemName(path)),
@ -179,4 +181,6 @@ void ClawEditor::drawTree(ObjPath *path, const ox::ModelObject &obj) noexcept {
} }
path->pop_back(); path->pop_back();
} }
} }
}

View File

@ -9,6 +9,8 @@
#include <studio/editor.hpp> #include <studio/editor.hpp>
namespace studio {
class ClawEditor: public studio::Editor { class ClawEditor: public studio::Editor {
private: private:
using ObjPath = ox::Vector<ox::StringView, 8>; using ObjPath = ox::Vector<ox::StringView, 8>;
@ -35,3 +37,4 @@ class ClawEditor: public studio::Editor {
void drawTree(ObjPath *path, const ox::ModelObject &obj) noexcept; void drawTree(ObjPath *path, const ox::ModelObject &obj) noexcept;
}; };
}

View File

@ -6,6 +6,8 @@
#include "filedialogmanager.hpp" #include "filedialogmanager.hpp"
namespace studio {
studio::TaskState FileDialogManager::update(turbine::Context *ctx) noexcept { studio::TaskState FileDialogManager::update(turbine::Context *ctx) noexcept {
switch (m_state) { switch (m_state) {
case UpdateProjectPathState::EnableSystemCursor: { case UpdateProjectPathState::EnableSystemCursor: {
@ -32,3 +34,4 @@ studio::TaskState FileDialogManager::update(turbine::Context *ctx) noexcept {
return studio::TaskState::Running; return studio::TaskState::Running;
} }
}

View File

@ -12,6 +12,8 @@
#include <studio/filedialog.hpp> #include <studio/filedialog.hpp>
#include <studio/task.hpp> #include <studio/task.hpp>
namespace studio {
class FileDialogManager : public studio::Task { class FileDialogManager : public studio::Task {
private: private:
enum class UpdateProjectPathState { enum class UpdateProjectPathState {
@ -36,4 +38,6 @@ class FileDialogManager : public studio::Task {
// signals // signals
ox::Signal<ox::Error(const ox::String &)> pathChosen; ox::Signal<ox::Error(const ox::String &)> pathChosen;
}; };
}

View File

@ -13,6 +13,8 @@
#include <studio/context.hpp> #include <studio/context.hpp>
#include "studioapp.hpp" #include "studioapp.hpp"
namespace studio {
class StudioUIDrawer: public turbine::gl::Drawer { class StudioUIDrawer: public turbine::gl::Drawer {
private: private:
StudioUI *m_ui = nullptr; StudioUI *m_ui = nullptr;
@ -58,8 +60,6 @@ static ox::Error runApp(
return err; return err;
} }
namespace studio {
int main( int main(
const char *appName, const char *appName,
ox::String projectDataDir, ox::String projectDataDir,
@ -87,3 +87,4 @@ int main(
} }
} }

View File

@ -9,6 +9,8 @@
#include "newmenu.hpp" #include "newmenu.hpp"
namespace studio {
NewMenu::NewMenu() noexcept { NewMenu::NewMenu() noexcept {
setTitle("New Item"); setTitle("New Item");
setSize({225, 110}); setSize({225, 110});
@ -115,3 +117,5 @@ void NewMenu::finish(turbine::Context *ctx) noexcept {
finished.emit(""); finished.emit("");
m_stage = Stage::Closed; m_stage = Stage::Closed;
} }
}

View File

@ -11,6 +11,8 @@
#include <studio/itemmaker.hpp> #include <studio/itemmaker.hpp>
#include <studio/popup.hpp> #include <studio/popup.hpp>
namespace studio {
class NewMenu: public studio::Popup { class NewMenu: public studio::Popup {
public: public:
enum class Stage { enum class Stage {
@ -73,3 +75,5 @@ template<typename T>
void NewMenu::addItemType(ox::String displayName, ox::String parentDir, ox::String fileExt, ox::ClawFormat pFmt) noexcept { void NewMenu::addItemType(ox::String displayName, ox::String parentDir, ox::String fileExt, ox::ClawFormat pFmt) noexcept {
m_types.emplace_back(ox::make<studio::ItemMakerT<T>>(std::move(displayName), std::move(parentDir), std::move(fileExt), pFmt)); m_types.emplace_back(ox::make<studio::ItemMakerT<T>>(std::move(displayName), std::move(parentDir), std::move(fileExt), pFmt));
} }
}

View File

@ -8,6 +8,8 @@
#include "projectexplorer.hpp" #include "projectexplorer.hpp"
namespace studio {
static ox::Result<ox::UniquePtr<ProjectTreeModel>> static ox::Result<ox::UniquePtr<ProjectTreeModel>>
buildProjectTreeModel(ProjectExplorer *explorer, ox::CRStringView name, ox::CRStringView path, ProjectTreeModel *parent) noexcept { buildProjectTreeModel(ProjectExplorer *explorer, ox::CRStringView name, ox::CRStringView path, ProjectTreeModel *parent) noexcept {
const auto fs = explorer->romFs(); const auto fs = explorer->romFs();
@ -59,3 +61,5 @@ ox::Error ProjectExplorer::refreshProjectTreeModel(ox::CRStringView) noexcept {
setModel(std::move(model)); setModel(std::move(model));
return OxError(0); return OxError(0);
} }
}

View File

@ -10,6 +10,8 @@
#include <studio/widget.hpp> #include <studio/widget.hpp>
#include "projecttreemodel.hpp" #include "projecttreemodel.hpp"
namespace studio {
class ProjectExplorer: public studio::Widget { class ProjectExplorer: public studio::Widget {
private: private:
ox::UniquePtr<ProjectTreeModel> m_treeModel; ox::UniquePtr<ProjectTreeModel> m_treeModel;
@ -31,4 +33,6 @@ class ProjectExplorer: public studio::Widget {
// slots // slots
public: public:
ox::Signal<ox::Error(const ox::StringView&)> fileChosen; ox::Signal<ox::Error(const ox::StringView&)> fileChosen;
}; };
}

View File

@ -7,6 +7,8 @@
#include "projectexplorer.hpp" #include "projectexplorer.hpp"
#include "projecttreemodel.hpp" #include "projecttreemodel.hpp"
namespace studio {
ProjectTreeModel::ProjectTreeModel(ProjectExplorer *explorer, ox::String name, ProjectTreeModel::ProjectTreeModel(ProjectExplorer *explorer, ox::String name,
ProjectTreeModel *parent) noexcept: ProjectTreeModel *parent) noexcept:
m_explorer(explorer), m_explorer(explorer),
@ -51,4 +53,6 @@ ox::BasicString<255> ProjectTreeModel::fullPath() const noexcept {
return m_parent->fullPath() + "/" + ox::StringView(m_name); return m_parent->fullPath() + "/" + ox::StringView(m_name);
} }
return ""; return "";
} }
}

View File

@ -9,6 +9,8 @@
#include <turbine/context.hpp> #include <turbine/context.hpp>
namespace studio {
class ProjectTreeModel { class ProjectTreeModel {
private: private:
class ProjectExplorer *m_explorer = nullptr; class ProjectExplorer *m_explorer = nullptr;
@ -28,4 +30,6 @@ class ProjectTreeModel {
private: private:
[[nodiscard]] [[nodiscard]]
ox::BasicString<255> fullPath() const noexcept; ox::BasicString<255> fullPath() const noexcept;
}; };
}

View File

@ -13,6 +13,8 @@
#include "filedialogmanager.hpp" #include "filedialogmanager.hpp"
#include "studioapp.hpp" #include "studioapp.hpp"
namespace studio {
ox::Vector<const studio::Module*> modules; ox::Vector<const studio::Module*> modules;
struct StudioConfig { struct StudioConfig {
@ -371,8 +373,6 @@ ox::Error StudioUI::closeFile(const ox::String &path) noexcept {
return OxError(0); return OxError(0);
} }
namespace studio {
void registerModule(const studio::Module *mod) noexcept { void registerModule(const studio::Module *mod) noexcept {
modules.emplace_back(mod); modules.emplace_back(mod);
} }

View File

@ -17,6 +17,8 @@
#include "projectexplorer.hpp" #include "projectexplorer.hpp"
#include "projecttreemodel.hpp" #include "projecttreemodel.hpp"
namespace studio {
class StudioUI: public ox::SignalHandler { class StudioUI: public ox::SignalHandler {
friend class StudioUIDrawer; friend class StudioUIDrawer;
@ -86,8 +88,6 @@ class StudioUI: public ox::SignalHandler {
ox::Error closeFile(const ox::String &path) noexcept; ox::Error closeFile(const ox::String &path) noexcept;
}; };
namespace studio {
int main( int main(
const char *appName, const char *appName,
ox::String projectDataDir, ox::String projectDataDir,

View File

@ -9,10 +9,10 @@
#include "undostack.hpp" #include "undostack.hpp"
#include "widget.hpp" #include "widget.hpp"
class StudioUI;
namespace studio { namespace studio {
class StudioUI;
class BaseEditor: public Widget { class BaseEditor: public Widget {
friend StudioUI; friend StudioUI;