MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / UpdateWindowState

Method UpdateWindowState

external/zep/src/editor.cpp:431–473  ·  view source on GitHub ↗

Here we ensure that the editor is in a valid state, and cleanup Default buffers

Source from the content-addressed store, hash-verified

429
430 // Here we ensure that the editor is in a valid state, and cleanup Default buffers
431 void ZepEditor::UpdateWindowState() {
432 // If there is no active tab window, and we have one, set it.
433 if (!m_pActiveTabWindow) {
434 if (!m_tabWindows.empty()) {
435 SetCurrentTabWindow(m_tabWindows.back());
436 }
437 }
438
439 // If the tab window doesn't contain an active window, and there is one, set it
440 if (m_pActiveTabWindow && !m_pActiveTabWindow->GetActiveWindow()) {
441 if (!m_pActiveTabWindow->GetWindows().empty()) {
442 m_pActiveTabWindow->SetActiveWindow(m_pActiveTabWindow->GetWindows().back());
443 m_bRegionsChanged = true;
444 }
445 }
446
447 // Clean up any default buffers
448 std::vector<ZepBuffer*> victims;
449 for (auto& buffer : m_buffers) {
450 if (!buffer->HasFileFlags(FileFlags::DefaultBuffer) || buffer->HasFileFlags(FileFlags::Dirty)) {
451 continue;
452 }
453
454 auto windows = FindBufferWindows(buffer.get());
455 if (windows.empty()) {
456 victims.push_back(buffer.get());
457 }
458 }
459
460 for (auto& victim : victims) {
461 RemoveBuffer(victim);
462 }
463
464 // If the display says we need a layout update, force it on all the windows
465 if (GetDisplay().LayoutDirty()) {
466 for (auto& tabWindow : GetTabWindows()) {
467 for (auto& window : tabWindow->GetWindows()) {
468 window->DirtyLayout();
469 }
470 }
471 GetDisplay().SetLayoutDirty(false);
472 }
473 }
474
475 void ZepEditor::ResetCursorTimer() {
476 timer_restart(m_cursorTimer);

Callers

nothing calls this directly

Calls 10

backMethod · 0.80
SetActiveWindowMethod · 0.80
HasFileFlagsMethod · 0.80
LayoutDirtyMethod · 0.80
DirtyLayoutMethod · 0.80
SetLayoutDirtyMethod · 0.80
emptyMethod · 0.45
GetActiveWindowMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected