1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 03:54:40 +00:00

Fix bug #591: Don't allow opening new windows (main menu, console) if there's any modal widget active. Also made some windows modal that should be (character creation)

This commit is contained in:
scrawl 2013-02-25 06:57:32 +01:00
parent e060713aa3
commit dfe29db9cb
11 changed files with 29 additions and 17 deletions

View File

@ -25,7 +25,7 @@ bool sortBirthSigns(const std::pair<std::string, const ESM::BirthSign*>& left, c
}
BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_birth.layout", parWindowManager)
: WindowModal("openmw_chargen_birth.layout", parWindowManager)
{
// Centre dialog
center();
@ -66,7 +66,7 @@ void BirthDialog::setNextButtonShow(bool shown)
void BirthDialog::open()
{
WindowBase::open();
WindowModal::open();
updateBirths();
updateSpells();
}

View File

@ -10,7 +10,7 @@
namespace MWGui
{
class BirthDialog : public WindowBase
class BirthDialog : public WindowModal
{
public:
BirthDialog(MWBase::WindowManager& parWindowManager);

View File

@ -21,7 +21,7 @@ using namespace MWGui;
/* GenerateClassResultDialog */
GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
: WindowModal("openmw_chargen_generate_class_result.layout", parWindowManager)
{
// Centre dialog
center();
@ -68,7 +68,7 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
/* PickClassDialog */
PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_class.layout", parWindowManager)
: WindowModal("openmw_chargen_class.layout", parWindowManager)
{
// Centre dialog
center();
@ -122,6 +122,7 @@ void PickClassDialog::setNextButtonShow(bool shown)
void PickClassDialog::open()
{
WindowModal::open ();
updateClasses();
updateStats();
}
@ -276,7 +277,7 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
}
InfoBoxDialog::InfoBoxDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_infobox.layout", parWindowManager)
: WindowModal("openmw_infobox.layout", parWindowManager)
, mCurrentButton(-1)
{
getWidget(mTextBox, "TextBox");
@ -327,6 +328,7 @@ void InfoBoxDialog::setButtons(ButtonList &buttons)
void InfoBoxDialog::open()
{
WindowModal::open();
// Fix layout
layoutVertically(mTextBox, 4);
layoutVertically(mButtonBar, 6);
@ -373,7 +375,7 @@ ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
/* CreateClassDialog */
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_create_class.layout", parWindowManager)
: WindowModal("openmw_chargen_create_class.layout", parWindowManager)
, mSpecDialog(nullptr)
, mAttribDialog(nullptr)
, mSkillDialog(nullptr)

View File

@ -12,7 +12,7 @@
namespace MWGui
{
class InfoBoxDialog : public WindowBase
class InfoBoxDialog : public WindowModal
{
public:
InfoBoxDialog(MWBase::WindowManager& parWindowManager);
@ -63,7 +63,7 @@ namespace MWGui
ClassChoiceDialog(MWBase::WindowManager& parWindowManager);
};
class GenerateClassResultDialog : public WindowBase
class GenerateClassResultDialog : public WindowModal
{
public:
GenerateClassResultDialog(MWBase::WindowManager& parWindowManager);
@ -90,7 +90,7 @@ namespace MWGui
std::string mCurrentClassId;
};
class PickClassDialog : public WindowBase
class PickClassDialog : public WindowModal
{
public:
PickClassDialog(MWBase::WindowManager& parWindowManager);
@ -238,7 +238,7 @@ namespace MWGui
MyGUI::EditPtr mTextEdit;
};
class CreateClassDialog : public WindowBase
class CreateClassDialog : public WindowModal
{
public:
CreateClassDialog(MWBase::WindowManager& parWindowManager);

View File

@ -20,7 +20,7 @@ using namespace MWGui;
using namespace Widgets;
RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_race.layout", parWindowManager)
: WindowModal("openmw_chargen_race.layout", parWindowManager)
, mGenderIndex(0)
, mFaceIndex(0)
, mHairIndex(0)
@ -100,6 +100,8 @@ void RaceDialog::setNextButtonShow(bool shown)
void RaceDialog::open()
{
WindowModal::open();
updateRaces();
updateSkills();
updateSpellPowers();

View File

@ -23,7 +23,7 @@ namespace MWGui
namespace MWGui
{
class RaceDialog : public WindowBase
class RaceDialog : public WindowModal
{
public:
RaceDialog(MWBase::WindowManager& parWindowManager);

View File

@ -23,7 +23,7 @@ using namespace Widgets;
const int ReviewDialog::sLineHeight = 18;
ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_review.layout", parWindowManager)
: WindowModal("openmw_chargen_review.layout", parWindowManager)
, mLastPos(0)
{
// Centre dialog
@ -97,6 +97,7 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
void ReviewDialog::open()
{
WindowModal::open();
updateSkillArea();
}

View File

@ -17,7 +17,7 @@ Layout is defined by resources/mygui/openmw_chargen_review.layout.
namespace MWGui
{
class ReviewDialog : public WindowBase
class ReviewDialog : public WindowModal
{
public:
enum Dialogs {

View File

@ -5,7 +5,7 @@
using namespace MWGui;
TextInputDialog::TextInputDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_text_input.layout", parWindowManager)
: WindowModal("openmw_text_input.layout", parWindowManager)
{
// Centre dialog
center();
@ -39,6 +39,7 @@ void TextInputDialog::setTextLabel(const std::string &label)
void TextInputDialog::open()
{
WindowModal::open();
// Make sure the edit box has focus
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
}

View File

@ -13,7 +13,7 @@ namespace MWGui
namespace MWGui
{
class TextInputDialog : public WindowBase
class TextInputDialog : public WindowModal
{
public:
TextInputDialog(MWBase::WindowManager& parWindowManager);

View File

@ -521,6 +521,9 @@ namespace MWInput
void InputManager::toggleMainMenu()
{
if (MyGUI::InputManager::getInstance ().isModalAny())
return;
if (mWindows.isGuiMode () && (mWindows.getMode () == MWGui::GM_MainMenu || mWindows.getMode () == MWGui::GM_Settings))
mWindows.popGuiMode();
else if (mWindows.isGuiMode () && mWindows.getMode () == MWGui::GM_Video)
@ -599,6 +602,9 @@ namespace MWInput
void InputManager::toggleConsole()
{
if (MyGUI::InputManager::getInstance ().isModalAny())
return;
bool gameMode = !mWindows.isGuiMode();
// Switch to console mode no matter what mode we are currently