Merge remote-tracking branch 'digmaster/master'

deque
Marc Zinnschlag 11 years ago
commit 2f56b11530

@ -57,6 +57,7 @@ namespace MWGui
class InventoryWindow;
class ContainerWindow;
class DialogueWindow;
class WindowModal;
enum ShowInDialogueMode {
ShowInDialogueMode_IfPossible,
@ -234,14 +235,19 @@ namespace MWBase
virtual void addVisitedLocation(const std::string& name, int x, int y) = 0;
/// Hides dialog and schedules dialog to be deleted.
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
///< Hides dialog and schedules dialog to be deleted.
///Gracefully attempts to exit the topmost GUI mode
/** No guarentee of actually closing the window **/
virtual void exitCurrentGuiMode() = 0;
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible) = 0;
virtual void staticMessageBox(const std::string& message) = 0;
virtual void removeStaticMessageBox() = 0;
/// returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
virtual int readPressedButton() = 0;
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
virtual void onFrame (float frameDuration) = 0;
@ -309,6 +315,19 @@ namespace MWBase
/// Does the current stack of GUI-windows permit saving?
virtual bool isSavingAllowed() const = 0;
/// Returns the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/
virtual MWGui::WindowModal* getCurrentModal() const = 0;
/// Sets the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/
virtual void addCurrentModal(MWGui::WindowModal* input) = 0;
/// Removes the top Modal
/** Used when one Modal adds another Modal
\param input Pointer to the current modal, to ensure proper modal is removed **/
virtual void removeCurrentModal(MWGui::WindowModal* input) = 0;
};
}

@ -66,10 +66,7 @@ namespace MWGui
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
mAlchemy.clear();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
exit();
}
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
@ -159,6 +156,12 @@ namespace MWGui
update();
}
void AlchemyWindow::exit() {
mAlchemy.clear();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
}
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)
{
removeIngredient(_sender);

@ -19,6 +19,7 @@ namespace MWGui
AlchemyWindow();
virtual void open();
virtual void exit();
private:
ItemView* mItemView;

@ -114,6 +114,14 @@ namespace MWGui
setTakeButtonShow(true);
}
void BookWindow::exit()
{
// no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
}
void BookWindow::setTakeButtonShow(bool show)
{
mTakeButtonShow = show;
@ -128,10 +136,7 @@ namespace MWGui
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
{
// no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
exit();
}
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)

@ -14,6 +14,8 @@ namespace MWGui
public:
BookWindow();
virtual void exit();
void open(MWWorld::Ptr book);
void setTakeButtonShow(bool show);
void nextPage();

@ -718,6 +718,11 @@ namespace MWGui
}
void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
{
exit();
}
void SelectSpecializationDialog::exit()
{
eventCancel();
}
@ -764,6 +769,11 @@ namespace MWGui
}
void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
{
exit();
}
void SelectAttributeDialog::exit()
{
eventCancel();
}
@ -855,6 +865,11 @@ namespace MWGui
}
void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
{
exit();
}
void SelectSkillDialog::exit()
{
eventCancel();
}

@ -136,6 +136,8 @@ namespace MWGui
SelectSpecializationDialog();
~SelectSpecializationDialog();
virtual void exit();
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
// Events
@ -167,6 +169,8 @@ namespace MWGui
SelectAttributeDialog();
~SelectAttributeDialog();
virtual void exit();
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
// Events
@ -196,6 +200,8 @@ namespace MWGui
SelectSkillDialog();
~SelectSkillDialog();
virtual void exit();
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
// Events

@ -118,6 +118,11 @@ void CompanionWindow::updateEncumbranceBar()
}
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
exit();
}
void CompanionWindow::exit()
{
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0)
{

@ -18,6 +18,8 @@ namespace MWGui
public:
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
virtual void exit();
void open(const MWWorld::Ptr& npc);
void onFrame ();

@ -28,13 +28,18 @@ namespace MWGui
center();
}
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
void ConfirmationDialog::exit()
{
eventCancelClicked();
setVisible(false);
}
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
}
void ConfirmationDialog::onOkButtonClicked(MyGUI::Widget* _sender)
{
eventOkClicked();

@ -10,6 +10,7 @@ namespace MWGui
public:
ConfirmationDialog();
void open(const std::string& message);
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -143,6 +143,11 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(NULL);
}
void Console::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Console);
}
void Console::setFont(const std::string &fntName)
{
mHistory->setFontName(fntName);

@ -21,86 +21,83 @@
namespace MWGui
{
class Console : public WindowBase, private Compiler::ErrorHandler, public ReferenceInterface
{
private:
class Console : public WindowBase, private Compiler::ErrorHandler, public ReferenceInterface
{
public:
/// Set the implicit object for script execution
void setSelectedObject(const MWWorld::Ptr& object);
Compiler::Extensions mExtensions;
MWScript::CompilerContext mCompilerContext;
std::vector<std::string> mNames;
bool mConsoleOnlyScripts;
MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory;
bool compile (const std::string& cmd, Compiler::Output& output);
typedef std::list<std::string> StringList;
/// Report error to the user.
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
// History of previous entered commands
StringList mCommandHistory;
StringList::iterator mCurrent;
std::string mEditString;
/// Report a file related error
virtual void report (const std::string& message, Type type);
Console(int w, int h, bool consoleOnlyScripts);
void listNames();
///< Write all valid identifiers and keywords into mNames and sort them.
/// \note If mNames is not empty, this function is a no-op.
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
/// time).
virtual void open();
virtual void close();
public:
virtual void exit();
void setSelectedObject(const MWWorld::Ptr& object);
///< Set the implicit object for script execution
void setFont(const std::string &fntName);
protected:
void onResChange(int width, int height);
virtual void onReferenceUnavailable();
void clearHistory();
// Print a message to the console. Messages may contain color
// code, eg. "#FFFFFF this is white".
void print(const std::string &msg);
public:
MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory;
// These are pre-colored versions that you should use.
typedef std::list<std::string> StringList;
/// Output from successful console command
void printOK(const std::string &msg);
// History of previous entered commands
StringList mCommandHistory;
StringList::iterator mCurrent;
std::string mEditString;
/// Error message
void printError(const std::string &msg);
Console(int w, int h, bool consoleOnlyScripts);
void execute (const std::string& command);
virtual void open();
virtual void close();
void executeFile (const std::string& path);
void setFont(const std::string &fntName);
protected:
void onResChange(int width, int height);
virtual void onReferenceUnavailable();
void clearHistory();
private:
// Print a message to the console. Messages may contain color
// code, eg. "#FFFFFF this is white".
void print(const std::string &msg);
void keyPress(MyGUI::Widget* _sender,
MyGUI::KeyCode key,
MyGUI::Char _char);
// These are pre-colored versions that you should use.
void acceptCommand(MyGUI::EditBox* _sender);
/// Output from successful console command
void printOK(const std::string &msg);
std::string complete( std::string input, std::vector<std::string> &matches );
/// Error message
void printError(const std::string &msg);
Compiler::Extensions mExtensions;
MWScript::CompilerContext mCompilerContext;
std::vector<std::string> mNames;
bool mConsoleOnlyScripts;
void execute (const std::string& command);
bool compile (const std::string& cmd, Compiler::Output& output);
void executeFile (const std::string& path);
/// Report error to the user.
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
private:
/// Report a file related error
virtual void report (const std::string& message, Type type);
void keyPress(MyGUI::Widget* _sender,
MyGUI::KeyCode key,
MyGUI::Char _char);
void acceptCommand(MyGUI::EditBox* _sender);
std::string complete( std::string input, std::vector<std::string> &matches );
/// Write all valid identifiers and keywords into mNames and sort them.
/// \note If mNames is not empty, this function is a no-op.
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
/// time).
void listNames();
};
}
#endif

@ -263,7 +263,7 @@ namespace MWGui
}
}
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
void ContainerWindow::exit()
{
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{
@ -271,6 +271,11 @@ namespace MWGui
}
}
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
exit();
}
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
{
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)

@ -54,6 +54,8 @@ namespace MWGui
void open(const MWWorld::Ptr& container, bool loot=false);
virtual void close();
virtual void exit();
private:
DragAndDrop* mDragAndDrop;

@ -49,7 +49,12 @@ namespace MWGui
mItemEdit->setCaption(boost::lexical_cast<std::string>(maxCount));
}
void CountDialog::cancel()
void CountDialog::cancel() //Keeping this here as I don't know if anything else relies on it.
{
exit();
}
void CountDialog::exit()
{
setVisible(false);
}
@ -65,16 +70,16 @@ namespace MWGui
setVisible(false);
}
// essentially duplicating what the OK button does if user presses
// Enter key
void CountDialog::onEnterKeyPressed(MyGUI::EditBox* _sender)
{
eventOkClicked(NULL, mSlider->getScrollPosition()+1);
setVisible(false);
}
void CountDialog::onEditTextChange(MyGUI::EditBox* _sender)
{
if (_sender->getCaption() == "")

@ -11,6 +11,7 @@ namespace MWGui
CountDialog();
void open(const std::string& item, const std::string& message, const int maxCount);
void cancel();
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;

@ -51,7 +51,7 @@ namespace MWGui
void PersuasionDialog::onCancel(MyGUI::Widget *sender)
{
setVisible(false);
exit();
}
void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
@ -87,6 +87,11 @@ namespace MWGui
mGoldLabel->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
}
void PersuasionDialog::exit()
{
setVisible(false);
}
// --------------------------------------------------------------------------------------------------
Response::Response(const std::string &text, const std::string &title)
@ -264,6 +269,13 @@ namespace MWGui
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
}
void DialogueWindow::exit()
{
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
return;
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
}
void DialogueWindow::onWindowResize(MyGUI::Window* _sender)
{
mTopicsList->adjustSize();
@ -281,9 +293,7 @@ namespace MWGui
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
{
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
return;
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
exit();
}
void DialogueWindow::onSelectTopic(const std::string& topic, int id)
@ -504,6 +514,15 @@ namespace MWGui
// no scrollbar
onScrollbarMoved(mScrollBar, 0);
}
MyGUI::Button* byeButton;
getWidget(byeButton, "ByeButton");
if(MWBase::Environment::get().getDialogueManager()->isInChoice()) {
byeButton->setEnabled(false);
}
else {
byeButton->setEnabled(true);
}
}
void DialogueWindow::notifyLinkClicked (TypesetBook::InteractiveId link)

@ -34,6 +34,7 @@ namespace MWGui
PersuasionDialog();
virtual void open();
virtual void exit();
private:
MyGUI::Button* mCancelButton;
@ -103,6 +104,8 @@ namespace MWGui
public:
DialogueWindow();
virtual void exit();
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -61,6 +61,11 @@ namespace MWGui
onRemoveSoul(NULL);
}
void EnchantingDialog::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
}
void EnchantingDialog::updateLabels()
{
std::stringstream enchantCost;
@ -141,7 +146,7 @@ namespace MWGui
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
exit();
}
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)

@ -19,6 +19,9 @@ namespace MWGui
virtual ~EnchantingDialog();
virtual void open();
virtual void exit();
void startEnchanting(MWWorld::Ptr actor);
void startSelfEnchanting(MWWorld::Ptr soulgem);

@ -26,6 +26,11 @@ namespace MWGui
center();
}
void ItemSelectionDialog::exit()
{
eventDialogCanceled();
}
void ItemSelectionDialog::openContainer(const MWWorld::Ptr& container)
{
mModel = new InventoryItemModel(container);
@ -53,7 +58,7 @@ namespace MWGui
void ItemSelectionDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{
eventDialogCanceled();
exit();
}
}

@ -14,6 +14,8 @@ namespace MWGui
public:
ItemSelectionDialog(const std::string& label);
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;

@ -110,6 +110,11 @@ void MerchantRepair::open()
center();
}
void MerchantRepair::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
}
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
{
// repair
@ -128,7 +133,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
exit();
}
}

@ -16,6 +16,8 @@ public:
virtual void open();
virtual void exit();
void startRepair(const MWWorld::Ptr& actor);
private:

@ -57,6 +57,11 @@ namespace MWGui
}
}
void QuickKeysMenu::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_QuickKeysMenu);
}
void QuickKeysMenu::clear()
{
for (int i=0; i<10; ++i)
@ -385,6 +390,11 @@ namespace MWGui
center();
}
void QuickKeysMenuAssign::exit()
{
setVisible(false);
}
void QuickKeysMenu::write(ESM::ESMWriter &writer)
{
writer.startRecord(ESM::REC_KEYS);
@ -508,7 +518,12 @@ namespace MWGui
void MagicSelectionDialog::onCancelButtonClicked (MyGUI::Widget *sender)
{
mParent->onAssignMagicCancel ();
exit();
}
void MagicSelectionDialog::exit()
{
mParent->onAssignMagicCancel();
}
void MagicSelectionDialog::open ()

@ -18,6 +18,7 @@ namespace MWGui
QuickKeysMenu();
~QuickKeysMenu();
virtual void exit();
void onItemButtonClicked(MyGUI::Widget* sender);
void onMagicButtonClicked(MyGUI::Widget* sender);
@ -69,6 +70,7 @@ namespace MWGui
{
public:
QuickKeysMenuAssign(QuickKeysMenu* parent);
virtual void exit();
private:
MyGUI::TextBox* mLabel;
@ -86,6 +88,7 @@ namespace MWGui
MagicSelectionDialog(QuickKeysMenu* parent);
virtual void open();
virtual void exit();
private:
MyGUI::Button* mCancelButton;

@ -38,6 +38,11 @@ void Recharge::open()
center();
}
void Recharge::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
}
void Recharge::start (const MWWorld::Ptr &item)
{
std::string path = std::string("icons\\");
@ -128,7 +133,7 @@ void Recharge::updateView()
void Recharge::onCancel(MyGUI::Widget *sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
exit();
}
void Recharge::onItemClicked(MyGUI::Widget *sender)

@ -15,6 +15,8 @@ public:
virtual void open();
virtual void exit();
void start (const MWWorld::Ptr& gem);
protected:

@ -35,6 +35,11 @@ void Repair::open()
center();
}
void Repair::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
}
void Repair::startRepairItem(const MWWorld::Ptr &item)
{
mRepair.setTool(item);
@ -134,7 +139,7 @@ void Repair::updateRepairView()
void Repair::onCancel(MyGUI::Widget *sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
exit();
}
void Repair::onRepairItem(MyGUI::Widget *sender)

@ -15,6 +15,8 @@ public:
virtual void open();
virtual void exit();
void startRepairItem (const MWWorld::Ptr& item);
protected:

@ -159,6 +159,11 @@ namespace MWGui
}
void SaveGameDialog::exit()
{
setVisible(false);
}
void SaveGameDialog::setLoadOrSave(bool load)
{
mSaving = !load;
@ -177,7 +182,7 @@ namespace MWGui
void SaveGameDialog::onCancelButtonClicked(MyGUI::Widget *sender)
{
setVisible(false);
exit();
}
void SaveGameDialog::onConfirmationGiven()

@ -19,6 +19,8 @@ namespace MWGui
virtual void open();
virtual void exit();
void setLoadOrSave(bool load);
private:

@ -67,6 +67,13 @@ namespace MWGui
setTakeButtonShow(true);
}
void ScrollWindow::exit()
{
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
}
void ScrollWindow::setTakeButtonShow(bool show)
{
mTakeButtonShow = show;
@ -81,9 +88,7 @@ namespace MWGui
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
{
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
exit();
}
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)

@ -14,6 +14,7 @@ namespace MWGui
ScrollWindow ();
void open (MWWorld::Ptr scroll);
virtual void exit();
void setTakeButtonShow(bool show);
void setInventoryAllowed(bool allowed);

@ -242,7 +242,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
exit();
}
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
@ -510,4 +510,9 @@ namespace MWGui
{
updateControlsBox ();
}
void SettingsWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
}
}

@ -17,6 +17,8 @@ namespace MWGui
virtual void open();
virtual void exit();
void updateControlsBox();
protected:

@ -33,6 +33,11 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
}
void SpellBuyingWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
}
void SpellBuyingWindow::addSpell(const std::string& spellId)
{
const MWWorld::ESMStore &store =
@ -132,7 +137,7 @@ namespace MWGui
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
exit();
}
void SpellBuyingWindow::updateLabels()

@ -25,6 +25,8 @@ namespace MWGui
void startSpellBuying(const MWWorld::Ptr& actor);
virtual void exit();
protected:
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold;

@ -75,6 +75,15 @@ namespace MWGui
center();
}
void EditEffectDialog::exit()
{
setVisible(false);
if(mEditing)
eventEffectModified(mOldEffect);
else
eventEffectRemoved(mEffect);
}
void EditEffectDialog::newEffect (const ESM::MagicEffect *effect)
{
setMagicEffect(effect);
@ -222,11 +231,7 @@ namespace MWGui
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
{
setVisible(false);
if(mEditing)
eventEffectModified(mOldEffect);
else
eventEffectRemoved(mEffect);
exit();
}
void EditEffectDialog::setSkill (int skill)
@ -313,7 +318,7 @@ namespace MWGui
void SpellCreationDialog::onCancelButtonClicked (MyGUI::Widget* sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
exit();
}
void SpellCreationDialog::onBuyButtonClicked (MyGUI::Widget* sender)
@ -367,6 +372,11 @@ namespace MWGui
center();
}
void SpellCreationDialog::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
}
void SpellCreationDialog::onReferenceUnavailable ()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Dialogue);

@ -18,6 +18,7 @@ namespace MWGui
EditEffectDialog();
virtual void open();
virtual void exit();
void setSkill(int skill);
void setAttribute(int attribute);
@ -127,6 +128,7 @@ namespace MWGui
SpellCreationDialog();
virtual void open();
virtual void exit();
void startSpellMaking(MWWorld::Ptr actor);

@ -136,6 +136,13 @@ namespace MWGui
return mPtr.getClass().getServices(mPtr);
}
void TradeWindow::exit()
{
mTradeModel->abort();
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
}
void TradeWindow::onItemSelected (int index)
{
const ItemStack& item = mSortModel->getItem(index);
@ -375,9 +382,7 @@ namespace MWGui
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
mTradeModel->abort();
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
exit();
}
void TradeWindow::onMaxSaleButtonClicked(MyGUI::Widget* _sender)

@ -35,6 +35,8 @@ namespace MWGui
int getMerchantServices();
virtual void exit();
private:
ItemView* mItemView;

@ -35,6 +35,11 @@ namespace MWGui
center();
}
void TrainingWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
}
void TrainingWindow::startTraining (MWWorld::Ptr actor)
{
mPtr = actor;
@ -107,7 +112,7 @@ namespace MWGui
void TrainingWindow::onCancelButtonClicked (MyGUI::Widget *sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
exit();
}
void TrainingWindow::onTrainingSelected (MyGUI::Widget *sender)

@ -14,6 +14,8 @@ namespace MWGui
virtual void open();
virtual void exit();
void startTraining(MWWorld::Ptr actor);
void onFrame(float dt);

@ -45,6 +45,11 @@ namespace MWGui
mSelect->getHeight());
}
void TravelWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
}
void TravelWindow::addDestination(const std::string& travelId,ESM::Position pos,bool interior)
{
int price = 0;
@ -170,7 +175,7 @@ namespace MWGui
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
exit();
}
void TravelWindow::updateLabels()

@ -22,6 +22,8 @@ namespace MWGui
public:
TravelWindow();
virtual void exit();
void startTravel(const MWWorld::Ptr& actor);
protected:

@ -69,6 +69,12 @@ namespace MWGui
mProgressBar.setVisible (false);
}
void WaitDialog::exit()
{
if(!mProgressBar.isVisible()) //Only exit if not currently waiting
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
void WaitDialog::open()
{
if (!MWBase::Environment::get().getWindowManager ()->getRestEnabled ())
@ -160,7 +166,7 @@ namespace MWGui
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{
MWBase::Environment::get().getWindowManager()->popGuiMode ();
exit();
}
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)

@ -28,6 +28,8 @@ namespace MWGui
virtual void open();
virtual void exit();
void onFrame(float dt);
void bedActivated() { setCanRest(true); }

@ -2,6 +2,8 @@
#include "../mwbase/windowmanager.hpp"
#include "container.hpp"
#include "../mwbase/environment.hpp"
#include "../mwgui/windowmanagerimp.hpp"
using namespace MWGui;
@ -21,6 +23,11 @@ void WindowBase::setVisible(bool visible)
close();
}
bool WindowBase::isVisible()
{
return mMainWidget->getVisible();
}
void WindowBase::center()
{
// Centre dialog
@ -45,11 +52,13 @@ WindowModal::WindowModal(const std::string& parLayout)
void WindowModal::open()
{
MyGUI::InputManager::getInstance ().addWidgetModal (mMainWidget);
MWBase::Environment::get().getWindowManager()->addCurrentModal(this); //Set so we can escape it if needed
}
void WindowModal::close()
{
MyGUI::InputManager::getInstance ().removeWidgetModal (mMainWidget);
MWBase::Environment::get().getWindowManager()->removeCurrentModal(this);
}
NoDrop::NoDrop(DragAndDrop *drag, MyGUI::Widget *widget)

@ -21,9 +21,16 @@ namespace MWGui
// Events
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
///Unhides the window
virtual void open() {}
///Hides the window
virtual void close () {}
///Gracefully exits the window
virtual void exit() {}
///Sets the visibility of the window
virtual void setVisible(bool visible);
///Returns the visibility state of the window
virtual bool isVisible();
void center();
/** Event : Dialog finished, OK button clicked.\n
@ -42,6 +49,7 @@ namespace MWGui
WindowModal(const std::string& parLayout);
virtual void open();
virtual void close();
virtual void exit() {}
};
/// A window that cannot be the target of a drag&drop action.

@ -23,6 +23,8 @@
#include "../mwworld/player.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwsound/soundmanagerimp.hpp"
#include "console.hpp"
#include "journalwindow.hpp"
#include "journalviewmodel.hpp"
@ -134,6 +136,7 @@ namespace MWGui
, mFPS(0.0f)
, mTriangleCount(0)
, mBatchCount(0)
, mCurrentModals()
{
// Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
@ -666,6 +669,93 @@ namespace MWGui
mGarbageDialogs.push_back(dialog);
}
void WindowManager::exitCurrentGuiMode() {
switch(mGuiModes.back()) {
case GM_QuickKeysMenu:
mQuickKeysMenu->exit();
break;
case GM_MainMenu:
removeGuiMode(GM_MainMenu); //Simple way to remove it
break;
case GM_Settings:
mSettingsWindow->exit();
break;
case GM_Console:
mConsole->exit();
break;
case GM_Scroll:
mScrollWindow->exit();
break;
case GM_Book:
mBookWindow->exit();
break;
case GM_Alchemy:
mAlchemyWindow->exit();
break;
case GM_Rest:
mWaitDialog->exit();
break;
case GM_RestBed:
mWaitDialog->exit();
break;
case GM_Name:
case GM_Race:
case GM_Class:
case GM_ClassPick:
case GM_ClassCreate:
case GM_Birth:
case GM_ClassGenerate:
case GM_Review:
break;
case GM_Inventory:
removeGuiMode(GM_Inventory); //Simple way to remove it
break;
case GM_Container:
mContainerWindow->exit();
break;
case GM_Companion:
mCompanionWindow->exit();
break;
case GM_Dialogue:
mDialogueWindow->exit();
break;
case GM_Barter:
mTradeWindow->exit();
break;
case GM_SpellBuying:
mSpellBuyingWindow->exit();
break;
case GM_Travel:
mTravelWindow->exit();
break;
case GM_SpellCreation:
mSpellCreationDialog->exit();
break;
case GM_Recharge:
mRecharge->exit();
break;
case GM_Enchanting:
mEnchantingDialog->exit();
break;
case GM_Training:
mTrainingWindow->exit();
break;
case GM_MerchantRepair:
mMerchantRepair->exit();
break;
case GM_Repair:
mRepair->exit();
break;
case GM_Journal:
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
removeGuiMode(GM_Journal); //Simple way to remove it
break;
default:
// Unsupported mode, switch back to game
break;
}
}
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons, enum MWGui::ShowInDialogueMode showInDialogueMode)
{
if (buttons.empty()) {
@ -1513,4 +1603,21 @@ namespace MWGui
mVideoWidget->setCoord(leftPadding, topPadding,
screenWidth - leftPadding*2, screenHeight - topPadding*2);
}
WindowModal* WindowManager::getCurrentModal() const
{
if(mCurrentModals.size() > 0)
return mCurrentModals.top();
else
return NULL;
}
void WindowManager::removeCurrentModal(WindowModal* input)
{
// Only remove the top if it matches the current pointer. A lot of things hide their visibility before showing it,
//so just popping the top would cause massive issues.
if(mCurrentModals.size() > 0)
if(input == mCurrentModals.top())
mCurrentModals.pop();
}
}

@ -82,6 +82,7 @@ namespace MWGui
class Recharge;
class CompanionWindow;
class VideoWidget;
class WindowModal;
class WindowManager : public MWBase::WindowManager
{
@ -132,10 +133,10 @@ namespace MWGui
virtual void forceHide(MWGui::GuiWindow wnd);
virtual void unsetForceHide(MWGui::GuiWindow wnd);
// Disallow all inventory mode windows
/// Disallow all inventory mode windows
virtual void disallowAll();
// Allow one or more windows
/// Allow one or more windows
virtual void allow(GuiWindow wnd);
virtual bool isAllowed(GuiWindow wnd) const;
@ -225,7 +226,11 @@ namespace MWGui
virtual void addVisitedLocation(const std::string& name, int x, int y);
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
///Hides dialog and schedules dialog to be deleted.
virtual void removeDialog(OEngine::GUI::Layout* dialog);
///Gracefully attempts to exit the topmost GUI mode
virtual void exitCurrentGuiMode();
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible);
virtual void staticMessageBox(const std::string& message);
@ -298,6 +303,19 @@ namespace MWGui
/// Does the current stack of GUI-windows permit saving?
virtual bool isSavingAllowed() const;
/// Returns the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/
virtual WindowModal* getCurrentModal() const;
/// Sets the current Modal
/** Used to send exit command to active Modal when Esc is pressed **/
virtual void addCurrentModal(WindowModal* input) {mCurrentModals.push(input);}
/// Removes the top Modal
/** Used when one Modal adds another Modal
\param input Pointer to the current modal, to ensure proper modal is removed **/
virtual void removeCurrentModal(WindowModal* input);
private:
bool mConsoleOnlyScripts;
@ -307,6 +325,8 @@ namespace MWGui
std::string mSelectedSpell;
std::stack<WindowModal*> mCurrentModals;
OEngine::GUI::MyGUIManager *mGuiManager;
OEngine::Render::OgreRenderer *mRendering;
HUD *mHud;

@ -28,6 +28,10 @@
#include "../mwmechanics/creaturestats.hpp"
#include "../mwdialogue/dialoguemanagerimp.hpp"
#include "../mwgui/windowbase.hpp"
using namespace ICS;
namespace
@ -635,19 +639,29 @@ namespace MWInput
void InputManager::toggleMainMenu()
{
if (MyGUI::InputManager::getInstance ().isModalAny())
if (MyGUI::InputManager::getInstance().isModalAny()) {
MWBase::Environment::get().getWindowManager()->getCurrentModal()->exit();
return;
}
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu))
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);
if(MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Dialogue) { //Give access to the main menu when at a choice in dialogue
if(MWBase::Environment::get().getDialogueManager()->isInChoice()) {
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
MWBase::Environment::get().getSoundManager()->pauseSounds (MWBase::SoundManager::Play_TypeSfx);
return;
}
}
else
if(!MWBase::Environment::get().getWindowManager()->isGuiMode()) //No open GUIs, open up the MainMenu
{
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
MWBase::Environment::get().getSoundManager()->pauseSounds (MWBase::SoundManager::Play_TypeSfx);
}
else //Close current GUI
{
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);
}
}
void InputManager::quickLoad() {
@ -763,8 +777,7 @@ namespace MWInput
}
else if(MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Journal)
{
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
}
// .. but don't touch any other mode.
}
@ -780,8 +793,12 @@ namespace MWInput
if (!MWBase::Environment::get().getWindowManager()->isGuiMode ()
&& MWBase::Environment::get().getWorld()->getGlobalFloat ("chargenstate")==-1)
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_QuickKeysMenu);
else if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu)
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_QuickKeysMenu);
else if (MWBase::Environment::get().getWindowManager()->getMode () == MWGui::GM_QuickKeysMenu) {
while(MyGUI::InputManager::getInstance().isModalAny()) { //Handle any open Modal windows
MWBase::Environment::get().getWindowManager()->getCurrentModal()->exit();
}
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); //And handle the actual main window
}
}
void InputManager::activate()

Loading…
Cancel
Save