Compare commits

..

No commits in common. "0abadc185047923e23c5af19dcac233487354a4b" and "4461f99fa4b23ea15de98cd4539e63886255acd4" have entirely different histories.

3 changed files with 8 additions and 25 deletions

View File

@ -231,10 +231,7 @@ void StudioUI::drawTabs() noexcept {
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
m_activeEditor->onActivated();
}
if (m_closeActiveTab) [[unlikely]] {
ImGui::SetTabItemClosed(e->itemDisplayName().c_str());
} else if (open) [[likely]] {
if (open) [[likely]] {
e->draw(m_sctx);
}
m_activeEditorOnLastDraw = e.get();
@ -261,20 +258,6 @@ void StudioUI::drawTabs() noexcept {
++it;
}
}
if (m_closeActiveTab) [[unlikely]] {
if (m_activeEditor) {
auto const idx = find_if(
m_editors.begin(), m_editors.end(),
[this](ox::UPtr<BaseEditor> const &e) {
return m_activeEditor == e.get();
});
if (idx != m_editors.end()) {
oxLogError(m_editors.erase(idx.offset()).error);
}
m_activeEditor = nullptr;
}
m_closeActiveTab = false;
}
}
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
@ -424,12 +407,13 @@ ox::Error StudioUI::handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR ne
}
ox::Error StudioUI::handleDeleteFile(ox::StringViewCR path) noexcept {
for (auto &e : m_editors) {
for (size_t i{}; auto &e : m_editors) {
if (path == e->itemPath()) {
oxLogError(m_editors.erase(i).error);
oxLogError(closeFile(path));
m_closeActiveTab = true;
break;
}
++i;
}
return m_projectExplorer.refreshProjectTreeModel();
}
@ -521,12 +505,13 @@ ox::Error StudioUI::handleCloseFileResponse(ig::PopupResponse const response) no
}
ox::Error StudioUI::closeCurrentFile() noexcept {
for (auto &e : m_editors) {
for (size_t i{}; auto &e : m_editors) {
if (m_activeEditor == e.get()) {
oxLogError(closeFile(e->itemPath()));
m_closeActiveTab = true;
oxLogError(m_editors.erase(i).error);
break;
}
++i;
}
return {};
}

View File

@ -41,7 +41,6 @@ class StudioUI: public ox::SignalHandler {
BaseEditor *m_activeEditorOnLastDraw = nullptr;
BaseEditor *m_activeEditor = nullptr;
BaseEditor *m_activeEditorUpdatePending = nullptr;
bool m_closeActiveTab{};
ox::Vector<ox::Pair<ox::String>> m_queuedMoves;
ox::Vector<ox::Pair<ox::String>> m_queuedDirMoves;
NewMenu m_newMenu{keelCtx(m_tctx)};

View File

@ -260,15 +260,14 @@ void QuestionPopup::draw(StudioContext &ctx, ImVec2 const &sz) noexcept {
if (ImGui::BeginPopupModal(m_title.c_str(), &m_open, modalFlags)) {
ImGui::Text("%s", m_question.c_str());
auto const r = PopupControlsOkCancel(m_open, "Yes", "No");
response.emit(r);
switch (r) {
case PopupResponse::None:
break;
case PopupResponse::OK:
response.emit(r);
close();
break;
case PopupResponse::Cancel:
response.emit(r);
close();
break;
}