1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-10-05 09:56:32 +00:00

No more using namespace

This commit is contained in:
Britt Mathis 2013-04-17 18:56:48 -04:00
parent 60fadaeaf0
commit 7eee86ab66
22 changed files with 8609 additions and 8557 deletions

View file

@ -9,9 +9,6 @@
#include "widgets.hpp" #include "widgets.hpp"
using namespace MWGui;
using namespace Widgets;
namespace namespace
{ {
@ -22,6 +19,9 @@ bool sortBirthSigns(const std::pair<std::string, const ESM::BirthSign*>& left, c
} }
namespace MWGui
{
BirthDialog::BirthDialog() BirthDialog::BirthDialog()
: WindowModal("openmw_chargen_birth.layout") : WindowModal("openmw_chargen_birth.layout")
{ {
@ -166,7 +166,7 @@ void BirthDialog::updateSpells()
if (mCurrentBirthId.empty()) if (mCurrentBirthId.empty())
return; return;
MWSpellPtr spellWidget; Widgets::MWSpellPtr spellWidget;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
@ -177,7 +177,7 @@ void BirthDialog::updateSpells()
store.get<ESM::BirthSign>().find(mCurrentBirthId); store.get<ESM::BirthSign>().find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->mTexture; std::string texturePath = std::string("textures\\") + birth->mTexture;
fixTexturePath(texturePath); Widgets::fixTexturePath(texturePath);
mBirthImage->setImageTexture(texturePath); mBirthImage->setImageTexture(texturePath);
std::vector<std::string> abilities, powers, spells; std::vector<std::string> abilities, powers, spells;
@ -227,7 +227,7 @@ void BirthDialog::updateSpells()
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<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") + boost::lexical_cast<std::string>(i));
spellWidget->setSpellId(spellId); spellWidget->setSpellId(spellId);
mSpellItems.push_back(spellWidget); mSpellItems.push_back(spellWidget);
@ -235,7 +235,7 @@ void BirthDialog::updateSpells()
MyGUI::IntCoord spellCoord = coord; MyGUI::IntCoord spellCoord = coord;
spellCoord.height = 24; // TODO: This should be fetched from the skin somehow, or perhaps a widget in the layout as a template? spellCoord.height = 24; // TODO: This should be fetched from the skin somehow, or perhaps a widget in the layout as a template?
spellWidget->createEffectWidgets(mSpellItems, mSpellArea, spellCoord, (category == 0) ? MWEffectList::EF_Constant : 0); spellWidget->createEffectWidgets(mSpellItems, mSpellArea, spellCoord, (category == 0) ? Widgets::MWEffectList::EF_Constant : 0);
coord.top = spellCoord.top; coord.top = spellCoord.top;
++i; ++i;
@ -243,3 +243,5 @@ void BirthDialog::updateSpells()
} }
} }
} }
}

View file

@ -12,7 +12,8 @@
#include "formatting.hpp" #include "formatting.hpp"
using namespace MWGui; namespace MWGui
{
BookWindow::BookWindow () BookWindow::BookWindow ()
: WindowBase("openmw_book.layout") : WindowBase("openmw_book.layout")
@ -157,3 +158,5 @@ void BookWindow::updatePages()
++i; ++i;
} }
} }
}

View file

@ -43,7 +43,8 @@ namespace
}; };
} }
using namespace MWGui; namespace MWGui
{
CharacterCreation::CharacterCreation() CharacterCreation::CharacterCreation()
: mNameDialog(0) : mNameDialog(0)
@ -722,3 +723,5 @@ CharacterCreation::~CharacterCreation()
delete mBirthSignDialog; delete mBirthSignDialog;
delete mReviewDialog; delete mReviewDialog;
} }
}

View file

@ -11,7 +11,8 @@
#undef min #undef min
#undef max #undef max
using namespace MWGui; namespace MWGui
{
/* GenerateClassResultDialog */ /* GenerateClassResultDialog */
@ -878,3 +879,5 @@ void DescriptionDialog::onOkClicked(MyGUI::Widget* _sender)
{ {
eventDone(this); eventDone(this);
} }
}

View file

@ -278,16 +278,15 @@ namespace MWGui
std::string Console::complete( std::string input, std::vector<std::string> &matches ) std::string Console::complete( std::string input, std::vector<std::string> &matches )
{ {
using namespace std; std::string output = input;
string output=input; std::string tmp = input;
string tmp=input;
bool has_front_quote = false; bool has_front_quote = false;
/* Does the input string contain things that don't have to be completed? If yes erase them. */ /* Does the input string contain things that don't have to be completed? If yes erase them. */
/* Are there quotation marks? */ /* Are there quotation marks? */
if( tmp.find('"') != string::npos ) { if( tmp.find('"') != std::string::npos ) {
int numquotes=0; int numquotes=0;
for(string::iterator it=tmp.begin(); it < tmp.end(); ++it) { for(std::string::iterator it=tmp.begin(); it < tmp.end(); ++it) {
if( *it == '"' ) if( *it == '"' )
numquotes++; numquotes++;
} }
@ -299,7 +298,7 @@ namespace MWGui
} }
else { else {
size_t pos; size_t pos;
if( ( ((pos = tmp.rfind(' ')) != string::npos ) ) && ( pos > tmp.rfind('"') ) ) { if( ( ((pos = tmp.rfind(' ')) != std::string::npos ) ) && ( pos > tmp.rfind('"') ) ) {
tmp.erase( 0, tmp.rfind(' ')+1); tmp.erase( 0, tmp.rfind(' ')+1);
} }
else { else {
@ -311,7 +310,7 @@ namespace MWGui
/* No quotation marks. Are there spaces?*/ /* No quotation marks. Are there spaces?*/
else { else {
size_t rpos; size_t rpos;
if( (rpos=tmp.rfind(' ')) != string::npos ) { if( (rpos=tmp.rfind(' ')) != std::string::npos ) {
if( rpos == 0 ) { if( rpos == 0 ) {
tmp.clear(); tmp.clear();
} }
@ -330,7 +329,7 @@ namespace MWGui
} }
/* Iterate through the vector. */ /* Iterate through the vector. */
for(vector<string>::iterator it=mNames.begin(); it < mNames.end();++it) { for(std::vector<std::string>::iterator it=mNames.begin(); it < mNames.end();++it) {
bool string_different=false; bool string_different=false;
/* Is the string shorter than the input string? If yes skip it. */ /* Is the string shorter than the input string? If yes skip it. */
@ -338,7 +337,7 @@ namespace MWGui
continue; continue;
/* Is the beginning of the string different from the input string? If yes skip it. */ /* Is the beginning of the string different from the input string? If yes skip it. */
for( string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();iter++, iter2++) { for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();iter++, iter2++) {
if( tolower(*iter) != tolower(*iter2) ) { if( tolower(*iter) != tolower(*iter2) ) {
string_different=true; string_different=true;
break; break;
@ -361,24 +360,24 @@ namespace MWGui
/* Only one match. We're done. */ /* Only one match. We're done. */
if( matches.size() == 1 ) { if( matches.size() == 1 ) {
/* Adding quotation marks when the input string started with a quotation mark or has spaces in it*/ /* Adding quotation marks when the input string started with a quotation mark or has spaces in it*/
if( ( matches.front().find(' ') != string::npos ) ) { if( ( matches.front().find(' ') != std::string::npos ) ) {
if( !has_front_quote ) if( !has_front_quote )
output.append(string("\"")); output.append(std::string("\""));
return output.append(matches.front() + string("\" ")); return output.append(matches.front() + std::string("\" "));
} }
else if( has_front_quote ) { else if( has_front_quote ) {
return output.append(matches.front() + string("\" ")); return output.append(matches.front() + std::string("\" "));
} }
else { else {
return output.append(matches.front() + string(" ")); return output.append(matches.front() + std::string(" "));
} }
} }
/* Check if all matching strings match further than input. If yes complete to this match. */ /* Check if all matching strings match further than input. If yes complete to this match. */
int i = tmp.length(); int i = tmp.length();
for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) { for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) {
for(vector<string>::iterator it=matches.begin(); it < matches.end();++it) { for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end();++it) {
if( tolower((*it)[i]) != tolower(*iter) ) { if( tolower((*it)[i]) != tolower(*iter) ) {
/* Append the longest match to the end of the output string*/ /* Append the longest match to the end of the output string*/
output.append(matches.front().substr( 0, i)); output.append(matches.front().substr( 0, i));

View file

@ -14,10 +14,6 @@
#include "tradewindow.hpp" #include "tradewindow.hpp"
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
using namespace MWGui;
using namespace Widgets;
namespace namespace
{ {
bool compareType(std::string type1, std::string type2) bool compareType(std::string type1, std::string type2)
@ -68,6 +64,8 @@ namespace
} }
} }
namespace MWGui
{
ContainerBase::ContainerBase(DragAndDrop* dragAndDrop) ContainerBase::ContainerBase(DragAndDrop* dragAndDrop)
: mDragAndDrop(dragAndDrop) : mDragAndDrop(dragAndDrop)
@ -751,3 +749,5 @@ void ContainerWindow::onReferenceUnavailable()
{ {
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
} }
}

View file

@ -19,14 +19,12 @@
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
#include "travelwindow.hpp" #include "travelwindow.hpp"
using namespace MWGui;
using namespace Widgets;
/** /**
*Copied from the internet. *Copied from the internet.
*/ */
namespace { namespace
{
std::string lower_string(const std::string& str) std::string lower_string(const std::string& str)
{ {
@ -46,7 +44,8 @@ bool sortByLength (const std::string& left, const std::string& right)
} }
} }
namespace MWGui
{
PersuasionDialog::PersuasionDialog() PersuasionDialog::PersuasionDialog()
: WindowModal("openmw_persuasion_dialog.layout") : WindowModal("openmw_persuasion_dialog.layout")
@ -537,3 +536,4 @@ void DialogueWindow::onFrame()
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(disp)+std::string("/100")+"#B29154"); mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(disp)+std::string("/100")+"#B29154");
} }
} }
}

View file

@ -12,8 +12,8 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
using namespace MWGui; namespace MWGui
using namespace Widgets; {
MyGUI::UString DialogueHistory::getColorAtPos(size_t _pos) MyGUI::UString DialogueHistory::getColorAtPos(size_t _pos)
{ {
@ -74,3 +74,5 @@ void DialogueHistory::addDialogText(const MyGUI::UString& parText)
addText(parText); addText(parText);
addText("\n"); addText("\n");
} }
}

View file

@ -9,8 +9,6 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <OgreUTFString.h> #include <OgreUTFString.h>
using namespace MWGui;
namespace namespace
{ {
int convertFromHex(std::string hex) int convertFromHex(std::string hex)
@ -78,6 +76,9 @@ namespace
} }
} }
namespace MWGui
{
std::vector<std::string> BookTextParser::split(std::string utf8Text, const int width, const int height) std::vector<std::string> BookTextParser::split(std::string utf8Text, const int width, const int height)
{ {
using Ogre::UTFString; using Ogre::UTFString;
@ -362,3 +363,5 @@ void BookTextParser::parseSubText(std::string text)
parseSubText(text.substr(tagStart, text.size())); parseSubText(text.substr(tagStart, text.size()));
} }
} }
}

View file

@ -12,7 +12,8 @@
#include "console.hpp" #include "console.hpp"
#include "spellicons.hpp" #include "spellicons.hpp"
using namespace MWGui; namespace MWGui
{
HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop) HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
: Layout("openmw_hud.layout") : Layout("openmw_hud.layout")
@ -537,3 +538,5 @@ void HUD::update()
{ {
mSpellIcons->updateWidgets(mEffectBox, true); mSpellIcons->updateWidgets(mEffectBox, true);
} }
}

View file

@ -5,8 +5,11 @@
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_ScrollBar.h> #include <MyGUI_ScrollBar.h>
using namespace MWGui; namespace MWGui
using namespace MWGui::Widgets; {
namespace Widgets
{
MWList::MWList() : MWList::MWList() :
mClient(0) mClient(0)
@ -161,3 +164,6 @@ size_t MWScrollView::getScrollRange()
{ {
return getVScroll()->getScrollRange(); return getVScroll()->getScrollRange();
} }
}
}

View file

@ -13,7 +13,8 @@
#include "widgets.hpp" #include "widgets.hpp"
using namespace MWGui; namespace MWGui
{
LocalMapBase::LocalMapBase() LocalMapBase::LocalMapBase()
: mCurX(0) : mCurX(0)
@ -440,3 +441,5 @@ void MapWindow::notifyMapChanged ()
mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" :
"#{sWorld}"); "#{sWorld}");
} }
}

View file

@ -5,7 +5,8 @@
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
using namespace MWGui; namespace MWGui
{
MessageBoxManager::MessageBoxManager () MessageBoxManager::MessageBoxManager ()
{ {
@ -413,3 +414,5 @@ int InteractiveMessageBox::readPressedButton ()
mButtonPressed = -1; mButtonPressed = -1;
return pressed; return pressed;
} }
}

View file

@ -10,9 +10,6 @@
#include "tooltips.hpp" #include "tooltips.hpp"
using namespace MWGui;
using namespace Widgets;
namespace namespace
{ {
int wrap(int index, int max) int wrap(int index, int max)
@ -56,6 +53,9 @@ int countParts(const std::string &part, const std::string &race, bool male)
} }
} }
namespace MWGui
{
RaceDialog::RaceDialog() RaceDialog::RaceDialog()
: WindowModal("openmw_chargen_race.layout") : WindowModal("openmw_chargen_race.layout")
, mGenderIndex(0) , mGenderIndex(0)
@ -382,7 +382,7 @@ void RaceDialog::updateSkills()
if (mCurrentRaceId.empty()) if (mCurrentRaceId.empty())
return; return;
MWSkillPtr skillWidget; Widgets::MWSkillPtr skillWidget;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18); MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
@ -395,10 +395,10 @@ void RaceDialog::updateSkills()
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue; continue;
skillWidget = mSkillList->createWidget<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") + boost::lexical_cast<std::string>(i));
skillWidget->setSkillNumber(skillId); skillWidget->setSkillNumber(skillId);
skillWidget->setSkillValue(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);
@ -419,7 +419,7 @@ void RaceDialog::updateSpellPowers()
if (mCurrentRaceId.empty()) if (mCurrentRaceId.empty())
return; return;
MWSpellPtr spellPowerWidget; Widgets::MWSpellPtr spellPowerWidget;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
@ -431,7 +431,7 @@ void RaceDialog::updateSpellPowers()
for (int i = 0; it != end; ++it) for (int i = 0; it != end; ++it)
{ {
const std::string &spellpower = *it; const std::string &spellpower = *it;
spellPowerWidget = mSpellPowerList->createWidget<MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + boost::lexical_cast<std::string>(i)); spellPowerWidget = mSpellPowerList->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + boost::lexical_cast<std::string>(i));
spellPowerWidget->setSpellId(spellpower); spellPowerWidget->setSpellId(spellpower);
spellPowerWidget->setUserString("ToolTipType", "Spell"); spellPowerWidget->setUserString("ToolTipType", "Spell");
spellPowerWidget->setUserString("Spell", spellpower); spellPowerWidget->setUserString("Spell", spellpower);
@ -442,3 +442,5 @@ void RaceDialog::updateSpellPowers()
++i; ++i;
} }
} }
}

View file

@ -11,8 +11,8 @@
#undef min #undef min
#undef max #undef max
using namespace MWGui; namespace MWGui
using namespace Widgets; {
const int ReviewDialog::sLineHeight = 18; const int ReviewDialog::sLineHeight = 18;
@ -60,13 +60,13 @@ ReviewDialog::ReviewDialog()
// Setup attributes // Setup attributes
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") + boost::lexical_cast<std::string>(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(MWAttribute::AttributeValue(0, 0)); attribute->setAttributeValue(Widgets::MWAttribute::AttributeValue(0, 0));
} }
// Setup skills // Setup skills
@ -155,7 +155,7 @@ void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
void ReviewDialog::setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::Stat<int>& value) void ReviewDialog::setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::Stat<int>& value)
{ {
std::map<int, MWAttributePtr>::iterator attr = mAttributeWidgets.find(static_cast<int>(attributeId)); std::map<int, Widgets::MWAttributePtr>::iterator attr = mAttributeWidgets.find(static_cast<int>(attributeId));
if (attr == mAttributeWidgets.end()) if (attr == mAttributeWidgets.end())
return; return;
@ -365,3 +365,5 @@ void ReviewDialog::onMouseWheel(MyGUI::Widget* _sender, int _rel)
else else
mSkillView->setViewOffset(MyGUI::IntPoint(0, mSkillView->getViewOffset().top + _rel*0.3)); mSkillView->setViewOffset(MyGUI::IntPoint(0, mSkillView->getViewOffset().top + _rel*0.3));
} }
}

View file

@ -10,7 +10,8 @@
#include "formatting.hpp" #include "formatting.hpp"
using namespace MWGui; namespace MWGui
{
ScrollWindow::ScrollWindow () ScrollWindow::ScrollWindow ()
: WindowBase("openmw_scroll.layout") : WindowBase("openmw_scroll.layout")
@ -78,3 +79,4 @@ void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
} }
}

View file

@ -13,7 +13,9 @@
#include "tooltips.hpp" #include "tooltips.hpp"
using namespace MWGui; namespace MWGui
{
const int StatsWindow::sLineHeight = 18; const int StatsWindow::sLineHeight = 18;
StatsWindow::StatsWindow () StatsWindow::StatsWindow ()
@ -572,3 +574,4 @@ void StatsWindow::onPinToggled()
{ {
MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned);
} }
}

View file

@ -3,7 +3,8 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
using namespace MWGui; namespace MWGui
{
TextInputDialog::TextInputDialog() TextInputDialog::TextInputDialog()
: WindowModal("openmw_text_input.layout") : WindowModal("openmw_text_input.layout")
@ -68,3 +69,5 @@ void TextInputDialog::onTextAccepted(MyGUI::Edit* _sender)
else else
eventDone(this); eventDone(this);
} }
}

View file

@ -9,8 +9,8 @@
#include "mapwindow.hpp" #include "mapwindow.hpp"
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
using namespace MWGui; namespace MWGui
using namespace MyGUI; {
ToolTips::ToolTips() : ToolTips::ToolTips() :
Layout("openmw_tooltips.layout") Layout("openmw_tooltips.layout")
@ -62,7 +62,7 @@ void ToolTips::onFrame(float frameDuration)
mMainWidget->getChildAt(i)->setVisible(false); mMainWidget->getChildAt(i)->setVisible(false);
} }
const IntSize &viewSize = RenderManager::getInstance().getViewSize(); const MyGUI::IntSize &viewSize = MyGUI::RenderManager::getInstance().getViewSize();
if (!mEnabled) if (!mEnabled)
{ {
@ -71,7 +71,7 @@ void ToolTips::onFrame(float frameDuration)
if (!mGameMode) if (!mGameMode)
{ {
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition(); const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
if (MWBase::Environment::get().getWindowManager()->getWorldMouseOver() && ((MWBase::Environment::get().getWindowManager()->getMode() == GM_Console) if (MWBase::Environment::get().getWindowManager()->getWorldMouseOver() && ((MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)
|| (MWBase::Environment::get().getWindowManager()->getMode() == GM_Container) || (MWBase::Environment::get().getWindowManager()->getMode() == GM_Container)
@ -84,7 +84,7 @@ void ToolTips::onFrame(float frameDuration)
const MWWorld::Class& objectclass = MWWorld::Class::get (mFocusObject); const MWWorld::Class& objectclass = MWWorld::Class::get (mFocusObject);
IntSize tooltipSize; MyGUI::IntSize tooltipSize;
if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)) if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console))
{ {
setCoord(0, 0, 300, 300); setCoord(0, 0, 300, 300);
@ -97,7 +97,7 @@ void ToolTips::onFrame(float frameDuration)
else else
tooltipSize = getToolTipViaPtr(true); tooltipSize = getToolTipViaPtr(true);
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24); MyGUI::IntPoint tooltipPosition = MyGUI::InputManager::getInstance().getMousePosition() + MyGUI::IntPoint(0, 24);
// make the tooltip stay completely in the viewport // make the tooltip stay completely in the viewport
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width) if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
@ -114,7 +114,7 @@ void ToolTips::onFrame(float frameDuration)
else else
{ {
const MyGUI::IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left); const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
if (mousePos == lastPressed) // mouseclick makes tooltip disappear if (mousePos == lastPressed) // mouseclick makes tooltip disappear
return; return;
@ -135,11 +135,11 @@ void ToolTips::onFrame(float frameDuration)
if (mRemainingDelay > 0) if (mRemainingDelay > 0)
return; return;
Widget* focus = InputManager::getInstance().getMouseFocusWidget(); MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getMouseFocusWidget();
if (focus == 0) if (focus == 0)
return; return;
IntSize tooltipSize; MyGUI::IntSize tooltipSize;
// try to go 1 level up until there is a widget that has tooltip // try to go 1 level up until there is a widget that has tooltip
// this is necessary because some skin elements are actually separate widgets // this is necessary because some skin elements are actually separate widgets
@ -252,7 +252,7 @@ void ToolTips::onFrame(float frameDuration)
else else
throw std::runtime_error ("unknown tooltip type"); throw std::runtime_error ("unknown tooltip type");
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24); MyGUI::IntPoint tooltipPosition = MyGUI::InputManager::getInstance().getMousePosition() + MyGUI::IntPoint(0, 24);
// make the tooltip stay completely in the viewport // make the tooltip stay completely in the viewport
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width) if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
@ -271,7 +271,7 @@ void ToolTips::onFrame(float frameDuration)
{ {
if (!mFocusObject.isEmpty()) if (!mFocusObject.isEmpty())
{ {
IntSize tooltipSize = getToolTipViaPtr(); MyGUI::IntSize tooltipSize = getToolTipViaPtr();
setCoord(viewSize.width/2 - tooltipSize.width/2, setCoord(viewSize.width/2 - tooltipSize.width/2,
std::max(0, int(mFocusToolTipY*viewSize.height - tooltipSize.height)), std::max(0, int(mFocusToolTipY*viewSize.height - tooltipSize.height)),
@ -298,12 +298,12 @@ void ToolTips::setFocusObject(const MWWorld::Ptr& focus)
mFocusObject = focus; mFocusObject = focus;
} }
IntSize ToolTips::getToolTipViaPtr (bool image) MyGUI::IntSize ToolTips::getToolTipViaPtr (bool image)
{ {
// this the maximum width of the tooltip before it starts word-wrapping // this the maximum width of the tooltip before it starts word-wrapping
setCoord(0, 0, 300, 300); setCoord(0, 0, 300, 300);
IntSize tooltipSize; MyGUI::IntSize tooltipSize;
const MWWorld::Class& object = MWWorld::Class::get (mFocusObject); const MWWorld::Class& object = MWWorld::Class::get (mFocusObject);
if (!object.hasToolTip(mFocusObject)) if (!object.hasToolTip(mFocusObject))
@ -337,7 +337,7 @@ void ToolTips::findImageExtension(std::string& image)
} }
} }
IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info) MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
{ {
mDynamicToolTipBox->setVisible(true); mDynamicToolTipBox->setVisible(true);
@ -371,7 +371,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
// this the maximum width of the tooltip before it starts word-wrapping // this the maximum width of the tooltip before it starts word-wrapping
setCoord(0, 0, 300, 300); setCoord(0, 0, 300, 300);
const IntPoint padding(8, 8); const MyGUI::IntPoint padding(8, 8);
const int maximumWidth = 500; const int maximumWidth = 500;
@ -381,32 +381,32 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
std::string realImage = "icons\\" + image; std::string realImage = "icons\\" + image;
findImageExtension(realImage); findImageExtension(realImage);
EditBox* captionWidget = mDynamicToolTipBox->createWidget<EditBox>("NormalText", IntCoord(0, 0, 300, 300), Align::Left | Align::Top, "ToolTipCaption"); MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
captionWidget->setProperty("Static", "true"); captionWidget->setProperty("Static", "true");
captionWidget->setCaptionWithReplacing(caption); captionWidget->setCaptionWithReplacing(caption);
IntSize captionSize = captionWidget->getTextSize(); MyGUI::IntSize captionSize = captionWidget->getTextSize();
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize); int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
EditBox* textWidget = mDynamicToolTipBox->createWidget<EditBox>("SandText", IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), Align::Stretch, "ToolTipText"); MyGUI::EditBox* textWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("SandText", MyGUI::IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), MyGUI::Align::Stretch, "ToolTipText");
textWidget->setProperty("Static", "true"); textWidget->setProperty("Static", "true");
textWidget->setProperty("MultiLine", "true"); textWidget->setProperty("MultiLine", "true");
textWidget->setProperty("WordWrap", info.wordWrap ? "true" : "false"); textWidget->setProperty("WordWrap", info.wordWrap ? "true" : "false");
textWidget->setCaptionWithReplacing(text); textWidget->setCaptionWithReplacing(text);
textWidget->setTextAlign(Align::HCenter | Align::Top); textWidget->setTextAlign(MyGUI::Align::HCenter | MyGUI::Align::Top);
IntSize textSize = textWidget->getTextSize(); MyGUI::IntSize textSize = textWidget->getTextSize();
captionSize += IntSize(imageSize, 0); // adjust for image captionSize += MyGUI::IntSize(imageSize, 0); // adjust for image
IntSize totalSize = IntSize( std::min(std::max(textSize.width,captionSize.width + ((image != "") ? imageCaptionHPadding : 0)),maximumWidth), MyGUI::IntSize totalSize = MyGUI::IntSize( std::min(std::max(textSize.width,captionSize.width + ((image != "") ? imageCaptionHPadding : 0)),maximumWidth),
((text != "") ? textSize.height + imageCaptionVPadding : 0) + captionHeight ); ((text != "") ? textSize.height + imageCaptionVPadding : 0) + captionHeight );
if (!info.effects.empty()) if (!info.effects.empty())
{ {
Widget* effectArea = mDynamicToolTipBox->createWidget<Widget>("", MyGUI::Widget* effectArea = mDynamicToolTipBox->createWidget<MyGUI::Widget>("",
IntCoord(0, totalSize.height, 300, 300-totalSize.height), MyGUI::IntCoord(0, totalSize.height, 300, 300-totalSize.height),
Align::Stretch, "ToolTipEffectArea"); MyGUI::Align::Stretch, "ToolTipEffectArea");
IntCoord coord(0, 6, totalSize.width, 24); MyGUI::IntCoord coord(0, 6, totalSize.width, 24);
/** /**
* \todo * \todo
@ -415,7 +415,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
*/ */
Widgets::MWEffectListPtr effectsWidget = effectArea->createWidget<Widgets::MWEffectList> Widgets::MWEffectListPtr effectsWidget = effectArea->createWidget<Widgets::MWEffectList>
("MW_StatName", coord, Align::Default, "ToolTipEffectsWidget"); ("MW_StatName", coord, MyGUI::Align::Default, "ToolTipEffectsWidget");
effectsWidget->setEffectList(info.effects); effectsWidget->setEffectList(info.effects);
std::vector<MyGUI::Widget*> effectItems; std::vector<MyGUI::Widget*> effectItems;
@ -427,14 +427,14 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
if (info.enchant != "") if (info.enchant != "")
{ {
assert(enchant); assert(enchant);
Widget* enchantArea = mDynamicToolTipBox->createWidget<Widget>("", MyGUI::Widget* enchantArea = mDynamicToolTipBox->createWidget<MyGUI::Widget>("",
IntCoord(0, totalSize.height, 300, 300-totalSize.height), MyGUI::IntCoord(0, totalSize.height, 300, 300-totalSize.height),
Align::Stretch, "ToolTipEnchantArea"); MyGUI::Align::Stretch, "ToolTipEnchantArea");
IntCoord coord(0, 6, totalSize.width, 24); MyGUI::IntCoord coord(0, 6, totalSize.width, 24);
Widgets::MWEffectListPtr enchantWidget = enchantArea->createWidget<Widgets::MWEffectList> Widgets::MWEffectListPtr enchantWidget = enchantArea->createWidget<Widgets::MWEffectList>
("MW_StatName", coord, Align::Default, "ToolTipEnchantWidget"); ("MW_StatName", coord, MyGUI::Align::Default, "ToolTipEnchantWidget");
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects)); enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects));
std::vector<MyGUI::Widget*> enchantEffectItems; std::vector<MyGUI::Widget*> enchantEffectItems;
@ -451,7 +451,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
const int chargeWidth = 204; const int chargeWidth = 204;
TextBox* chargeText = enchantArea->createWidget<TextBox>("SandText", IntCoord(0, 0, 10, 18), Align::Default, "ToolTipEnchantChargeText"); MyGUI::TextBox* chargeText = enchantArea->createWidget<MyGUI::TextBox>("SandText", MyGUI::IntCoord(0, 0, 10, 18), MyGUI::Align::Default, "ToolTipEnchantChargeText");
chargeText->setCaptionWithReplacing("#{sCharges}"); chargeText->setCaptionWithReplacing("#{sCharges}");
const int chargeTextWidth = chargeText->getTextSize().width + 5; const int chargeTextWidth = chargeText->getTextSize().width + 5;
@ -462,18 +462,18 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
chargeText->setCoord((totalSize.width - chargeAndTextWidth)/2, coord.top+6, chargeTextWidth, 18); chargeText->setCoord((totalSize.width - chargeAndTextWidth)/2, coord.top+6, chargeTextWidth, 18);
IntCoord chargeCoord; MyGUI::IntCoord chargeCoord;
if (totalSize.width < chargeWidth) if (totalSize.width < chargeWidth)
{ {
totalSize.width = chargeWidth; totalSize.width = chargeWidth;
chargeCoord = IntCoord(0, coord.top+6, chargeWidth, 18); chargeCoord = MyGUI::IntCoord(0, coord.top+6, chargeWidth, 18);
} }
else else
{ {
chargeCoord = IntCoord((totalSize.width - chargeAndTextWidth)/2 + chargeTextWidth, coord.top+6, chargeWidth, 18); chargeCoord = MyGUI::IntCoord((totalSize.width - chargeAndTextWidth)/2 + chargeTextWidth, coord.top+6, chargeWidth, 18);
} }
Widgets::MWDynamicStatPtr chargeWidget = enchantArea->createWidget<Widgets::MWDynamicStat> Widgets::MWDynamicStatPtr chargeWidget = enchantArea->createWidget<Widgets::MWDynamicStat>
("MW_ChargeBar", chargeCoord, Align::Default, "ToolTipEnchantCharge"); ("MW_ChargeBar", chargeCoord, MyGUI::Align::Default, "ToolTipEnchantCharge");
chargeWidget->setValue(charge, charge); chargeWidget->setValue(charge, charge);
totalSize.height += 24; totalSize.height += 24;
} }
@ -497,23 +497,23 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
}else{ }else{
horizontal_scroll = 80 - mHorizontalScrollIndex; horizontal_scroll = 80 - mHorizontalScrollIndex;
} }
captionWidget->setPosition (IntPoint(horizontal_scroll, captionWidget->getPosition().top + padding.top)); captionWidget->setPosition (MyGUI::IntPoint(horizontal_scroll, captionWidget->getPosition().top + padding.top));
} else { } else {
captionWidget->setPosition (captionWidget->getPosition() + padding); captionWidget->setPosition (captionWidget->getPosition() + padding);
} }
textWidget->setPosition (textWidget->getPosition() + IntPoint(0, padding.top)); // only apply vertical padding, the horizontal works automatically due to Align::HCenter textWidget->setPosition (textWidget->getPosition() + MyGUI::IntPoint(0, padding.top)); // only apply vertical padding, the horizontal works automatically due to Align::HCenter
if (image != "") if (image != "")
{ {
ImageBox* imageWidget = mDynamicToolTipBox->createWidget<ImageBox>("ImageBox", MyGUI::ImageBox* imageWidget = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("ImageBox",
IntCoord((totalSize.width - captionSize.width - imageCaptionHPadding)/2, 0, imageSize, imageSize), MyGUI::IntCoord((totalSize.width - captionSize.width - imageCaptionHPadding)/2, 0, imageSize, imageSize),
Align::Left | Align::Top, "ToolTipImage"); MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipImage");
imageWidget->setImageTexture(realImage); imageWidget->setImageTexture(realImage);
imageWidget->setPosition (imageWidget->getPosition() + padding); imageWidget->setPosition (imageWidget->getPosition() + padding);
} }
totalSize += IntSize(padding.left*2, padding.top*2); totalSize += MyGUI::IntSize(padding.left*2, padding.top*2);
return totalSize; return totalSize;
} }
@ -767,3 +767,5 @@ void ToolTips::setDelay(float delay)
mDelay = delay; mDelay = delay;
mRemainingDelay = mDelay; mRemainingDelay = mDelay;
} }
}

View file

@ -12,8 +12,10 @@
#undef min #undef min
#undef max #undef max
using namespace MWGui; namespace MWGui
using namespace MWGui::Widgets; {
namespace Widgets
{
/* Helper functions */ /* Helper functions */
@ -21,7 +23,7 @@ using namespace MWGui::Widgets;
* Fixes the filename of a texture path to use the correct .dds extension. * Fixes the filename of a texture path to use the correct .dds extension.
* This is needed on some ESM entries which point to a .tga file instead. * This is needed on some ESM entries which point to a .tga file instead.
*/ */
void MWGui::Widgets::fixTexturePath(std::string &path) void fixTexturePath(std::string &path)
{ {
int offset = path.rfind("."); int offset = path.rfind(".");
if (offset < 0) if (offset < 0)
@ -891,3 +893,5 @@ void VBox::onWidgetCreated(MyGUI::Widget* _widget)
{ {
align(); align();
} }
}
}

View file

@ -39,7 +39,8 @@
#include "companionwindow.hpp" #include "companionwindow.hpp"
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
using namespace MWGui; namespace MWGui
{
WindowManager::WindowManager( WindowManager::WindowManager(
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *ogre, const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *ogre,
@ -1179,3 +1180,5 @@ void WindowManager::frameStarted (float dt)
{ {
mInventoryWindow->doRenderUpdate (); mInventoryWindow->doRenderUpdate ();
} }
}

View file

@ -2,8 +2,8 @@
#include "exposedwindow.hpp" #include "exposedwindow.hpp"
using namespace MWGui; namespace MWGui
{
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout) WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
: WindowBase(parLayout), mPinned(false), mVisible(false) : WindowBase(parLayout), mPinned(false), mVisible(false)
{ {
@ -24,3 +24,4 @@ void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender)
onPinToggled(); onPinToggled();
} }
}