diff options
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r-- | src/gui/itempopup.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index f2ac374a..66729605 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -1,10 +1,9 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Legend of Mazzeroth. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +32,8 @@ #include "../graphics.h" +#include "../units.h" + #include "../resources/iteminfo.h" #include "../utils/gettext.h" @@ -41,15 +42,13 @@ ItemPopup::ItemPopup(): Popup("ItemPopup") { - mItemType = ""; - // Item Name - mItemName = new gcn::Label(""); + mItemName = new gcn::Label; mItemName->setFont(boldFont); mItemName->setPosition(2, 2); // Item Description - mItemDesc = new TextBox(); + mItemDesc = new TextBox; mItemDesc->setEditable(false); mItemDescScroll = new ScrollArea(mItemDesc); @@ -60,7 +59,7 @@ ItemPopup::ItemPopup(): mItemDescScroll->setPosition(2, getFont()->getHeight()); // Item Effect - mItemEffect = new TextBox(); + mItemEffect = new TextBox; mItemEffect->setEditable(false); mItemEffectScroll = new ScrollArea(mItemEffect); @@ -72,7 +71,7 @@ ItemPopup::ItemPopup(): (2 * getPadding())); // Item Weight - mItemWeight = new TextBox(); + mItemWeight = new TextBox; mItemWeight->setEditable(false); mItemWeightScroll = new ScrollArea(mItemWeight); @@ -111,9 +110,11 @@ void ItemPopup::setItem(const ItemInfo &item) mItemName->setWidth(boldFont->getWidth(item.getName())); mItemDesc->setTextWrapped(item.getDescription(), 196); mItemEffect->setTextWrapped(item.getEffect(), 196); - mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) + - _(" grams"), 196); + mItemWeight->setTextWrapped(_("Weight: ") + + Units::formatWeight(item.getWeight()), 196); +#ifdef EATHENA_SUPPORT mItemType = item.getType(); +#endif int minWidth = mItemName->getWidth(); @@ -161,11 +162,13 @@ void ItemPopup::setItem(const ItemInfo &item) void ItemPopup::updateColors() { +#ifdef EATHENA_SUPPORT mItemName->setForegroundColor(getColor(mItemType)); +#endif graphics->setColor(guiPalette->getColor(Palette::TEXT)); } -gcn::Color ItemPopup::getColor(const std::string& type) +gcn::Color ItemPopup::getColor(const std::string &type) { gcn::Color color; @@ -213,9 +216,9 @@ unsigned int ItemPopup::getNumRows() void ItemPopup::view(int x, int y) { if (graphics->getWidth() < (x + getWidth() + 5)) - x = graphics->getWidth() - getWidth(); + x = graphics->getWidth() - getWidth(); if ((y - getHeight() - 10) < 0) - y = 0; + y = 0; else y = y - getHeight() - 10; setPosition(x, y); |