mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-23 15:40:42 +00:00
Fixed crash when Esc-ing out of Save "are you sure" dialog.
This commit is contained in:
parent
e0356cf89d
commit
ee7b5fa5c2
@ -322,7 +322,12 @@ namespace MWBase
|
|||||||
|
|
||||||
/// Sets the current Modal
|
/// Sets the current Modal
|
||||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||||
virtual void setCurrentModal(MWGui::WindowModal* input) = 0;
|
virtual void addCurrentModal(MWGui::WindowModal* input) = 0;
|
||||||
|
|
||||||
|
/// Removes the top Modal
|
||||||
|
/** Used when one Modal adds another Modal
|
||||||
|
\param input Pointer to the current modal, to ensure proper modal is removed **/
|
||||||
|
virtual void removeCurrentModal(MWGui::WindowModal* input) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ WindowModal::WindowModal(const std::string& parLayout)
|
|||||||
void WindowModal::open()
|
void WindowModal::open()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance ().addWidgetModal (mMainWidget);
|
MyGUI::InputManager::getInstance ().addWidgetModal (mMainWidget);
|
||||||
MWBase::Environment::get().getWindowManager()->setCurrentModal(this); //Set so we can escape it if needed
|
MWBase::Environment::get().getWindowManager()->addCurrentModal(this); //Set so we can escape it if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowModal::close()
|
void WindowModal::close()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance ().removeWidgetModal (mMainWidget);
|
MyGUI::InputManager::getInstance ().removeWidgetModal (mMainWidget);
|
||||||
MWBase::Environment::get().getWindowManager()->setCurrentModal(NULL);
|
MWBase::Environment::get().getWindowManager()->removeCurrentModal(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowModal::exit()
|
void WindowModal::exit()
|
||||||
|
@ -136,7 +136,7 @@ namespace MWGui
|
|||||||
, mFPS(0.0f)
|
, mFPS(0.0f)
|
||||||
, mTriangleCount(0)
|
, mTriangleCount(0)
|
||||||
, mBatchCount(0)
|
, mBatchCount(0)
|
||||||
, currentModal(NULL)
|
, mCurrentModals()
|
||||||
{
|
{
|
||||||
// Set up the GUI system
|
// Set up the GUI system
|
||||||
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
|
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
|
||||||
@ -1606,4 +1606,21 @@ namespace MWGui
|
|||||||
mVideoWidget->setCoord(leftPadding, topPadding,
|
mVideoWidget->setCoord(leftPadding, topPadding,
|
||||||
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowModal* WindowManager::getCurrentModal() const
|
||||||
|
{
|
||||||
|
if(mCurrentModals.size() > 0)
|
||||||
|
return mCurrentModals.top();
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::removeCurrentModal(WindowModal* input)
|
||||||
|
{
|
||||||
|
// Only remove the top if it matches the current pointer. A lot of things hide their visibility before showing it,
|
||||||
|
//so just popping the top would cause massive issues.
|
||||||
|
if(mCurrentModals.size() > 0)
|
||||||
|
if(input == mCurrentModals.top())
|
||||||
|
mCurrentModals.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,11 +305,16 @@ namespace MWGui
|
|||||||
|
|
||||||
/// Returns the current Modal
|
/// Returns the current Modal
|
||||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||||
virtual WindowModal* getCurrentModal() const {return currentModal;}
|
virtual WindowModal* getCurrentModal() const;
|
||||||
|
|
||||||
/// Sets the current Modal
|
/// Sets the current Modal
|
||||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||||
virtual void setCurrentModal(WindowModal* input) {currentModal = input;}
|
virtual void addCurrentModal(WindowModal* input) {mCurrentModals.push(input);}
|
||||||
|
|
||||||
|
/// Removes the top Modal
|
||||||
|
/** Used when one Modal adds another Modal
|
||||||
|
\param input Pointer to the current modal, to ensure proper modal is removed **/
|
||||||
|
virtual void removeCurrentModal(WindowModal* input);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mConsoleOnlyScripts;
|
bool mConsoleOnlyScripts;
|
||||||
@ -320,7 +325,7 @@ namespace MWGui
|
|||||||
|
|
||||||
std::string mSelectedSpell;
|
std::string mSelectedSpell;
|
||||||
|
|
||||||
WindowModal* currentModal;
|
std::stack<WindowModal*> mCurrentModals;
|
||||||
|
|
||||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||||
OEngine::Render::OgreRenderer *mRendering;
|
OEngine::Render::OgreRenderer *mRendering;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user