[olympic] Cleanup
This commit is contained in:
parent
56f59b29fe
commit
00c2a39dba
@ -171,8 +171,7 @@ constexpr AssetRef<T>::AssetRef(AssetRef const&h) noexcept: m_ctr(h.m_ctr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr AssetRef<T>::AssetRef(AssetRef &&h) noexcept {
|
constexpr AssetRef<T>::AssetRef(AssetRef &&h) noexcept: m_ctr(h.m_ctr) {
|
||||||
m_ctr = h.m_ctr;
|
|
||||||
if (m_ctr) {
|
if (m_ctr) {
|
||||||
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
|
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ oxModelEnd()
|
|||||||
StudioUI::StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept:
|
StudioUI::StudioUI(turbine::Context &ctx, ox::StringView projectDataDir) noexcept:
|
||||||
m_ctx(ctx),
|
m_ctx(ctx),
|
||||||
m_projectDataDir(projectDataDir),
|
m_projectDataDir(projectDataDir),
|
||||||
m_projectExplorer(ox::make_unique<ProjectExplorer>(m_ctx)),
|
m_projectExplorer(m_ctx),
|
||||||
m_aboutPopup(m_ctx) {
|
m_aboutPopup(m_ctx) {
|
||||||
m_projectExplorer->fileChosen.connect(this, &StudioUI::openFile);
|
m_projectExplorer.fileChosen.connect(this, &StudioUI::openFile);
|
||||||
ImGui::GetIO().IniFilename = nullptr;
|
ImGui::GetIO().IniFilename = nullptr;
|
||||||
loadModules();
|
loadModules();
|
||||||
// open project and files
|
// open project and files
|
||||||
@ -148,7 +148,7 @@ void StudioUI::draw() noexcept {
|
|||||||
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
|
ImGui::Begin("MainWindow##Studio", nullptr, windowFlags);
|
||||||
{
|
{
|
||||||
if (m_showProjectExplorer) {
|
if (m_showProjectExplorer) {
|
||||||
m_projectExplorer->draw(m_ctx);
|
m_projectExplorer.draw(m_ctx);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
drawTabBar();
|
drawTabBar();
|
||||||
@ -285,7 +285,7 @@ void StudioUI::loadModule(studio::Module const*mod) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::loadModules() noexcept {
|
void StudioUI::loadModules() noexcept {
|
||||||
for (auto &mod : modules) {
|
for (auto const mod : modules) {
|
||||||
loadModule(mod);
|
loadModule(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,15 +324,15 @@ ox::Error StudioUI::openProject(ox::CRStringView path) noexcept {
|
|||||||
m_project = ox::make_unique<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir);
|
m_project = ox::make_unique<studio::Project>(keelCtx(m_ctx), ox::String(path), m_projectDataDir);
|
||||||
auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||||
sctx->project = m_project.get();
|
sctx->project = m_project.get();
|
||||||
m_project->fileAdded.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
|
m_project->fileAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
|
||||||
m_project->fileDeleted.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
|
m_project->fileDeleted.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
|
||||||
m_openFiles.clear();
|
m_openFiles.clear();
|
||||||
m_editors.clear();
|
m_editors.clear();
|
||||||
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
|
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
|
||||||
config->projectPath = ox::String(path);
|
config->projectPath = ox::String(path);
|
||||||
config->openFiles.clear();
|
config->openFiles.clear();
|
||||||
});
|
});
|
||||||
return m_projectExplorer->refreshProjectTreeModel();
|
return m_projectExplorer.refreshProjectTreeModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::openFile(ox::CRStringView path) noexcept {
|
ox::Error StudioUI::openFile(ox::CRStringView path) noexcept {
|
||||||
|
@ -30,7 +30,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
ox::Vector<ox::UPtr<studio::BaseEditor>> m_editors;
|
ox::Vector<ox::UPtr<studio::BaseEditor>> m_editors;
|
||||||
ox::Vector<ox::UPtr<studio::Widget>> m_widgets;
|
ox::Vector<ox::UPtr<studio::Widget>> m_widgets;
|
||||||
ox::HashMap<ox::String, studio::EditorMaker::Func> m_editorMakers;
|
ox::HashMap<ox::String, studio::EditorMaker::Func> m_editorMakers;
|
||||||
ox::UPtr<ProjectExplorer> m_projectExplorer;
|
ProjectExplorer m_projectExplorer;
|
||||||
ox::Vector<ox::String> m_openFiles;
|
ox::Vector<ox::String> m_openFiles;
|
||||||
studio::BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
studio::BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
||||||
studio::BaseEditor *m_activeEditor = nullptr;
|
studio::BaseEditor *m_activeEditor = nullptr;
|
||||||
@ -67,7 +67,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
|
|
||||||
void loadEditorMaker(studio::EditorMaker const&editorMaker) noexcept;
|
void loadEditorMaker(studio::EditorMaker const&editorMaker) noexcept;
|
||||||
|
|
||||||
void loadModule(const studio::Module *mod) noexcept;
|
void loadModule(studio::Module const*mod) noexcept;
|
||||||
|
|
||||||
void loadModules() noexcept;
|
void loadModules() noexcept;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user