2121
2222namespace nexo ::editor {
2323
24- void ADocumentWindow::beginRender (const std::string & windowName)
24+ void ADocumentWindow::beginRender (const std::string& windowName)
2525 {
2626 dockingUpdate (windowName);
2727 visibilityUpdate ();
2828 sizeUpdate ();
2929 }
3030
31- void ADocumentWindow::dockingUpdate (const std::string & windowName)
31+ void ADocumentWindow::dockingUpdate (const std::string& windowName)
3232 {
33- if (const ImGuiWindow* currentWindow = ImGui::GetCurrentWindow (); currentWindow)
34- {
35- const bool isDocked = currentWindow->DockIsActive ;
33+ if (const ImGuiWindow* currentWindow = ImGui::GetCurrentWindow (); currentWindow) {
34+ const bool isDocked = currentWindow->DockIsActive ;
3635 const ImGuiID currentDockID = currentWindow->DockId ;
37- const auto dockId = m_windowRegistry.getDockId (windowName);
36+ const auto dockId = m_windowRegistry.getDockId (windowName);
3837
39- // If it's the first time opening the window and we have a dock id saved in the registry, then we force set it
38+ // If it's the first time opening the window and we have a dock id saved in the registry, then we force set
39+ // it
4040 if (m_firstOpened && (dockId && currentDockID != *dockId))
4141 ImGui::DockBuilderDockWindow (windowName.c_str (), *dockId);
4242 // If the docks ids differ, it means the window got rearranged in the global layout
43- // If we are docked but we dont have a dock id saved in the registry, it means the user moved the window
43+ // If we are docked, but we don't have a dock id saved in the registry, it means the user moved the window
4444 // In both cases, we update our docking registry with the new dock id
4545 else if ((dockId && currentDockID != *dockId) || (isDocked && !dockId))
4646 m_windowRegistry.setDockId (windowName, currentDockID);
4747
48-
4948 // If it is not docked anymore, we have a floating window without docking node,
5049 // So we erase it from the docking registry
51- if (!m_firstOpened && !isDocked)
52- m_windowRegistry.resetDockId (windowName);
50+ if (!m_firstOpened && !isDocked) m_windowRegistry.resetDockId (windowName);
5351 m_firstOpened = false ;
5452 }
5553 }
5654
5755 void ADocumentWindow::visibilityUpdate ()
5856 {
59- m_focused = ImGui::IsWindowFocused ();
60- const bool isDocked = ImGui::IsWindowDocked ();
57+ m_focused = ImGui::IsWindowFocused ();
58+ const bool isDocked = ImGui::IsWindowDocked ();
6159 const ImGuiWindow* window = ImGui::GetCurrentWindow ();
6260
6361 if (isDocked) {
6462 // If the window is currently being rendered with normal content,
6563 // and not hidden or set to skip items, then it is visible
6664 m_isVisibleInDock = !window->Hidden && !window->SkipItems && window->Active ;
67- }
68- else {
65+ } else {
6966 // Not docked windows are visible if we've reached this point
7067 m_isVisibleInDock = true ;
7168 }
@@ -75,10 +72,10 @@ namespace nexo::editor {
7572 void ADocumentWindow::sizeUpdate ()
7673 {
7774 const ImGuiWindow* window = ImGui::GetCurrentWindow ();
78- m_windowPos = window->Pos ;
79- m_windowSize = window->Size ;
80- m_contentSizeMin = ImGui::GetWindowContentRegionMin ();
81- m_contentSizeMax = ImGui::GetWindowContentRegionMax ();
82- m_contentSize = ImGui::GetContentRegionAvail ();
75+ m_windowPos = window->Pos ;
76+ m_windowSize = window->Size ;
77+ m_contentSizeMin = ImGui::GetWindowContentRegionMin ();
78+ m_contentSizeMax = ImGui::GetWindowContentRegionMax ();
79+ m_contentSize = ImGui::GetContentRegionAvail ();
8380 }
84- }
81+ } // namespace nexo::editor
0 commit comments