forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'scrawl/quick_keys'
Conflicts: apps/openmw/mwgui/windowmanagerimp.cpp
This commit is contained in:
commit
160b52162b
36 changed files with 1126 additions and 122 deletions
|
@ -28,7 +28,8 @@ add_openmw_dir (mwgui
|
||||||
dialogue_history window_base stats_window messagebox journalwindow charactercreation
|
dialogue_history window_base stats_window messagebox journalwindow charactercreation
|
||||||
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
||||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu
|
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
||||||
|
itemselection
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
|
|
|
@ -171,6 +171,8 @@ namespace MWBase
|
||||||
virtual void setWeaponVisibility(bool visible) = 0;
|
virtual void setWeaponVisibility(bool visible) = 0;
|
||||||
virtual void setSpellVisibility(bool visible) = 0;
|
virtual void setSpellVisibility(bool visible) = 0;
|
||||||
|
|
||||||
|
virtual void activateQuickKey (int index) = 0;
|
||||||
|
|
||||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
||||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
||||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
||||||
|
|
|
@ -65,9 +65,9 @@ void BirthDialog::setNextButtonShow(bool shown)
|
||||||
|
|
||||||
void BirthDialog::open()
|
void BirthDialog::open()
|
||||||
{
|
{
|
||||||
|
WindowBase::open();
|
||||||
updateBirths();
|
updateBirths();
|
||||||
updateSpells();
|
updateSpells();
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace MWGui
|
||||||
void setBirthId(const std::string &raceId);
|
void setBirthId(const std::string &raceId);
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -194,7 +194,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mNameDialog->setTextInput(mPlayerName);
|
mNameDialog->setTextInput(mPlayerName);
|
||||||
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
mNameDialog->setNextButtonShow(mCreationStage >= CSE_NameChosen);
|
||||||
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone);
|
||||||
mNameDialog->open();
|
mNameDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GM_Race:
|
case GM_Race:
|
||||||
|
@ -205,7 +205,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||||
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);
|
||||||
mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack);
|
mRaceDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogBack);
|
||||||
mRaceDialog->open();
|
mRaceDialog->setVisible(true);;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GM_Class:
|
case GM_Class:
|
||||||
|
@ -213,7 +213,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mClassChoiceDialog = 0;
|
mClassChoiceDialog = 0;
|
||||||
mClassChoiceDialog = new ClassChoiceDialog(*mWM);
|
mClassChoiceDialog = new ClassChoiceDialog(*mWM);
|
||||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||||
mClassChoiceDialog->open();
|
mClassChoiceDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GM_ClassPick:
|
case GM_ClassPick:
|
||||||
|
@ -224,7 +224,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mPickClassDialog->setClassId(mPlayerClass.name);
|
mPickClassDialog->setClassId(mPlayerClass.name);
|
||||||
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
|
||||||
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
|
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
|
||||||
mPickClassDialog->open();
|
mPickClassDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GM_Birth:
|
case GM_Birth:
|
||||||
|
@ -234,7 +234,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||||
mBirthSignDialog->open();
|
mBirthSignDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GM_ClassCreate:
|
case GM_ClassCreate:
|
||||||
|
@ -244,7 +244,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||||
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
|
||||||
mCreateClassDialog->open();
|
mCreateClassDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
case GM_ClassGenerate:
|
case GM_ClassGenerate:
|
||||||
mGenerateClassStep = 0;
|
mGenerateClassStep = 0;
|
||||||
|
@ -289,7 +289,7 @@ void CharacterCreation::spawnDialog(const char id)
|
||||||
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
mReviewDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogDone);
|
||||||
mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack);
|
mReviewDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onReviewDialogBack);
|
||||||
mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog);
|
mReviewDialog->eventActivateDialog += MyGUI::newDelegate(this, &CharacterCreation::onReviewActivateDialog);
|
||||||
mReviewDialog->open();
|
mReviewDialog->setVisible(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ void CharacterCreation::showClassQuestionDialog()
|
||||||
mGenerateClassResultDialog->setClassId(mGenerateClass);
|
mGenerateClassResultDialog->setClassId(mGenerateClass);
|
||||||
mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack);
|
mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack);
|
||||||
mGenerateClassResultDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassDone);
|
mGenerateClassResultDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassDone);
|
||||||
mGenerateClassResultDialog->open();
|
mGenerateClassResultDialog->setVisible(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ void CharacterCreation::showClassQuestionDialog()
|
||||||
buttons.push_back(sGenerateClassSteps[mGenerateClassStep].mButtons[2]);
|
buttons.push_back(sGenerateClassSteps[mGenerateClassStep].mButtons[2]);
|
||||||
mGenerateClassQuestionDialog->setButtons(buttons);
|
mGenerateClassQuestionDialog->setButtons(buttons);
|
||||||
mGenerateClassQuestionDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassQuestionChosen);
|
mGenerateClassQuestionDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassQuestionChosen);
|
||||||
mGenerateClassQuestionDialog->open();
|
mGenerateClassQuestionDialog->setVisible(true);
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps[mGenerateClassStep].mSound);
|
MWBase::Environment::get().getSoundManager()->say(sGenerateClassSteps[mGenerateClassStep].mSound);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,6 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parW
|
||||||
backButton->setCoord(315 - okButtonWidth - backButtonWidth - 6, 219, backButtonWidth, 23);
|
backButton->setCoord(315 - okButtonWidth - backButtonWidth - 6, 219, backButtonWidth, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateClassResultDialog::open()
|
|
||||||
{
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GenerateClassResultDialog::getClassId() const
|
std::string GenerateClassResultDialog::getClassId() const
|
||||||
{
|
{
|
||||||
return mClassName->getCaption();
|
return mClassName->getCaption();
|
||||||
|
@ -143,7 +138,6 @@ void PickClassDialog::open()
|
||||||
{
|
{
|
||||||
updateClasses();
|
updateClasses();
|
||||||
updateStats();
|
updateStats();
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +335,6 @@ void InfoBoxDialog::open()
|
||||||
layoutVertically(mMainWidget, 4 + 6);
|
layoutVertically(mMainWidget, 4 + 6);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int InfoBoxDialog::getChosenButton() const
|
int InfoBoxDialog::getChosenButton() const
|
||||||
|
@ -549,11 +542,6 @@ void CreateClassDialog::setNextButtonShow(bool shown)
|
||||||
descriptionButton->setCoord(459 - okButtonWidth - backButtonWidth - descriptionButtonWidth - 12, 158, descriptionButtonWidth, 23);
|
descriptionButton->setCoord(459 - okButtonWidth - backButtonWidth - descriptionButtonWidth - 12, 158, descriptionButtonWidth, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateClassDialog::open()
|
|
||||||
{
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
||||||
void CreateClassDialog::onDialogCancel()
|
void CreateClassDialog::onDialogCancel()
|
||||||
|
@ -695,7 +683,7 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
||||||
/* SelectSpecializationDialog */
|
/* SelectSpecializationDialog */
|
||||||
|
|
||||||
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
||||||
: WindowBase("openmw_chargen_select_specialization.layout", parWindowManager)
|
: WindowModal("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -727,13 +715,10 @@ SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& pa
|
||||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
||||||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||||
cancelButton->setCoord(216 - buttonWidth, 90, buttonWidth, 21);
|
cancelButton->setCoord(216 - buttonWidth, 90, buttonWidth, 21);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectSpecializationDialog::~SelectSpecializationDialog()
|
SelectSpecializationDialog::~SelectSpecializationDialog()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
@ -760,7 +745,7 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
||||||
/* SelectAttributeDialog */
|
/* SelectAttributeDialog */
|
||||||
|
|
||||||
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
||||||
: WindowBase("openmw_chargen_select_attribute.layout", parWindowManager)
|
: WindowModal("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -785,13 +770,10 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
|
||||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
||||||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||||
cancelButton->setCoord(186 - buttonWidth, 180, buttonWidth, 21);
|
cancelButton->setCoord(186 - buttonWidth, 180, buttonWidth, 21);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectAttributeDialog::~SelectAttributeDialog()
|
SelectAttributeDialog::~SelectAttributeDialog()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
@ -812,7 +794,7 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
||||||
/* SelectSkillDialog */
|
/* SelectSkillDialog */
|
||||||
|
|
||||||
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||||
: WindowBase("openmw_chargen_select_skill.layout", parWindowManager)
|
: WindowModal("openmw_chargen_select_skill.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -884,12 +866,10 @@ SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||||
int buttonWidth = cancelButton->getTextSize().width + 24;
|
int buttonWidth = cancelButton->getTextSize().width + 24;
|
||||||
cancelButton->setCoord(447 - buttonWidth, 218, buttonWidth, 21);
|
cancelButton->setCoord(447 - buttonWidth, 218, buttonWidth, 21);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectSkillDialog::~SelectSkillDialog()
|
SelectSkillDialog::~SelectSkillDialog()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
@ -908,7 +888,7 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
||||||
/* DescriptionDialog */
|
/* DescriptionDialog */
|
||||||
|
|
||||||
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||||
: WindowBase("openmw_chargen_class_description.layout", parWindowManager)
|
: WindowModal("openmw_chargen_class_description.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -924,13 +904,10 @@ DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
// Make sure the edit box has focus
|
// Make sure the edit box has focus
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptionDialog::~DescriptionDialog()
|
DescriptionDialog::~DescriptionDialog()
|
||||||
{
|
{
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace MWGui
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
void setButtons(ButtonList &buttons);
|
void setButtons(ButtonList &buttons);
|
||||||
|
|
||||||
void open();
|
virtual void open();
|
||||||
int getChosenButton() const;
|
int getChosenButton() const;
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
@ -74,8 +74,6 @@ namespace MWGui
|
||||||
std::string getClassId() const;
|
std::string getClassId() const;
|
||||||
void setClassId(const std::string &classId);
|
void setClassId(const std::string &classId);
|
||||||
|
|
||||||
void open();
|
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
|
@ -104,7 +102,7 @@ namespace MWGui
|
||||||
void setClassId(const std::string &classId);
|
void setClassId(const std::string &classId);
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
@ -134,7 +132,7 @@ namespace MWGui
|
||||||
std::string mCurrentClassId;
|
std::string mCurrentClassId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SelectSpecializationDialog : public WindowBase
|
class SelectSpecializationDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -165,7 +163,7 @@ namespace MWGui
|
||||||
ESM::Class::Specialization mSpecializationId;
|
ESM::Class::Specialization mSpecializationId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SelectAttributeDialog : public WindowBase
|
class SelectAttributeDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -198,7 +196,7 @@ namespace MWGui
|
||||||
ESM::Attribute::AttributeID mAttributeId;
|
ESM::Attribute::AttributeID mAttributeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SelectSkillDialog : public WindowBase
|
class SelectSkillDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -234,7 +232,7 @@ namespace MWGui
|
||||||
ESM::Skill::SkillEnum mSkillId;
|
ESM::Skill::SkillEnum mSkillId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DescriptionDialog : public WindowBase
|
class DescriptionDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -264,7 +262,6 @@ namespace MWGui
|
||||||
std::vector<ESM::Skill::SkillEnum> getMinorSkills() const;
|
std::vector<ESM::Skill::SkillEnum> getMinorSkills() const;
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void open();
|
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
||||||
WindowBase("openmw_confirmation_dialog.layout", parWindowManager)
|
WindowModal("openmw_confirmation_dialog.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
getWidget(mMessage, "Message");
|
getWidget(mMessage, "Message");
|
||||||
getWidget(mOkButton, "OkButton");
|
getWidget(mOkButton, "OkButton");
|
||||||
|
@ -32,9 +32,6 @@ namespace MWGui
|
||||||
|
|
||||||
center();
|
center();
|
||||||
|
|
||||||
// make other gui elements inaccessible while this dialog is open
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
|
|
||||||
int okButtonWidth = mOkButton->getTextSize().width + 24;
|
int okButtonWidth = mOkButton->getTextSize().width + 24;
|
||||||
mOkButton->setCoord(mMainWidget->getWidth() - 30 - okButtonWidth,
|
mOkButton->setCoord(mMainWidget->getWidth() - 30 - okButtonWidth,
|
||||||
mOkButton->getTop(),
|
mOkButton->getTop(),
|
||||||
|
@ -52,19 +49,13 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
eventCancelClicked();
|
eventCancelClicked();
|
||||||
|
|
||||||
close();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
eventOkClicked();
|
eventOkClicked();
|
||||||
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmationDialog::close()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class ConfirmationDialog : public WindowBase
|
class ConfirmationDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -26,8 +26,6 @@ namespace MWGui
|
||||||
|
|
||||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
void close();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
||||||
WindowBase("openmw_count_window.layout", parWindowManager)
|
WindowModal("openmw_count_window.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
getWidget(mSlider, "CountSlider");
|
getWidget(mSlider, "CountSlider");
|
||||||
getWidget(mItemEdit, "ItemEdit");
|
getWidget(mItemEdit, "ItemEdit");
|
||||||
|
@ -40,9 +40,6 @@ namespace MWGui
|
||||||
width,
|
width,
|
||||||
mMainWidget->getHeight());
|
mMainWidget->getHeight());
|
||||||
|
|
||||||
// make other gui elements inaccessible while this dialog is open
|
|
||||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mItemEdit);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(mItemEdit);
|
||||||
|
|
||||||
mSlider->setScrollPosition(maxCount-1);
|
mSlider->setScrollPosition(maxCount-1);
|
||||||
|
@ -63,14 +60,14 @@ namespace MWGui
|
||||||
|
|
||||||
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
close();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
|
||||||
|
|
||||||
close();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::onEditTextChange(MyGUI::EditBox* _sender)
|
void CountDialog::onEditTextChange(MyGUI::EditBox* _sender)
|
||||||
|
@ -99,10 +96,4 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mItemEdit->setCaption(boost::lexical_cast<std::string>(_position+1));
|
mItemEdit->setCaption(boost::lexical_cast<std::string>(_position+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::close()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class CountDialog : public WindowBase
|
class CountDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CountDialog(MWBase::WindowManager& parWindowManager);
|
CountDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
@ -30,8 +30,6 @@ namespace MWGui
|
||||||
void onOkButtonClicked(MyGUI::Widget* _sender);
|
void onOkButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onEditTextChange(MyGUI::EditBox* _sender);
|
void onEditTextChange(MyGUI::EditBox* _sender);
|
||||||
void onSliderMoved(MyGUI::ScrollBar* _sender, size_t _position);
|
void onSliderMoved(MyGUI::ScrollBar* _sender, size_t _position);
|
||||||
|
|
||||||
void close();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
45
apps/openmw/mwgui/itemselection.cpp
Normal file
45
apps/openmw/mwgui/itemselection.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#include "itemselection.hpp"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
ItemSelectionDialog::ItemSelectionDialog(const std::string &label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager)
|
||||||
|
: ContainerBase(NULL)
|
||||||
|
, WindowModal("openmw_itemselection_dialog.layout", parWindowManager)
|
||||||
|
{
|
||||||
|
mFilter = filter;
|
||||||
|
|
||||||
|
MyGUI::ScrollView* itemView;
|
||||||
|
MyGUI::Widget* containerWidget;
|
||||||
|
getWidget(containerWidget, "Items");
|
||||||
|
getWidget(itemView, "ItemView");
|
||||||
|
setWidgets(containerWidget, itemView);
|
||||||
|
|
||||||
|
MyGUI::TextBox* l;
|
||||||
|
getWidget(l, "Label");
|
||||||
|
l->setCaptionWithReplacing (label);
|
||||||
|
|
||||||
|
MyGUI::Button* cancelButton;
|
||||||
|
getWidget(cancelButton, "CancelButton");
|
||||||
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemSelectionDialog::onCancelButtonClicked);
|
||||||
|
|
||||||
|
int dx = (cancelButton->getTextSize().width + 24) - cancelButton->getWidth();
|
||||||
|
cancelButton->setCoord(cancelButton->getLeft() - dx,
|
||||||
|
cancelButton->getTop(),
|
||||||
|
cancelButton->getTextSize ().width + 24,
|
||||||
|
cancelButton->getHeight());
|
||||||
|
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemSelectionDialog::onSelectedItemImpl(MWWorld::Ptr item)
|
||||||
|
{
|
||||||
|
eventItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ItemSelectionDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
eventDialogCanceled();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
apps/openmw/mwgui/itemselection.hpp
Normal file
28
apps/openmw/mwgui/itemselection.hpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include "container.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
class ItemSelectionDialog : public ContainerBase, public WindowModal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemSelectionDialog(const std::string& label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager);
|
||||||
|
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
||||||
|
|
||||||
|
EventHandle_Item eventItemSelected;
|
||||||
|
EventHandle_Void eventDialogCanceled;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void onReferenceUnavailable() { ; }
|
||||||
|
|
||||||
|
virtual void onSelectedItemImpl(MWWorld::Ptr item);
|
||||||
|
|
||||||
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JournalWindow(MWBase::WindowManager& parWindowManager);
|
JournalWindow(MWBase::WindowManager& parWindowManager);
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
virtual void setVisible(bool visible); // only used to play close sound
|
virtual void setVisible(bool visible); // only used to play close sound
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,9 @@ namespace MWGui
|
||||||
GM_Review,
|
GM_Review,
|
||||||
|
|
||||||
// interactive MessageBox
|
// interactive MessageBox
|
||||||
GM_InterMessageBox
|
GM_InterMessageBox,
|
||||||
|
|
||||||
|
GM_QuickKeysMenu
|
||||||
};
|
};
|
||||||
|
|
||||||
// Windows shown in inventory mode
|
// Windows shown in inventory mode
|
||||||
|
|
630
apps/openmw/mwgui/quickkeysmenu.cpp
Normal file
630
apps/openmw/mwgui/quickkeysmenu.cpp
Normal file
|
@ -0,0 +1,630 @@
|
||||||
|
#include "quickkeysmenu.hpp"
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
#include "../mwworld/actionequip.hpp"
|
||||||
|
#include "../mwmechanics/spells.hpp"
|
||||||
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
#include "../mwmechanics/spellsuccess.hpp"
|
||||||
|
#include "../mwgui/inventorywindow.hpp"
|
||||||
|
#include "../mwgui/bookwindow.hpp"
|
||||||
|
#include "../mwgui/scrollwindow.hpp"
|
||||||
|
|
||||||
|
#include "windowmanagerimp.hpp"
|
||||||
|
#include "itemselection.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
bool sortItems(const MWWorld::Ptr& left, const MWWorld::Ptr& right)
|
||||||
|
{
|
||||||
|
int cmp = MWWorld::Class::get(left).getName(left).compare(
|
||||||
|
MWWorld::Class::get(right).getName(right));
|
||||||
|
return cmp < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sortSpells(const std::string& left, const std::string& right)
|
||||||
|
{
|
||||||
|
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
|
||||||
|
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
|
||||||
|
|
||||||
|
int cmp = a->name.compare(b->name);
|
||||||
|
return cmp < 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
QuickKeysMenu::QuickKeysMenu(MWBase::WindowManager& parWindowManager)
|
||||||
|
: WindowBase("openmw_quickkeys_menu.layout", parWindowManager)
|
||||||
|
, mAssignDialog(0)
|
||||||
|
, mItemSelectionDialog(0)
|
||||||
|
, mMagicSelectionDialog(0)
|
||||||
|
{
|
||||||
|
getWidget(mOkButton, "OKButton");
|
||||||
|
getWidget(mInstructionLabel, "InstructionLabel");
|
||||||
|
|
||||||
|
mMainWidget->setSize(mMainWidget->getWidth(),
|
||||||
|
mMainWidget->getHeight() + (mInstructionLabel->getTextSize().height - mInstructionLabel->getHeight()));
|
||||||
|
|
||||||
|
int okButtonWidth = mOkButton->getTextSize ().width + 24;
|
||||||
|
mOkButton->setCoord(mOkButton->getLeft() - (okButtonWidth - mOkButton->getWidth()),
|
||||||
|
mOkButton->getTop(),
|
||||||
|
okButtonWidth,
|
||||||
|
mOkButton->getHeight());
|
||||||
|
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onOkButtonClicked);
|
||||||
|
|
||||||
|
center();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
{
|
||||||
|
MyGUI::Button* button;
|
||||||
|
getWidget(button, "QuickKey" + boost::lexical_cast<std::string>(i+1));
|
||||||
|
|
||||||
|
button->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||||
|
|
||||||
|
unassign(button, i);
|
||||||
|
|
||||||
|
mQuickKeyButtons.push_back(button);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QuickKeysMenu::~QuickKeysMenu()
|
||||||
|
{
|
||||||
|
delete mAssignDialog;
|
||||||
|
delete mItemSelectionDialog;
|
||||||
|
delete mMagicSelectionDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::unassign(MyGUI::Widget* key, int index)
|
||||||
|
{
|
||||||
|
while (key->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (key->getChildAt(0));
|
||||||
|
|
||||||
|
key->setUserData(Type_Unassigned);
|
||||||
|
|
||||||
|
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
|
||||||
|
textBox->setTextAlign (MyGUI::Align::Center);
|
||||||
|
textBox->setCaption (boost::lexical_cast<std::string>(index+1));
|
||||||
|
textBox->setNeedMouseFocus (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
{
|
||||||
|
if (sender == mQuickKeyButtons[i] || sender->getParent () == mQuickKeyButtons[i])
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(index != -1);
|
||||||
|
mSelectedIndex = index;
|
||||||
|
|
||||||
|
{
|
||||||
|
// open assign dialog
|
||||||
|
if (!mAssignDialog)
|
||||||
|
mAssignDialog = new QuickKeysMenuAssign(mWindowManager, this);
|
||||||
|
mAssignDialog->setVisible (true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onOkButtonClicked (MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
mWindowManager.removeGuiMode(GM_QuickKeysMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QuickKeysMenu::onItemButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
if (!mItemSelectionDialog )
|
||||||
|
{
|
||||||
|
mItemSelectionDialog = new ItemSelectionDialog("#{sQuickMenu6}", ContainerBase::Filter_All, mWindowManager);
|
||||||
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItem);
|
||||||
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
|
||||||
|
}
|
||||||
|
mItemSelectionDialog->setVisible(true);
|
||||||
|
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
mItemSelectionDialog->drawItems ();
|
||||||
|
|
||||||
|
mAssignDialog->setVisible (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onMagicButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
if (!mMagicSelectionDialog )
|
||||||
|
{
|
||||||
|
mMagicSelectionDialog = new MagicSelectionDialog(mWindowManager, this);
|
||||||
|
}
|
||||||
|
mMagicSelectionDialog->setVisible(true);
|
||||||
|
|
||||||
|
mAssignDialog->setVisible (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onUnassignButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
unassign(mQuickKeyButtons[mSelectedIndex], mSelectedIndex);
|
||||||
|
mAssignDialog->setVisible (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
mAssignDialog->setVisible (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onAssignItem(MWWorld::Ptr item)
|
||||||
|
{
|
||||||
|
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||||
|
while (button->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||||
|
|
||||||
|
button->setUserData(Type_Item);
|
||||||
|
|
||||||
|
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||||
|
std::string backgroundTex = "textures\\menu_icon_barter.dds";
|
||||||
|
frame->setImageTexture (backgroundTex);
|
||||||
|
frame->setImageCoord (MyGUI::IntCoord(4, 4, 40, 40));
|
||||||
|
frame->setUserString ("ToolTipType", "ItemPtr");
|
||||||
|
frame->setUserData(item);
|
||||||
|
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||||
|
|
||||||
|
|
||||||
|
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||||
|
std::string path = std::string("icons\\");
|
||||||
|
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
image->setImageTexture (path);
|
||||||
|
image->setNeedMouseFocus (false);
|
||||||
|
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onAssignItemCancel()
|
||||||
|
{
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onAssignMagicItem (MWWorld::Ptr item)
|
||||||
|
{
|
||||||
|
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||||
|
while (button->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||||
|
|
||||||
|
button->setUserData(Type_MagicItem);
|
||||||
|
|
||||||
|
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||||
|
std::string backgroundTex = "textures\\menu_icon_select_magic_magic.dds";
|
||||||
|
frame->setImageTexture (backgroundTex);
|
||||||
|
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
|
||||||
|
frame->setUserString ("ToolTipType", "ItemPtr");
|
||||||
|
frame->setUserData(item);
|
||||||
|
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||||
|
|
||||||
|
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||||
|
std::string path = std::string("icons\\");
|
||||||
|
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
image->setImageTexture (path);
|
||||||
|
image->setNeedMouseFocus (false);
|
||||||
|
|
||||||
|
mMagicSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onAssignMagic (const std::string& spellId)
|
||||||
|
{
|
||||||
|
MyGUI::Button* button = mQuickKeyButtons[mSelectedIndex];
|
||||||
|
while (button->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (button->getChildAt(0));
|
||||||
|
|
||||||
|
button->setUserData(Type_Magic);
|
||||||
|
|
||||||
|
MyGUI::ImageBox* frame = button->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(9, 8, 42, 42), MyGUI::Align::Default);
|
||||||
|
std::string backgroundTex = "textures\\menu_icon_select_magic.dds";
|
||||||
|
frame->setImageTexture (backgroundTex);
|
||||||
|
frame->setImageCoord (MyGUI::IntCoord(2, 2, 40, 40));
|
||||||
|
frame->setUserString ("ToolTipType", "Spell");
|
||||||
|
frame->setUserString ("Spell", spellId);
|
||||||
|
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
|
||||||
|
|
||||||
|
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||||
|
|
||||||
|
// use the icon of the first effect
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||||
|
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
|
||||||
|
std::string path = effect->icon;
|
||||||
|
int slashPos = path.find("\\");
|
||||||
|
path.insert(slashPos+1, "b_");
|
||||||
|
path = std::string("icons\\") + path;
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
|
||||||
|
image->setImageTexture (path);
|
||||||
|
image->setNeedMouseFocus (false);
|
||||||
|
|
||||||
|
mMagicSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::onAssignMagicCancel ()
|
||||||
|
{
|
||||||
|
mMagicSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickKeysMenu::activateQuickKey(int index)
|
||||||
|
{
|
||||||
|
MyGUI::Button* button = mQuickKeyButtons[index-1];
|
||||||
|
|
||||||
|
QuickKeyType type = *button->getUserData<QuickKeyType>();
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||||
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||||
|
MWMechanics::Spells& spells = stats.getSpells();
|
||||||
|
|
||||||
|
if (type == Type_Magic)
|
||||||
|
{
|
||||||
|
std::string spellId = button->getChildAt(0)->getUserString("Spell");
|
||||||
|
spells.setSelectedSpell(spellId);
|
||||||
|
store.setSelectedEnchantItem(store.end());
|
||||||
|
mWindowManager.setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
|
||||||
|
}
|
||||||
|
else if (type == Type_Item)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
|
||||||
|
|
||||||
|
// make sure the item is available
|
||||||
|
if (item.getRefData ().getCount() == 0)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager ()->messageBox (
|
||||||
|
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(item).use(item);
|
||||||
|
|
||||||
|
action->execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
|
||||||
|
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||||
|
// the "Take" button should not be visible.
|
||||||
|
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
|
||||||
|
// without screwing up future book windows
|
||||||
|
mWindowManager.getBookWindow()->setTakeButtonShow(false);
|
||||||
|
mWindowManager.getScrollWindow()->setTakeButtonShow(false);
|
||||||
|
|
||||||
|
// since we changed equipping status, update the inventory window
|
||||||
|
mWindowManager.getInventoryWindow()->drawItems();
|
||||||
|
}
|
||||||
|
else if (type == Type_MagicItem)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr item = *button->getChildAt (0)->getUserData<MWWorld::Ptr>();
|
||||||
|
|
||||||
|
// make sure the item is available
|
||||||
|
if (item.getRefData ().getCount() == 0)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager ()->messageBox (
|
||||||
|
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// retrieve ContainerStoreIterator to the item
|
||||||
|
MWWorld::ContainerStoreIterator it = store.begin();
|
||||||
|
for (; it != store.end(); ++it)
|
||||||
|
{
|
||||||
|
if (*it == item)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(it != store.end());
|
||||||
|
|
||||||
|
// equip, if it can be equipped
|
||||||
|
if (!MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||||
|
{
|
||||||
|
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||||
|
|
||||||
|
MWWorld::ActionEquip action(item);
|
||||||
|
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||||
|
|
||||||
|
// since we changed equipping status, update the inventory window
|
||||||
|
mWindowManager.getInventoryWindow()->drawItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
store.setSelectedEnchantItem(it);
|
||||||
|
spells.setSelectedSpell("");
|
||||||
|
mWindowManager.setSelectedEnchantItem(item, 100); /// \todo track charge %
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
QuickKeysMenuAssign::QuickKeysMenuAssign (MWBase::WindowManager &parWindowManager, QuickKeysMenu* parent)
|
||||||
|
: WindowModal("openmw_quickkeys_menu_assign.layout", parWindowManager)
|
||||||
|
, mParent(parent)
|
||||||
|
{
|
||||||
|
getWidget(mLabel, "Label");
|
||||||
|
getWidget(mItemButton, "ItemButton");
|
||||||
|
getWidget(mMagicButton, "MagicButton");
|
||||||
|
getWidget(mUnassignButton, "UnassignButton");
|
||||||
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
|
||||||
|
mItemButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onItemButtonClicked);
|
||||||
|
mMagicButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onMagicButtonClicked);
|
||||||
|
mUnassignButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onUnassignButtonClicked);
|
||||||
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onCancelButtonClicked);
|
||||||
|
|
||||||
|
|
||||||
|
int maxWidth = mItemButton->getTextSize ().width + 24;
|
||||||
|
maxWidth = std::max(maxWidth, mMagicButton->getTextSize ().width + 24);
|
||||||
|
maxWidth = std::max(maxWidth, mUnassignButton->getTextSize ().width + 24);
|
||||||
|
maxWidth = std::max(maxWidth, mCancelButton->getTextSize ().width + 24);
|
||||||
|
|
||||||
|
mMainWidget->setSize(maxWidth + 24, mMainWidget->getHeight());
|
||||||
|
mLabel->setSize(maxWidth, mLabel->getHeight());
|
||||||
|
|
||||||
|
mItemButton->setCoord((maxWidth - mItemButton->getTextSize().width-24)/2 + 8,
|
||||||
|
mItemButton->getTop(),
|
||||||
|
mItemButton->getTextSize().width + 24,
|
||||||
|
mItemButton->getHeight());
|
||||||
|
mMagicButton->setCoord((maxWidth - mMagicButton->getTextSize().width-24)/2 + 8,
|
||||||
|
mMagicButton->getTop(),
|
||||||
|
mMagicButton->getTextSize().width + 24,
|
||||||
|
mMagicButton->getHeight());
|
||||||
|
mUnassignButton->setCoord((maxWidth - mUnassignButton->getTextSize().width-24)/2 + 8,
|
||||||
|
mUnassignButton->getTop(),
|
||||||
|
mUnassignButton->getTextSize().width + 24,
|
||||||
|
mUnassignButton->getHeight());
|
||||||
|
mCancelButton->setCoord((maxWidth - mCancelButton->getTextSize().width-24)/2 + 8,
|
||||||
|
mCancelButton->getTop(),
|
||||||
|
mCancelButton->getTextSize().width + 24,
|
||||||
|
mCancelButton->getHeight());
|
||||||
|
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MagicSelectionDialog::MagicSelectionDialog(MWBase::WindowManager &parWindowManager, QuickKeysMenu* parent)
|
||||||
|
: WindowModal("openmw_magicselection_dialog.layout", parWindowManager)
|
||||||
|
, mParent(parent)
|
||||||
|
, mWidth(0)
|
||||||
|
, mHeight(0)
|
||||||
|
{
|
||||||
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
getWidget(mMagicList, "MagicList");
|
||||||
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onCancelButtonClicked);
|
||||||
|
|
||||||
|
int dx = (mCancelButton->getTextSize().width + 24) - mCancelButton->getWidth();
|
||||||
|
mCancelButton->setCoord(mCancelButton->getLeft() - dx,
|
||||||
|
mCancelButton->getTop(),
|
||||||
|
mCancelButton->getTextSize ().width + 24,
|
||||||
|
mCancelButton->getHeight());
|
||||||
|
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MagicSelectionDialog::onCancelButtonClicked (MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
mParent->onAssignMagicCancel ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MagicSelectionDialog::open ()
|
||||||
|
{
|
||||||
|
WindowModal::open();
|
||||||
|
|
||||||
|
while (mMagicList->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (mMagicList->getChildAt (0));
|
||||||
|
|
||||||
|
mHeight = 0;
|
||||||
|
|
||||||
|
const int spellHeight = 18;
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||||
|
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||||
|
MWMechanics::Spells& spells = stats.getSpells();
|
||||||
|
|
||||||
|
/// \todo lots of copy&pasted code from SpellWindow
|
||||||
|
|
||||||
|
// retrieve powers & spells, sort by name
|
||||||
|
std::vector<std::string> spellList;
|
||||||
|
|
||||||
|
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||||
|
{
|
||||||
|
spellList.push_back(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> powers;
|
||||||
|
std::vector<std::string>::iterator it = spellList.begin();
|
||||||
|
while (it != spellList.end())
|
||||||
|
{
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||||
|
if (spell->data.type == ESM::Spell::ST_Power)
|
||||||
|
{
|
||||||
|
powers.push_back(*it);
|
||||||
|
it = spellList.erase(it);
|
||||||
|
}
|
||||||
|
else if (spell->data.type == ESM::Spell::ST_Ability
|
||||||
|
|| spell->data.type == ESM::Spell::ST_Blight
|
||||||
|
|| spell->data.type == ESM::Spell::ST_Curse
|
||||||
|
|| spell->data.type == ESM::Spell::ST_Disease)
|
||||||
|
{
|
||||||
|
it = spellList.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
std::sort(powers.begin(), powers.end(), sortSpells);
|
||||||
|
std::sort(spellList.begin(), spellList.end(), sortSpells);
|
||||||
|
|
||||||
|
// retrieve usable magic items & sort
|
||||||
|
std::vector<MWWorld::Ptr> items;
|
||||||
|
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
|
||||||
|
{
|
||||||
|
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
|
||||||
|
if (enchantId != "")
|
||||||
|
{
|
||||||
|
// only add items with "Cast once" or "Cast on use"
|
||||||
|
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
|
||||||
|
int type = enchant->data.type;
|
||||||
|
if (type != ESM::Enchantment::CastOnce
|
||||||
|
&& type != ESM::Enchantment::WhenUsed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
items.push_back(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::sort(items.begin(), items.end(), sortItems);
|
||||||
|
|
||||||
|
|
||||||
|
int height = estimateHeight(items.size() + powers.size() + spellList.size());
|
||||||
|
bool scrollVisible = height > mMagicList->getHeight();
|
||||||
|
mWidth = mMagicList->getWidth() - scrollVisible * 18;
|
||||||
|
|
||||||
|
|
||||||
|
// powers
|
||||||
|
addGroup("#{sPowers}", "");
|
||||||
|
|
||||||
|
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
|
||||||
|
{
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||||
|
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||||
|
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
t->setCaption(spell->name);
|
||||||
|
t->setTextAlign(MyGUI::Align::Left);
|
||||||
|
t->setUserString("ToolTipType", "Spell");
|
||||||
|
t->setUserString("Spell", *it);
|
||||||
|
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||||
|
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onSpellSelected);
|
||||||
|
|
||||||
|
mHeight += spellHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// other spells
|
||||||
|
addGroup("#{sSpells}", "");
|
||||||
|
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
|
||||||
|
{
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||||
|
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||||
|
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
t->setCaption(spell->name);
|
||||||
|
t->setTextAlign(MyGUI::Align::Left);
|
||||||
|
t->setUserString("ToolTipType", "Spell");
|
||||||
|
t->setUserString("Spell", *it);
|
||||||
|
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||||
|
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onSpellSelected);
|
||||||
|
|
||||||
|
mHeight += spellHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// enchanted items
|
||||||
|
addGroup("#{sMagicItem}", "");
|
||||||
|
|
||||||
|
for (std::vector<MWWorld::Ptr>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr item = *it;
|
||||||
|
|
||||||
|
// check if the item is currently equipped (will display in a different color)
|
||||||
|
bool equipped = false;
|
||||||
|
for (int i=0; i < MWWorld::InventoryStore::Slots; ++i)
|
||||||
|
{
|
||||||
|
if (store.getSlot(i) != store.end() && *store.getSlot(i) == item)
|
||||||
|
{
|
||||||
|
equipped = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
|
||||||
|
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
t->setCaption(MWWorld::Class::get(item).getName(item));
|
||||||
|
t->setTextAlign(MyGUI::Align::Left);
|
||||||
|
t->setUserData(item);
|
||||||
|
t->setUserString("ToolTipType", "ItemPtr");
|
||||||
|
t->eventMouseButtonClick += MyGUI::newDelegate(this, &MagicSelectionDialog::onEnchantedItemSelected);
|
||||||
|
t->eventMouseWheel += MyGUI::newDelegate(this, &MagicSelectionDialog::onMouseWheel);
|
||||||
|
|
||||||
|
mHeight += spellHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mMagicList->setCanvasSize (mWidth, std::max(mMagicList->getHeight(), mHeight));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MagicSelectionDialog::addGroup(const std::string &label, const std::string& label2)
|
||||||
|
{
|
||||||
|
if (mMagicList->getChildCount() > 0)
|
||||||
|
{
|
||||||
|
MyGUI::ImageBox* separator = mMagicList->createWidget<MyGUI::ImageBox>("MW_HLine",
|
||||||
|
MyGUI::IntCoord(4, mHeight, mWidth-8, 18),
|
||||||
|
MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
separator->setNeedMouseFocus(false);
|
||||||
|
mHeight += 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyGUI::TextBox* groupWidget = mMagicList->createWidget<MyGUI::TextBox>("SandBrightText",
|
||||||
|
MyGUI::IntCoord(0, mHeight, mWidth, 24),
|
||||||
|
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
|
||||||
|
groupWidget->setCaptionWithReplacing(label);
|
||||||
|
groupWidget->setTextAlign(MyGUI::Align::Left);
|
||||||
|
groupWidget->setNeedMouseFocus(false);
|
||||||
|
|
||||||
|
if (label2 != "")
|
||||||
|
{
|
||||||
|
MyGUI::TextBox* groupWidget2 = mMagicList->createWidget<MyGUI::TextBox>("SandBrightText",
|
||||||
|
MyGUI::IntCoord(0, mHeight, mWidth-4, 24),
|
||||||
|
MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
groupWidget2->setCaptionWithReplacing(label2);
|
||||||
|
groupWidget2->setTextAlign(MyGUI::Align::Right);
|
||||||
|
groupWidget2->setNeedMouseFocus(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mHeight += 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MagicSelectionDialog::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
|
{
|
||||||
|
if (mMagicList->getViewOffset().top + _rel*0.3 > 0)
|
||||||
|
mMagicList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
|
else
|
||||||
|
mMagicList->setViewOffset(MyGUI::IntPoint(0, mMagicList->getViewOffset().top + _rel*0.3));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MagicSelectionDialog::onEnchantedItemSelected(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>();
|
||||||
|
|
||||||
|
mParent->onAssignMagicItem (item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MagicSelectionDialog::onSpellSelected(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
mParent->onAssignMagic (_sender->getUserString("Spell"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int MagicSelectionDialog::estimateHeight(int numSpells) const
|
||||||
|
{
|
||||||
|
int height = 0;
|
||||||
|
height += 24 * 3 + 18 * 2; // group headings
|
||||||
|
height += numSpells * 18;
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
107
apps/openmw/mwgui/quickkeysmenu.hpp
Normal file
107
apps/openmw/mwgui/quickkeysmenu.hpp
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#ifndef MWGUI_QUICKKEYS_H
|
||||||
|
#define MWGUI_QUICKKEYS_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "window_base.hpp"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
class QuickKeysMenuAssign;
|
||||||
|
class ItemSelectionDialog;
|
||||||
|
class MagicSelectionDialog;
|
||||||
|
|
||||||
|
class QuickKeysMenu : public WindowBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QuickKeysMenu(MWBase::WindowManager& parWindowManager);
|
||||||
|
~QuickKeysMenu();
|
||||||
|
|
||||||
|
|
||||||
|
void onItemButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onMagicButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onUnassignButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
|
|
||||||
|
void onAssignItem (MWWorld::Ptr item);
|
||||||
|
void onAssignItemCancel ();
|
||||||
|
void onAssignMagicItem (MWWorld::Ptr item);
|
||||||
|
void onAssignMagic (const std::string& spellId);
|
||||||
|
void onAssignMagicCancel ();
|
||||||
|
|
||||||
|
void activateQuickKey(int index);
|
||||||
|
|
||||||
|
enum QuickKeyType
|
||||||
|
{
|
||||||
|
Type_Item,
|
||||||
|
Type_Magic,
|
||||||
|
Type_MagicItem,
|
||||||
|
Type_Unassigned
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
MyGUI::EditBox* mInstructionLabel;
|
||||||
|
MyGUI::Button* mOkButton;
|
||||||
|
|
||||||
|
std::vector<MyGUI::Button*> mQuickKeyButtons;
|
||||||
|
|
||||||
|
QuickKeysMenuAssign* mAssignDialog;
|
||||||
|
ItemSelectionDialog* mItemSelectionDialog;
|
||||||
|
MagicSelectionDialog* mMagicSelectionDialog;
|
||||||
|
|
||||||
|
int mSelectedIndex;
|
||||||
|
|
||||||
|
|
||||||
|
void onQuickKeyButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onOkButtonClicked(MyGUI::Widget* sender);
|
||||||
|
|
||||||
|
void unassign(MyGUI::Widget* key, int index);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QuickKeysMenuAssign : public WindowModal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QuickKeysMenuAssign(MWBase::WindowManager& parWindowManager, QuickKeysMenu* parent);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MyGUI::TextBox* mLabel;
|
||||||
|
MyGUI::Button* mItemButton;
|
||||||
|
MyGUI::Button* mMagicButton;
|
||||||
|
MyGUI::Button* mUnassignButton;
|
||||||
|
MyGUI::Button* mCancelButton;
|
||||||
|
|
||||||
|
QuickKeysMenu* mParent;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MagicSelectionDialog : public WindowModal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MagicSelectionDialog(MWBase::WindowManager& parWindowManager, QuickKeysMenu* parent);
|
||||||
|
|
||||||
|
virtual void open();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MyGUI::Button* mCancelButton;
|
||||||
|
MyGUI::ScrollView* mMagicList;
|
||||||
|
|
||||||
|
int mWidth;
|
||||||
|
int mHeight;
|
||||||
|
|
||||||
|
QuickKeysMenu* mParent;
|
||||||
|
|
||||||
|
void onCancelButtonClicked (MyGUI::Widget* sender);
|
||||||
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
|
void onEnchantedItemSelected(MyGUI::Widget* _sender);
|
||||||
|
void onSpellSelected(MyGUI::Widget* _sender);
|
||||||
|
int estimateHeight(int numSpells) const;
|
||||||
|
|
||||||
|
|
||||||
|
void addGroup(const std::string& label, const std::string& label2);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -113,7 +113,6 @@ void RaceDialog::open()
|
||||||
updateRaces();
|
updateRaces();
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MWGui
|
||||||
// setHair()
|
// setHair()
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -110,7 +110,6 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
|
||||||
void ReviewDialog::open()
|
void ReviewDialog::open()
|
||||||
{
|
{
|
||||||
updateSkillArea();
|
updateSkillArea();
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
void ReviewDialog::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace MWGui
|
||||||
void configureSkills(const SkillList& major, const SkillList& minor);
|
void configureSkills(const SkillList& major, const SkillList& minor);
|
||||||
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
|
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
|
||||||
|
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
#include "../mwworld/actionequip.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/spells.hpp"
|
#include "../mwmechanics/spells.hpp"
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
@ -350,34 +351,10 @@ namespace MWGui
|
||||||
if (_sender->getUserString("Equipped") == "false"
|
if (_sender->getUserString("Equipped") == "false"
|
||||||
&& !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
&& !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
|
||||||
{
|
{
|
||||||
// sound
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound(MWWorld::Class::get(item).getUpSoundId(item), 1.0, 1.0);
|
|
||||||
|
|
||||||
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
// Note: can't use Class::use here because enchanted scrolls for example would then open the scroll window instead of equipping
|
||||||
|
|
||||||
/// \todo the following code is pretty much copy&paste from ActionEquip, put it in a function?
|
MWWorld::ActionEquip action(item);
|
||||||
// slots that this item can be equipped in
|
action.execute (MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ());
|
||||||
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(item).getEquipmentSlots(item);
|
|
||||||
|
|
||||||
// equip the item in the first free slot
|
|
||||||
for (std::vector<int>::const_iterator slot=slots.first.begin();
|
|
||||||
slot!=slots.first.end(); ++slot)
|
|
||||||
{
|
|
||||||
// if all slots are occupied, replace the last slot
|
|
||||||
if (slot == --slots.first.end())
|
|
||||||
{
|
|
||||||
store.equip(*slot, it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (store.getSlot(*slot) == store.end())
|
|
||||||
{
|
|
||||||
// slot is not occupied
|
|
||||||
store.equip(*slot, it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// \todo scripts?
|
|
||||||
|
|
||||||
// since we changed equipping status, update the inventory window
|
// since we changed equipping status, update the inventory window
|
||||||
mWindowManager.getInventoryWindow()->drawItems();
|
mWindowManager.getInventoryWindow()->drawItems();
|
||||||
|
|
|
@ -45,7 +45,6 @@ void TextInputDialog::open()
|
||||||
{
|
{
|
||||||
// Make sure the edit box has focus
|
// Make sure the edit box has focus
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MWGui
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void setTextLabel(const std::string &label);
|
void setTextLabel(const std::string &label);
|
||||||
void open();
|
virtual void open();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onOkClicked(MyGUI::Widget* _sender);
|
void onOkClicked(MyGUI::Widget* _sender);
|
||||||
|
|
|
@ -12,17 +12,15 @@ WindowBase::WindowBase(const std::string& parLayout, MWBase::WindowManager& parW
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBase::open()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowBase::setVisible(bool visible)
|
void WindowBase::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
bool wasVisible = mMainWidget->getVisible();
|
bool wasVisible = mMainWidget->getVisible();
|
||||||
mMainWidget->setVisible(visible);
|
mMainWidget->setVisible(visible);
|
||||||
|
|
||||||
if (!wasVisible && visible)
|
if (visible)
|
||||||
open();
|
open();
|
||||||
|
else if (wasVisible && !visible)
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBase::center()
|
void WindowBase::center()
|
||||||
|
@ -40,3 +38,18 @@ void WindowBase::center()
|
||||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||||
mMainWidget->setCoord(coord);
|
mMainWidget->setCoord(coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowModal::WindowModal(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
||||||
|
: WindowBase(parLayout, parWindowManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowModal::open()
|
||||||
|
{
|
||||||
|
MyGUI::InputManager::getInstance ().addWidgetModal (mMainWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowModal::close()
|
||||||
|
{
|
||||||
|
MyGUI::InputManager::getInstance ().removeWidgetModal (mMainWidget);
|
||||||
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@ namespace MWGui
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
|
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
|
||||||
|
|
||||||
virtual void open();
|
virtual void open() {}
|
||||||
virtual void setVisible(bool visible); // calls open() if visible is true and was false before
|
virtual void close () {}
|
||||||
|
virtual void setVisible(bool visible);
|
||||||
void center();
|
void center();
|
||||||
|
|
||||||
/** Event : Dialog finished, OK button clicked.\n
|
/** Event : Dialog finished, OK button clicked.\n
|
||||||
|
@ -33,6 +34,18 @@ namespace MWGui
|
||||||
/// \todo remove
|
/// \todo remove
|
||||||
MWBase::WindowManager& mWindowManager;
|
MWBase::WindowManager& mWindowManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "Modal" windows cause the rest of the interface to be unaccessible while they are visible
|
||||||
|
*/
|
||||||
|
class WindowModal : public WindowBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WindowModal(const std::string& parLayout, MWBase::WindowManager& parWindowManager);
|
||||||
|
virtual void open();
|
||||||
|
virtual void close();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "confirmationdialog.hpp"
|
#include "confirmationdialog.hpp"
|
||||||
#include "alchemywindow.hpp"
|
#include "alchemywindow.hpp"
|
||||||
#include "spellwindow.hpp"
|
#include "spellwindow.hpp"
|
||||||
|
#include "quickkeysmenu.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -133,6 +134,7 @@ WindowManager::WindowManager(
|
||||||
mConfirmationDialog = new ConfirmationDialog(*this);
|
mConfirmationDialog = new ConfirmationDialog(*this);
|
||||||
mAlchemyWindow = new AlchemyWindow(*this);
|
mAlchemyWindow = new AlchemyWindow(*this);
|
||||||
mSpellWindow = new SpellWindow(*this);
|
mSpellWindow = new SpellWindow(*this);
|
||||||
|
mQuickKeysMenu = new QuickKeysMenu(*this);
|
||||||
|
|
||||||
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows","");
|
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows","");
|
||||||
|
|
||||||
|
@ -226,6 +228,7 @@ void WindowManager::updateVisible()
|
||||||
mSettingsWindow->setVisible(false);
|
mSettingsWindow->setVisible(false);
|
||||||
mAlchemyWindow->setVisible(false);
|
mAlchemyWindow->setVisible(false);
|
||||||
mSpellWindow->setVisible(false);
|
mSpellWindow->setVisible(false);
|
||||||
|
mQuickKeysMenu->setVisible(false);
|
||||||
|
|
||||||
// Mouse is visible whenever we're not in game mode
|
// Mouse is visible whenever we're not in game mode
|
||||||
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
|
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
|
||||||
|
@ -254,6 +257,9 @@ void WindowManager::updateVisible()
|
||||||
GuiMode mode = mGuiModes.back();
|
GuiMode mode = mGuiModes.back();
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
|
case GM_QuickKeysMenu:
|
||||||
|
mQuickKeysMenu->setVisible (true);
|
||||||
|
break;
|
||||||
case GM_MainMenu:
|
case GM_MainMenu:
|
||||||
mMenu->setVisible(true);
|
mMenu->setVisible(true);
|
||||||
break;
|
break;
|
||||||
|
@ -312,7 +318,6 @@ void WindowManager::updateVisible()
|
||||||
break;
|
break;
|
||||||
case GM_Journal:
|
case GM_Journal:
|
||||||
mJournal->setVisible(true);
|
mJournal->setVisible(true);
|
||||||
mJournal->open();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Unsupported mode, switch back to game
|
// Unsupported mode, switch back to game
|
||||||
|
@ -652,6 +657,7 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
|
||||||
mAlchemyWindow->center();
|
mAlchemyWindow->center();
|
||||||
mScrollWindow->center();
|
mScrollWindow->center();
|
||||||
mBookWindow->center();
|
mBookWindow->center();
|
||||||
|
mQuickKeysMenu->center();
|
||||||
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
|
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
|
||||||
mInputBlocker->setSize(MyGUI::IntSize(x,y));
|
mInputBlocker->setSize(MyGUI::IntSize(x,y));
|
||||||
}
|
}
|
||||||
|
@ -848,7 +854,13 @@ void WindowManager::notifyInputActionBound ()
|
||||||
allowMouse();
|
allowMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WindowManager::showCrosshair (bool show)
|
void WindowManager::showCrosshair (bool show)
|
||||||
{
|
{
|
||||||
mHud->setCrosshairVisible (show);
|
mHud->setCrosshairVisible (show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::activateQuickKey (int index)
|
||||||
|
{
|
||||||
|
mQuickKeysMenu->activateQuickKey(index);
|
||||||
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace MWGui
|
||||||
class MessageBoxManager;
|
class MessageBoxManager;
|
||||||
class SettingsWindow;
|
class SettingsWindow;
|
||||||
class AlchemyWindow;
|
class AlchemyWindow;
|
||||||
|
class QuickKeysMenu;
|
||||||
|
|
||||||
class WindowManager : public MWBase::WindowManager
|
class WindowManager : public MWBase::WindowManager
|
||||||
{
|
{
|
||||||
|
@ -151,6 +152,8 @@ namespace MWGui
|
||||||
virtual void setWeaponVisibility(bool visible);
|
virtual void setWeaponVisibility(bool visible);
|
||||||
virtual void setSpellVisibility(bool visible);
|
virtual void setSpellVisibility(bool visible);
|
||||||
|
|
||||||
|
virtual void activateQuickKey (int index);
|
||||||
|
|
||||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent);
|
||||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
||||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
||||||
|
@ -211,6 +214,7 @@ namespace MWGui
|
||||||
ConfirmationDialog* mConfirmationDialog;
|
ConfirmationDialog* mConfirmationDialog;
|
||||||
AlchemyWindow* mAlchemyWindow;
|
AlchemyWindow* mAlchemyWindow;
|
||||||
SpellWindow* mSpellWindow;
|
SpellWindow* mSpellWindow;
|
||||||
|
QuickKeysMenu* mQuickKeysMenu;
|
||||||
|
|
||||||
CharacterCreation* mCharGen;
|
CharacterCreation* mCharGen;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#include <MyGUI_InputManager.h>
|
#include <MyGUI_InputManager.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
#include <MyGUI_Widget.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
|
|
||||||
|
@ -21,6 +23,7 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWInput
|
namespace MWInput
|
||||||
{
|
{
|
||||||
|
@ -190,7 +193,40 @@ namespace MWInput
|
||||||
case A_ToggleSpell:
|
case A_ToggleSpell:
|
||||||
toggleSpell ();
|
toggleSpell ();
|
||||||
break;
|
break;
|
||||||
}
|
case A_QuickKey1:
|
||||||
|
quickKey(1);
|
||||||
|
break;
|
||||||
|
case A_QuickKey2:
|
||||||
|
quickKey(2);
|
||||||
|
break;
|
||||||
|
case A_QuickKey3:
|
||||||
|
quickKey(3);
|
||||||
|
break;
|
||||||
|
case A_QuickKey4:
|
||||||
|
quickKey(4);
|
||||||
|
break;
|
||||||
|
case A_QuickKey5:
|
||||||
|
quickKey(5);
|
||||||
|
break;
|
||||||
|
case A_QuickKey6:
|
||||||
|
quickKey(6);
|
||||||
|
break;
|
||||||
|
case A_QuickKey7:
|
||||||
|
quickKey(7);
|
||||||
|
break;
|
||||||
|
case A_QuickKey8:
|
||||||
|
quickKey(8);
|
||||||
|
break;
|
||||||
|
case A_QuickKey9:
|
||||||
|
quickKey(9);
|
||||||
|
break;
|
||||||
|
case A_QuickKey10:
|
||||||
|
quickKey(10);
|
||||||
|
break;
|
||||||
|
case A_QuickKeysMenu:
|
||||||
|
showQuickKeysMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +437,15 @@ namespace MWInput
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
MyGUI::InputManager::getInstance().injectMousePress(mMouseX, mMouseY, MyGUI::MouseButton::Enum(id));
|
||||||
|
|
||||||
|
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
|
||||||
|
{
|
||||||
|
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,6 +584,17 @@ namespace MWInput
|
||||||
// .. but don't touch any other mode.
|
// .. but don't touch any other mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputManager::quickKey (int index)
|
||||||
|
{
|
||||||
|
mWindows.activateQuickKey (index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputManager::showQuickKeysMenu()
|
||||||
|
{
|
||||||
|
if (!mWindows.isGuiMode ())
|
||||||
|
mWindows.pushGuiMode (MWGui::GM_QuickKeysMenu);
|
||||||
|
}
|
||||||
|
|
||||||
void InputManager::activate()
|
void InputManager::activate()
|
||||||
{
|
{
|
||||||
mEngine.activate();
|
mEngine.activate();
|
||||||
|
@ -600,7 +656,8 @@ namespace MWInput
|
||||||
defaultKeyBindings[A_MoveRight] = OIS::KC_D;
|
defaultKeyBindings[A_MoveRight] = OIS::KC_D;
|
||||||
defaultKeyBindings[A_ToggleWeapon] = OIS::KC_F;
|
defaultKeyBindings[A_ToggleWeapon] = OIS::KC_F;
|
||||||
defaultKeyBindings[A_ToggleSpell] = OIS::KC_R;
|
defaultKeyBindings[A_ToggleSpell] = OIS::KC_R;
|
||||||
defaultKeyBindings[A_Console] = OIS::KC_F1;
|
defaultKeyBindings[A_QuickKeysMenu] = OIS::KC_F1;
|
||||||
|
defaultKeyBindings[A_Console] = OIS::KC_F2;
|
||||||
defaultKeyBindings[A_Crouch] = OIS::KC_LCONTROL;
|
defaultKeyBindings[A_Crouch] = OIS::KC_LCONTROL;
|
||||||
defaultKeyBindings[A_AutoMove] = OIS::KC_Q;
|
defaultKeyBindings[A_AutoMove] = OIS::KC_Q;
|
||||||
defaultKeyBindings[A_Jump] = OIS::KC_E;
|
defaultKeyBindings[A_Jump] = OIS::KC_E;
|
||||||
|
@ -608,9 +665,21 @@ namespace MWInput
|
||||||
defaultKeyBindings[A_Rest] = OIS::KC_T;
|
defaultKeyBindings[A_Rest] = OIS::KC_T;
|
||||||
defaultKeyBindings[A_GameMenu] = OIS::KC_ESCAPE;
|
defaultKeyBindings[A_GameMenu] = OIS::KC_ESCAPE;
|
||||||
defaultKeyBindings[A_TogglePOV] = OIS::KC_TAB;
|
defaultKeyBindings[A_TogglePOV] = OIS::KC_TAB;
|
||||||
|
defaultKeyBindings[A_QuickKey1] = OIS::KC_1;
|
||||||
|
defaultKeyBindings[A_QuickKey2] = OIS::KC_2;
|
||||||
|
defaultKeyBindings[A_QuickKey3] = OIS::KC_3;
|
||||||
|
defaultKeyBindings[A_QuickKey4] = OIS::KC_4;
|
||||||
|
defaultKeyBindings[A_QuickKey5] = OIS::KC_5;
|
||||||
|
defaultKeyBindings[A_QuickKey6] = OIS::KC_6;
|
||||||
|
defaultKeyBindings[A_QuickKey7] = OIS::KC_7;
|
||||||
|
defaultKeyBindings[A_QuickKey8] = OIS::KC_8;
|
||||||
|
defaultKeyBindings[A_QuickKey9] = OIS::KC_9;
|
||||||
|
defaultKeyBindings[A_QuickKey10] = OIS::KC_0;
|
||||||
|
defaultKeyBindings[A_Screenshot] = OIS::KC_SYSRQ;
|
||||||
|
|
||||||
std::map<int, int> defaultMouseButtonBindings;
|
std::map<int, int> defaultMouseButtonBindings;
|
||||||
defaultMouseButtonBindings[A_Inventory] = OIS::MB_Right;
|
defaultMouseButtonBindings[A_Inventory] = OIS::MB_Right;
|
||||||
|
defaultMouseButtonBindings[A_Use] = OIS::MB_Left;
|
||||||
|
|
||||||
for (int i = 0; i < A_Last; ++i)
|
for (int i = 0; i < A_Last; ++i)
|
||||||
{
|
{
|
||||||
|
@ -627,7 +696,10 @@ namespace MWInput
|
||||||
control = mInputCtrl->getChannel(i)->getAttachedControls ().front().control;
|
control = mInputCtrl->getChannel(i)->getAttachedControls ().front().control;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!controlExists || force)
|
if (!controlExists || force ||
|
||||||
|
( mInputCtrl->getKeyBinding (control, ICS::Control::INCREASE) == OIS::KC_UNASSIGNED
|
||||||
|
&& mInputCtrl->getMouseButtonBinding (control, ICS::Control::INCREASE) == ICS_MAX_DEVICE_BUTTONS
|
||||||
|
))
|
||||||
{
|
{
|
||||||
clearAllBindings (control);
|
clearAllBindings (control);
|
||||||
|
|
||||||
|
@ -658,6 +730,17 @@ namespace MWInput
|
||||||
descriptions[A_Rest] = "sRestKey";
|
descriptions[A_Rest] = "sRestKey";
|
||||||
descriptions[A_Inventory] = "sInventory";
|
descriptions[A_Inventory] = "sInventory";
|
||||||
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
||||||
|
descriptions[A_QuickKeysMenu] = "sQuickMenu";
|
||||||
|
descriptions[A_QuickKey1] = "sQuick1Cmd";
|
||||||
|
descriptions[A_QuickKey2] = "sQuick2Cmd";
|
||||||
|
descriptions[A_QuickKey3] = "sQuick3Cmd";
|
||||||
|
descriptions[A_QuickKey4] = "sQuick4Cmd";
|
||||||
|
descriptions[A_QuickKey5] = "sQuick5Cmd";
|
||||||
|
descriptions[A_QuickKey6] = "sQuick6Cmd";
|
||||||
|
descriptions[A_QuickKey7] = "sQuick7Cmd";
|
||||||
|
descriptions[A_QuickKey8] = "sQuick8Cmd";
|
||||||
|
descriptions[A_QuickKey9] = "sQuick9Cmd";
|
||||||
|
descriptions[A_QuickKey10] = "sQuick10Cmd";
|
||||||
|
|
||||||
if (descriptions[action] == "")
|
if (descriptions[action] == "")
|
||||||
return ""; // not configurable
|
return ""; // not configurable
|
||||||
|
@ -698,6 +781,17 @@ namespace MWInput
|
||||||
ret.push_back(A_Journal);
|
ret.push_back(A_Journal);
|
||||||
ret.push_back(A_Rest);
|
ret.push_back(A_Rest);
|
||||||
ret.push_back(A_Console);
|
ret.push_back(A_Console);
|
||||||
|
ret.push_back(A_QuickKeysMenu);
|
||||||
|
ret.push_back(A_QuickKey1);
|
||||||
|
ret.push_back(A_QuickKey2);
|
||||||
|
ret.push_back(A_QuickKey3);
|
||||||
|
ret.push_back(A_QuickKey4);
|
||||||
|
ret.push_back(A_QuickKey5);
|
||||||
|
ret.push_back(A_QuickKey6);
|
||||||
|
ret.push_back(A_QuickKey7);
|
||||||
|
ret.push_back(A_QuickKey8);
|
||||||
|
ret.push_back(A_QuickKey9);
|
||||||
|
ret.push_back(A_QuickKey10);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,9 @@ namespace MWInput
|
||||||
void toggleAutoMove();
|
void toggleAutoMove();
|
||||||
void exitNow();
|
void exitNow();
|
||||||
|
|
||||||
|
void quickKey (int index);
|
||||||
|
void showQuickKeysMenu();
|
||||||
|
|
||||||
bool actionIsActive (int id);
|
bool actionIsActive (int id);
|
||||||
|
|
||||||
void loadKeyDefaults(bool force = false);
|
void loadKeyDefaults(bool force = false);
|
||||||
|
@ -218,6 +221,19 @@ namespace MWInput
|
||||||
|
|
||||||
A_TogglePOV,
|
A_TogglePOV,
|
||||||
|
|
||||||
|
A_QuickKey1,
|
||||||
|
A_QuickKey2,
|
||||||
|
A_QuickKey3,
|
||||||
|
A_QuickKey4,
|
||||||
|
A_QuickKey5,
|
||||||
|
A_QuickKey6,
|
||||||
|
A_QuickKey7,
|
||||||
|
A_QuickKey8,
|
||||||
|
A_QuickKey9,
|
||||||
|
A_QuickKey10,
|
||||||
|
|
||||||
|
A_QuickKeysMenu,
|
||||||
|
|
||||||
A_Last // Marker for the last item
|
A_Last // Marker for the last item
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
#include "npcstats.hpp"
|
#include "npcstats.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
|
|
|
@ -65,6 +65,10 @@ set(MYGUI_FILES
|
||||||
openmw_tooltips.layout
|
openmw_tooltips.layout
|
||||||
openmw_trade_window.layout
|
openmw_trade_window.layout
|
||||||
openmw_windows.skin.xml
|
openmw_windows.skin.xml
|
||||||
|
openmw_quickkeys_menu.layout
|
||||||
|
openmw_quickkeys_menu_assign.layout
|
||||||
|
openmw_itemselection_dialog.layout
|
||||||
|
openmw_magicselection_dialog.layout
|
||||||
smallbars.png
|
smallbars.png
|
||||||
VeraMono.ttf
|
VeraMono.ttf
|
||||||
)
|
)
|
||||||
|
|
20
files/mygui/openmw_itemselection_dialog.layout
Normal file
20
files/mygui/openmw_itemselection_dialog.layout
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="Window" skin="MW_Dialog" position="0 0 380 155" layer="Windows" name="_Main">
|
||||||
|
|
||||||
|
<Widget type="TextBox" skin="SandText" position="8 8 300 18" name="Label"/>
|
||||||
|
|
||||||
|
<Widget type="Widget" skin="MW_Box" position="8 34 355 70" name="box" align="Left Top Stretch">
|
||||||
|
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 347 62" name="ItemView" align="Left Top Stretch">
|
||||||
|
<Property key="CanvasAlign" value="Left Top"/>
|
||||||
|
<Widget type="Button" skin="" name="Items" position="0 0 347 62" name="Items" align="Left Top Stretch"/>
|
||||||
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" position="340 110 24 24" name="CancelButton">
|
||||||
|
<Property key="Caption" value="#{sCancel}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
19
files/mygui/openmw_magicselection_dialog.layout
Normal file
19
files/mygui/openmw_magicselection_dialog.layout
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="Window" skin="MW_Dialog" position="0 0 330 370" layer="Windows" name="_Main">
|
||||||
|
|
||||||
|
<Widget type="TextBox" skin="SandText" position="8 8 292 24">
|
||||||
|
<Property key="Caption" value="Select a magic to quick key."/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Widget" skin="MW_Box" position="8 38 306 285" name="box" align="Left Top Stretch">
|
||||||
|
<Widget type="ScrollView" skin="MW_ScrollView" position="4 4 298 277" name="MagicList" align="Left Top Stretch">
|
||||||
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" name="CancelButton" position="284 330 32 24" align="Right Bottom">
|
||||||
|
<Property key="Caption" value="#{sCancel}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
38
files/mygui/openmw_quickkeys_menu.layout
Normal file
38
files/mygui/openmw_quickkeys_menu.layout
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="Window" skin="MW_Dialog" position="0 0 370 230" layer="Windows" name="_Main">
|
||||||
|
|
||||||
|
<Widget type="TextBox" skin="SandText" position="8 8 354 18">
|
||||||
|
<Property key="Caption" value="#{sQuickMenuTitle}"/>
|
||||||
|
<Property key="TextAlign" value="Center"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="EditBox" skin="SandText" position="8 26 354 18" name="InstructionLabel" align="Left Top VStretch">
|
||||||
|
<Property key="Caption" value="#{sQuickMenuInstruc}"/>
|
||||||
|
<Property key="MultiLine" value="true"/>
|
||||||
|
<Property key="WordWrap" value="true"/>
|
||||||
|
<Property key="Static" value="true"/>
|
||||||
|
<Property key="TextAlign" value="Center"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Widget" skin="" position="15 55 332 128" align="Left Bottom HCenter">
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Box" position="0 0 60 59" name="QuickKey1"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="68 0 60 59" name="QuickKey2"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="136 0 60 59" name="QuickKey3"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="204 0 60 59" name="QuickKey4"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="272 0 60 59" name="QuickKey5"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="0 67 60 59" name="QuickKey6"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="68 67 60 59" name="QuickKey7"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="136 67 60 59" name="QuickKey8"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="204 67 60 59" name="QuickKey9"/>
|
||||||
|
<Widget type="Button" skin="MW_Box" position="272 67 60 59" name="QuickKey10"/>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" name="OKButton" position="315 190 32 24" align="Right Bottom">
|
||||||
|
<Property key="Caption" value="#{sOK}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
28
files/mygui/openmw_quickkeys_menu_assign.layout
Normal file
28
files/mygui/openmw_quickkeys_menu_assign.layout
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="Window" skin="MW_Dialog" position="0 0 16 154" layer="Windows" name="_Main">
|
||||||
|
|
||||||
|
<Widget type="TextBox" skin="SandText" position="8 8 0 18" name="Label">
|
||||||
|
<Property key="Caption" value="#{sQuickMenu1}"/>
|
||||||
|
<Property key="TextAlign" value="Center"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" position="8 28 0 24" name="ItemButton">
|
||||||
|
<Property key="Caption" value="#{sQuickMenu2}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" position="8 56 0 24" name="MagicButton">
|
||||||
|
<Property key="Caption" value="#{sQuickMenu3}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" position="8 84 0 24" name="UnassignButton">
|
||||||
|
<Property key="Caption" value="#{sQuickMenu4}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
|
||||||
|
<Widget type="Button" skin="MW_Button" position="8 112 0 24" name="CancelButton">
|
||||||
|
<Property key="Caption" value="#{sCancel}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
Loading…
Reference in a new issue