diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 21b90991c..3866c5a96 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -433,6 +433,8 @@ namespace MWGui void InventoryWindow::onPinToggled() { + Settings::Manager::setBool("inventory pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 8002dc48a..12d1237b0 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -629,7 +629,7 @@ namespace MWGui , mGlobalMap(0) , mGlobalMapImage(NULL) , mGlobalMapOverlay(NULL) - , mGlobal(false) + , mGlobal(Settings::Manager::getBool("global", "Map")) , mEventBoxGlobal(NULL) , mEventBoxLocal(NULL) , mGlobalMapRender(new MWRender::GlobalMap(localMapRender->getRoot(), workQueue)) @@ -667,7 +667,7 @@ namespace MWGui getWidget(mButton, "WorldButton"); mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked); - mButton->setCaptionWithReplacing("#{sWorld}"); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); getWidget(mEventBoxGlobal, "EventBoxGlobal"); mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); @@ -680,6 +680,9 @@ namespace MWGui mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); LocalMapBase::init(mLocalMap, mPlayerArrowLocal, Settings::Manager::getInt("local map widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); + + mGlobalMap->setVisible(mGlobal); + mLocalMap->setVisible(!mGlobal); } void MapWindow::onNoteEditOk() @@ -912,6 +915,8 @@ namespace MWGui mGlobalMap->setVisible(mGlobal); mLocalMap->setVisible(!mGlobal); + Settings::Manager::setBool("global", "Map", mGlobal); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); @@ -921,6 +926,8 @@ namespace MWGui void MapWindow::onPinToggled() { + Settings::Manager::setBool("map pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 7c12a8fc2..0c3485e6a 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -4,6 +4,8 @@ #include +#include + #include "../mwbase/windowmanager.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -48,6 +50,8 @@ namespace MWGui void SpellWindow::onPinToggled() { + Settings::Manager::setBool("spells pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index d68c1bcc5..780e4905e 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -672,6 +674,8 @@ namespace MWGui void StatsWindow::onPinToggled() { + Settings::Manager::setBool("stats pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 16d1a9c6d..38aa142c4 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -400,6 +400,11 @@ namespace MWGui allow(GW_ALL); mRestAllowed = !newgame; + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); } WindowManager::~WindowManager() @@ -550,15 +555,23 @@ namespace MWGui setSpellVisibility((mAllowed & GW_Magic) && (!mSpellWindow->pinned() || (mForceHidden & GW_Magic))); setHMSVisibility((mAllowed & GW_Stats) && (!mStatsWindow->pinned() || (mForceHidden & GW_Stats))); - // If in game mode, show only the pinned windows - if (gameMode) + // If in game mode (or interactive messagebox), show only the pinned windows + if (mGuiModes.empty()) { mInventoryWindow->setGuiMode(GM_None); - mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map)); - mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats)); - mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory)); - mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic)); + mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map)); + mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats)); + mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory)); + mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic)); + + return; + } + + // No need to check GUI if game mode + if (gameMode) + { + mInventoryWindow->setGuiMode(GM_None); return; } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 55f550d5a..6756d0e7a 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -107,6 +107,9 @@ local map widget size = 512 # may result in longer loading times. local map cell distance = 1 +# If true, map in world mode, otherwise in local mode +global = false + [GUI] # Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger). @@ -365,18 +368,24 @@ stats x = 0.0 stats y = 0.0 stats w = 0.375 stats h = 0.4275 +# Stats window pin status +stats pin = false # Spells window displaying powers, spells, and magical items. spells x = 0.625 spells y = 0.5725 spells w = 0.375 spells h = 0.4275 +# Spells window pin status +spells pin = false # Local and world map window. map x = 0.625 map y = 0.0 map w = 0.375 map h = 0.5725 +# Map window pin status +map pin = false # Dialog window for talking with NPCs. dialogue x = 0.095 @@ -401,6 +410,8 @@ inventory x = 0.0 inventory y = 0.4275 inventory w = 0.6225 inventory h = 0.5725 +# Inventory window pin status +inventory pin = false # Player inventory window when searching a container. inventory container x = 0.0