diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 76e2e6baa..7ad17fab0 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -37,6 +37,11 @@ namespace MWGui , mPreviewDirty(true) , mDragAndDrop(dragAndDrop) , mSelectedItem(-1) + , mPositionInventory(0, 342, 498, 258) + , mPositionContainer(0, 342, 498, 258) + , mPositionCompanion(0, 342, 498, 258) + , mPositionBarter(0, 342, 498, 258) + , mGuiMode(GM_Inventory) { static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize); @@ -68,7 +73,7 @@ namespace MWGui mFilterAll->setStateSelected(true); - setCoord(0, 342, 498, 258); + setCoord(mPositionInventory.left, mPositionInventory.top, mPositionInventory.width, mPositionInventory.height); onWindowResize(static_cast(mMainWidget)); mPreview.setup(); @@ -84,6 +89,27 @@ namespace MWGui mPreview.setup(); } + void InventoryWindow::setGuiMode(GuiMode mode) + { + mGuiMode = mode; + switch(mode) { + case GM_Container: + mMainWidget->setCoord(mPositionContainer); + break; + case GM_Companion: + mMainWidget->setCoord(mPositionCompanion); + break; + case GM_Barter: + mMainWidget->setCoord(mPositionBarter); + break; + case GM_Inventory: + default: + mMainWidget->setCoord(mPositionInventory); + break; + } + onWindowResize(static_cast(mMainWidget)); + } + TradeItemModel* InventoryWindow::getTradeModel() { return mTradeModel; @@ -211,6 +237,21 @@ namespace MWGui _sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15, _sender->getSize().height-44 ); + switch(mGuiMode) { + case GM_Container: + mPositionContainer = _sender->getCoord(); + break; + case GM_Companion: + mPositionCompanion = _sender->getCoord(); + break; + case GM_Barter: + mPositionBarter = _sender->getCoord(); + break; + case GM_Inventory: + default: + mPositionInventory = _sender->getCoord(); + } + if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize) { mLastXSize = mMainWidget->getSize().width; diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 13c118913..35140437d 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -5,6 +5,7 @@ #include "windowpinnablebase.hpp" #include "widgets.hpp" +#include "mode.hpp" namespace MWGui { @@ -47,6 +48,8 @@ namespace MWGui void updatePlayer(); + void setGuiMode(GuiMode mode); + private: DragAndDrop* mDragAndDrop; @@ -73,6 +76,13 @@ namespace MWGui MyGUI::Button* mFilterMagic; MyGUI::Button* mFilterMisc; + MyGUI::IntCoord mPositionInventory; + MyGUI::IntCoord mPositionContainer; + MyGUI::IntCoord mPositionCompanion; + MyGUI::IntCoord mPositionBarter; + + GuiMode mGuiMode; + int mLastXSize; int mLastYSize; diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 72d44cda5..d0b88b5c2 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -441,16 +441,19 @@ namespace MWGui mMap ->setVisible(eff & GW_Map); mStatsWindow ->setVisible(eff & GW_Stats); mInventoryWindow->setVisible(eff & GW_Inventory); + mInventoryWindow->setGuiMode(mode); mSpellWindow ->setVisible(eff & GW_Magic); break; } case GM_Container: mContainerWindow->setVisible(true); mInventoryWindow->setVisible(true); + mInventoryWindow->setGuiMode(mode); break; case GM_Companion: mCompanionWindow->setVisible(true); mInventoryWindow->setVisible(true); + mInventoryWindow->setGuiMode(mode); break; case GM_Dialogue: mDialogueWindow->setVisible(true); @@ -458,6 +461,7 @@ namespace MWGui case GM_Barter: mInventoryWindow->setVisible(true); mInventoryWindow->setTrading(true); + mInventoryWindow->setGuiMode(mode); mTradeWindow->setVisible(true); break; case GM_SpellBuying: