Adds persisted pin (feature #2834, bug #2489)

0.6.1
Andrei Kortunov 8 years ago
parent 3c9f3a0f7f
commit 95ce7637f3

@ -433,6 +433,8 @@ namespace MWGui
void InventoryWindow::onPinToggled() void InventoryWindow::onPinToggled()
{ {
Settings::Manager::setBool("inventory pin", "Windows", mPinned);
MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned);
} }

@ -629,7 +629,7 @@ namespace MWGui
, mGlobalMap(0) , mGlobalMap(0)
, mGlobalMapImage(NULL) , mGlobalMapImage(NULL)
, mGlobalMapOverlay(NULL) , mGlobalMapOverlay(NULL)
, mGlobal(false) , mGlobal(Settings::Manager::getBool("global", "Map"))
, mEventBoxGlobal(NULL) , mEventBoxGlobal(NULL)
, mEventBoxLocal(NULL) , mEventBoxLocal(NULL)
, mGlobalMapRender(new MWRender::GlobalMap(localMapRender->getRoot(), workQueue)) , mGlobalMapRender(new MWRender::GlobalMap(localMapRender->getRoot(), workQueue))
@ -667,7 +667,7 @@ namespace MWGui
getWidget(mButton, "WorldButton"); getWidget(mButton, "WorldButton");
mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked); mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked);
mButton->setCaptionWithReplacing("#{sWorld}"); mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}");
getWidget(mEventBoxGlobal, "EventBoxGlobal"); getWidget(mEventBoxGlobal, "EventBoxGlobal");
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
@ -680,6 +680,9 @@ namespace MWGui
mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); 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")); 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() void MapWindow::onNoteEditOk()
@ -912,6 +915,8 @@ namespace MWGui
mGlobalMap->setVisible(mGlobal); mGlobalMap->setVisible(mGlobal);
mLocalMap->setVisible(!mGlobal); mLocalMap->setVisible(!mGlobal);
Settings::Manager::setBool("global", "Map", mGlobal);
mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" :
"#{sWorld}"); "#{sWorld}");
@ -921,6 +926,8 @@ namespace MWGui
void MapWindow::onPinToggled() void MapWindow::onPinToggled()
{ {
Settings::Manager::setBool("map pin", "Windows", mPinned);
MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned);
} }

@ -4,6 +4,8 @@
#include <MyGUI_InputManager.h> #include <MyGUI_InputManager.h>
#include <components/settings/settings.hpp>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -48,6 +50,8 @@ namespace MWGui
void SpellWindow::onPinToggled() void SpellWindow::onPinToggled()
{ {
Settings::Manager::setBool("spells pin", "Windows", mPinned);
MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned);
} }

@ -6,6 +6,8 @@
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h> #include <MyGUI_Gui.h>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -672,6 +674,8 @@ namespace MWGui
void StatsWindow::onPinToggled() void StatsWindow::onPinToggled()
{ {
Settings::Manager::setBool("stats pin", "Windows", mPinned);
MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned);
} }

@ -400,6 +400,11 @@ namespace MWGui
allow(GW_ALL); allow(GW_ALL);
mRestAllowed = !newgame; 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() WindowManager::~WindowManager()
@ -550,15 +555,23 @@ namespace MWGui
setSpellVisibility((mAllowed & GW_Magic) && (!mSpellWindow->pinned() || (mForceHidden & GW_Magic))); setSpellVisibility((mAllowed & GW_Magic) && (!mSpellWindow->pinned() || (mForceHidden & GW_Magic)));
setHMSVisibility((mAllowed & GW_Stats) && (!mStatsWindow->pinned() || (mForceHidden & GW_Stats))); setHMSVisibility((mAllowed & GW_Stats) && (!mStatsWindow->pinned() || (mForceHidden & GW_Stats)));
// If in game mode, show only the pinned windows // If in game mode (or interactive messagebox), show only the pinned windows
if (gameMode) if (mGuiModes.empty())
{ {
mInventoryWindow->setGuiMode(GM_None); 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; return;
} }

@ -107,6 +107,9 @@ local map widget size = 512
# may result in longer loading times. # may result in longer loading times.
local map cell distance = 1 local map cell distance = 1
# If true, map in world mode, otherwise in local mode
global = false
[GUI] [GUI]
# Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger). # 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 y = 0.0
stats w = 0.375 stats w = 0.375
stats h = 0.4275 stats h = 0.4275
# Stats window pin status
stats pin = false
# Spells window displaying powers, spells, and magical items. # Spells window displaying powers, spells, and magical items.
spells x = 0.625 spells x = 0.625
spells y = 0.5725 spells y = 0.5725
spells w = 0.375 spells w = 0.375
spells h = 0.4275 spells h = 0.4275
# Spells window pin status
spells pin = false
# Local and world map window. # Local and world map window.
map x = 0.625 map x = 0.625
map y = 0.0 map y = 0.0
map w = 0.375 map w = 0.375
map h = 0.5725 map h = 0.5725
# Map window pin status
map pin = false
# Dialog window for talking with NPCs. # Dialog window for talking with NPCs.
dialogue x = 0.095 dialogue x = 0.095
@ -401,6 +410,8 @@ inventory x = 0.0
inventory y = 0.4275 inventory y = 0.4275
inventory w = 0.6225 inventory w = 0.6225
inventory h = 0.5725 inventory h = 0.5725
# Inventory window pin status
inventory pin = false
# Player inventory window when searching a container. # Player inventory window when searching a container.
inventory container x = 0.0 inventory container x = 0.0

Loading…
Cancel
Save