merged by branches together, starting with alchemy window

Merge branch 'guimode_stacking' into next

Conflicts:
	apps/openmw/mwgui/mode.hpp
actorid
scrawl 13 years ago
commit 51b8a76a68

@ -27,8 +27,8 @@ add_openmw_dir (mwgui
text_input widgets race class birth review window_manager console dialogue
dialogue_history window_base stats_window messagebox journalwindow charactercreation
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
formatting itemwidget inventorywindow container hud countdialog tradewindow settingswindow
confirmationdialog
formatting inventorywindow container hud countdialog tradewindow settingswindow
confirmationdialog alchemywindow
)
add_openmw_dir (mwdialogue
@ -50,7 +50,7 @@ add_openmw_dir (mwworld
refdata world physicssystem scene globals class action nullaction actionteleport
containerstore actiontalk actiontake manualref player cellfunctors
cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp
actionequip timestamp actionalchemy
)
add_openmw_dir (mwclass

@ -105,7 +105,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// frame.
// passing of time
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game)
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->advanceTime (
mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
@ -116,9 +116,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// update actors
std::vector<std::pair<std::string, Ogre::Vector3> > movement;
MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(),
MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game);
MWBase::Environment::get().getWindowManager()->isGuiMode());
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game)
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
// update world
@ -421,7 +421,7 @@ void OMW::Engine::go()
void OMW::Engine::activate()
{
if (MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game)
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return;
std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle();

@ -9,6 +9,7 @@
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionalchemy.hpp"
#include "../mwworld/world.hpp"
#include "../mwrender/objects.hpp"
@ -140,4 +141,10 @@ namespace MWClass
return info;
}
boost::shared_ptr<MWWorld::Action> Apparatus::use (const MWWorld::Ptr& ptr) const
{
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionAlchemy());
}
}

@ -44,6 +44,10 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const;
///< Generate action for using via inventory menu
};
}

@ -635,7 +635,7 @@ namespace MWDialogue
actorKnownTopics.clear();
//initialise the GUI
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor));
@ -843,7 +843,7 @@ namespace MWDialogue
void DialogueManager::goodbyeSelected()
{
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Game);
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
void DialogueManager::questionAnswered(std::string answere)

@ -0,0 +1,10 @@
#include "alchemywindow.hpp"
namespace MWGui
{
AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager)
: WindowBase("openmw_alchemy_window_layout.xml", parWindowManager)
{
center();
}
}

@ -0,0 +1,15 @@
#ifndef MWGUI_ALCHEMY_H
#define MWGUI_ALCHEMY_H
#include "window_base.hpp"
namespace MWGui
{
class AlchemyWindow : public WindowBase
{
public:
AlchemyWindow(WindowManager& parWindowManager);
};
}
#endif

@ -1,13 +1,14 @@
#include "bookwindow.hpp"
#include "formatting.hpp"
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwworld/actiontake.hpp"
#include <boost/lexical_cast.hpp>
#include "formatting.hpp"
#include "window_manager.hpp"
using namespace MWGui;
@ -91,7 +92,7 @@ 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().getInputManager()->setGuiMode(MWGui::GM_Game);
mWindowManager.popGuiMode();
}
void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -101,7 +102,7 @@ void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mBook);
take.execute();
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game);
mWindowManager.popGuiMode();
}
void BookWindow::onNextPageButtonClicked (MyGUI::Widget* _sender)

@ -110,7 +110,6 @@ using namespace MWGui;
CharacterCreation::CharacterCreation(WindowManager* _wm)
: mNameDialog(0)
, mRaceDialog(0)
, mDialogueWindow(0)
, mClassChoiceDialog(0)
, mGenerateClassQuestionDialog(0)
, mGenerateClassResultDialog(0)
@ -253,7 +252,7 @@ void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
if (mReviewDialog)
mWM->removeDialog(mReviewDialog);
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
void CharacterCreation::onReviewDialogBack()
@ -261,7 +260,7 @@ void CharacterCreation::onReviewDialogBack()
if (mReviewDialog)
mWM->removeDialog(mReviewDialog);
mWM->setGuiMode(GM_Birth);
mWM->pushGuiMode(GM_Birth);
}
void CharacterCreation::onReviewActivateDialog(int parDialog)
@ -270,19 +269,21 @@ void CharacterCreation::onReviewActivateDialog(int parDialog)
mWM->removeDialog(mReviewDialog);
mCreationStage = CSE_ReviewNext;
mWM->popGuiMode();
switch(parDialog)
{
case ReviewDialog::NAME_DIALOG:
mWM->setGuiMode(GM_Name);
mWM->pushGuiMode(GM_Name);
break;
case ReviewDialog::RACE_DIALOG:
mWM->setGuiMode(GM_Race);
mWM->pushGuiMode(GM_Race);
break;
case ReviewDialog::CLASS_DIALOG:
mWM->setGuiMode(GM_Class);
mWM->pushGuiMode(GM_Class);
break;
case ReviewDialog::BIRTHSIGN_DIALOG:
mWM->setGuiMode(GM_Birth);
mWM->pushGuiMode(GM_Birth);
};
}
@ -304,13 +305,19 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
//TODO This bit gets repeated a few times; wrap it in a function
if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
}
@ -324,7 +331,8 @@ void CharacterCreation::onPickClassDialogBack()
mWM->removeDialog(mPickClassDialog);
}
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
void CharacterCreation::onClassChoice(int _index)
@ -334,19 +342,21 @@ void CharacterCreation::onClassChoice(int _index)
mWM->removeDialog(mClassChoiceDialog);
}
mWM->popGuiMode();
switch(_index)
{
case ClassChoiceDialog::Class_Generate:
mWM->setGuiMode(GM_ClassGenerate);
mWM->pushGuiMode(GM_ClassGenerate);
break;
case ClassChoiceDialog::Class_Pick:
mWM->setGuiMode(GM_ClassPick);
mWM->pushGuiMode(GM_ClassPick);
break;
case ClassChoiceDialog::Class_Create:
mWM->setGuiMode(GM_ClassCreate);
mWM->pushGuiMode(GM_ClassCreate);
break;
case ClassChoiceDialog::Class_Back:
mWM->setGuiMode(GM_Race);
mWM->pushGuiMode(GM_Race);
break;
};
@ -363,13 +373,19 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
}
if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
mWM->setGuiMode(GM_Race);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Race);
}
else
{
mCreationStage = CSE_NameChosen;
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
}
@ -383,7 +399,8 @@ void CharacterCreation::onRaceDialogBack()
mWM->removeDialog(mRaceDialog);
}
mWM->setGuiMode(GM_Name);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Name);
}
void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
@ -398,13 +415,19 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
}
if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review);
else if(mCreationStage >= CSE_RaceChosen)
mWM->setGuiMode(GM_Class);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
else
{
mCreationStage = CSE_RaceChosen;
mWM->setGuiMode(GM_Game);
mCreationStage = CSE_NameChosen;
mWM->popGuiMode();
}
}
@ -419,11 +442,14 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
}
if (mCreationStage >= CSE_BirthSignChosen)
mWM->setGuiMode(GM_Review);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else
{
mCreationStage = CSE_BirthSignChosen;
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
}
@ -435,7 +461,8 @@ void CharacterCreation::onBirthSignDialogBack()
mWM->removeDialog(mBirthSignDialog);
}
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
@ -470,13 +497,19 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
}
if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
}
@ -485,7 +518,8 @@ void CharacterCreation::onCreateClassDialogBack()
if (mCreateClassDialog)
mWM->removeDialog(mCreateClassDialog);
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
void CharacterCreation::onClassQuestionChosen(int _index)
@ -496,7 +530,8 @@ void CharacterCreation::onClassQuestionChosen(int _index)
mWM->removeDialog(mGenerateClassQuestionDialog);
if (_index < 0 || _index >= 3)
{
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
return;
}
@ -581,7 +616,8 @@ void CharacterCreation::showClassQuestionDialog()
if (mGenerateClassStep > sGenerateClassSteps.size())
{
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
return;
}
@ -610,7 +646,8 @@ void CharacterCreation::onGenerateClassBack()
mWM->removeDialog(mGenerateClassResultDialog);
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
mWM->setGuiMode(GM_Class);
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
@ -620,13 +657,19 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth);
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else
{
mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game);
mWM->popGuiMode();
}
}
@ -634,7 +677,6 @@ CharacterCreation::~CharacterCreation()
{
delete mNameDialog;
delete mRaceDialog;
delete mDialogueWindow;
delete mClassChoiceDialog;
delete mGenerateClassQuestionDialog;
delete mGenerateClassResultDialog;

@ -46,7 +46,6 @@ namespace MWGui
//Dialogs
TextInputDialog* mNameDialog;
RaceDialog* mRaceDialog;
DialogueWindow* mDialogueWindow;
ClassChoiceDialog* mClassChoiceDialog;
InfoBoxDialog* mGenerateClassQuestionDialog;
GenerateClassResultDialog* mGenerateClassResultDialog;

@ -636,7 +636,7 @@ void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game);
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
}
@ -667,6 +667,6 @@ void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
containerStore.clear();
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game);
MWBase::Environment::get().getWindowManager()->popGuiMode();
}
}

@ -112,15 +112,6 @@ void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
history->setVScrollPosition(history->getVScrollPosition() - _rel*0.3);
}
void DialogueWindow::open()
{
topicsList->clear();
pTopicsText.clear();
history->eraseText(0,history->getTextLength());
updateOptions();
setVisible(true);
}
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
{
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
@ -133,7 +124,7 @@ void DialogueWindow::onSelectTopic(std::string topic)
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str)
{
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.setGuiMode(GM_Barter);
mWindowManager.pushGuiMode(GM_Barter);
mWindowManager.getTradeWindow()->startTrade(mActor);
}
@ -147,6 +138,11 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
mActor = actor;
topicsList->setEnabled(true);
setTitle(npcName);
topicsList->clear();
pTopicsText.clear();
history->eraseText(0,history->getTextLength());
updateOptions();
}
void DialogueWindow::setKeywords(std::list<std::string> keyWords)

@ -30,8 +30,6 @@ namespace MWGui
public:
DialogueWindow(WindowManager& parWindowManager);
void open();
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -58,7 +58,7 @@ void MessageBoxManager::onFrame (float frameDuration)
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
delete mInterMessageBoxe;
mInterMessageBoxe = NULL;
mWindowManager->setNextMode(GM_Game);
mWindowManager->popGuiMode();
}
}

@ -5,7 +5,6 @@ namespace MWGui
{
enum GuiMode
{
GM_Game, // Game mode, only HUD
GM_Settings, // Settings window
GM_Inventory, // Inventory mode
GM_Container,
@ -16,6 +15,7 @@ namespace MWGui
GM_Scroll, // Read scroll
GM_Book, // Read book
GM_Alchemy, // Make potions
GM_Dialogue, // NPC interaction
GM_Barter,

@ -1,12 +1,13 @@
#include "scrollwindow.hpp"
#include "formatting.hpp"
#include "../mwbase/environment.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwsound/soundmanager.hpp"
#include "formatting.hpp"
#include "window_manager.hpp"
using namespace MWGui;
ScrollWindow::ScrollWindow (WindowManager& parWindowManager) :
@ -55,7 +56,7 @@ void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
{
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game);
mWindowManager.popGuiMode();
}
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -65,5 +66,5 @@ void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mScroll);
take.execute();
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game);
mWindowManager.popGuiMode();
}

@ -96,7 +96,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{
mWindowManager.setGuiMode(GM_Game);
mWindowManager.popGuiMode();
}
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)

@ -210,7 +210,7 @@ namespace MWGui
std::string sound = "Item Gold Up";
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
mWindowManager.setGuiMode(GM_Game);
mWindowManager.popGuiMode();
}
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
@ -220,7 +220,7 @@ namespace MWGui
// now gimme back my stuff!
mWindowManager.getInventoryWindow()->returnBoughtItems(MWWorld::Class::get(mContainer).getContainerStore(mContainer));
mWindowManager.setGuiMode(GM_Game);
mWindowManager.popGuiMode();
}
void TradeWindow::updateLabels()

@ -18,6 +18,7 @@
#include "tradewindow.hpp"
#include "settingswindow.hpp"
#include "confirmationdialog.hpp"
#include "alchemywindow.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwinput/inputmanager.hpp"
@ -54,6 +55,7 @@ WindowManager::WindowManager(
, mTradeWindow(NULL)
, mSettingsWindow(NULL)
, mConfirmationDialog(NULL)
, mAlchemyWindow(NULL)
, mCharGen(NULL)
, playerClass()
, playerName()
@ -66,9 +68,6 @@ WindowManager::WindowManager(
, playerMagicka()
, playerFatigue()
, gui(NULL)
, mode(GM_Game)
, nextMode(GM_Game)
, needModeChange(false)
, garbageDialogs()
, shown(GW_ALL)
, allowed(newGame ? GW_None : GW_ALL)
@ -124,6 +123,7 @@ WindowManager::WindowManager(
mCountDialog = new CountDialog(*this);
mSettingsWindow = new SettingsWindow(*this);
mConfirmationDialog = new ConfirmationDialog(*this);
mAlchemyWindow = new AlchemyWindow(*this);
// The HUD is always on
hud->setVisible(true);
@ -166,6 +166,7 @@ WindowManager::~WindowManager()
delete mTradeWindow;
delete mSettingsWindow;
delete mConfirmationDialog;
delete mAlchemyWindow;
cleanupGarbage();
}
@ -186,12 +187,6 @@ void WindowManager::cleanupGarbage()
void WindowManager::update()
{
cleanupGarbage();
if (needModeChange)
{
needModeChange = false;
MWBase::Environment::get().getInputManager()->setGuiMode(nextMode);
nextMode = GM_Game;
}
if (showFPSLevel > 0)
{
hud->setFPS(mFPS);
@ -200,17 +195,6 @@ void WindowManager::update()
}
}
void WindowManager::setNextMode(GuiMode newMode)
{
nextMode = newMode;
needModeChange = true;
}
void WindowManager::setGuiMode(GuiMode newMode)
{
MWBase::Environment::get().getInputManager()->setGuiMode(newMode);
}
void WindowManager::updateVisible()
{
// Start out by hiding everything except the HUD
@ -226,19 +210,25 @@ void WindowManager::updateVisible()
mBookWindow->setVisible(false);
mTradeWindow->setVisible(false);
mSettingsWindow->setVisible(false);
mAlchemyWindow->setVisible(false);
// Mouse is visible whenever we're not in game mode
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
if (mode == GM_Game)
bool gameMode = !isGuiMode();
if (gameMode)
mToolTips->enterGameMode();
else
mToolTips->enterGuiMode();
// If in game mode, don't show anything.
if (gameMode)
return;
GuiMode mode = mGuiModes.back();
switch(mode) {
case GM_Game:
// If in game mode, don't show anything.
break;
case GM_MainMenu:
menu->setVisible(true);
break;
@ -254,6 +244,9 @@ void WindowManager::updateVisible()
case GM_Book:
mBookWindow->setVisible(true);
break;
case GM_Alchemy:
mAlchemyWindow->setVisible(true);
break;
case GM_Name:
case GM_Race:
case GM_Class:
@ -285,7 +278,7 @@ void WindowManager::updateVisible()
mInventoryWindow->openInventory();
break;
case GM_Dialogue:
mDialogueWindow->open();
mDialogueWindow->setVisible(true);
break;
case GM_Barter:
mInventoryWindow->setVisible(true);
@ -293,9 +286,6 @@ void WindowManager::updateVisible()
mTradeWindow->setVisible(true);
break;
case GM_InterMessageBox:
if(!mMessageBoxManager->isInteractiveMessageBox()) {
setGuiMode(GM_Game);
}
break;
case GM_Journal:
mJournal->setVisible(true);
@ -303,9 +293,6 @@ void WindowManager::updateVisible()
break;
default:
// Unsupported mode, switch back to game
// Note: The call will eventually end up this method again but
// will stop at the check if mode is GM_Game.
setGuiMode(GM_Game);
break;
}
}
@ -439,7 +426,7 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
else
{
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
setGuiMode(GM_InterMessageBox);
pushGuiMode(GM_InterMessageBox);
}
}
@ -464,7 +451,7 @@ void WindowManager::onDialogueWindowBye()
//removeDialog(dialogueWindow);
mDialogueWindow->setVisible(false);
}
setGuiMode(GM_Game);
popGuiMode();
}
void WindowManager::onFrame (float frameDuration)
@ -608,3 +595,27 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
{
hud->setFpsLevel(Settings::Manager::getInt("fps", "HUD"));
}
void WindowManager::pushGuiMode(GuiMode mode)
{
if (mode==GM_Inventory && allowed==GW_None)
return;
mGuiModes.push_back(mode);
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
updateVisible();
}
void WindowManager::popGuiMode()
{
if (mGuiModes.size())
mGuiModes.pop_back();
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
updateVisible();
}

@ -80,6 +80,7 @@ namespace MWGui
class TradeWindow;
class SettingsWindow;
class ConfirmationDialog;
class AlchemyWindow;
struct ClassPoint
{
@ -99,8 +100,6 @@ namespace MWGui
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
virtual ~WindowManager();
void setGuiMode(GuiMode newMode);
/**
* Should be called each frame to update windows/gui elements.
* This could mean updating sizes of gui elements or opening
@ -108,19 +107,17 @@ namespace MWGui
*/
void update();
void setMode(GuiMode newMode)
{
if (newMode==GM_Inventory && allowed==GW_None)
return;
void pushGuiMode(GuiMode mode);
void popGuiMode();
mode = newMode;
updateVisible();
GuiMode getMode() const
{
if (mGuiModes.empty())
throw std::runtime_error ("getMode() called, but there is no active mode");
return mGuiModes.back();
}
void setNextMode(GuiMode newMode);
GuiMode getMode() const { return mode; }
bool isGuiMode() const { return getMode() != GM_Game; } // Everything that is not game mode is considered "gui mode"
bool isGuiMode() const { return !mGuiModes.empty(); }
// Disallow all inventory mode windows
void disallowAll()
@ -235,6 +232,7 @@ namespace MWGui
TradeWindow* mTradeWindow;
SettingsWindow* mSettingsWindow;
ConfirmationDialog* mConfirmationDialog;
AlchemyWindow* mAlchemyWindow;
CharacterCreation* mCharGen;
@ -249,9 +247,7 @@ namespace MWGui
MyGUI::Gui *gui; // Gui
GuiMode mode; // Current gui mode
GuiMode nextMode; // Next mode to activate in update()
bool needModeChange; //Whether a mode change is needed in update() [will use nextMode]
std::vector<GuiMode> mGuiModes;
std::vector<OEngine::GUI::Layout*> garbageDialogs;
void cleanupGarbage();

@ -140,28 +140,27 @@ namespace MWInput
if (mDragDrop)
return;
MWGui::GuiMode mode = windows.getMode();
if (mode != MWGui::GM_Settings)
setGuiMode(MWGui::GM_Settings);
if (!windows.isGuiMode() || windows.getMode() != MWGui::GM_Settings)
windows.pushGuiMode(MWGui::GM_Settings);
}
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
void toggleInventory()
{
using namespace MWGui;
using namespace MWGui;
if (mDragDrop)
return;
if (mDragDrop)
return;
GuiMode mode = windows.getMode();
bool gameMode = !windows.isGuiMode();
// Toggle between game mode and inventory mode
if(mode == GM_Game)
setGuiMode(GM_Inventory);
else if(mode == GM_Inventory)
setGuiMode(GM_Game);
// Toggle between game mode and inventory mode
if(gameMode)
windows.pushGuiMode(GM_Inventory);
else if(windows.getMode() == GM_Inventory)
windows.popGuiMode();
// .. but don't touch any other mode.
// .. but don't touch any other mode.
}
// Toggle console
@ -172,28 +171,33 @@ namespace MWInput
if (mDragDrop)
return;
GuiMode mode = windows.getMode();
bool gameMode = !windows.isGuiMode();
// Switch to console mode no matter what mode we are currently
// in, except of course if we are already in console mode
if(mode == GM_Console)
setGuiMode(GM_Game);
else setGuiMode(GM_Console);
if (!gameMode)
{
if (windows.getMode() == GM_Console)
windows.popGuiMode();
else
windows.pushGuiMode(GM_Console);
}
else
windows.pushGuiMode(GM_Console);
}
void toggleJournal()
{
using namespace MWGui;
using namespace MWGui;
GuiMode mode = windows.getMode();
// Toggle between game mode and journal mode
bool gameMode = !windows.isGuiMode();
// Toggle between game mode and journal mode
if(mode == GM_Game)
setGuiMode(GM_Journal);
else if(mode == GM_Journal)
setGuiMode(GM_Game);
// .. but don't touch any other mode.
if(gameMode)
windows.pushGuiMode(GM_Journal);
else if(windows.getMode() == GM_Journal)
windows.popGuiMode();
// .. but don't touch any other mode.
}
void activate()
@ -287,8 +291,7 @@ namespace MWInput
lst->add(guiEvents,Event::EV_ALL);
}
// Start out in game mode
setGuiMode(MWGui::GM_Game);
changeInputMode(false);
/**********************************
Key binding section
@ -353,6 +356,7 @@ namespace MWInput
windows.update();
// Disable movement in Gui mode
if (windows.isGuiMode()) return;
// Configure player movement according to keyboard input. Actual movement will
@ -393,14 +397,10 @@ namespace MWInput
// Switch between gui modes. Besides controlling the Gui windows
// this also makes sure input is directed to the right place
void setGuiMode(MWGui::GuiMode mode)
void changeInputMode(bool guiMode)
{
// Tell the GUI what to show (this also takes care of the mouse
// pointer)
windows.setMode(mode);
// Are we in GUI mode now?
if(windows.isGuiMode())
if(guiMode)
{
// Disable mouse look
mouse->setCamera(NULL);
@ -436,11 +436,6 @@ namespace MWInput
delete impl;
}
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
{
impl->setGuiMode(mode);
}
void MWInputManager::update()
{
impl->update();
@ -450,4 +445,9 @@ namespace MWInput
{
impl->setDragDrop(dragDrop);
}
void MWInputManager::changeInputMode(bool guiMode)
{
impl->changeInputMode(guiMode);
}
}

@ -50,9 +50,9 @@ namespace MWInput
void update();
void setDragDrop(bool dragDrop);
void changeInputMode(bool guiMode);
void setGuiMode(MWGui::GuiMode mode);
void setDragDrop(bool dragDrop);
};
}
#endif

@ -44,7 +44,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getInputManager()->setGuiMode(mDialogue);
MWBase::Environment::get().getWindowManager()->pushGuiMode(mDialogue);
}
};

@ -0,0 +1,13 @@
#include "actionalchemy.hpp"
#include "../mwbase/environment.hpp"
#include "../mwgui/window_manager.hpp"
namespace MWWorld
{
void ActionAlchemy::execute()
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Alchemy);
}
}

@ -0,0 +1,15 @@
#ifndef GAME_MWWORLD_ACTIONALCHEMY_H
#define GAME_MWWORLD_ACTIONALCHEMY_H
#include "action.hpp"
namespace MWWorld
{
class ActionAlchemy : public Action
{
public:
virtual void execute ();
};
}
#endif

@ -16,7 +16,7 @@ namespace MWWorld
void ActionOpen::execute ()
{
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Container);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container);
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(mContainer);
}
}

@ -18,12 +18,12 @@ namespace MWWorld
if (ref->base->data.isScroll)
{
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(mObject);
}
else
{
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Book);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book);
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(mObject);
}
}

@ -59,6 +59,7 @@ configure_file("${SDIR}/openmw_count_window_layout.xml" "${DDIR}/openmw_count_wi
configure_file("${SDIR}/openmw_trade_window_layout.xml" "${DDIR}/openmw_trade_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_settings_window_layout.xml" "${DDIR}/openmw_settings_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_confirmation_dialog_layout.xml" "${DDIR}/openmw_confirmation_dialog_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_alchemy_window_layout.xml" "${DDIR}/openmw_alchemy_window_layout.xml" COPYONLY)
configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY)
configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY)
configure_file("${SDIR}/EBGaramond-Regular.ttf" "${DDIR}/EBGaramond-Regular.ttf" COPYONLY)

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 600 500" name="_Main">
</Widget>
</MyGUI>
Loading…
Cancel
Save