mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-12 00:40:23 +00:00
Allow the 'Activate' key to close the countdialog window; cleanups
This commit is contained in:
parent
3fa4a194a7
commit
7b40e57ba1
@ -215,6 +215,7 @@ namespace MWBase
|
|||||||
virtual void removeStaticMessageBox() = 0;
|
virtual void removeStaticMessageBox() = 0;
|
||||||
|
|
||||||
virtual void enterPressed () = 0;
|
virtual void enterPressed () = 0;
|
||||||
|
virtual void activateKeyPressed () = 0;
|
||||||
virtual int readPressedButton() = 0;
|
virtual int readPressedButton() = 0;
|
||||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
|
@ -49,11 +49,16 @@ namespace MWGui
|
|||||||
mItemEdit->setCaption(boost::lexical_cast<std::string>(maxCount));
|
mItemEdit->setCaption(boost::lexical_cast<std::string>(maxCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::cancel()
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
|
||||||
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
||||||
|
@ -10,6 +10,7 @@ namespace MWGui
|
|||||||
public:
|
public:
|
||||||
CountDialog();
|
CountDialog();
|
||||||
void open(const std::string& item, const std::string& message, const int maxCount);
|
void open(const std::string& item, const std::string& message, const int maxCount);
|
||||||
|
void cancel();
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ namespace MWGui
|
|||||||
MyGUI::TextBox* mLabelText;
|
MyGUI::TextBox* mLabelText;
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
|
||||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onEditTextChange(MyGUI::EditBox* _sender);
|
void onEditTextChange(MyGUI::EditBox* _sender);
|
||||||
|
@ -146,10 +146,10 @@ namespace MWGui
|
|||||||
mMessageBoxSpeed = speed;
|
mMessageBoxSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxManager::enterPressed ()
|
void MessageBoxManager::okayPressed ()
|
||||||
{
|
{
|
||||||
if(mInterMessageBoxe != NULL)
|
if(mInterMessageBoxe != NULL)
|
||||||
mInterMessageBoxe->enterPressed();
|
mInterMessageBoxe->okayPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MessageBoxManager::readPressedButton ()
|
int MessageBoxManager::readPressedButton ()
|
||||||
@ -379,7 +379,7 @@ namespace MWGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveMessageBox::enterPressed()
|
void InteractiveMessageBox::okayPressed()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
||||||
|
@ -40,7 +40,7 @@ namespace MWGui
|
|||||||
bool removeMessageBox (MessageBox *msgbox);
|
bool removeMessageBox (MessageBox *msgbox);
|
||||||
void setMessageBoxSpeed (int speed);
|
void setMessageBoxSpeed (int speed);
|
||||||
|
|
||||||
void enterPressed();
|
void okayPressed();
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
|
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
|
||||||
@ -82,7 +82,7 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
|
||||||
void enterPressed ();
|
void okayPressed ();
|
||||||
void mousePressed (MyGUI::Widget* _widget);
|
void mousePressed (MyGUI::Widget* _widget);
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
|
@ -663,7 +663,13 @@ namespace MWGui
|
|||||||
|
|
||||||
void WindowManager::enterPressed ()
|
void WindowManager::enterPressed ()
|
||||||
{
|
{
|
||||||
mMessageBoxManager->enterPressed();
|
mMessageBoxManager->okayPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::activateKeyPressed ()
|
||||||
|
{
|
||||||
|
mMessageBoxManager->okayPressed();
|
||||||
|
mCountDialog->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WindowManager::readPressedButton ()
|
int WindowManager::readPressedButton ()
|
||||||
|
@ -204,6 +204,7 @@ namespace MWGui
|
|||||||
virtual void staticMessageBox(const std::string& message);
|
virtual void staticMessageBox(const std::string& message);
|
||||||
virtual void removeStaticMessageBox();
|
virtual void removeStaticMessageBox();
|
||||||
virtual void enterPressed ();
|
virtual void enterPressed ();
|
||||||
|
virtual void activateKeyPressed ();
|
||||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||||
|
|
||||||
virtual void onFrame (float frameDuration);
|
virtual void onFrame (float frameDuration);
|
||||||
|
@ -204,13 +204,15 @@ namespace MWInput
|
|||||||
case A_Activate:
|
case A_Activate:
|
||||||
resetIdleTime();
|
resetIdleTime();
|
||||||
|
|
||||||
if (mWindows.getMode() == MWGui::GM_Container) {
|
if (mWindows.isGuiMode())
|
||||||
toggleContainer ();
|
{
|
||||||
} else if (MWBase::Environment::get().getWindowManager()->isGuiMode()) {
|
if (mWindows.getMode() == MWGui::GM_Container)
|
||||||
MWBase::Environment::get().getWindowManager()->enterPressed();
|
toggleContainer ();
|
||||||
} else {
|
else
|
||||||
activate();
|
MWBase::Environment::get().getWindowManager()->activateKeyPressed();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
activate();
|
||||||
break;
|
break;
|
||||||
case A_Journal:
|
case A_Journal:
|
||||||
toggleJournal ();
|
toggleJournal ();
|
||||||
@ -681,10 +683,8 @@ namespace MWInput
|
|||||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool gameMode = !mWindows.isGuiMode();
|
|
||||||
|
|
||||||
// Toggle between game mode and inventory mode
|
// Toggle between game mode and inventory mode
|
||||||
if(gameMode)
|
if(!mWindows.isGuiMode())
|
||||||
mWindows.pushGuiMode(MWGui::GM_Inventory);
|
mWindows.pushGuiMode(MWGui::GM_Inventory);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -701,9 +701,7 @@ namespace MWInput
|
|||||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool gameMode = !mWindows.isGuiMode();
|
if(mWindows.isGuiMode())
|
||||||
|
|
||||||
if(!gameMode)
|
|
||||||
{
|
{
|
||||||
if (mWindows.getMode() == MWGui::GM_Container)
|
if (mWindows.getMode() == MWGui::GM_Container)
|
||||||
mWindows.popGuiMode();
|
mWindows.popGuiMode();
|
||||||
@ -713,17 +711,14 @@ namespace MWInput
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InputManager::toggleConsole()
|
void InputManager::toggleConsole()
|
||||||
{
|
{
|
||||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool gameMode = !mWindows.isGuiMode();
|
|
||||||
|
|
||||||
// Switch to console mode no matter what mode we are currently
|
// Switch to console mode no matter what mode we are currently
|
||||||
// in, except of course if we are already in console mode
|
// in, except of course if we are already in console mode
|
||||||
if (!gameMode)
|
if (mWindows.isGuiMode())
|
||||||
{
|
{
|
||||||
if (mWindows.getMode() == MWGui::GM_Console)
|
if (mWindows.getMode() == MWGui::GM_Console)
|
||||||
mWindows.popGuiMode();
|
mWindows.popGuiMode();
|
||||||
@ -740,9 +735,7 @@ namespace MWInput
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Toggle between game mode and journal mode
|
// Toggle between game mode and journal mode
|
||||||
bool gameMode = !mWindows.isGuiMode();
|
if(!mWindows.isGuiMode() && MWBase::Environment::get().getWindowManager ()->getJournalAllowed())
|
||||||
|
|
||||||
if(gameMode && MWBase::Environment::get().getWindowManager ()->getJournalAllowed())
|
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0);
|
||||||
mWindows.pushGuiMode(MWGui::GM_Journal);
|
mWindows.pushGuiMode(MWGui::GM_Journal);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user