[nostalgia] Add PaletteEditor
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user