diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-06 00:04:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-06 00:04:33 +0300 |
commit | 7b155f111daf5d7ae477b16d0f0789b1113bea74 (patch) | |
tree | 2d2711ab1f9daed793171383af1a7e1fa6ff737c /src/gui | |
parent | c3afff20d4989ab2835545715bbe67e5b5d9b353 (diff) | |
download | mv-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.gz mv-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.bz2 mv-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.xz mv-7b155f111daf5d7ae477b16d0f0789b1113bea74.zip |
Fix some issues after auto checking.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/beingpopup.cpp | 12 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 15 | ||||
-rw-r--r-- | src/gui/gui.cpp | 4 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 12 | ||||
-rw-r--r-- | src/gui/outfitwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/palette.h | 24 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.h | 2 | ||||
-rw-r--r-- | src/gui/quitdialog.cpp | 13 | ||||
-rw-r--r-- | src/gui/sdlinput.cpp | 6 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 12 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 25 | ||||
-rw-r--r-- | src/gui/textcommandeditor.cpp | 69 | ||||
-rw-r--r-- | src/gui/textcommandeditor.h | 9 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/setuptabscroll.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 28 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.h | 2 | ||||
-rw-r--r-- | src/gui/worldselectdialog.cpp | 10 |
22 files changed, 136 insertions, 153 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index c58cca626..879b50245 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -41,27 +41,27 @@ #include "debug.h" BeingPopup::BeingPopup() : - Popup("BeingPopup", "beingpopup.xml") + Popup("BeingPopup", "beingpopup.xml"), + mBeingName(new Label("A")), + mBeingParty(new Label("A")), + mBeingGuild(new Label("A")), + mBeingRank(new Label("A")), + mBeingComment(new Label("A")) { // Being Name - mBeingName = new Label("A"); mBeingName->setFont(boldFont); mBeingName->setPosition(getPadding(), getPadding()); const int fontHeight = mBeingName->getHeight() + getPadding(); // Being's party - mBeingParty = new Label("A"); mBeingParty->setPosition(getPadding(), fontHeight); // Being's party - mBeingGuild = new Label("A"); mBeingGuild->setPosition(getPadding(), 2 * fontHeight); - mBeingRank = new Label("A"); mBeingRank->setPosition(getPadding(), 3 * fontHeight); - mBeingComment = new Label("A"); mBeingComment->setPosition(getPadding(), 4 * fontHeight); add(mBeingName); diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index a18f3d383..38a58c03c 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -550,15 +550,13 @@ bool CharSelectDialog::selectByName(const std::string &name, CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog): mCharacter(nullptr), - mPlayerBox(new PlayerBox) + mPlayerBox(new PlayerBox), + mName(new Label("wwwwwwwwwwwwwwwwwwwwwwww")), + mLevel(new Label("(888)")), + mMoney(new Label("wwwwwwwww")), + mButton(new Button("wwwwwwwww", "go", charSelectDialog)), + mDelete(new Button(_("Delete"), "delete", charSelectDialog)) { - mButton = new Button("wwwwwwwww", "go", charSelectDialog); - mName = new Label("wwwwwwwwwwwwwwwwwwwwwwww"); - mLevel = new Label("(888)"); - mMoney = new Label("wwwwwwwww"); - - mDelete = new Button(_("Delete"), "delete", charSelectDialog); - LayoutHelper h(this); ContainerPlacer placer = h.getPlacer(0, 0); @@ -571,7 +569,6 @@ CharacterDisplay::CharacterDisplay(CharSelectDialog *charSelectDialog): update(); - // Setting the width so that the largest label fits. mName->adjustSize(); mMoney->adjustSize(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 8d05fc26d..feabd79d5 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -323,10 +323,10 @@ bool Gui::handleKeyInput2() continue; } - bool keyEventConsumed = false; - if (mFocusHandler) { + bool keyEventConsumed = false; + // Send key inputs to the focused widgets if (mFocusHandler->getFocused()) { diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 192a5e116..f9cbb92dd 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -51,34 +51,32 @@ ItemPopup::ItemPopup(): Popup("ItemPopup", "itempopup.xml"), - mIcon(nullptr), + mItemName(new Label), + mItemDesc(new TextBox), + mItemEffect(new TextBox), + mItemWeight(new TextBox), + mIcon(new Icon(nullptr)), mLastName(""), mLastColor(1) { // Item Name - mItemName = new Label; mItemName->setFont(boldFont); mItemName->setPosition(getPadding(), getPadding()); const int fontHeight = getFont()->getHeight(); // Item Description - mItemDesc = new TextBox; mItemDesc->setEditable(false); mItemDesc->setPosition(getPadding(), fontHeight); // Item Effect - mItemEffect = new TextBox; mItemEffect->setEditable(false); mItemEffect->setPosition(getPadding(), 2 * fontHeight + 2 * getPadding()); // Item Weight - mItemWeight = new TextBox; mItemWeight->setEditable(false); mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding()); - mIcon = new Icon(nullptr); - add(mItemName); add(mItemDesc); add(mItemEffect); diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 1552d793f..2a46cf2ce 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -539,10 +539,10 @@ void OutfitWindow::showCurrentOutfit() void OutfitWindow::wearNextOutfit(bool all) { - bool fromStart = false; next(); if (!all && mCurrentOutfit < OUTFITS_COUNT) { + bool fromStart = false; while (!mItemsUnequip[mCurrentOutfit]) { next(); @@ -560,10 +560,10 @@ void OutfitWindow::wearNextOutfit(bool all) void OutfitWindow::wearPreviousOutfit(bool all) { - bool fromStart = false; previous(); if (!all && mCurrentOutfit < OUTFITS_COUNT) { + bool fromStart = false; while (!mItemsUnequip[mCurrentOutfit]) { previous(); diff --git a/src/gui/palette.h b/src/gui/palette.h index 7d5d93830..235070990 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -152,19 +152,19 @@ class Palette struct ColorElem { - ColorElem() + ColorElem() : + type(0), + color(0), + testColor(0), + committedColor(0), + text(), + ch(0), + grad(STATIC), + committedGrad(STATIC), + gradientIndex(0), + delay(0), + committedDelay(0) { - type = 0; - color = 0; - testColor = 0; - committedColor = 0; - text = ""; - ch = 0; - grad = STATIC; - committedGrad = STATIC; - gradientIndex = 0; - delay = 0; - committedDelay = 0; } int type; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index dfaf4122a..b4d5ec22a 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -86,6 +86,7 @@ std::string tradePartnerName(""); PopupMenu::PopupMenu(): Popup("PopupMenu", "popupmenu.xml"), + mBrowserBox(new BrowserBox), mBeingId(0), mFloorItemId(0), mItem(nullptr), @@ -101,7 +102,6 @@ PopupMenu::PopupMenu(): mX(0), mY(0) { - mBrowserBox = new BrowserBox; mBrowserBox->setPosition(4, 4); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); mBrowserBox->setOpaque(false); @@ -2139,7 +2139,7 @@ void PopupMenu::addPlayerMisc() mBrowserBox->addRow("addcomment", _("Add comment")); } -void PopupMenu::addPickupFilter(const std::string name) +void PopupMenu::addPickupFilter(const std::string &name) { if (actorSpriteManager->isInPickupList(name) || actorSpriteManager->isInIgnorePickupList(name)) diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index b5d0e956c..094d3ae44 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -172,7 +172,7 @@ class PopupMenu : public Popup, public LinkHandler void addPlayerMisc(); - void addPickupFilter(const std::string name); + void addPickupFilter(const std::string &name); BrowserBox* mBrowserBox; diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index c5257b99b..c3368ca8a 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -47,15 +47,14 @@ QuitDialog::QuitDialog(QuitDialog** pointerToMe): Window(_("Quit"), true, nullptr, "quit.xml"), + mLogoutQuit(new RadioButton(_("Quit"), "quitdialog")), + mForceQuit(new RadioButton(_("Quit"), "quitdialog")), + mSwitchAccountServer(new RadioButton(_("Switch server"), "quitdialog")), + mSwitchCharacter(new RadioButton(_("Switch character"), "quitdialog")), + mOkButton(new Button(_("OK"), "ok", this)), + mCancelButton(new Button(_("Cancel"), "cancel", this)), mMyPointer(pointerToMe) { - mForceQuit = new RadioButton(_("Quit"), "quitdialog"); - mLogoutQuit = new RadioButton(_("Quit"), "quitdialog"); - mSwitchAccountServer = new RadioButton(_("Switch server"), "quitdialog"); - mSwitchCharacter = new RadioButton(_("Switch character"), "quitdialog"); - mOkButton = new Button(_("OK"), "ok", this); - mCancelButton = new Button(_("Cancel"), "cancel", this); - addKeyListener(this); ContainerPlacer placer = getPlacer(0, 0); diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 6828158d2..55a4e0e6c 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -64,10 +64,10 @@ #include <guichan/exception.hpp> -SDLInput::SDLInput() +SDLInput::SDLInput() : + mMouseDown(false), + mMouseInWindow(true) { - mMouseInWindow = true; - mMouseDown = false; } bool SDLInput::isKeyQueueEmpty() diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 838e52c84..c2045effa 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -145,13 +145,13 @@ void ServersListModel::setVersionString(int index, const std::string &version) class ServersListBox : public ListBox { public: - ServersListBox(ServersListModel *model): - ListBox(model) + ServersListBox(ServersListModel *model) : + ListBox(model), + mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), + mTextColor(Theme::getThemeColor(Theme::TEXT)), + mNotSupportedColor(Theme::getThemeColor( + Theme::SERVER_VERSION_NOT_SUPPORTED)) { - mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT); - mTextColor = Theme::getThemeColor(Theme::TEXT); - mNotSupportedColor = Theme::getThemeColor( - Theme::SERVER_VERSION_NOT_SUPPORTED); } void draw(gcn::Graphics *graphics) diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index f0e332529..6ba80ea4e 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -420,10 +420,9 @@ public: class SocialPlayersTab : public SocialTab { public: - SocialPlayersTab(std::string name) + SocialPlayersTab(std::string name) : + mBeings(new BeingsListModal()) { - mBeings = new BeingsListModal(); - mList = new AvatarListBox(mBeings); mScroll = new ScrollArea(mList); @@ -586,10 +585,9 @@ private: class SocialNavigationTab : public SocialTab { public: - SocialNavigationTab() + SocialNavigationTab() : + mBeings(new BeingsListModal()) { - mBeings = new BeingsListModal(); - mList = new AvatarListBox(mBeings); mScroll = new ScrollArea(mList); @@ -919,10 +917,9 @@ protected: class SocialAttackTab : public SocialTab { public: - SocialAttackTab() + SocialAttackTab() : + mBeings(new BeingsListModal()) { - mBeings = new BeingsListModal(); - mList = new AvatarListBox(mBeings); mScroll = new ScrollArea(mList); @@ -974,10 +971,9 @@ private: class SocialPickupTab : public SocialTab { public: - SocialPickupTab() + SocialPickupTab() : + mBeings(new BeingsListModal()) { - mBeings = new BeingsListModal(); - mList = new AvatarListBox(mBeings); mScroll = new ScrollArea(mList); @@ -1029,10 +1025,9 @@ private: class SocialFriendsTab : public SocialTab { public: - SocialFriendsTab(std::string name) + SocialFriendsTab(std::string name) : + mBeings(new BeingsListModal()) { - mBeings = new BeingsListModal(); - mList = new AvatarListBox(mBeings); mScroll = new ScrollArea(mList); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index c3025f516..67e2be0c8 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -164,13 +164,41 @@ public: }; -TextCommandEditor::TextCommandEditor(TextCommand *command): - Window(_("Command Editor"), false, nullptr, "commandeditor.xml") +TextCommandEditor::TextCommandEditor(TextCommand *command) : + Window(_("Command Editor"), false, nullptr, "commandeditor.xml"), + mIsMagicCommand(command->getCommandType() == TEXT_COMMAND_MAGIC), + mCommand(command), + mIsMagic(new RadioButton(_("magic"), "magic", mIsMagicCommand)), + mIsOther(new RadioButton(_("other"), "magic", !mIsMagicCommand)), + mSymbolLabel(new Label(_("Symbol:"))), + mSymbolTextField(new TextField()), + mCommandLabel(new Label(_("Command:"))), + mCommandTextField(new TextField()), + mCommentLabel(new Label(_("Comment:"))), + mCommentTextField(new TextField), + mTargetTypeModel(new TargetTypeModel), + mTypeLabel(new Label(_("Target Type:"))), + mTypeDropDown(new DropDown(mTargetTypeModel)), + mIconsModal(new IconsModal), + mIconLabel(new Label(_("Icon:"))), + mIconDropDown(new DropDown(mIconsModal)), + mManaLabel(new Label(_("Mana:"))), + mManaField(new IntTextField(0)), + mMagicLvlLabel(new Label(_("Magic level:"))), + mMagicLvlField(new IntTextField(0)), + mMagicSchoolModel(new MagicSchoolModel), + mSchoolLabel(new Label(_("Magic School:"))), + mSchoolDropDown(new DropDown(mMagicSchoolModel)), + mSchoolLvlLabel(new Label(_("School level:"))), + mSchoolLvlField(new IntTextField(0)), + mCancelButton(new Button(_("Cancel"), "cancel", this)), + mSaveButton(new Button(_("Save"), "save", this)), + mDeleteButton(new Button(_("Delete"), "delete", this)), + mEnabledKeyboard(keyboard.isEnabled()) { int w = 350; int h = 370; - mEnabledKeyboard = keyboard.isEnabled(); keyboard.setEnabled(false); setWindowName("TextCommandEditor"); @@ -178,70 +206,35 @@ TextCommandEditor::TextCommandEditor(TextCommand *command): setDefaultSize(w, h, ImageRect::CENTER); mAdvanced = false; - mCommand = command; - mIsMagicCommand = (command->getCommandType() == TEXT_COMMAND_MAGIC); - - mIsMagic = new RadioButton(_("magic"), "magic", mIsMagicCommand); mIsMagic->setActionEventId("magic"); mIsMagic->addActionListener(this); - mIsOther = new RadioButton(_("other"), "magic", !mIsMagicCommand); mIsOther->setActionEventId("other"); mIsOther->addActionListener(this); - - mSymbolLabel = new Label(_("Symbol:")); - mSymbolTextField = new TextField(); - - mCommandLabel = new Label(_("Command:")); - mCommandTextField = new TextField(); - - mCommentLabel = new Label(_("Comment:")); - mCommentTextField = new TextField(); - - mManaLabel = new Label(_("Mana:")); - mManaField = new IntTextField(0); mManaField->setRange(0, 500); mManaField->setWidth(20); - mTargetTypeModel = new TargetTypeModel; - mTypeLabel = new Label(_("Target Type:")); - mTypeDropDown = new DropDown(mTargetTypeModel); mTypeDropDown->setActionEventId("type"); mTypeDropDown->addActionListener(this); - mIconsModal = new IconsModal; - mIconLabel = new Label(_("Icon:")); - mIconDropDown = new DropDown(mIconsModal); mIconDropDown->setActionEventId("icon"); mIconDropDown->addActionListener(this); mIconDropDown->setSelectedString(mCommand->getIcon()); - mMagicLvlLabel = new Label(_("Magic level:")); - mMagicLvlField = new IntTextField(0); mMagicLvlField->setRange(0, 5); mMagicLvlField->setWidth(20); - mMagicSchoolModel = new MagicSchoolModel; - mSchoolLabel = new Label(_("Magic School:")); - mSchoolDropDown = new DropDown(mMagicSchoolModel); mSchoolDropDown->setActionEventId("school"); mSchoolDropDown->addActionListener(this); mSchoolDropDown->setSelected(0); - mSchoolLvlLabel = new Label(_("School level:")); - mSchoolLvlField = new IntTextField(0); mSchoolLvlField->setRange(0, 5); mSchoolLvlField->setWidth(20); - mSaveButton = new Button(_("Save"), "save", this); mSaveButton->adjustSize(); - - mCancelButton = new Button(_("Cancel"), "cancel", this); mCancelButton->adjustSize(); - - mDeleteButton = new Button(_("Delete"), "delete", this); mDeleteButton->adjustSize(); if (command->getCommandType() == TEXT_COMMAND_MAGIC) diff --git a/src/gui/textcommandeditor.h b/src/gui/textcommandeditor.h index 39952f353..2221a9507 100644 --- a/src/gui/textcommandeditor.h +++ b/src/gui/textcommandeditor.h @@ -72,6 +72,7 @@ class TextCommandEditor : public Window, public gcn::ActionListener void deleteCommand(); + bool mIsMagicCommand; TextCommand *mCommand; bool mAdvanced; @@ -85,29 +86,27 @@ class TextCommandEditor : public Window, public gcn::ActionListener Label *mCommentLabel; TextField *mCommentTextField; + TargetTypeModel *mTargetTypeModel; Label *mTypeLabel; DropDown *mTypeDropDown; + IconsModal *mIconsModal; Label *mIconLabel; DropDown *mIconDropDown; Label *mManaLabel; IntTextField *mManaField; Label *mMagicLvlLabel; IntTextField *mMagicLvlField; + MagicSchoolModel *mMagicSchoolModel; Label *mSchoolLabel; DropDown *mSchoolDropDown; Label *mSchoolLvlLabel; IntTextField *mSchoolLvlField; - IconsModal *mIconsModal; - TargetTypeModel *mTargetTypeModel; - MagicSchoolModel *mMagicSchoolModel; - //Button *mAdvancedButton; Button *mCancelButton; Button *mSaveButton; Button *mDeleteButton; bool mEnabledKeyboard; - bool mIsMagicCommand; }; #endif diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index c46131379..5994b1e1a 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -61,10 +61,9 @@ static const int BOX_HEIGHT = 43; class ItemIdPair { public: - ItemIdPair(int id, Item* item) + ItemIdPair(int id, Item* item) : + mId(id), mItem(item) { - mId = id; - mItem = item; } int mId; @@ -166,18 +165,17 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mDescItems(false), mTag(0), mSortType(0), - mShowMatrix(nullptr) + mItemPopup(new ItemPopup), + mShowMatrix(nullptr), + mEquipedColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED)), + mUnEquipedColor(Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED)) { - mItemPopup = new ItemPopup; setFocusable(true); mSelImg = Theme::getImageFromTheme("selection.png"); if (!mSelImg) logger->log1("Error: Unable to load selection.png"); - mEquipedColor = Theme::getThemeColor(Theme::ITEM_EQUIPPED); - mUnEquipedColor = Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED); - addKeyListener(this); addMouseListener(this); addWidgetListener(this); diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 61d929f0b..98d820164 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -34,9 +34,9 @@ #include "debug.h" -ItemLinkHandler::ItemLinkHandler() +ItemLinkHandler::ItemLinkHandler() : + mItemPopup(new ItemPopup) { - mItemPopup = new ItemPopup; } ItemLinkHandler::~ItemLinkHandler() diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index 13c2668f5..d7ff749d2 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -29,10 +29,10 @@ SetupTabScroll::SetupTabScroll() : SetupTab(), + mContainer(new VertContainer(25, false, 8)), + mScroll(new ScrollArea(mContainer)), mPreferredFirstItemSize(200) { - mContainer = new VertContainer(25, false, 8); - mScroll = new ScrollArea(mContainer); mScroll->setOpaque(false); mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index ab6400149..3031460c4 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -47,29 +47,33 @@ float ShopListBox::mAlpha = 1.0; ShopListBox::ShopListBox(gcn::ListModel *listModel): ListBox(listModel), mPlayerMoney(0), - mShopItems(nullptr) + mShopItems(nullptr), + mItemPopup(new ItemPopup), + mRowHeight(getFont()->getHeight()), + mPriceCheck(true), + mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), + mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)), + mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING)) { - mRowHeight = getFont()->getHeight(); - init(); + setForegroundColor(Theme::getThemeColor(Theme::TEXT)); } ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel): ListBox(listModel), mPlayerMoney(0), - mShopItems(shopListModel) + mShopItems(shopListModel), + mItemPopup(new ItemPopup), + mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)), + mPriceCheck(true), + mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), + mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)), + mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING)) { - mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE); - init(); + setForegroundColor(Theme::getThemeColor(Theme::TEXT)); } void ShopListBox::init() { - mPriceCheck = true; - mItemPopup = new ItemPopup; - mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT); - mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND); - mWarningColor = Theme::getThemeColor(Theme::SHOP_WARNING); - setForegroundColor(Theme::getThemeColor(Theme::TEXT)); } void ShopListBox::setPlayersMoney(int money) diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 694fdb92e..75598aa94 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -94,13 +94,13 @@ class ShopListBox : public ListBox unsigned int mRowHeight; /**< Row Height */ - static float mAlpha; - bool mPriceCheck; gcn::Color mHighlightColor; gcn::Color mBackgroundColor; gcn::Color mWarningColor; + + static float mAlpha; }; #endif // SHOPLISTBOX_H diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index f3ea962bc..36533864e 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -37,16 +37,16 @@ float TextPreview::mAlpha = 1.0; TextPreview::TextPreview(const std::string &text): + mFont(gui->getFont()), mText(text), + mTextColor(&Theme::getThemeColor(Theme::TEXT)), + mBGColor(&Theme::getThemeColor(Theme::BACKGROUND)), + mTextBGColor(nullptr), + mTextAlpha(false), + mOpaque(false), mShadow(false), mOutline(false) { - mTextAlpha = false; - mFont = gui->getFont(); - mTextColor = &Theme::getThemeColor(Theme::TEXT); - mTextBGColor = nullptr; - mBGColor = &Theme::getThemeColor(Theme::BACKGROUND); - mOpaque = false; } void TextPreview::draw(gcn::Graphics* graphics) diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 81e27fd06..06c588215 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -121,11 +121,11 @@ class TextPreview : public gcn::Widget const gcn::Color *mTextColor; const gcn::Color *mBGColor; const gcn::Color *mTextBGColor; - static float mAlpha; bool mTextAlpha; bool mOpaque; bool mShadow; bool mOutline; + static float mAlpha; }; #endif diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index d1b97c82f..16253c26e 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -77,13 +77,13 @@ class WorldListModel : public gcn::ListModel }; WorldSelectDialog::WorldSelectDialog(Worlds worlds): - Window(_("Select World"), false, nullptr, "world.xml") + Window(_("Select World"), false, nullptr, "world.xml"), + mWorldListModel(new WorldListModel(worlds)), + mWorldList(new ListBox(mWorldListModel)), + mChangeLoginButton(new Button(_("Change Login"), "login", this)), + mChooseWorld(new Button(_("Choose World"), "world", this)) { - mWorldListModel = new WorldListModel(worlds); - mWorldList = new ListBox(mWorldListModel); ScrollArea *worldsScroll = new ScrollArea(mWorldList); - mChangeLoginButton = new Button(_("Change Login"), "login", this); - mChooseWorld = new Button(_("Choose World"), "world", this); worldsScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); |