Removed gameWindowSize parameter from all dialogs that had it, instead this is fetched via the environment variable.

This commit is contained in:
Jan Borsodi 2010-10-23 00:17:41 +02:00
parent 12fe9305a6
commit 025af1717f
11 changed files with 25 additions and 18 deletions

View file

@ -11,11 +11,12 @@
using namespace MWGui; using namespace MWGui;
using namespace Widgets; using namespace Widgets;
BirthDialog::BirthDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) BirthDialog::BirthDialog(MWWorld::Environment& environment)
: Layout("openmw_chargen_birth_layout.xml") : Layout("openmw_chargen_birth_layout.xml")
, environment(environment) , environment(environment)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;

View file

@ -20,7 +20,7 @@ namespace MWGui
class BirthDialog : public OEngine::GUI::Layout class BirthDialog : public OEngine::GUI::Layout
{ {
public: public:
BirthDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); BirthDialog(MWWorld::Environment& environment);
enum Gender enum Gender
{ {

View file

@ -73,11 +73,12 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
/* PickClassDialog */ /* PickClassDialog */
PickClassDialog::PickClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) PickClassDialog::PickClassDialog(MWWorld::Environment& environment)
: Layout("openmw_chargen_class_layout.xml") : Layout("openmw_chargen_class_layout.xml")
, environment(environment) , environment(environment)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;
@ -427,7 +428,7 @@ ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
/* CreateClassDialog */ /* CreateClassDialog */
CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
: Layout("openmw_chargen_create_class_layout.xml") : Layout("openmw_chargen_create_class_layout.xml")
, environment(environment) , environment(environment)
, specDialog(nullptr) , specDialog(nullptr)
@ -436,6 +437,7 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment, MyGUI::I
, descDialog(nullptr) , descDialog(nullptr)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;

View file

@ -114,7 +114,7 @@ namespace MWGui
class PickClassDialog : public OEngine::GUI::Layout class PickClassDialog : public OEngine::GUI::Layout
{ {
public: public:
PickClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); PickClassDialog(MWWorld::Environment& environment);
const std::string &getClassId() const { return currentClassId; } const std::string &getClassId() const { return currentClassId; }
void setClassId(const std::string &classId); void setClassId(const std::string &classId);
@ -287,7 +287,7 @@ namespace MWGui
class CreateClassDialog : public OEngine::GUI::Layout class CreateClassDialog : public OEngine::GUI::Layout
{ {
public: public:
CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); CreateClassDialog(MWWorld::Environment& environment);
virtual ~CreateClassDialog(); virtual ~CreateClassDialog();
std::string getName() const; std::string getName() const;

View file

@ -15,7 +15,7 @@
using namespace MWGui; using namespace MWGui;
using namespace Widgets; using namespace Widgets;
RaceDialog::RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) RaceDialog::RaceDialog(MWWorld::Environment& environment)
: Layout("openmw_chargen_race_layout.xml") : Layout("openmw_chargen_race_layout.xml")
, environment(environment) , environment(environment)
, genderIndex(0) , genderIndex(0)
@ -25,6 +25,7 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWin
, hairCount(14) , hairCount(14)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;

View file

@ -24,7 +24,7 @@ namespace MWGui
class RaceDialog : public OEngine::GUI::Layout class RaceDialog : public OEngine::GUI::Layout
{ {
public: public:
RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); RaceDialog(MWWorld::Environment& environment);
enum Gender enum Gender
{ {

View file

@ -13,12 +13,13 @@ using namespace Widgets;
const int ReviewDialog::lineHeight = 18; const int ReviewDialog::lineHeight = 18;
ReviewDialog::ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) ReviewDialog::ReviewDialog(MWWorld::Environment& environment)
: Layout("openmw_chargen_review_layout.xml") : Layout("openmw_chargen_review_layout.xml")
, environment(environment) , environment(environment)
, lastPos(0) , lastPos(0)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;

View file

@ -25,7 +25,7 @@ namespace MWGui
public: public:
typedef std::vector<int> SkillList; typedef std::vector<int> SkillList;
ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); ReviewDialog(MWWorld::Environment& environment);
void setPlayerName(const std::string &name); void setPlayerName(const std::string &name);
void setRace(const std::string &raceId); void setRace(const std::string &raceId);

View file

@ -1,14 +1,16 @@
#include "text_input.hpp" #include "text_input.hpp"
#include "window_manager.hpp"
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwworld/world.hpp"
using namespace MWGui; using namespace MWGui;
TextInputDialog::TextInputDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) TextInputDialog::TextInputDialog(MWWorld::Environment& environment)
: Layout("openmw_text_input_layout.xml") : Layout("openmw_text_input_layout.xml")
, environment(environment) , environment(environment)
{ {
// Centre dialog // Centre dialog
MyGUI::IntSize gameWindowSize = environment.mWindowManager->getGui()->getViewSize();
MyGUI::IntCoord coord = mMainWidget->getCoord(); MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2; coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2; coord.top = (gameWindowSize.height - coord.height)/2;

View file

@ -18,7 +18,7 @@ namespace MWGui
class TextInputDialog : public OEngine::GUI::Layout class TextInputDialog : public OEngine::GUI::Layout
{ {
public: public:
TextInputDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); TextInputDialog(MWWorld::Environment& environment);
std::string getTextInput() const { return textEdit ? textEdit->getOnlyText() : ""; } std::string getTextInput() const { return textEdit ? textEdit->getOnlyText() : ""; }
void setTextInput(const std::string &text) { if (textEdit) textEdit->setOnlyText(text); } void setTextInput(const std::string &text) { if (textEdit) textEdit->setOnlyText(text); }

View file

@ -169,7 +169,7 @@ void WindowManager::updateVisible()
{ {
if (nameDialog) if (nameDialog)
removeDialog(nameDialog); removeDialog(nameDialog);
nameDialog = new TextInputDialog(environment, gui->getViewSize()); nameDialog = new TextInputDialog(environment);
std::string sName = getGameSettingString("sName", "Name"); std::string sName = getGameSettingString("sName", "Name");
nameDialog->setTextLabel(sName); nameDialog->setTextLabel(sName);
nameDialog->setTextInput(playerName); nameDialog->setTextInput(playerName);
@ -183,7 +183,7 @@ void WindowManager::updateVisible()
{ {
if (raceDialog) if (raceDialog)
removeDialog(raceDialog); removeDialog(raceDialog);
raceDialog = new RaceDialog(environment, gui->getViewSize()); raceDialog = new RaceDialog(environment);
raceDialog->setNextButtonShow(raceChosen); raceDialog->setNextButtonShow(raceChosen);
raceDialog->setRaceId(playerRaceId); raceDialog->setRaceId(playerRaceId);
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone); raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
@ -213,7 +213,7 @@ void WindowManager::updateVisible()
{ {
if (pickClassDialog) if (pickClassDialog)
removeDialog(pickClassDialog); removeDialog(pickClassDialog);
pickClassDialog = new PickClassDialog(environment, gui->getViewSize()); pickClassDialog = new PickClassDialog(environment);
pickClassDialog->setNextButtonShow(classChosen); pickClassDialog->setNextButtonShow(classChosen);
pickClassDialog->setClassId(playerClass.name); pickClassDialog->setClassId(playerClass.name);
pickClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogDone); pickClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogDone);
@ -226,7 +226,7 @@ void WindowManager::updateVisible()
{ {
if (createClassDialog) if (createClassDialog)
removeDialog(createClassDialog); removeDialog(createClassDialog);
createClassDialog = new CreateClassDialog(environment, gui->getViewSize()); createClassDialog = new CreateClassDialog(environment);
createClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogDone); createClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogDone);
createClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogBack); createClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogBack);
createClassDialog->open(); createClassDialog->open();
@ -237,7 +237,7 @@ void WindowManager::updateVisible()
{ {
if (birthSignDialog) if (birthSignDialog)
removeDialog(birthSignDialog); removeDialog(birthSignDialog);
birthSignDialog = new BirthDialog(environment, gui->getViewSize()); birthSignDialog = new BirthDialog(environment);
birthSignDialog->setNextButtonShow(birthSignChosen); birthSignDialog->setNextButtonShow(birthSignChosen);
birthSignDialog->setBirthId(playerBirthSignId); birthSignDialog->setBirthId(playerBirthSignId);
birthSignDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogDone); birthSignDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogDone);
@ -251,7 +251,7 @@ void WindowManager::updateVisible()
reviewNext = false; reviewNext = false;
if (reviewDialog) if (reviewDialog)
removeDialog(reviewDialog); removeDialog(reviewDialog);
reviewDialog = new ReviewDialog(environment, gui->getViewSize()); reviewDialog = new ReviewDialog(environment);
reviewDialog->setPlayerName(playerName); reviewDialog->setPlayerName(playerName);
reviewDialog->setRace(playerRaceId); reviewDialog->setRace(playerRaceId);
reviewDialog->setClass(playerClass); reviewDialog->setClass(playerClass);