From 5fc46b166ac69c2c575df3490b01afe35fc896ed Mon Sep 17 00:00:00 2001 From: Cody Glassman Date: Wed, 18 Oct 2023 09:04:57 -0700 Subject: [PATCH] track debug window size and dimensions between sessions --- apps/openmw/mwgui/settings.cpp | 19 +++++++++++++++++++ apps/openmw/mwgui/settings.hpp | 1 + apps/openmw/mwgui/windowmanagerimp.cpp | 1 + components/settings/categories/windows.hpp | 9 +++++++++ files/settings-default.cfg | 11 +++++++++++ 5 files changed, 41 insertions(+) diff --git a/apps/openmw/mwgui/settings.cpp b/apps/openmw/mwgui/settings.cpp index fb1068ca41..5005876d55 100644 --- a/apps/openmw/mwgui/settings.cpp +++ b/apps/openmw/mwgui/settings.cpp @@ -99,6 +99,25 @@ namespace MWGui }; } + WindowSettingValues makeDebugWindowSettingValues() + { + return WindowSettingValues{ + .mRegular = WindowRectSettingValues { + .mX = Settings::windows().mDebugX, + .mY = Settings::windows().mDebugY, + .mW = Settings::windows().mDebugW, + .mH = Settings::windows().mDebugH, + }, + .mMaximized = WindowRectSettingValues { + .mX = Settings::windows().mDebugMaximizedX, + .mY = Settings::windows().mDebugMaximizedY, + .mW = Settings::windows().mDebugMaximizedW, + .mH = Settings::windows().mDebugMaximizedH, + }, + .mIsMaximized = Settings::windows().mDebugMaximized, + }; + } + WindowSettingValues makeDialogueWindowSettingValues() { return WindowSettingValues{ diff --git a/apps/openmw/mwgui/settings.hpp b/apps/openmw/mwgui/settings.hpp index 8d1cda37dd..b51ac29ce5 100644 --- a/apps/openmw/mwgui/settings.hpp +++ b/apps/openmw/mwgui/settings.hpp @@ -25,6 +25,7 @@ namespace MWGui WindowSettingValues makeCompanionWindowSettingValues(); WindowSettingValues makeConsoleWindowSettingValues(); WindowSettingValues makeContainerWindowSettingValues(); + WindowSettingValues makeDebugWindowSettingValues(); WindowSettingValues makeDialogueWindowSettingValues(); WindowSettingValues makeInventoryWindowSettingValues(); WindowSettingValues makeInventoryBarterWindowSettingValues(); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 9bcfb3e158..94bac9e10e 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -498,6 +498,7 @@ namespace MWGui auto debugWindow = std::make_unique(); mDebugWindow = debugWindow.get(); mWindows.push_back(std::move(debugWindow)); + trackWindow(mDebugWindow, makeDebugWindowSettingValues()); auto postProcessorHud = std::make_unique(); mPostProcessorHud = postProcessorHud.get(); diff --git a/components/settings/categories/windows.hpp b/components/settings/categories/windows.hpp index 77927c1204..1fc249cc97 100644 --- a/components/settings/categories/windows.hpp +++ b/components/settings/categories/windows.hpp @@ -161,6 +161,15 @@ namespace Settings SettingValue mPostprocessorMaximizedW{ mIndex, "Windows", "postprocessor maximized w" }; SettingValue mPostprocessorMaximizedH{ mIndex, "Windows", "postprocessor maximized h" }; SettingValue mPostprocessorMaximized{ mIndex, "Windows", "postprocessor maximized" }; + SettingValue mDebugX{ mIndex, "Windows", "debug x" }; + SettingValue mDebugY{ mIndex, "Windows", "debug y" }; + SettingValue mDebugW{ mIndex, "Windows", "debug w" }; + SettingValue mDebugH{ mIndex, "Windows", "debug h" }; + SettingValue mDebugMaximizedX{ mIndex, "Windows", "debug maximized x" }; + SettingValue mDebugMaximizedY{ mIndex, "Windows", "debug maximized y" }; + SettingValue mDebugMaximizedW{ mIndex, "Windows", "debug maximized w" }; + SettingValue mDebugMaximizedH{ mIndex, "Windows", "debug maximized h" }; + SettingValue mDebugMaximized{ mIndex, "Windows", "debug maximized" }; }; } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 5c473bea81..d8a101a7a5 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -847,6 +847,17 @@ postprocessor maximized w = 0.97 postprocessor maximized h = 0.875 postprocessor maximized = false +# Debug window for viewing logs and profiling +debug x = 0.70 +debug y = 0.00 +debug w = 0.30 +debug h = 1.00 +debug maximized x = 0.015 +debug maximized y = 0.02 +debug maximized w = 0.97 +debug maximized h = 0.875 +debug maximized = false + [Navigator] # Enable navigator (true, false). When enabled background threads are started to build navmesh for world geometry.