diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index b5a1b50d0..d52a307c2 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -444,6 +444,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 5c7e73862..4d4efeecb 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() @@ -777,7 +780,7 @@ namespace MWGui void MapWindow::setVisible(bool visible) { WindowBase::setVisible(visible); - mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->isGuiMode()); + mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_None); } void MapWindow::renderGlobalMap() @@ -918,6 +921,8 @@ namespace MWGui mGlobalMap->setVisible(mGlobal); mLocalMap->setVisible(!mGlobal); + Settings::Manager::setBool("global", "Map", mGlobal); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); @@ -927,6 +932,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 cb5450988..e77281898 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -369,6 +369,8 @@ namespace MWGui mPlayerSkillValues.insert(std::make_pair(ESM::Skill::sSkillIds[i], MWMechanics::SkillValue())); } + updatePinnedWindows(); + // Set up visibility updateVisible(); @@ -546,14 +548,14 @@ 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; } @@ -1853,6 +1855,17 @@ namespace MWGui mVideoWidget->stop(); } + void WindowManager::updatePinnedWindows() + { + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); + + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + } + void WindowManager::pinWindow(GuiWindow window) { switch (window) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index b1948c1f7..787c88598 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -539,6 +539,8 @@ namespace MWGui void createTextures(); void createCursors(); void setMenuTransparency(float value); + + void updatePinnedWindows(); }; } diff --git a/docs/source/reference/modding/settings/map.rst b/docs/source/reference/modding/settings/map.rst index d65f4bd8f..8bf563da9 100644 --- a/docs/source/reference/modding/settings/map.rst +++ b/docs/source/reference/modding/settings/map.rst @@ -1,6 +1,17 @@ Map Settings ############ +global +------ + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, a world map on a map window will be displayed, otherwise a local map will be displayed. + +The default value is false. This setting can be toggled with the local/world map switch button on the map window. + global map cell size -------------------- diff --git a/docs/source/reference/modding/settings/windows.rst b/docs/source/reference/modding/settings/windows.rst index 8860de983..bafcac295 100644 --- a/docs/source/reference/modding/settings/windows.rst +++ b/docs/source/reference/modding/settings/windows.rst @@ -18,6 +18,21 @@ Each window in the GUI mode remembers it's previous location when exiting the ga .. note:: To scale the windows, making the widgets proportionally larger, see the scaling factor setting instead. +:Type: boolean +:Range: True/False + +This section controls the state of pinnable windows: pinned or not. For example, to pin only the map window, the actual settings will be:: + + inventory pin = false + map pin = true + stats pin = false + spells pin = false + +The pinnable window can be pinned/unpinned by clicking on a button in the right upper corner of the window. + +.. note:: + A world/local map switch button on the map window will be showed only in GUI mode. + stats ----- @@ -25,6 +40,7 @@ stats y = 0.0 h = 0.375 w = 0.4275 + pin = false The stats window, displaying level, race, class, skills and stats. Activated by clicking on any of the three bars in the lower left corner of the HUD. @@ -35,6 +51,7 @@ spells y = 0.5725 h = 0.375 w = 0.4275 + pin = false The spells window, displaying powers, spells, and magical items. Activated by clicking on the spells widget (third from left) in the bottom left corner of the HUD. @@ -45,39 +62,10 @@ map y = 0.0 h = 0.375 w = 0.5725 + pin = false The local and world map window. Activated by clicking on the map widget in the bottom right corner of the HUD. -dialogue --------- - -:Default: x = 0.095 - y = 0.095 - h = 0.810 - w = 0.810 - -The dialog window, for talking with NPCs. Activated by clicking on a NPC. - -alchemy -------- - -:Default: x = 0.25 - y = 0.25 - h = 0.5 - w = 0.5 - -The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. - -console -------- - -:Default: x = 0.0 - y = 0.0 - h = 1.0 - w = 0.5 - -The console command window. Activated by pressing the tilde (~) key. - inventory --------- @@ -85,6 +73,7 @@ inventory y = 0.4275 h = 0.6225 w = 0.5725 + pin = false The inventory window, displaying the paper doll and possessions, when activated by clicking on the inventory widget (second from left) in the bottom left corner of the HUD. @@ -146,4 +135,34 @@ companion h = 0.75 w = 0.375 -The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. \ No newline at end of file +The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. + +dialogue +-------- + +:Default: x = 0.095 + y = 0.095 + h = 0.810 + w = 0.810 + +The dialog window, for talking with NPCs. Activated by clicking on a NPC. + +alchemy +------- + +:Default: x = 0.25 + y = 0.25 + h = 0.5 + w = 0.5 + +The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. + +console +------- + +:Default: x = 0.0 + y = 0.0 + h = 1.0 + w = 0.5 + +The console command window. Activated by pressing the tilde (~) key. diff --git a/files/settings-default.cfg b/files/settings-default.cfg index da0cbd285..ec3c2ade6 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). @@ -371,18 +374,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 @@ -407,6 +416,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