[nostalgia] Add PaletteEditor

This commit is contained in:
2022-04-02 16:38:38 -05:00
parent 99987ee423
commit 71e0f181ea
14 changed files with 251 additions and 334 deletions
+7 -8
View File
@@ -182,7 +182,7 @@ void StudioUI::drawTabBar() noexcept {
void StudioUI::drawTabs() noexcept {
for (auto it = m_editors.begin(); it != m_editors.end();) {
auto const &e = *it;
bool open = true;
auto open = true;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
m_acitveEditor = e.get();
e->draw(m_ctx);
@@ -289,14 +289,13 @@ ox::Error StudioUI::openFile(const ox::String &path) noexcept {
if (!m_editorMakers.contains(ext)) {
return OxError(1, "There is no editor for this file extension");
}
try {
auto editor = m_editorMakers[ext](path);
editor->closed.connect(this, &StudioUI::closeFile);
m_editors.emplace_back(editor);
} catch (const ox::Exception &ex) {
oxErrorf("Could not open Editor: {} ({}:{})", ex.msg, ex.file, ex.line);
return ex.toError();
auto [editor, err] = m_editorMakers[ext](path);
if (err) {
oxErrorf("Could not open Editor: {} ({}:{})", err.msg, err.file, err.line);
return err;
}
editor->closed.connect(this, &StudioUI::closeFile);
m_editors.emplace_back(editor);
m_openFiles.emplace_back(path);
// save to config
studio::editConfig<StudioConfig>(m_ctx, [&](StudioConfig *config) {