Merge remote-tracking branch 'scrawl/master'

openmw-35
Marc Zinnschlag 10 years ago
commit 595c08817f

@ -101,7 +101,7 @@ set(OENGINE_OGRE
set(OENGINE_GUI set(OENGINE_GUI
${LIBS_DIR}/openengine/gui/loglistener.cpp ${LIBS_DIR}/openengine/gui/loglistener.cpp
${LIBS_DIR}/openengine/gui/manager.cpp ${LIBS_DIR}/openengine/gui/manager.cpp
${LIBS_DIR}/openengine/gui/layout.hpp ${LIBS_DIR}/openengine/gui/layout.cpp
) )
set(OENGINE_BULLET set(OENGINE_BULLET

@ -41,6 +41,7 @@ add_openmw_dir (mwgui
itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog
recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview
draganddrop
) )
add_openmw_dir (mwdialogue add_openmw_dir (mwdialogue

@ -28,6 +28,8 @@ public:
void seed (string_t keyword, value_t value) void seed (string_t keyword, value_t value)
{ {
if (keyword.empty())
return;
seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), 0, mRoot); seed_impl (/*std::move*/ (keyword), /*std::move*/ (value), 0, mRoot);
} }

@ -1,7 +1,8 @@
#include "alchemywindow.hpp" #include "alchemywindow.hpp"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -9,6 +10,7 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/magiceffects.hpp" #include "../mwmechanics/magiceffects.hpp"
#include "../mwmechanics/alchemy.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
@ -27,6 +29,7 @@ namespace MWGui
, mApparatus (4) , mApparatus (4)
, mIngredients (4) , mIngredients (4)
, mSortModel(NULL) , mSortModel(NULL)
, mAlchemy(new MWMechanics::Alchemy())
{ {
getWidget(mCreateButton, "CreateButton"); getWidget(mCreateButton, "CreateButton");
getWidget(mCancelButton, "CancelButton"); getWidget(mCancelButton, "CancelButton");
@ -66,7 +69,7 @@ namespace MWGui
std::string name = mNameEdit->getCaption(); std::string name = mNameEdit->getCaption();
boost::algorithm::trim(name); boost::algorithm::trim(name);
MWMechanics::Alchemy::Result result = mAlchemy.create (mNameEdit->getCaption ()); MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ());
if (result == MWMechanics::Alchemy::Result_NoName) if (result == MWMechanics::Alchemy::Result_NoName)
{ {
@ -121,7 +124,7 @@ namespace MWGui
void AlchemyWindow::open() void AlchemyWindow::open()
{ {
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr()); InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr());
mSortModel = new SortFilterItemModel(model); mSortModel = new SortFilterItemModel(model);
@ -132,10 +135,10 @@ namespace MWGui
int index = 0; int index = 0;
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr()); mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy->beginTools());
iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index) iter!=mAlchemy->endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
{ {
mApparatus.at (index)->setItem(*iter); mApparatus.at (index)->setItem(*iter);
mApparatus.at (index)->clearUserStrings(); mApparatus.at (index)->clearUserStrings();
@ -150,7 +153,7 @@ namespace MWGui
} }
void AlchemyWindow::exit() { void AlchemyWindow::exit() {
mAlchemy.clear(); mAlchemy->clear();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
} }
@ -164,7 +167,7 @@ namespace MWGui
void AlchemyWindow::onSelectedItem(int index) void AlchemyWindow::onSelectedItem(int index)
{ {
MWWorld::Ptr item = mSortModel->getItem(index).mBase; MWWorld::Ptr item = mSortModel->getItem(index).mBase;
int res = mAlchemy.addIngredient(item); int res = mAlchemy->addIngredient(item);
if (res != -1) if (res != -1)
{ {
@ -177,20 +180,20 @@ namespace MWGui
void AlchemyWindow::update() void AlchemyWindow::update()
{ {
std::string suggestedName = mAlchemy.suggestPotionName(); std::string suggestedName = mAlchemy->suggestPotionName();
if (suggestedName != mSuggestedPotionName) if (suggestedName != mSuggestedPotionName)
mNameEdit->setCaptionWithReplacing(suggestedName); mNameEdit->setCaptionWithReplacing(suggestedName);
mSuggestedPotionName = suggestedName; mSuggestedPotionName = suggestedName;
mSortModel->clearDragItems(); mSortModel->clearDragItems();
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients (); MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy->beginIngredients ();
for (int i=0; i<4; ++i) for (int i=0; i<4; ++i)
{ {
ItemWidget* ingredient = mIngredients[i]; ItemWidget* ingredient = mIngredients[i];
MWWorld::Ptr item; MWWorld::Ptr item;
if (it != mAlchemy.endIngredients ()) if (it != mAlchemy->endIngredients ())
{ {
item = *it; item = *it;
++it; ++it;
@ -217,7 +220,7 @@ namespace MWGui
mItemView->update(); mItemView->update();
std::set<MWMechanics::EffectKey> effectIds = mAlchemy.listEffects(); std::set<MWMechanics::EffectKey> effectIds = mAlchemy->listEffects();
Widgets::SpellEffectList list; Widgets::SpellEffectList list;
for (std::set<MWMechanics::EffectKey>::iterator it = effectIds.begin(); it != effectIds.end(); ++it) for (std::set<MWMechanics::EffectKey>::iterator it = effectIds.begin(); it != effectIds.end(); ++it)
{ {
@ -252,7 +255,7 @@ namespace MWGui
{ {
for (int i=0; i<4; ++i) for (int i=0; i<4; ++i)
if (mIngredients[i] == ingredient) if (mIngredients[i] == ingredient)
mAlchemy.removeIngredient (i); mAlchemy->removeIngredient (i);
update(); update();
} }

@ -3,11 +3,14 @@
#include <vector> #include <vector>
#include "../mwmechanics/alchemy.hpp"
#include "widgets.hpp" #include "widgets.hpp"
#include "windowbase.hpp" #include "windowbase.hpp"
namespace MWMechanics
{
class Alchemy;
}
namespace MWGui namespace MWGui
{ {
class ItemView; class ItemView;
@ -45,7 +48,7 @@ namespace MWGui
void update(); void update();
MWMechanics::Alchemy mAlchemy; std::auto_ptr<MWMechanics::Alchemy> mAlchemy;
std::vector<ItemWidget*> mApparatus; std::vector<ItemWidget*> mApparatus;
std::vector<ItemWidget*> mIngredients; std::vector<ItemWidget*> mIngredients;

@ -1,6 +1,8 @@
#include "birth.hpp" #include "birth.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_ListBox.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
@ -230,7 +232,7 @@ namespace MWGui
for (std::vector<std::string>::const_iterator it = categories[category].spells.begin(); it != end; ++it) for (std::vector<std::string>::const_iterator it = categories[category].spells.begin(); it != end; ++it)
{ {
const std::string &spellId = *it; const std::string &spellId = *it;
spellWidget = mSpellArea->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("Spell") + boost::lexical_cast<std::string>(i)); spellWidget = mSpellArea->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("Spell") + MyGUI::utility::toString(i));
spellWidget->setSpellId(spellId); spellWidget->setSpellId(spellId);
mSpellItems.push_back(spellWidget); mSpellItems.push_back(spellWidget);

@ -3,11 +3,6 @@
#include "windowbase.hpp" #include "windowbase.hpp"
/*
This file contains the dialog for choosing a birth sign.
Layout is defined by resources/mygui/openmw_chargen_race.layout.
*/
namespace MWGui namespace MWGui
{ {
class BirthDialog : public WindowModal class BirthDialog : public WindowModal

@ -1,6 +1,6 @@
#include "bookwindow.hpp" #include "bookwindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_TextBox.h>
#include <components/esm/loadbook.hpp> #include <components/esm/loadbook.hpp>
@ -140,8 +140,8 @@ namespace MWGui
void BookWindow::updatePages() void BookWindow::updatePages()
{ {
mLeftPageNumber->setCaption( boost::lexical_cast<std::string>(mCurrentPage*2 + 1) ); mLeftPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 1) );
mRightPageNumber->setCaption( boost::lexical_cast<std::string>(mCurrentPage*2 + 2) ); mRightPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 2) );
//If it is the last page, hide the button "Next Page" //If it is the last page, hide the button "Next Page"
if ( (mCurrentPage+1)*2 == mPages.size() if ( (mCurrentPage+1)*2 == mPages.size()

@ -1,20 +1,24 @@
#include "charactercreation.hpp" #include "charactercreation.hpp"
#include "textinput.hpp"
#include "race.hpp"
#include "class.hpp"
#include "birth.hpp"
#include "review.hpp"
#include "inventorywindow.hpp"
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/fallback.hpp" #include "../mwworld/fallback.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "textinput.hpp"
#include "race.hpp"
#include "class.hpp"
#include "birth.hpp"
#include "review.hpp"
#include "inventorywindow.hpp"
namespace namespace
{ {
struct Step struct Step
@ -28,11 +32,11 @@ namespace
Step sGenerateClassSteps(int number) { Step sGenerateClassSteps(int number) {
number++; number++;
const MWWorld::Fallback* fallback=MWBase::Environment::get().getWorld()->getFallback(); const MWWorld::Fallback* fallback=MWBase::Environment::get().getWorld()->getFallback();
Step step = {fallback->getFallbackString("Question_"+boost::lexical_cast<std::string>(number)+"_Question"), Step step = {fallback->getFallbackString("Question_"+MyGUI::utility::toString(number)+"_Question"),
{fallback->getFallbackString("Question_"+boost::lexical_cast<std::string>(number)+"_AnswerOne"), {fallback->getFallbackString("Question_"+MyGUI::utility::toString(number)+"_AnswerOne"),
fallback->getFallbackString("Question_"+boost::lexical_cast<std::string>(number)+"_AnswerTwo"), fallback->getFallbackString("Question_"+MyGUI::utility::toString(number)+"_AnswerTwo"),
fallback->getFallbackString("Question_"+boost::lexical_cast<std::string>(number)+"_AnswerThree")}, fallback->getFallbackString("Question_"+MyGUI::utility::toString(number)+"_AnswerThree")},
"vo\\misc\\chargen qa"+boost::lexical_cast<std::string>(number)+".wav" "vo\\misc\\chargen qa"+MyGUI::utility::toString(number)+".wav"
}; };
return step; return step;
} }

@ -4,8 +4,9 @@
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
#include <components/esm/loadclas.hpp> #include <components/esm/loadclas.hpp>
#include "../mwbase/world.hpp" #include <vector>
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/stat.hpp"
namespace MWGui namespace MWGui
{ {

@ -1,5 +1,9 @@
#include "class.hpp" #include "class.hpp"
#include <MyGUI_ImageBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"

@ -6,11 +6,6 @@
#include "widgets.hpp" #include "widgets.hpp"
#include "windowbase.hpp" #include "windowbase.hpp"
/*
This file contains the dialogs for choosing a class.
Layout is defined by resources/mygui/openmw_chargen_class.layout.
*/
namespace MWGui namespace MWGui
{ {
class InfoBoxDialog : public WindowModal class InfoBoxDialog : public WindowModal

@ -1,9 +1,10 @@
#include "companionwindow.hpp" #include "companionwindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_InputManager.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
@ -13,7 +14,7 @@
#include "itemview.hpp" #include "itemview.hpp"
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"
#include "companionitemmodel.hpp" #include "companionitemmodel.hpp"
#include "container.hpp" #include "draganddrop.hpp"
#include "countdialog.hpp" #include "countdialog.hpp"
namespace MWGui namespace MWGui
@ -120,7 +121,7 @@ void CompanionWindow::updateEncumbranceBar()
else else
{ {
MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr); MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr);
mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + boost::lexical_cast<std::string>(stats.getProfit())); mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + MyGUI::utility::toString(stats.getProfit()));
} }
} }

@ -1,5 +1,8 @@
#include "confirmationdialog.hpp" #include "confirmationdialog.hpp"
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
namespace MWGui namespace MWGui
{ {
ConfirmationDialog::ConfirmationDialog() : ConfirmationDialog::ConfirmationDialog() :

@ -1,5 +1,7 @@
#include "console.hpp" #include "console.hpp"
#include <MyGUI_EditBox.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>

@ -1,6 +1,7 @@
#include "container.hpp" #include "container.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_InputManager.h>
#include <MyGUI_Button.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -24,123 +25,11 @@
#include "inventoryitemmodel.hpp" #include "inventoryitemmodel.hpp"
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"
#include "pickpocketitemmodel.hpp" #include "pickpocketitemmodel.hpp"
#include "draganddrop.hpp"
namespace MWGui namespace MWGui
{ {
DragAndDrop::DragAndDrop()
: mDraggedWidget(NULL)
, mDraggedCount(0)
, mSourceModel(NULL)
, mSourceView(NULL)
, mSourceSortModel(NULL)
, mIsOnDragAndDrop(false)
{
}
void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count)
{
mItem = sourceModel->getItem(index);
mDraggedCount = count;
mSourceModel = sourceModel;
mSourceView = sourceView;
mSourceSortModel = sortModel;
mIsOnDragAndDrop = true;
// If picking up an item that isn't from the player's inventory, the item gets added to player inventory backend
// immediately, even though it's still floating beneath the mouse cursor. A bit counterintuitive,
// but this is how it works in vanilla, and not doing so would break quests (BM_beasts for instance).
ItemModel* playerModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getModel();
if (mSourceModel != playerModel)
{
MWWorld::Ptr item = mSourceModel->moveItem(mItem, mDraggedCount, playerModel);
playerModel->update();
ItemModel::ModelIndex newIndex = -1;
for (unsigned int i=0; i<playerModel->getItemCount(); ++i)
{
if (playerModel->getItem(i).mBase == item)
{
newIndex = i;
break;
}
}
mItem = playerModel->getItem(newIndex);
mSourceModel = playerModel;
SortFilterItemModel* playerFilterModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getSortFilterModel();
mSourceSortModel = playerFilterModel;
}
std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
if (mSourceSortModel)
{
mSourceSortModel->clearDragItems();
mSourceSortModel->addDragItem(mItem.mBase, count);
}
ItemWidget* baseWidget = MyGUI::Gui::getInstance().createWidget<ItemWidget>("MW_ItemIcon", 0, 0, 42, 42, MyGUI::Align::Default, "DragAndDrop");
Controllers::ControllerFollowMouse* controller =
MyGUI::ControllerManager::getInstance().createItem(Controllers::ControllerFollowMouse::getClassTypeName())
->castType<Controllers::ControllerFollowMouse>();
MyGUI::ControllerManager::getInstance().addItem(baseWidget, controller);
mDraggedWidget = baseWidget;
baseWidget->setItem(mItem.mBase);
baseWidget->setNeedMouseFocus(false);
baseWidget->setCount(count);
sourceView->update();
MWBase::Environment::get().getWindowManager()->setDragDrop(true);
}
void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
{
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
// We can't drop a conjured item to the ground; the target container should always be the source container
if (mItem.mFlags & ItemStack::Flag_Bound && targetModel != mSourceModel)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
// If item is dropped where it was taken from, we don't need to do anything -
// otherwise, do the transfer
if (targetModel != mSourceModel)
{
mSourceModel->moveItem(mItem, mDraggedCount, targetModel);
}
mSourceModel->update();
finish();
if (targetView)
targetView->update();
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
// We need to update the view since an other item could be auto-equipped.
mSourceView->update();
}
void DragAndDrop::finish()
{
mIsOnDragAndDrop = false;
mSourceSortModel->clearDragItems();
MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget);
mDraggedWidget = 0;
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
}
ContainerWindow::ContainerWindow(DragAndDrop* dragAndDrop) ContainerWindow::ContainerWindow(DragAndDrop* dragAndDrop)
: WindowBase("openmw_container_window.layout") : WindowBase("openmw_container_window.layout")
, mDragAndDrop(dragAndDrop) , mDragAndDrop(dragAndDrop)

@ -28,25 +28,6 @@ namespace MWGui
namespace MWGui namespace MWGui
{ {
class DragAndDrop
{
public:
bool mIsOnDragAndDrop;
MyGUI::Widget* mDraggedWidget;
ItemModel* mSourceModel;
ItemView* mSourceView;
SortFilterItemModel* mSourceSortModel;
ItemStack mItem;
int mDraggedCount;
DragAndDrop();
void startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count);
void drop (ItemModel* targetModel, ItemView* targetView);
void finish();
};
class ContainerWindow : public WindowBase, public ReferenceInterface class ContainerWindow : public WindowBase, public ReferenceInterface
{ {
public: public:

@ -1,6 +1,7 @@
#include "controllers.hpp" #include "controllers.hpp"
#include <MyGUI_InputManager.h> #include <MyGUI_InputManager.h>
#include <MyGUI_Widget.h>
namespace MWGui namespace MWGui
{ {

@ -1,9 +1,13 @@
#ifndef MWGUI_CONTROLLERS_H #ifndef MWGUI_CONTROLLERS_H
#define MWGUI_CONTROLLERS_H #define MWGUI_CONTROLLERS_H
#include <MyGUI_Widget.h> #include <string>
#include <MyGUI_ControllerItem.h> #include <MyGUI_ControllerItem.h>
namespace MyGUI
{
class Widget;
}
namespace MWGui namespace MWGui
{ {

@ -1,6 +1,8 @@
#include "countdialog.hpp" #include "countdialog.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Button.h>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_RenderManager.h>
#include <components/widgets/numericeditbox.hpp> #include <components/widgets/numericeditbox.hpp>

@ -1,5 +1,9 @@
#include "debugwindow.hpp" #include "debugwindow.hpp"
#include <MyGUI_TabControl.h>
#include <MyGUI_TabItem.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_EditBox.h>
#include <LinearMath/btQuickprof.h> #include <LinearMath/btQuickprof.h>

@ -1,7 +1,10 @@
#include "dialogue.hpp" #include "dialogue.hpp"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_Window.h>
#include <MyGUI_ProgressBar.h>
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
@ -96,7 +99,7 @@ namespace MWGui
mBribe100Button->setEnabled (playerGold >= 100); mBribe100Button->setEnabled (playerGold >= 100);
mBribe1000Button->setEnabled (playerGold >= 1000); mBribe1000Button->setEnabled (playerGold >= 1000);
mGoldLabel->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); mGoldLabel->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
} }
void PersuasionDialog::exit() void PersuasionDialog::exit()
@ -626,7 +629,7 @@ namespace MWGui
dispositionVisible = true; dispositionVisible = true;
mDispositionBar->setProgressRange(100); mDispositionBar->setProgressRange(100);
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)); mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr));
mDispositionText->setCaption(boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100")); mDispositionText->setCaption(MyGUI::utility::toString(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100"));
} }
bool dispositionWasVisible = mDispositionBar->getVisible(); bool dispositionWasVisible = mDispositionBar->getVisible();
@ -668,7 +671,7 @@ namespace MWGui
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange())); + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()));
mDispositionBar->setProgressRange(100); mDispositionBar->setProgressRange(100);
mDispositionBar->setProgressPosition(disp); mDispositionBar->setProgressPosition(disp);
mDispositionText->setCaption(boost::lexical_cast<std::string>(disp)+std::string("/100")); mDispositionText->setCaption(MyGUI::utility::toString(disp)+std::string("/100"));
} }
} }
} }

@ -18,11 +18,6 @@ namespace MWGui
class WindowManager; class WindowManager;
} }
/*
This file contains the dialouge window
Layout is defined by resources/mygui/openmw_dialogue_window.layout.
*/
namespace MWGui namespace MWGui
{ {
class DialogueHistoryViewModel; class DialogueHistoryViewModel;
@ -171,7 +166,7 @@ namespace MWGui
BookPage* mHistory; BookPage* mHistory;
Gui::MWList* mTopicsList; Gui::MWList* mTopicsList;
MyGUI::ScrollBar* mScrollBar; MyGUI::ScrollBar* mScrollBar;
MyGUI::Progress* mDispositionBar; MyGUI::ProgressBar* mDispositionBar;
MyGUI::EditBox* mDispositionText; MyGUI::EditBox* mDispositionText;
PersuasionDialog mPersuasionDialog; PersuasionDialog mPersuasionDialog;

@ -0,0 +1,134 @@
#include "draganddrop.hpp"
#include <MyGUI_Gui.h>
#include <MyGUI_ControllerManager.h>
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/class.hpp"
#include "sortfilteritemmodel.hpp"
#include "inventorywindow.hpp"
#include "itemwidget.hpp"
#include "itemview.hpp"
#include "controllers.hpp"
namespace MWGui
{
DragAndDrop::DragAndDrop()
: mDraggedWidget(NULL)
, mDraggedCount(0)
, mSourceModel(NULL)
, mSourceView(NULL)
, mSourceSortModel(NULL)
, mIsOnDragAndDrop(false)
{
}
void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count)
{
mItem = sourceModel->getItem(index);
mDraggedCount = count;
mSourceModel = sourceModel;
mSourceView = sourceView;
mSourceSortModel = sortModel;
mIsOnDragAndDrop = true;
// If picking up an item that isn't from the player's inventory, the item gets added to player inventory backend
// immediately, even though it's still floating beneath the mouse cursor. A bit counterintuitive,
// but this is how it works in vanilla, and not doing so would break quests (BM_beasts for instance).
ItemModel* playerModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getModel();
if (mSourceModel != playerModel)
{
MWWorld::Ptr item = mSourceModel->moveItem(mItem, mDraggedCount, playerModel);
playerModel->update();
ItemModel::ModelIndex newIndex = -1;
for (unsigned int i=0; i<playerModel->getItemCount(); ++i)
{
if (playerModel->getItem(i).mBase == item)
{
newIndex = i;
break;
}
}
mItem = playerModel->getItem(newIndex);
mSourceModel = playerModel;
SortFilterItemModel* playerFilterModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getSortFilterModel();
mSourceSortModel = playerFilterModel;
}
std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
if (mSourceSortModel)
{
mSourceSortModel->clearDragItems();
mSourceSortModel->addDragItem(mItem.mBase, count);
}
ItemWidget* baseWidget = MyGUI::Gui::getInstance().createWidget<ItemWidget>("MW_ItemIcon", 0, 0, 42, 42, MyGUI::Align::Default, "DragAndDrop");
Controllers::ControllerFollowMouse* controller =
MyGUI::ControllerManager::getInstance().createItem(Controllers::ControllerFollowMouse::getClassTypeName())
->castType<Controllers::ControllerFollowMouse>();
MyGUI::ControllerManager::getInstance().addItem(baseWidget, controller);
mDraggedWidget = baseWidget;
baseWidget->setItem(mItem.mBase);
baseWidget->setNeedMouseFocus(false);
baseWidget->setCount(count);
sourceView->update();
MWBase::Environment::get().getWindowManager()->setDragDrop(true);
}
void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
{
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
// We can't drop a conjured item to the ground; the target container should always be the source container
if (mItem.mFlags & ItemStack::Flag_Bound && targetModel != mSourceModel)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
// If item is dropped where it was taken from, we don't need to do anything -
// otherwise, do the transfer
if (targetModel != mSourceModel)
{
mSourceModel->moveItem(mItem, mDraggedCount, targetModel);
}
mSourceModel->update();
finish();
if (targetView)
targetView->update();
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
// We need to update the view since an other item could be auto-equipped.
mSourceView->update();
}
void DragAndDrop::finish()
{
mIsOnDragAndDrop = false;
mSourceSortModel->clearDragItems();
MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget);
mDraggedWidget = 0;
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
}
}

@ -0,0 +1,38 @@
#ifndef OPENMW_MWGUI_DRAGANDDROP_H
#define OPENMW_MWGUI_DRAGANDDROP_H
#include "itemmodel.hpp"
namespace MyGUI
{
class Widget;
}
namespace MWGui
{
class ItemView;
class SortFilterItemModel;
class DragAndDrop
{
public:
bool mIsOnDragAndDrop;
MyGUI::Widget* mDraggedWidget;
ItemModel* mSourceModel;
ItemView* mSourceView;
SortFilterItemModel* mSourceSortModel;
ItemStack mItem;
int mDraggedCount;
DragAndDrop();
void startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count);
void drop (ItemModel* targetModel, ItemView* targetView);
void finish();
};
}
#endif

@ -3,7 +3,12 @@
#include <iomanip> #include <iomanip>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/widgets/list.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -15,7 +20,6 @@
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "itemselection.hpp" #include "itemselection.hpp"
#include "container.hpp"
#include "itemwidget.hpp" #include "itemwidget.hpp"
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"
@ -106,15 +110,15 @@ namespace MWGui
{ {
std::stringstream enchantCost; std::stringstream enchantCost;
enchantCost << std::setprecision(1) << std::fixed << mEnchanting.getEnchantPoints(); enchantCost << std::setprecision(1) << std::fixed << mEnchanting.getEnchantPoints();
mEnchantmentPoints->setCaption(enchantCost.str() + " / " + boost::lexical_cast<std::string>(mEnchanting.getMaxEnchantValue())); mEnchantmentPoints->setCaption(enchantCost.str() + " / " + MyGUI::utility::toString(mEnchanting.getMaxEnchantValue()));
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge())); mCharge->setCaption(MyGUI::utility::toString(mEnchanting.getGemCharge()));
std::stringstream castCost; std::stringstream castCost;
castCost << mEnchanting.getEffectiveCastCost(); castCost << mEnchanting.getEffectiveCastCost();
mCastCost->setCaption(castCost.str()); mCastCost->setCaption(castCost.str());
mPrice->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantPrice())); mPrice->setCaption(MyGUI::utility::toString(mEnchanting.getEnchantPrice()));
switch(mEnchanting.getCastStyle()) switch(mEnchanting.getCastStyle())
{ {

@ -1,19 +1,22 @@
#include "formatting.hpp" #include "formatting.hpp"
#include <components/interpreter/defines.hpp> #include <OgreUTFString.h>
#include <components/misc/resourcehelpers.hpp> #include <OgreResourceGroupManager.h>
#include <components/misc/stringops.hpp>
#include "../mwscript/interpretercontext.hpp" #include <MyGUI_EditText.h>
#include <MyGUI_Gui.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_FontManager.h>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <OgreUTFString.h> #include <components/interpreter/defines.hpp>
#include <OgreResourceGroupManager.h> #include <components/misc/resourcehelpers.hpp>
#include <components/misc/stringops.hpp>
#include <MyGUI_EditText.h> #include "../mwscript/interpretercontext.hpp"
namespace MWGui namespace MWGui
{ {
@ -280,8 +283,8 @@ namespace MWGui
continue; continue;
std::string src = attr.at("src"); std::string src = attr.at("src");
int width = boost::lexical_cast<int>(attr.at("width")); int width = MyGUI::utility::parseInt(attr.at("width"));
int height = boost::lexical_cast<int>(attr.at("height")); int height = MyGUI::utility::parseInt(attr.at("height"));
ImageElement elem(paper, pag, mBlockStyle, ImageElement elem(paper, pag, mBlockStyle,
src, width, height); src, width, height);
@ -393,7 +396,7 @@ namespace MWGui
{ {
MyGUI::EditBox* box = parent->createWidget<MyGUI::EditBox>("NormalText", MyGUI::EditBox* box = parent->createWidget<MyGUI::EditBox>("NormalText",
MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top, MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top,
parent->getName() + boost::lexical_cast<std::string>(parent->getChildCount())); parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
box->setProperty("Static", "true"); box->setProperty("Static", "true");
box->setProperty("MultiLine", "true"); box->setProperty("MultiLine", "true");
box->setProperty("WordWrap", "true"); box->setProperty("WordWrap", "true");
@ -461,7 +464,7 @@ namespace MWGui
mImageBox = parent->createWidget<MyGUI::ImageBox> ("ImageBox", mImageBox = parent->createWidget<MyGUI::ImageBox> ("ImageBox",
MyGUI::IntCoord(left, pag.getCurrentTop(), width, mImageHeight), MyGUI::Align::Left | MyGUI::Align::Top, MyGUI::IntCoord(left, pag.getCurrentTop(), width, mImageHeight), MyGUI::Align::Left | MyGUI::Align::Top,
parent->getName() + boost::lexical_cast<std::string>(parent->getChildCount())); parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
std::string image = Misc::ResourceHelpers::correctBookartPath(src, width, mImageHeight); std::string image = Misc::ResourceHelpers::correctBookartPath(src, width, mImageHeight);
mImageBox->setImageTexture(image); mImageBox->setImageTexture(image);

@ -1,7 +1,7 @@
#ifndef MWGUI_FORMATTING_H #ifndef MWGUI_FORMATTING_H
#define MWGUI_FORMATTING_H #define MWGUI_FORMATTING_H
#include <MyGUI.h> #include <MyGUI_Colour.h>
#include <map> #include <map>
namespace MWGui namespace MWGui

@ -1,6 +1,13 @@
#include "hud.hpp" #include "hud.hpp"
#include <boost/lexical_cast.hpp> #include <OgreMath.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_ProgressBar.h>
#include <MyGUI_Button.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_ScrollView.h>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
@ -19,7 +26,7 @@
#include "console.hpp" #include "console.hpp"
#include "spellicons.hpp" #include "spellicons.hpp"
#include "itemmodel.hpp" #include "itemmodel.hpp"
#include "container.hpp" #include "draganddrop.hpp"
#include "itemmodel.hpp" #include "itemmodel.hpp"
#include "itemwidget.hpp" #include "itemwidget.hpp"
@ -205,17 +212,17 @@ namespace MWGui
void HUD::setFPS(float fps) void HUD::setFPS(float fps)
{ {
if (mFpsCounter) if (mFpsCounter)
mFpsCounter->setCaption(boost::lexical_cast<std::string>((int)fps)); mFpsCounter->setCaption(MyGUI::utility::toString((int)fps));
} }
void HUD::setTriangleCount(unsigned int count) void HUD::setTriangleCount(unsigned int count)
{ {
mTriangleCounter->setCaption(boost::lexical_cast<std::string>(count)); mTriangleCounter->setCaption(MyGUI::utility::toString(count));
} }
void HUD::setBatchCount(unsigned int count) void HUD::setBatchCount(unsigned int count)
{ {
mBatchCounter->setCaption(boost::lexical_cast<std::string>(count)); mBatchCounter->setCaption(MyGUI::utility::toString(count));
} }
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value) void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
@ -224,7 +231,7 @@ namespace MWGui
int modified = static_cast<int>(value.getModified()); int modified = static_cast<int>(value.getModified());
MyGUI::Widget* w; MyGUI::Widget* w;
std::string valStr = boost::lexical_cast<std::string>(current) + "/" + boost::lexical_cast<std::string>(modified); std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified);
if (id == "HBar") if (id == "HBar")
{ {
mHealth->setProgressRange(modified); mHealth->setProgressRange(modified);

@ -4,7 +4,11 @@
#include "mapwindow.hpp" #include "mapwindow.hpp"
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "../mwworld/ptr.hpp"
namespace MWWorld
{
class Ptr;
}
namespace MWGui namespace MWGui
{ {

@ -2,7 +2,11 @@
#include <stdexcept> #include <stdexcept>
#include <boost/lexical_cast.hpp> #include <MyGUI_Window.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_Button.h>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -15,6 +19,7 @@
#include "../mwworld/action.hpp" #include "../mwworld/action.hpp"
#include "../mwscript/interpretercontext.hpp" #include "../mwscript/interpretercontext.hpp"
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
#include "../mwrender/characterpreview.hpp"
#include "bookwindow.hpp" #include "bookwindow.hpp"
#include "scrollwindow.hpp" #include "scrollwindow.hpp"
@ -25,7 +30,8 @@
#include "tradeitemmodel.hpp" #include "tradeitemmodel.hpp"
#include "countdialog.hpp" #include "countdialog.hpp"
#include "tradewindow.hpp" #include "tradewindow.hpp"
#include "container.hpp" #include "draganddrop.hpp"
#include "widgets.hpp"
namespace namespace
{ {
@ -534,9 +540,9 @@ namespace MWGui
if (mPreviewResize || mPreviewDirty) if (mPreviewResize || mPreviewDirty)
{ {
mArmorRating->setCaptionWithReplacing ("#{sArmor}: " mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
+ boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr)))); + MyGUI::utility::toString(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
if (mArmorRating->getTextSize().width > mArmorRating->getSize().width) if (mArmorRating->getTextSize().width > mArmorRating->getSize().width)
mArmorRating->setCaptionWithReplacing (boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr)))); mArmorRating->setCaptionWithReplacing (MyGUI::utility::toString(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
} }
if (mPreviewResize) if (mPreviewResize)
{ {
@ -667,4 +673,9 @@ namespace MWGui
useItem(model.getItem(cycled).mBase); useItem(model.getItem(cycled).mBase);
} }
void InventoryWindow::rebuildAvatar()
{
mPreview->rebuild();
}
} }

@ -1,14 +1,23 @@
#ifndef MGUI_Inventory_H #ifndef MGUI_Inventory_H
#define MGUI_Inventory_H #define MGUI_Inventory_H
#include "../mwrender/characterpreview.hpp"
#include "windowpinnablebase.hpp" #include "windowpinnablebase.hpp"
#include "widgets.hpp"
#include "mode.hpp" #include "mode.hpp"
#include "../mwworld/ptr.hpp"
namespace MWRender
{
class InventoryPreview;
}
namespace MWGui namespace MWGui
{ {
namespace Widgets
{
class MWDynamicStat;
}
class ItemView; class ItemView;
class SortFilterItemModel; class SortFilterItemModel;
class TradeItemModel; class TradeItemModel;
@ -33,9 +42,7 @@ namespace MWGui
MWWorld::Ptr getAvatarSelectedItem(int x, int y); MWWorld::Ptr getAvatarSelectedItem(int x, int y);
void rebuildAvatar() { void rebuildAvatar();
mPreview->rebuild();
}
SortFilterItemModel* getSortFilterModel(); SortFilterItemModel* getSortFilterModel();
TradeItemModel* getTradeModel(); TradeItemModel* getTradeModel();

@ -1,5 +1,8 @@
#include "itemselection.hpp" #include "itemselection.hpp"
#include <MyGUI_TextBox.h>
#include <MyGUI_Button.h>
#include "itemview.hpp" #include "itemview.hpp"
#include "inventoryitemmodel.hpp" #include "inventoryitemmodel.hpp"
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"

@ -1,7 +1,14 @@
#ifndef OPENMW_GAME_MWGUI_ITEMSELECTION_H #ifndef OPENMW_GAME_MWGUI_ITEMSELECTION_H
#define OPENMW_GAME_MWGUI_ITEMSELECTION_H #define OPENMW_GAME_MWGUI_ITEMSELECTION_H
#include "container.hpp" #include <MyGUI_Delegate.h>
#include "windowbase.hpp"
namespace MWWorld
{
class Ptr;
}
namespace MWGui namespace MWGui
{ {

@ -2,8 +2,6 @@
#include <cmath> #include <cmath>
#include <boost/lexical_cast.hpp>
#include <MyGUI_FactoryManager.h> #include <MyGUI_FactoryManager.h>
#include <MyGUI_Gui.h> #include <MyGUI_Gui.h>
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>

@ -4,8 +4,6 @@
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_TextBox.h> #include <MyGUI_TextBox.h>
#include <boost/lexical_cast.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -17,9 +15,9 @@ namespace
if (count == 1) if (count == 1)
return ""; return "";
if (count > 9999) if (count > 9999)
return boost::lexical_cast<std::string>(int(count/1000.f)) + "k"; return MyGUI::utility::toString(int(count/1000.f)) + "k";
else else
return boost::lexical_cast<std::string>(count); return MyGUI::utility::toString(count);
} }
} }

@ -1,22 +1,24 @@
#include "journalwindow.hpp" #include "journalwindow.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/journal.hpp"
#include <sstream> #include <sstream>
#include <set> #include <set>
#include <stack> #include <stack>
#include <string> #include <string>
#include <utility> #include <utility>
#include <MyGUI_TextBox.h>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include "boost/lexical_cast.hpp"
#include <components/widgets/imagebutton.hpp> #include <components/widgets/imagebutton.hpp>
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/journal.hpp"
#include "bookpage.hpp" #include "bookpage.hpp"
#include "windowbase.hpp" #include "windowbase.hpp"
#include "journalviewmodel.hpp" #include "journalviewmodel.hpp"
@ -71,7 +73,7 @@ namespace
void setText (char const * name, value_type const & value) void setText (char const * name, value_type const & value)
{ {
getWidget <MyGUI::TextBox> (name) -> getWidget <MyGUI::TextBox> (name) ->
setCaption (boost::lexical_cast <std::string> (value)); setCaption (MyGUI::utility::toString (value));
} }
void setVisible (char const * name, bool visible) void setVisible (char const * name, bool visible)

@ -1,7 +1,6 @@
#ifndef MWGUI_JOURNAL_H #ifndef MWGUI_JOURNAL_H
#define MWGUI_JOURNAL_H #define MWGUI_JOURNAL_H
#include <memory>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
namespace MWBase { class WindowManager; } namespace MWBase { class WindowManager; }

@ -1,6 +1,8 @@
#include "levelupdialog.hpp" #include "levelupdialog.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Button.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_EditBox.h>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -34,17 +36,17 @@ namespace MWGui
for (int i=1; i<9; ++i) for (int i=1; i<9; ++i)
{ {
MyGUI::TextBox* t; MyGUI::TextBox* t;
getWidget(t, "AttribVal" + boost::lexical_cast<std::string>(i)); getWidget(t, "AttribVal" + MyGUI::utility::toString(i));
MyGUI::Button* b; MyGUI::Button* b;
getWidget(b, "Attrib" + boost::lexical_cast<std::string>(i)); getWidget(b, "Attrib" + MyGUI::utility::toString(i));
b->setUserData (i-1); b->setUserData (i-1);
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked); b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
mAttributes.push_back(b); mAttributes.push_back(b);
mAttributeValues.push_back(t); mAttributeValues.push_back(t);
getWidget(t, "AttribMultiplier" + boost::lexical_cast<std::string>(i)); getWidget(t, "AttribMultiplier" + MyGUI::utility::toString(i));
mAttributeMultipliers.push_back(t); mAttributeMultipliers.push_back(t);
} }
@ -76,7 +78,7 @@ namespace MWGui
if (val >= 100) if (val >= 100)
val = 100; val = 100;
mAttributeValues[i]->setCaption(boost::lexical_cast<std::string>(val)); mAttributeValues[i]->setCaption(MyGUI::utility::toString(val));
} }
} }
@ -154,13 +156,13 @@ namespace MWGui
mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds"); mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds");
int level = creatureStats.getLevel ()+1; int level = creatureStats.getLevel ()+1;
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level)); mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + MyGUI::utility::toString(level));
std::string levelupdescription; std::string levelupdescription;
if(level > 20) if(level > 20)
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Default"); levelupdescription=world->getFallback()->getFallbackString("Level_Up_Default");
else else
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Level"+boost::lexical_cast<std::string>(level)); levelupdescription=world->getFallback()->getFallbackString("Level_Up_Level"+MyGUI::utility::toString(level));
mLevelDescription->setCaption (levelupdescription); mLevelDescription->setCaption (levelupdescription);
@ -174,7 +176,7 @@ namespace MWGui
availableAttributes++; availableAttributes++;
int mult = pcStats.getLevelupAttributeMultiplier (i); int mult = pcStats.getLevelupAttributeMultiplier (i);
text->setCaption(mult <= 1 ? "" : "x" + boost::lexical_cast<std::string>(mult)); text->setCaption(mult <= 1 ? "" : "x" + MyGUI::utility::toString(mult));
} }
else else
{ {

@ -8,6 +8,12 @@
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <OgreViewport.h> #include <OgreViewport.h>
#include <OgreHardwarePixelBuffer.h> #include <OgreHardwarePixelBuffer.h>
#include <OgreSceneManager.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_Gui.h>
#include <MyGUI_TextBox.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -1,13 +1,18 @@
#ifndef MWGUI_LOADINGSCREEN_H #ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H #define MWGUI_LOADINGSCREEN_H
#include <OgreSceneManager.h>
#include <OgreTimer.h> #include <OgreTimer.h>
#include <OgreStringVector.h>
#include "windowbase.hpp" #include "windowbase.hpp"
#include <components/loadinglistener/loadinglistener.hpp> #include <components/loadinglistener/loadinglistener.hpp>
namespace Ogre
{
class SceneManager;
}
namespace MWGui namespace MWGui
{ {
class BackgroundImage; class BackgroundImage;

@ -2,6 +2,10 @@
#include <OgreResourceGroupManager.h> #include <OgreResourceGroupManager.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_Gui.h>
#include <MyGUI_RenderManager.h>
#include <components/version/version.hpp> #include <components/version/version.hpp>
#include <components/widgets/imagebutton.hpp> #include <components/widgets/imagebutton.hpp>

@ -1,10 +1,17 @@
#include "mapwindow.hpp" #include "mapwindow.hpp"
#include <boost/lexical_cast.hpp>
#include <OgreSceneNode.h> #include <OgreSceneNode.h>
#include <OgreVector2.h> #include <OgreVector2.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_Gui.h>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_RotatingSkin.h>
#include <MyGUI_FactoryManager.h>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -15,7 +22,7 @@
#include "../mwrender/globalmap.hpp" #include "../mwrender/globalmap.hpp"
#include "../components/esm/globalmap.hpp" #include <components/esm/globalmap.hpp>
#include "widgets.hpp" #include "widgets.hpp"
#include "confirmationdialog.hpp" #include "confirmationdialog.hpp"
@ -226,8 +233,8 @@ namespace MWGui
{ {
for (int my=0; my<3; ++my) for (int my=0; my<3; ++my)
{ {
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(mCurX + (mx-1)) + "_" std::string image = mPrefix+"_"+ MyGUI::utility::toString(mCurX + (mx-1)) + "_"
+ boost::lexical_cast<std::string>(mCurY + (-1*(my-1))); + MyGUI::utility::toString(mCurY + (-1*(my-1)));
MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx]; MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx];
fog->setImageTexture(mFogOfWar ? fog->setImageTexture(mFogOfWar ?
((MyGUI::RenderManager::getInstance().getTexture(image+"_fog") != 0) ? image+"_fog" ((MyGUI::RenderManager::getInstance().getTexture(image+"_fog") != 0) ? image+"_fog"
@ -353,8 +360,8 @@ namespace MWGui
for (int my=0; my<3; ++my) for (int my=0; my<3; ++my)
{ {
// map // map
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_" std::string image = mPrefix+"_"+ MyGUI::utility::toString(x + (mx-1)) + "_"
+ boost::lexical_cast<std::string>(y + (-1*(my-1))); + MyGUI::utility::toString(y + (-1*(my-1)));
MyGUI::ImageBox* box = mMapWidgets[my + 3*mx]; MyGUI::ImageBox* box = mMapWidgets[my + 3*mx];

@ -2,7 +2,9 @@
#include <components/esm/loadgmst.hpp> #include <components/esm/loadgmst.hpp>
#include <boost/lexical_cast.hpp> #include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -67,7 +69,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
std::string name = iter->getClass().getName(*iter) std::string name = iter->getClass().getName(*iter)
+ " - " + boost::lexical_cast<std::string>(price) + " - " + MyGUI::utility::toString(price)
+ MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>() + MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("sgp")->getString(); .find("sgp")->getString();
@ -83,7 +85,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
currentY += 18; currentY += 18;
button->setUserString("Price", boost::lexical_cast<std::string>(price)); button->setUserString("Price", MyGUI::utility::toString(price));
button->setUserData(*iter); button->setUserData(*iter);
button->setCaptionWithReplacing(name); button->setCaptionWithReplacing(name);
button->setSize(button->getTextSize().width,18); button->setSize(button->getTextSize().width,18);
@ -98,7 +100,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
mList->setVisibleVScroll(true); mList->setVisibleVScroll(true);
mGoldLabel->setCaptionWithReplacing("#{sGold}: " mGoldLabel->setCaptionWithReplacing("#{sGold}: "
+ boost::lexical_cast<std::string>(playerGold)); + MyGUI::utility::toString(playerGold));
} }
void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel) void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
@ -123,7 +125,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
{ {
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int price = boost::lexical_cast<int>(sender->getUserString("Price")); int price = MyGUI::utility::parseInt(sender->getUserString("Price"));
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId)) if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
return; return;

@ -4,8 +4,6 @@
#include "windowbase.hpp" #include "windowbase.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace MWGui namespace MWGui
{ {

@ -1,9 +1,16 @@
#include "messagebox.hpp"
#include <MyGUI_LanguageManager.h>
#include <MyGUI_EditBox.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_Button.h>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include "messagebox.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWGui namespace MWGui
{ {

@ -3,8 +3,6 @@
#include "windowbase.hpp" #include "windowbase.hpp"
#include "../mwbase/windowmanager.hpp"
#undef MessageBox #undef MessageBox
namespace MyGUI namespace MyGUI

@ -1,6 +1,8 @@
#include "quickkeysmenu.hpp" #include "quickkeysmenu.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_EditBox.h>
#include <MyGUI_Button.h>
#include <MyGUI_Gui.h>
#include <components/esm/quickkeys.hpp> #include <components/esm/quickkeys.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
@ -53,7 +55,7 @@ namespace MWGui
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
{ {
ItemWidget* button; ItemWidget* button;
getWidget(button, "QuickKey" + boost::lexical_cast<std::string>(i+1)); getWidget(button, "QuickKey" + MyGUI::utility::toString(i+1));
button->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked); button->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
@ -96,7 +98,7 @@ namespace MWGui
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default); MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
textBox->setTextAlign (MyGUI::Align::Center); textBox->setTextAlign (MyGUI::Align::Center);
textBox->setCaption (boost::lexical_cast<std::string>(index+1)); textBox->setCaption (MyGUI::utility::toString(index+1));
textBox->setNeedMouseFocus (false); textBox->setNeedMouseFocus (false);
} }

@ -1,12 +1,17 @@
#include "race.hpp" #include "race.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_ListBox.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_Gui.h>
#include <boost/format.hpp> #include <boost/format.hpp>
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwrender/characterpreview.hpp"
#include "tooltips.hpp" #include "tooltips.hpp"
@ -397,7 +402,7 @@ namespace MWGui
continue; continue;
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default, skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default,
std::string("Skill") + boost::lexical_cast<std::string>(i)); std::string("Skill") + MyGUI::utility::toString(i));
skillWidget->setSkillNumber(skillId); skillWidget->setSkillNumber(skillId);
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(race->mData.mBonus[i].mBonus)); skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(race->mData.mBonus[i].mBonus));
ToolTips::createSkillToolTip(skillWidget, skillId); ToolTips::createSkillToolTip(skillWidget, skillId);
@ -431,7 +436,7 @@ namespace MWGui
for (int i = 0; it != end; ++it) for (int i = 0; it != end; ++it)
{ {
const std::string &spellpower = *it; const std::string &spellpower = *it;
Widgets::MWSpellPtr spellPowerWidget = mSpellPowerList->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + boost::lexical_cast<std::string>(i)); Widgets::MWSpellPtr spellPowerWidget = mSpellPowerList->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + MyGUI::utility::toString(i));
spellPowerWidget->setSpellId(spellpower); spellPowerWidget->setSpellId(spellpower);
spellPowerWidget->setUserString("ToolTipType", "Spell"); spellPowerWidget->setUserString("ToolTipType", "Spell");
spellPowerWidget->setUserString("Spell", spellpower); spellPowerWidget->setUserString("Spell", spellpower);
@ -442,4 +447,9 @@ namespace MWGui
++i; ++i;
} }
} }
const ESM::NPC& RaceDialog::getResult() const
{
return mPreview->getPrototype();
}
} }

@ -1,8 +1,6 @@
#ifndef MWGUI_RACE_H #ifndef MWGUI_RACE_H
#define MWGUI_RACE_H #define MWGUI_RACE_H
#include "../mwrender/characterpreview.hpp"
#include "windowbase.hpp" #include "windowbase.hpp"
@ -11,10 +9,15 @@ namespace MWGui
class WindowManager; class WindowManager;
} }
/* namespace MWRender
This file contains the dialog for choosing a race. {
Layout is defined by resources/mygui/openmw_chargen_race.layout. class RaceSelectionPreview;
*/ }
namespace ESM
{
struct NPC;
}
namespace MWGui namespace MWGui
{ {
@ -29,7 +32,7 @@ namespace MWGui
GM_Female GM_Female
}; };
const ESM::NPC &getResult() const { return mPreview->getPrototype(); } const ESM::NPC &getResult() const;
const std::string &getRaceId() const { return mCurrentRaceId; } const std::string &getRaceId() const { return mCurrentRaceId; }
Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; } Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; }
// getFace() // getFace()

@ -1,8 +1,10 @@
#include "recharge.hpp" #include "recharge.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -63,7 +65,7 @@ void Recharge::updateView()
std::string soul = gem.getCellRef().getSoul(); std::string soul = gem.getCellRef().getSoul();
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul); const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
mChargeLabel->setCaptionWithReplacing("#{sCharges} " + boost::lexical_cast<std::string>(creature->mData.mSoul)); mChargeLabel->setCaptionWithReplacing("#{sCharges} " + MyGUI::utility::toString(creature->mData.mSoul));
bool toolBoxVisible = (gem.getRefData().getCount() != 0); bool toolBoxVisible = (gem.getRefData().getCount() != 0);
mGemBox->setVisible(toolBoxVisible); mGemBox->setVisible(toolBoxVisible);

@ -3,7 +3,10 @@
#include "windowbase.hpp" #include "windowbase.hpp"
#include "../mwworld/ptr.hpp" namespace MWWorld
{
class Ptr;
}
namespace MWGui namespace MWGui
{ {

@ -2,7 +2,8 @@
#include <iomanip> #include <iomanip>
#include <boost/lexical_cast.hpp> #include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -65,7 +66,7 @@ void Repair::updateRepairView()
std::stringstream qualityStr; std::stringstream qualityStr;
qualityStr << std::setprecision(3) << quality; qualityStr << std::setprecision(3) << quality;
mUsesLabel->setCaptionWithReplacing("#{sUses} " + boost::lexical_cast<std::string>(uses)); mUsesLabel->setCaptionWithReplacing("#{sUses} " + MyGUI::utility::toString(uses));
mQualityLabel->setCaptionWithReplacing("#{sQuality} " + qualityStr.str()); mQualityLabel->setCaptionWithReplacing("#{sQuality} " + qualityStr.str());
bool toolBoxVisible = (mRepair.getTool().getRefData().getCount() != 0); bool toolBoxVisible = (mRepair.getTool().getRefData().getCount() != 0);

@ -1,6 +1,8 @@
#include "review.hpp" #include "review.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_ScrollView.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -12,6 +14,16 @@
#undef min #undef min
#undef max #undef max
namespace
{
void adjustButtonSize(MyGUI::Button *button)
{
// adjust size of button to fit its text
MyGUI::IntSize size = button->getTextSize();
button->setSize(size.width + 24, button->getSize().height);
}
}
namespace MWGui namespace MWGui
{ {
@ -63,7 +75,7 @@ namespace MWGui
Widgets::MWAttributePtr attribute; Widgets::MWAttributePtr attribute;
for (int idx = 0; idx < ESM::Attribute::Length; ++idx) for (int idx = 0; idx < ESM::Attribute::Length; ++idx)
{ {
getWidget(attribute, std::string("Attribute") + boost::lexical_cast<std::string>(idx)); getWidget(attribute, std::string("Attribute") + MyGUI::utility::toString(idx));
mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::sAttributeIds[idx]), attribute)); mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::sAttributeIds[idx]), attribute));
attribute->setAttributeId(ESM::Attribute::sAttributeIds[idx]); attribute->setAttributeId(ESM::Attribute::sAttributeIds[idx]);
attribute->setAttributeValue(Widgets::MWAttribute::AttributeValue()); attribute->setAttributeValue(Widgets::MWAttribute::AttributeValue());
@ -135,21 +147,21 @@ namespace MWGui
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value) void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value)
{ {
mHealth->setValue(value.getCurrent(), value.getModified()); mHealth->setValue(value.getCurrent(), value.getModified());
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified()); std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr); mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
} }
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value) void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value)
{ {
mMagicka->setValue(value.getCurrent(), value.getModified()); mMagicka->setValue(value.getCurrent(), value.getModified());
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified()); std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr); mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
} }
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value) void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
{ {
mFatigue->setValue(value.getCurrent(), value.getModified()); mFatigue->setValue(value.getCurrent(), value.getModified());
std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified()); std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr); mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
} }
@ -169,7 +181,7 @@ namespace MWGui
if (widget) if (widget)
{ {
float modified = value.getModified(), base = value.getBase(); float modified = value.getModified(), base = value.getBase();
std::string text = boost::lexical_cast<std::string>(std::floor(modified)); std::string text = MyGUI::utility::toString(std::floor(modified));
std::string state = "normal"; std::string state = "normal";
if (modified > base) if (modified > base)
state = "increased"; state = "increased";
@ -289,7 +301,7 @@ namespace MWGui
state = "increased"; state = "increased";
else if (modified < base) else if (modified < base)
state = "decreased"; state = "decreased";
MyGUI::TextBox* widget = addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), state, coord1, coord2); MyGUI::TextBox* widget = addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId), MyGUI::utility::toString(static_cast<int>(modified)), state, coord1, coord2);
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{ {

@ -11,11 +11,6 @@ namespace MWGui
class WindowManager; class WindowManager;
} }
/*
This file contains the dialog for reviewing the generated character.
Layout is defined by resources/mygui/openmw_chargen_review.layout.
*/
namespace MWGui namespace MWGui
{ {
class ReviewDialog : public WindowModal class ReviewDialog : public WindowModal

@ -4,6 +4,11 @@
#include <OgreImage.h> #include <OgreImage.h>
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <MyGUI_ComboBox.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_InputManager.h>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>

@ -1,5 +1,7 @@
#include "screenfader.hpp" #include "screenfader.hpp"
#include <MyGUI_RenderManager.h>
namespace MWGui namespace MWGui
{ {

@ -1,6 +1,9 @@
#include "scrollwindow.hpp" #include "scrollwindow.hpp"
#include <MyGUI_ScrollView.h>
#include <components/esm/loadbook.hpp> #include <components/esm/loadbook.hpp>
#include <components/widgets/imagebutton.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -3,10 +3,13 @@
#include "windowbase.hpp" #include "windowbase.hpp"
#include <components/widgets/imagebutton.hpp>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace Gui
{
class ImageButton;
}
namespace MWGui namespace MWGui
{ {
class ScrollWindow : public WindowBase class ScrollWindow : public WindowBase

@ -1,9 +1,14 @@
#include "settingswindow.hpp" #include "settingswindow.hpp"
#include <OgreRoot.h> #include <OgreRoot.h>
#include <OgrePlugin.h>
#include <boost/lexical_cast.hpp> #include <MyGUI_ScrollBar.h>
#include <MyGUI_Window.h>
#include <MyGUI_ComboBox.h>
#include <MyGUI_ListBox.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/math/common_factor_rt.hpp> #include <boost/math/common_factor_rt.hpp>
@ -48,8 +53,8 @@ namespace
assert (split.size() >= 2); assert (split.size() >= 2);
boost::trim(split[0]); boost::trim(split[0]);
boost::trim(split[1]); boost::trim(split[1]);
x = boost::lexical_cast<int> (split[0]); x = MyGUI::utility::parseInt (split[0]);
y = boost::lexical_cast<int> (split[1]); y = MyGUI::utility::parseInt (split[1]);
} }
bool sortResolutions (std::pair<int, int> left, std::pair<int, int> right) bool sortResolutions (std::pair<int, int> left, std::pair<int, int> right)
@ -67,7 +72,7 @@ namespace
// special case: 8 : 5 is usually referred to as 16:10 // special case: 8 : 5 is usually referred to as 16:10
if (xaspect == 8 && yaspect == 5) if (xaspect == 8 && yaspect == 5)
return "16 : 10"; return "16 : 10";
return boost::lexical_cast<std::string>(xaspect) + " : " + boost::lexical_cast<std::string>(yaspect); return MyGUI::utility::toString(xaspect) + " : " + MyGUI::utility::toString(yaspect);
} }
std::string hlslGlsl () std::string hlslGlsl ()
@ -105,9 +110,9 @@ namespace
min = 0.f; min = 0.f;
max = 1.f; max = 1.f;
if (!widget->getUserString(settingMin).empty()) if (!widget->getUserString(settingMin).empty())
min = boost::lexical_cast<float>(widget->getUserString(settingMin)); min = MyGUI::utility::parseFloat(widget->getUserString(settingMin));
if (!widget->getUserString(settingMax).empty()) if (!widget->getUserString(settingMax).empty())
max = boost::lexical_cast<float>(widget->getUserString(settingMax)); max = MyGUI::utility::parseFloat(widget->getUserString(settingMax));
} }
} }
@ -224,7 +229,7 @@ namespace MWGui
for (std::vector < std::pair<int, int> >::const_iterator it=resolutions.begin(); for (std::vector < std::pair<int, int> >::const_iterator it=resolutions.begin();
it!=resolutions.end(); ++it) it!=resolutions.end(); ++it)
{ {
std::string str = boost::lexical_cast<std::string>(it->first) + " x " + boost::lexical_cast<std::string>(it->second) std::string str = MyGUI::utility::toString(it->first) + " x " + MyGUI::utility::toString(it->second)
+ " (" + getAspect(it->first,it->second) + ")"; + " (" + getAspect(it->first,it->second) + ")";
if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE) if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE)
@ -233,7 +238,7 @@ namespace MWGui
std::string tf = Settings::Manager::getString("texture filtering", "General"); std::string tf = Settings::Manager::getString("texture filtering", "General");
mTextureFilteringButton->setCaption(textureFilteringToStr(tf)); mTextureFilteringButton->setCaption(textureFilteringToStr(tf));
mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(Settings::Manager::getInt("anisotropy", "General")) + ")"); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")");
mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows")); mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows"));
@ -249,11 +254,11 @@ namespace MWGui
MyGUI::TextBox* fovText; MyGUI::TextBox* fovText;
getWidget(fovText, "FovText"); getWidget(fovText, "FovText");
fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int(Settings::Manager::getInt("field of view", "General"))) + ")"); fovText->setCaption("Field of View (" + MyGUI::utility::toString(int(Settings::Manager::getInt("field of view", "General"))) + ")");
MyGUI::TextBox* diffText; MyGUI::TextBox* diffText;
getWidget(diffText, "DifficultyText"); getWidget(diffText, "DifficultyText");
diffText->setCaptionWithReplacing("#{sDifficulty} (" + boost::lexical_cast<std::string>(int(Settings::Manager::getInt("difficulty", "Game"))) + ")"); diffText->setCaptionWithReplacing("#{sDifficulty} (" + MyGUI::utility::toString(int(Settings::Manager::getInt("difficulty", "Game"))) + ")");
mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video")); mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
} }
@ -425,13 +430,13 @@ namespace MWGui
{ {
MyGUI::TextBox* fovText; MyGUI::TextBox* fovText;
getWidget(fovText, "FovText"); getWidget(fovText, "FovText");
fovText->setCaption("Field of View (" + boost::lexical_cast<std::string>(int(value)) + ")"); fovText->setCaption("Field of View (" + MyGUI::utility::toString(int(value)) + ")");
} }
if (scroller == mDifficultySlider) if (scroller == mDifficultySlider)
{ {
MyGUI::TextBox* diffText; MyGUI::TextBox* diffText;
getWidget(diffText, "DifficultyText"); getWidget(diffText, "DifficultyText");
diffText->setCaptionWithReplacing("#{sDifficulty} (" + boost::lexical_cast<std::string>(int(value)) + ")"); diffText->setCaptionWithReplacing("#{sDifficulty} (" + MyGUI::utility::toString(int(value)) + ")");
} }
} }
else else
@ -439,7 +444,7 @@ namespace MWGui
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos); Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), pos);
if (scroller == mAnisotropySlider) if (scroller == mAnisotropySlider)
{ {
mAnisotropyLabel->setCaption("Anisotropy (" + boost::lexical_cast<std::string>(pos) + ")"); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(pos) + ")");
} }
} }
apply(); apply();

@ -1,6 +1,7 @@
#include "soulgemdialog.hpp" #include "soulgemdialog.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "messagebox.hpp" #include "messagebox.hpp"

@ -1,6 +1,8 @@
#include "spellbuyingwindow.hpp" #include "spellbuyingwindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Gui.h>
#include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -65,7 +67,7 @@ namespace MWGui
mCurrentY += sLineHeight; mCurrentY += sLineHeight;
toAdd->setUserData(price); toAdd->setUserData(price);
toAdd->setCaptionWithReplacing(spell->mName+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}"); toAdd->setCaptionWithReplacing(spell->mName+" - "+MyGUI::utility::toString(price)+"#{sgp}");
toAdd->setSize(toAdd->getTextSize().width,sLineHeight); toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell"); toAdd->setUserString("ToolTipType", "Spell");
@ -166,7 +168,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
mPlayerGold->setCoord(8, mPlayerGold->setCoord(8,
mPlayerGold->getTop(), mPlayerGold->getTop(),
mPlayerGold->getTextSize().width, mPlayerGold->getTextSize().width,

@ -1,9 +1,11 @@
#include "spellcreationdialog.hpp" #include "spellcreationdialog.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/widgets/list.hpp>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
@ -21,6 +23,7 @@
#include "tooltips.hpp" #include "tooltips.hpp"
#include "class.hpp" #include "class.hpp"
#include "widgets.hpp"
namespace namespace
{ {
@ -266,7 +269,7 @@ namespace MWGui
void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos)
{ {
mMagnitudeMinValue->setCaption(boost::lexical_cast<std::string>(pos+1)); mMagnitudeMinValue->setCaption(MyGUI::utility::toString(pos+1));
mEffect.mMagnMin = pos+1; mEffect.mMagnMin = pos+1;
// trigger the check again (see below) // trigger the check again (see below)
@ -286,21 +289,21 @@ namespace MWGui
mEffect.mMagnMax = pos+1; mEffect.mMagnMax = pos+1;
mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1)); mMagnitudeMaxValue->setCaption("- " + MyGUI::utility::toString(pos+1));
eventEffectModified(mEffect); eventEffectModified(mEffect);
} }
void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos)
{ {
mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1)); mDurationValue->setCaption(MyGUI::utility::toString(pos+1));
mEffect.mDuration = pos+1; mEffect.mDuration = pos+1;
eventEffectModified(mEffect); eventEffectModified(mEffect);
} }
void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos) void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos)
{ {
mAreaValue->setCaption(boost::lexical_cast<std::string>(pos)); mAreaValue->setCaption(MyGUI::utility::toString(pos));
mEffect.mArea = pos; mEffect.mArea = pos;
eventEffectModified(mEffect); eventEffectModified(mEffect);
} }
@ -362,7 +365,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > playerGold) if (MyGUI::utility::parseInt(mPriceLabel->getCaption()) > playerGold)
{ {
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
return; return;
@ -370,7 +373,7 @@ namespace MWGui
mSpell.mName = mNameEdit->getCaption(); mSpell.mName = mNameEdit->getCaption();
int price = boost::lexical_cast<int>(mPriceLabel->getCaption()); int price = MyGUI::utility::parseInt(mPriceLabel->getCaption());
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
@ -448,17 +451,17 @@ namespace MWGui
mSpell.mData.mType = ESM::Spell::ST_Spell; mSpell.mData.mType = ESM::Spell::ST_Spell;
mSpell.mData.mFlags = 0; mSpell.mData.mFlags = 0;
mMagickaCost->setCaption(boost::lexical_cast<std::string>(int(y))); mMagickaCost->setCaption(MyGUI::utility::toString(int(y)));
float fSpellMakingValueMult = float fSpellMakingValueMult =
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->getFloat(); store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->getFloat();
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,int(y) * fSpellMakingValueMult,true); int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,int(y) * fSpellMakingValueMult,true);
mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price))); mPriceLabel->setCaption(MyGUI::utility::toString(int(price)));
float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayerPtr()); float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWBase::Environment::get().getWorld()->getPlayerPtr());
mSuccessChance->setCaption(boost::lexical_cast<std::string>(int(chance))); mSuccessChance->setCaption(MyGUI::utility::toString(int(chance)));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

@ -3,11 +3,14 @@
#include <components/esm/loadmgef.hpp> #include <components/esm/loadmgef.hpp>
#include <components/esm/loadspel.hpp> #include <components/esm/loadspel.hpp>
#include <components/widgets/list.hpp>
#include "windowbase.hpp" #include "windowbase.hpp"
#include "referenceinterface.hpp" #include "referenceinterface.hpp"
#include "widgets.hpp"
namespace Gui
{
class MWList;
}
namespace MWGui namespace MWGui
{ {

@ -1,10 +1,10 @@
#include "spellicons.hpp" #include "spellicons.hpp"
#include <boost/lexical_cast.hpp>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <MyGUI_ImageBox.h>
#include <components/esm/loadmgef.hpp> #include <components/esm/loadmgef.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
@ -115,7 +115,7 @@ namespace MWGui
} }
else if ( displayType != ESM::MagicEffect::MDT_None ) else if ( displayType != ESM::MagicEffect::MDT_None )
{ {
sourcesDescription += ": " + boost::lexical_cast<std::string>(effectIt->mMagnitude); sourcesDescription += ": " + MyGUI::utility::toString(effectIt->mMagnitude);
if ( displayType == ESM::MagicEffect::MDT_Percentage ) if ( displayType == ESM::MagicEffect::MDT_Percentage )
sourcesDescription += MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", ""); sourcesDescription += MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", "");

@ -2,6 +2,8 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <MyGUI_InputManager.h>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -1,6 +1,10 @@
#include "statswindow.hpp" #include "statswindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Window.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_ProgressBar.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -8,6 +12,7 @@
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
@ -145,7 +150,7 @@ namespace MWGui
// health, magicka, fatigue tooltip // health, magicka, fatigue tooltip
MyGUI::Widget* w; MyGUI::Widget* w;
std::string valStr = boost::lexical_cast<std::string>(current) + "/" + boost::lexical_cast<std::string>(modified); std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified);
if (id == "HBar") if (id == "HBar")
{ {
getWidget(w, "Health"); getWidget(w, "Health");
@ -190,7 +195,7 @@ namespace MWGui
if (widget) if (widget)
{ {
int modified = value.getModified(), base = value.getBase(); int modified = value.getModified(), base = value.getBase();
std::string text = boost::lexical_cast<std::string>(modified); std::string text = MyGUI::utility::toString(modified);
std::string state = "normal"; std::string state = "normal";
if (modified > base) if (modified > base)
state = "increased"; state = "increased";
@ -239,10 +244,10 @@ namespace MWGui
{ {
int max = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("iLevelUpTotal")->getInt(); int max = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("iLevelUpTotal")->getInt();
getWidget(levelWidget, i==0 ? "Level_str" : "LevelText"); getWidget(levelWidget, i==0 ? "Level_str" : "LevelText");
levelWidget->setUserString("RangePosition_LevelProgress", boost::lexical_cast<std::string>(PCstats.getLevelProgress())); levelWidget->setUserString("RangePosition_LevelProgress", MyGUI::utility::toString(PCstats.getLevelProgress()));
levelWidget->setUserString("Range_LevelProgress", boost::lexical_cast<std::string>(max)); levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max));
levelWidget->setUserString("Caption_LevelProgressText", boost::lexical_cast<std::string>(PCstats.getLevelProgress()) + "/" levelWidget->setUserString("Caption_LevelProgressText", MyGUI::utility::toString(PCstats.getLevelProgress()) + "/"
+ boost::lexical_cast<std::string>(max)); + MyGUI::utility::toString(max));
} }
setFactions(PCstats.getFactionRanks()); setFactions(PCstats.getFactionRanks());
@ -397,7 +402,7 @@ namespace MWGui
else if (modified < base) else if (modified < base)
state = "decreased"; state = "decreased";
MyGUI::TextBox* widget = addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId), MyGUI::TextBox* widget = addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString(skillNameId, skillNameId),
boost::lexical_cast<std::string>(static_cast<int>(modified)), state, coord1, coord2); MyGUI::utility::toString(static_cast<int>(modified)), state, coord1, coord2);
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{ {
@ -415,9 +420,9 @@ namespace MWGui
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillProgressVBox", "true"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillProgressVBox", "true");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillProgressVBox", "false"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillProgressVBox", "false");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", boost::lexical_cast<std::string>(progressPercent)+"/100"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", MyGUI::utility::toString(progressPercent)+"/100");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("RangePosition_SkillProgress", boost::lexical_cast<std::string>(progressPercent)); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("RangePosition_SkillProgress", MyGUI::utility::toString(progressPercent));
} else { } else {
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillMaxed", "true"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Visible_SkillMaxed", "true");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillMaxed", "false"); mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("UserData^Hidden_SkillMaxed", "false");
@ -528,8 +533,8 @@ namespace MWGui
const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttribute[0]); const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttribute[0]);
const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttribute[1]); const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttribute[1]);
text += "\n#{fontcolourhtml=normal}#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1) text += "\n#{fontcolourhtml=normal}#{" + attr1->mName + "}: " + MyGUI::utility::toString(rankData.mAttribute1)
+ ", #{" + attr2->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute2); + ", #{" + attr2->mName + "}: " + MyGUI::utility::toString(rankData.mAttribute2);
text += "\n\n#{fontcolourhtml=header}#{sFavoriteSkills}"; text += "\n\n#{fontcolourhtml=header}#{sFavoriteSkills}";
text += "\n#{fontcolourhtml=normal}"; text += "\n#{fontcolourhtml=normal}";
@ -550,9 +555,9 @@ namespace MWGui
text += "\n"; text += "\n";
if (rankData.mSkill1 > 0) if (rankData.mSkill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.mSkill1); text += "\n#{sNeedOneSkill} " + MyGUI::utility::toString(rankData.mSkill1);
if (rankData.mSkill2 > 0) if (rankData.mSkill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.mSkill2); text += "\n#{sNeedTwoSkills} " + MyGUI::utility::toString(rankData.mSkill2);
} }
} }
@ -581,7 +586,7 @@ namespace MWGui
addSeparator(coord1, coord2); addSeparator(coord1, coord2);
addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString("sReputation", "Reputation"), addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString("sReputation", "Reputation"),
boost::lexical_cast<std::string>(static_cast<int>(mReputation)), "normal", coord1, coord2); MyGUI::utility::toString(static_cast<int>(mReputation)), "normal", coord1, coord2);
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{ {
@ -591,7 +596,7 @@ namespace MWGui
} }
addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString("sBounty", "Bounty"), addValueItem(MWBase::Environment::get().getWindowManager()->getGameSettingString("sBounty", "Bounty"),
boost::lexical_cast<std::string>(static_cast<int>(mBounty)), "normal", coord1, coord2); MyGUI::utility::toString(static_cast<int>(mBounty)), "normal", coord1, coord2);
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{ {

@ -1,11 +1,11 @@
#ifndef MWGUI_STATS_WINDOW_H #ifndef MWGUI_STATS_WINDOW_H
#define MWGUI_STATS_WINDOW_H #define MWGUI_STATS_WINDOW_H
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "windowpinnablebase.hpp" #include "windowpinnablebase.hpp"
#include <components/esm/loadskil.hpp>
namespace MWGui namespace MWGui
{ {
class WindowManager; class WindowManager;

@ -3,6 +3,9 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include <MyGUI_EditBox.h>
#include <MyGUI_Button.h>
namespace MWGui namespace MWGui
{ {
@ -64,4 +67,15 @@ namespace MWGui
onOkClicked(_sender); onOkClicked(_sender);
} }
std::string TextInputDialog::getTextInput() const
{
return mTextEdit->getCaption();
}
void TextInputDialog::setTextInput(const std::string &text)
{
mTextEdit->setCaption(text);
}
} }

@ -15,8 +15,8 @@ namespace MWGui
public: public:
TextInputDialog(); TextInputDialog();
std::string getTextInput() const { return mTextEdit->getCaption(); } std::string getTextInput() const;
void setTextInput(const std::string &text) { mTextEdit->setCaption(text); } void setTextInput(const std::string &text);
void setNextButtonShow(bool shown); void setNextButtonShow(bool shown);
void setTextLabel(const std::string &label); void setTextLabel(const std::string &label);

@ -2,7 +2,10 @@
#include <iomanip> #include <iomanip>
#include <boost/lexical_cast.hpp> #include <MyGUI_Gui.h>
#include <MyGUI_RenderManager.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_ImageBox.h>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
@ -551,7 +554,7 @@ namespace MWGui
if (value == 1) if (value == 1)
return ""; return "";
else else
return " (" + boost::lexical_cast<std::string>(value) + ")"; return " (" + MyGUI::utility::toString(value) + ")";
} }
std::string ToolTips::getCellRefString(const MWWorld::CellRef& cellref) std::string ToolTips::getCellRefString(const MWWorld::CellRef& cellref)

@ -1,6 +1,8 @@
#include "tradewindow.hpp" #include "tradewindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Button.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_ControllerManager.h>
#include <components/widgets/numericeditbox.hpp> #include <components/widgets/numericeditbox.hpp>
@ -484,7 +486,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(playerGold)); mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold));
if (mCurrentBalance > 0) if (mCurrentBalance > 0)
{ {
@ -497,7 +499,7 @@ namespace MWGui
mTotalBalance->setValue(std::abs(mCurrentBalance)); mTotalBalance->setValue(std::abs(mCurrentBalance));
mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast<std::string>(getMerchantGold())); mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + MyGUI::utility::toString(getMerchantGold()));
} }
void TradeWindow::updateOffer() void TradeWindow::updateOffer()

@ -1,19 +1,19 @@
#ifndef MWGUI_TRADEWINDOW_H #ifndef MWGUI_TRADEWINDOW_H
#define MWGUI_TRADEWINDOW_H #define MWGUI_TRADEWINDOW_H
#include "container.hpp" #include "referenceinterface.hpp"
#include "windowbase.hpp"
namespace Gui namespace Gui
{ {
class NumericEditBox; class NumericEditBox;
} }
namespace MWGui namespace MyGUI
{ {
class WindowManager; class ControllerItem;
} }
namespace MWGui namespace MWGui
{ {
class ItemView; class ItemView;

@ -1,6 +1,6 @@
#include "trainingwindow.hpp" #include "trainingwindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Gui.h>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -65,7 +65,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor); MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor);
@ -100,7 +100,7 @@ namespace MWGui
button->setUserData(skills[i].first); button->setUserData(skills[i].first);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected); button->eventMouseButtonClick += MyGUI::newDelegate(this, &TrainingWindow::onTrainingSelected);
button->setCaptionWithReplacing("#{" + ESM::Skill::sSkillNameIds[skills[i].first] + "} - " + boost::lexical_cast<std::string>(price)); button->setCaptionWithReplacing("#{" + ESM::Skill::sSkillNameIds[skills[i].first] + "} - " + MyGUI::utility::toString(price));
button->setSize(button->getTextSize ().width+12, button->getSize().height); button->setSize(button->getTextSize ().width+12, button->getSize().height);

@ -1,6 +1,8 @@
#include "travelwindow.hpp" #include "travelwindow.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include <MyGUI_Gui.h>
#include <OgreVector3.h> #include <OgreVector3.h>
@ -87,7 +89,7 @@ namespace MWGui
oss << price; oss << price;
toAdd->setUserString("price",oss.str()); toAdd->setUserString("price",oss.str());
toAdd->setCaptionWithReplacing("#{sCell=" + name + "} - " + boost::lexical_cast<std::string>(price)+"#{sgp}"); toAdd->setCaptionWithReplacing("#{sCell=" + name + "} - " + MyGUI::utility::toString(price)+"#{sgp}");
toAdd->setSize(toAdd->getTextSize().width,sLineHeight); toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel);
toAdd->setUserString("Destination", name); toAdd->setUserString("Destination", name);
@ -192,7 +194,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold)); mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
mPlayerGold->setCoord(8, mPlayerGold->setCoord(8,
mPlayerGold->getTop(), mPlayerGold->getTop(),
mPlayerGold->getTextSize().width, mPlayerGold->getTextSize().width,

@ -1,7 +1,9 @@
#ifndef MWGUI_TravelWINDOW_H #ifndef MWGUI_TravelWINDOW_H
#define MWGUI_TravelWINDOW_H #define MWGUI_TravelWINDOW_H
#include "container.hpp"
#include "windowbase.hpp"
#include "referenceinterface.hpp"
namespace MyGUI namespace MyGUI
{ {

@ -1,5 +1,7 @@
#include "videowidget.hpp" #include "videowidget.hpp"
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
#include "../mwsound/movieaudiofactory.hpp" #include "../mwsound/movieaudiofactory.hpp"
namespace MWGui namespace MWGui
@ -7,40 +9,41 @@ namespace MWGui
VideoWidget::VideoWidget() VideoWidget::VideoWidget()
{ {
mPlayer.reset(new Video::VideoPlayer());
setNeedKeyFocus(true); setNeedKeyFocus(true);
} }
void VideoWidget::playVideo(const std::string &video) void VideoWidget::playVideo(const std::string &video)
{ {
mPlayer.setAudioFactory(new MWSound::MovieAudioFactory()); mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
mPlayer.playVideo(video); mPlayer->playVideo(video);
setImageTexture(mPlayer.getTextureName()); setImageTexture(mPlayer->getTextureName());
} }
int VideoWidget::getVideoWidth() int VideoWidget::getVideoWidth()
{ {
return mPlayer.getVideoWidth(); return mPlayer->getVideoWidth();
} }
int VideoWidget::getVideoHeight() int VideoWidget::getVideoHeight()
{ {
return mPlayer.getVideoHeight(); return mPlayer->getVideoHeight();
} }
bool VideoWidget::update() bool VideoWidget::update()
{ {
return mPlayer.update(); return mPlayer->update();
} }
void VideoWidget::stop() void VideoWidget::stop()
{ {
mPlayer.close(); mPlayer->close();
} }
bool VideoWidget::hasAudioStream() bool VideoWidget::hasAudioStream()
{ {
return mPlayer.hasAudioStream(); return mPlayer->hasAudioStream();
} }
} }

@ -3,7 +3,10 @@
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp> namespace Video
{
class VideoPlayer;
}
namespace MWGui namespace MWGui
{ {
@ -33,7 +36,7 @@ namespace MWGui
void stop(); void stop();
private: private:
Video::VideoPlayer mPlayer; std::auto_ptr<Video::VideoPlayer> mPlayer;
}; };
} }

@ -1,6 +1,6 @@
#include "waitdialog.hpp" #include "waitdialog.hpp"
#include <boost/lexical_cast.hpp> #include <MyGUI_ProgressBar.h>
#include <components/widgets/box.hpp> #include <components/widgets/box.hpp>
@ -19,6 +19,8 @@
#include "../mwstate/charactermanager.hpp" #include "../mwstate/charactermanager.hpp"
#include "widgets.hpp"
namespace MWGui namespace MWGui
{ {
@ -38,7 +40,7 @@ namespace MWGui
{ {
mProgressBar->setProgressRange (total); mProgressBar->setProgressRange (total);
mProgressBar->setProgressPosition (cur); mProgressBar->setProgressPosition (cur);
mProgressText->setCaption(boost::lexical_cast<std::string>(cur) + "/" + boost::lexical_cast<std::string>(total)); mProgressText->setCaption(MyGUI::utility::toString(cur) + "/" + MyGUI::utility::toString(total));
} }
// --------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------
@ -104,9 +106,9 @@ namespace MWGui
if (hour == 0) hour = 12; if (hour == 0) hour = 12;
std::string dateTimeText = std::string dateTimeText =
boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getDay ()) + " " MyGUI::utility::toString(MWBase::Environment::get().getWorld ()->getDay ()) + " "
+ month + " (#{sDay} " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getTimeStamp ().getDay()) + month + " (#{sDay} " + MyGUI::utility::toString(MWBase::Environment::get().getWorld ()->getTimeStamp ().getDay())
+ ") " + boost::lexical_cast<std::string>(hour) + " " + (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}"); + ") " + MyGUI::utility::toString(hour) + " " + (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}");
mDateTimeText->setCaptionWithReplacing (dateTimeText); mDateTimeText->setCaptionWithReplacing (dateTimeText);
} }
@ -172,7 +174,7 @@ namespace MWGui
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position) void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
{ {
mHourText->setCaptionWithReplacing (boost::lexical_cast<std::string>(position+1) + " #{sRestMenu2}"); mHourText->setCaptionWithReplacing (MyGUI::utility::toString(position+1) + " #{sRestMenu2}");
mManualHours = position+1; mManualHours = position+1;
} }

@ -2,11 +2,15 @@
#define MWGUI_WAIT_DIALOG_H #define MWGUI_WAIT_DIALOG_H
#include "windowbase.hpp" #include "windowbase.hpp"
#include "widgets.hpp"
namespace MWGui namespace MWGui
{ {
namespace Widgets
{
class MWScrollBar;
}
class WaitDialogProgressBar : public WindowBase class WaitDialogProgressBar : public WindowBase
{ {
public: public:

@ -1,21 +1,22 @@
#include "widgets.hpp" #include "widgets.hpp"
#include "../mwworld/esmstore.hpp"
#include <boost/lexical_cast.hpp>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <components/misc/resourcehelpers.hpp>
#include <MyGUI_ProgressBar.h> #include <MyGUI_ProgressBar.h>
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_ControllerManager.h> #include <MyGUI_ControllerManager.h>
#include <components/misc/resourcehelpers.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwworld/esmstore.hpp"
#include "controllers.hpp"
#undef min #undef min
#undef max #undef max
@ -71,7 +72,7 @@ namespace MWGui
if (mSkillValueWidget) if (mSkillValueWidget)
{ {
SkillValue::Type modified = mValue.getModified(), base = mValue.getBase(); SkillValue::Type modified = mValue.getModified(), base = mValue.getBase();
mSkillValueWidget->setCaption(boost::lexical_cast<std::string>(modified)); mSkillValueWidget->setCaption(MyGUI::utility::toString(modified));
if (modified > base) if (modified > base)
mSkillValueWidget->_setWidgetState("increased"); mSkillValueWidget->_setWidgetState("increased");
else if (modified < base) else if (modified < base)
@ -167,7 +168,7 @@ namespace MWGui
if (mAttributeValueWidget) if (mAttributeValueWidget)
{ {
int modified = mValue.getModified(), base = mValue.getBase(); int modified = mValue.getModified(), base = mValue.getBase();
mAttributeValueWidget->setCaption(boost::lexical_cast<std::string>(modified)); mAttributeValueWidget->setCaption(MyGUI::utility::toString(modified));
if (modified > base) if (modified > base)
mAttributeValueWidget->_setWidgetState("increased"); mAttributeValueWidget->_setWidgetState("increased");
else if (modified < base) else if (modified < base)
@ -429,9 +430,9 @@ namespace MWGui
spellLine += formatter.str(); spellLine += formatter.str();
} }
else if ( displayType != ESM::MagicEffect::MDT_None ) { else if ( displayType != ESM::MagicEffect::MDT_None ) {
spellLine += " " + boost::lexical_cast<std::string>(mEffectParams.mMagnMin); spellLine += " " + MyGUI::utility::toString(mEffectParams.mMagnMin);
if (mEffectParams.mMagnMin != mEffectParams.mMagnMax) if (mEffectParams.mMagnMin != mEffectParams.mMagnMax)
spellLine += to + boost::lexical_cast<std::string>(mEffectParams.mMagnMax); spellLine += to + MyGUI::utility::toString(mEffectParams.mMagnMax);
if ( displayType == ESM::MagicEffect::MDT_Percentage ) if ( displayType == ESM::MagicEffect::MDT_Percentage )
spellLine += pct; spellLine += pct;
@ -449,12 +450,12 @@ namespace MWGui
{ {
if (mEffectParams.mDuration > 0 && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) if (mEffectParams.mDuration > 0 && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration))
{ {
spellLine += " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sfor", "") + " " + boost::lexical_cast<std::string>(mEffectParams.mDuration) + ((mEffectParams.mDuration == 1) ? sec : secs); spellLine += " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sfor", "") + " " + MyGUI::utility::toString(mEffectParams.mDuration) + ((mEffectParams.mDuration == 1) ? sec : secs);
} }
if (mEffectParams.mArea > 0) if (mEffectParams.mArea > 0)
{ {
spellLine += " #{sin} " + boost::lexical_cast<std::string>(mEffectParams.mArea) + " #{sfootarea}"; spellLine += " #{sin} " + MyGUI::utility::toString(mEffectParams.mArea) + " #{sfootarea}";
} }
// potions have no target // potions have no target

@ -2,7 +2,6 @@
#define MWGUI_WIDGETS_H #define MWGUI_WIDGETS_H
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "controllers.hpp"
#include <components/esm/effectlist.hpp> #include <components/esm/effectlist.hpp>
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
@ -14,6 +13,7 @@
namespace MyGUI namespace MyGUI
{ {
class ImageBox; class ImageBox;
class ControllerItem;
} }
namespace MWBase namespace MWBase

@ -1,9 +1,11 @@
#include "windowbase.hpp" #include "windowbase.hpp"
#include <MyGUI_InputManager.h>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "container.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwgui/windowmanagerimp.hpp"
#include "draganddrop.hpp"
using namespace MWGui; using namespace MWGui;

@ -5,11 +5,19 @@
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <OgreRenderWindow.h> #include <OgreRenderWindow.h>
#include <OgreSceneManager.h>
#include "MyGUI_UString.h"
#include "MyGUI_IPointer.h" #include <MyGUI_UString.h>
#include "MyGUI_ResourceImageSetPointer.h" #include <MyGUI_IPointer.h>
#include "MyGUI_TextureUtility.h" #include <MyGUI_ResourceImageSetPointer.h>
#include <MyGUI_TextureUtility.h>
#include <MyGUI_FactoryManager.h>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_PointerManager.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_Gui.h>
#include <MyGUI_ClipboardManager.h>
#include <MyGUI_RenderManager.h>
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include <openengine/gui/manager.hpp> #include <openengine/gui/manager.hpp>
@ -27,6 +35,7 @@
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
@ -74,6 +83,9 @@
#include "screenfader.hpp" #include "screenfader.hpp"
#include "debugwindow.hpp" #include "debugwindow.hpp"
#include "spellview.hpp" #include "spellview.hpp"
#include "draganddrop.hpp"
#include "container.hpp"
#include "controllers.hpp"
namespace MWGui namespace MWGui
{ {

@ -1,5 +1,7 @@
#include "windowpinnablebase.hpp" #include "windowpinnablebase.hpp"
#include <MyGUI_Button.h>
#include "exposedwindow.hpp" #include "exposedwindow.hpp"
namespace MWGui namespace MWGui

@ -43,7 +43,6 @@ namespace ESM
namespace MWWorld namespace MWWorld
{ {
class Ptr;
class ContainerStore; class ContainerStore;
class InventoryStore; class InventoryStore;
class PhysicsSystem; class PhysicsSystem;

@ -18,6 +18,7 @@
#include <components/esm/loadweap.hpp> #include <components/esm/loadweap.hpp>
#include "ptr.hpp" #include "ptr.hpp"
#include "cellreflist.hpp"
namespace ESM namespace ESM
{ {

@ -4,13 +4,17 @@
#include <vector> #include <vector>
#include "contentloader.hpp" #include "contentloader.hpp"
#include "components/esm/esmreader.hpp"
namespace ToUTF8 namespace ToUTF8
{ {
class Utf8Encoder; class Utf8Encoder;
} }
namespace ESM
{
class ESMReader;
}
namespace MWWorld namespace MWWorld
{ {

@ -6,7 +6,7 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include "cellreflist.hpp" #include "livecellref.hpp"
namespace MWWorld namespace MWWorld
{ {

@ -0,0 +1,103 @@
#include "layout.hpp"
#include <MyGUI_LayoutManager.h>
#include <MyGUI_Widget.h>
#include <MyGUI_Gui.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_Window.h>
namespace OEngine
{
namespace GUI
{
void Layout::initialise(const std::string& _layout, MyGUI::Widget* _parent)
{
const std::string MAIN_WINDOW = "_Main";
mLayoutName = _layout;
if (mLayoutName.empty())
mMainWidget = _parent;
else
{
mPrefix = MyGUI::utility::toString(this, "_");
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
const std::string main_name = mPrefix + MAIN_WINDOW;
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter)
{
if ((*iter)->getName() == main_name)
{
mMainWidget = (*iter);
break;
}
}
MYGUI_ASSERT(mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found.");
}
}
void Layout::shutdown()
{
MyGUI::Gui::getInstance().destroyWidget(mMainWidget);
mListWindowRoot.clear();
}
void Layout::setCoord(int x, int y, int w, int h)
{
mMainWidget->setCoord(x,y,w,h);
}
void Layout::adjustWindowCaption()
{
MyGUI::TextBox* box = mMainWidget->castType<MyGUI::Window>(mMainWidget)->getCaptionWidget();
box->setSize(box->getTextSize().width + 24, box->getSize().height);
// in order to trigger alignment updates, we need to update the parent
// mygui doesn't provide a proper way of doing this, so we are just changing size
box->getParent()->setCoord(MyGUI::IntCoord(
box->getParent()->getCoord().left,
box->getParent()->getCoord().top,
box->getParent()->getCoord().width,
box->getParent()->getCoord().height+1
));
box->getParent()->setCoord(MyGUI::IntCoord(
box->getParent()->getCoord().left,
box->getParent()->getCoord().top,
box->getParent()->getCoord().width,
box->getParent()->getCoord().height-1
));
}
void Layout::setVisible(bool b)
{
mMainWidget->setVisible(b);
}
void Layout::setText(const std::string &name, const std::string &caption)
{
MyGUI::Widget* pt;
getWidget(pt, name);
static_cast<MyGUI::TextBox*>(pt)->setCaption(caption);
}
void Layout::setTitle(const std::string& title)
{
static_cast<MyGUI::Window*>(mMainWidget)->setCaptionWithReplacing(title);
adjustWindowCaption();
}
MyGUI::Widget* Layout::getWidget(const std::string &_name)
{
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin();
iter!=mListWindowRoot.end(); ++iter)
{
MyGUI::Widget* find = (*iter)->findWidget(mPrefix + _name);
if (nullptr != find)
{
return find;
}
}
MYGUI_EXCEPT("widget name '" << _name << "' in layout '" << mLayoutName << "' not found.");
}
}
}

@ -1,7 +1,9 @@
#ifndef OENGINE_MYGUI_LAYOUT_H #ifndef OENGINE_MYGUI_LAYOUT_H
#define OENGINE_MYGUI_LAYOUT_H #define OENGINE_MYGUI_LAYOUT_H
#include <MyGUI.h> #include <string>
#include <MyGUI_WidgetDefines.h>
#include <MyGUI_Widget.h>
namespace OEngine { namespace OEngine {
namespace GUI namespace GUI
@ -17,118 +19,43 @@ namespace GUI
{ initialise(_layout, _parent); } { initialise(_layout, _parent); }
virtual ~Layout() { shutdown(); } virtual ~Layout() { shutdown(); }
MyGUI::Widget* getWidget(const std::string& _name);
template <typename T> template <typename T>
void getWidget(T * & _widget, const std::string & _name, bool _throw = true) void getWidget(T * & _widget, const std::string & _name)
{ {
_widget = nullptr; MyGUI::Widget* w = getWidget(_name);
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); T* cast = w->castType<T>(false);
iter!=mListWindowRoot.end(); ++iter) if (!cast)
{ {
MyGUI::Widget* find = (*iter)->findWidget(mPrefix + _name); MYGUI_EXCEPT("Error cast : dest type = '" << T::getClassTypeName()
if (nullptr != find) << "' source name = '" << w->getName()
{ << "' source type = '" << w->getTypeName() << "' in layout '" << mLayoutName << "'");
T * cast = find->castType<T>(false);
if (nullptr != cast)
_widget = cast;
else if (_throw)
{
MYGUI_EXCEPT("Error cast : dest type = '" << T::getClassTypeName()
<< "' source name = '" << find->getName()
<< "' source type = '" << find->getTypeName() << "' in layout '" << mLayoutName << "'");
}
return;
}
} }
MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' in layout '" << mLayoutName << "' not found."); else
_widget = cast;
} }
private: private:
void initialise(const std::string & _layout, void initialise(const std::string & _layout,
MyGUI::Widget* _parent = nullptr) MyGUI::Widget* _parent = nullptr);
{
const std::string MAIN_WINDOW = "_Main";
mLayoutName = _layout;
if (mLayoutName.empty())
mMainWidget = _parent;
else
{
mPrefix = MyGUI::utility::toString(this, "_");
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
const std::string main_name = mPrefix + MAIN_WINDOW; void shutdown();
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter)
{
if ((*iter)->getName() == main_name)
{
mMainWidget = (*iter);
break;
}
}
MYGUI_ASSERT(mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found.");
}
}
void shutdown()
{
MyGUI::Gui::getInstance().destroyWidget(mMainWidget);
mListWindowRoot.clear();
}
public: public:
void setCoord(int x, int y, int w, int h) void setCoord(int x, int y, int w, int h);
{
mMainWidget->setCoord(x,y,w,h);
}
void adjustWindowCaption() // adjust the size of the window caption so that all text is visible
{ // NOTE: this assumes that mMainWidget is of type Window.
// adjust the size of the window caption so that all text is visible void adjustWindowCaption();
// NOTE: this assumes that mMainWidget is of type Window.
MyGUI::TextBox* box = static_cast<MyGUI::Window*>(mMainWidget)->getCaptionWidget();
box->setSize(box->getTextSize().width + 24, box->getSize().height);
// in order to trigger alignment updates, we need to update the parent virtual void setVisible(bool b);
// mygui doesn't provide a proper way of doing this, so we are just changing size
box->getParent()->setCoord(MyGUI::IntCoord(
box->getParent()->getCoord().left,
box->getParent()->getCoord().top,
box->getParent()->getCoord().width,
box->getParent()->getCoord().height+1
));
box->getParent()->setCoord(MyGUI::IntCoord(
box->getParent()->getCoord().left,
box->getParent()->getCoord().top,
box->getParent()->getCoord().width,
box->getParent()->getCoord().height-1
));
}
virtual void setVisible(bool b) void setText(const std::string& name, const std::string& caption);
{
mMainWidget->setVisible(b);
}
void setText(const std::string& name, const std::string& caption) // NOTE: this assume that mMainWidget is of type Window.
{ void setTitle(const std::string& title);
MyGUI::Widget* pt;
getWidget(pt, name);
static_cast<MyGUI::TextBox*>(pt)->setCaption(caption);
}
void setTitle(const std::string& title)
{
// NOTE: this assume that mMainWidget is of type Window.
static_cast<MyGUI::Window*>(mMainWidget)->setCaptionWithReplacing(title);
adjustWindowCaption();
}
void adjustButtonSize(MyGUI::Button* button)
{
// adjust size of button to fit its text
MyGUI::IntSize size = button->getTextSize();
button->setSize(size.width + 24, button->getSize().height);
}
MyGUI::Widget* mMainWidget; MyGUI::Widget* mMainWidget;
protected: protected:

Loading…
Cancel
Save