[nostalgia/studio] Fix closing last tab
This commit is contained in:
parent
a94051644b
commit
6e8bb8adc6
@ -140,7 +140,8 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
ImGui::Begin("TabWindow##MainWindow", nullptr, windowFlags);
|
ImGui::Begin("TabWindow##MainWindow", nullptr, windowFlags);
|
||||||
constexpr auto tabBarFlags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_TabListPopupButton;
|
constexpr auto tabBarFlags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_TabListPopupButton;
|
||||||
if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow", tabBarFlags)) {
|
if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow", tabBarFlags)) {
|
||||||
for (auto &e : m_editors) {
|
for (auto it = m_editors.begin(); it != m_editors.end(); ) {
|
||||||
|
auto const &e = *it;
|
||||||
bool open = true;
|
bool open = true;
|
||||||
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
|
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
|
||||||
e->draw(m_ctx);
|
e->draw(m_ctx);
|
||||||
@ -149,10 +150,14 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
if (!open) {
|
if (!open) {
|
||||||
e->close();
|
e->close();
|
||||||
try {
|
try {
|
||||||
oxThrowError(m_editors.erase(e));
|
oxThrowError(m_editors.erase(it).moveTo(&it));
|
||||||
} catch (const std::exception &e) {
|
} catch (const ox::Exception &ex) {
|
||||||
oxErrf("Editor tab deletion failed: {}", e.what());
|
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
|
||||||
|
} catch (const std::exception &ex) {
|
||||||
|
oxErrf("Editor tab deletion failed: {}\n", ex.what());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
@ -173,10 +178,10 @@ void StudioUI::loadModule(studio::Module *module) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::loadModules() noexcept {
|
void StudioUI::loadModules() noexcept {
|
||||||
//for (auto &moduleMaker : BuiltinModules) {
|
for (auto &moduleMaker : BuiltinModules) {
|
||||||
// const auto module = moduleMaker();
|
const auto module = moduleMaker();
|
||||||
// loadModule(module.get());
|
loadModule(module.get());
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::openProject(const ox::String &path) noexcept {
|
ox::Error StudioUI::openProject(const ox::String &path) noexcept {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user