diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-03 12:13:16 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-03 12:13:16 -0700 |
commit | 269e05e71f09cac3d181f2042cde01e5541658f3 (patch) | |
tree | c8c65fac80dd78f8ec1bf6fb5c59eef9479bb1be | |
parent | 0cf29b14232b08c7db9259bce26e96b59dac750c (diff) | |
download | mana-269e05e71f09cac3d181f2042cde01e5541658f3.tar.gz mana-269e05e71f09cac3d181f2042cde01e5541658f3.tar.bz2 mana-269e05e71f09cac3d181f2042cde01e5541658f3.tar.xz mana-269e05e71f09cac3d181f2042cde01e5541658f3.zip |
Made highlights configurable through the color dialog.
Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r-- | src/gui/browserbox.cpp | 17 | ||||
-rw-r--r-- | src/gui/colour.cpp | 1 | ||||
-rw-r--r-- | src/gui/listbox.cpp | 7 | ||||
-rw-r--r-- | src/gui/shoplistbox.cpp | 7 |
4 files changed, 27 insertions, 5 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 6fd0482a..cd5479c8 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -122,7 +122,18 @@ void BrowserBox::addRow(const std::string &row) //discard older rows when a row limit has been set if (mMaxRows > 0) { - while (mTextRows.size() > mMaxRows) mTextRows.pop_front(); + while (mTextRows.size() > mMaxRows) + { + mTextRows.pop_front(); + for (unsigned int i = 0; i < mLinks.size(); i++) + { + mLinks[i].y1 -= font->getHeight(); + mLinks[i].y2 -= font->getHeight(); + + if (mLinks[i].y1 < 0) + mLinks.erase(mLinks.begin() + i); + } + } } // Auto size mode @@ -238,9 +249,10 @@ void BrowserBox::draw(gcn::Graphics *graphics) if (mSelectedLink >= 0) { + bool valid; if ((mHighMode & BACKGROUND)) { - graphics->setColor(gcn::Color(HIGHLIGHT)); + graphics->setColor(gcn::Color(textColour->getColour('H', valid))); graphics->fillRectangle(gcn::Rectangle( mLinks[mSelectedLink].x1, mLinks[mSelectedLink].y1, @@ -251,7 +263,6 @@ void BrowserBox::draw(gcn::Graphics *graphics) if ((mHighMode & UNDERLINE)) { - bool valid; graphics->setColor(gcn::Color(textColour->getColour('<', valid))); graphics->drawLine( mLinks[mSelectedLink].x1, diff --git a/src/gui/colour.cpp b/src/gui/colour.cpp index e6ceeaca..075e9861 100644 --- a/src/gui/colour.cpp +++ b/src/gui/colour.cpp @@ -32,6 +32,7 @@ Colour::Colour() { addColour('C', 0x000000, _("Chat")); addColour('G', 0xff0000, _("GM")); + addColour('H', 0xebc873, _("Highlight")); addColour('Y', 0x1fa052, _("Player")); addColour('W', 0x0000ff, _("Whisper")); addColour('I', 0xf1dc27, _("Is")); diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 1de57593..643d234e 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -24,6 +24,7 @@ #include <guichan/listmodel.hpp> #include <guichan/mouseinput.hpp> +#include "colour.h" #include "listbox.h" #include "../configuration.h" @@ -43,9 +44,13 @@ void ListBox::draw(gcn::Graphics *graphics) if (config.getValue("guialpha", 0.8) != mAlpha) mAlpha = config.getValue("guialpha", 0.8); + bool valid; + const int red = (textColour->getColour('H', valid) >> 16) & 0xFF; + const int green = (textColour->getColour('H', valid) >> 8) & 0xFF; + const int blue = textColour->getColour('H', valid) & 0xFF; const int alpha = mAlpha * 255; - graphics->setColor(gcn::Color(235, 200, 115, alpha)); + graphics->setColor(gcn::Color(red, green, blue, alpha)); graphics->setFont(getFont()); const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 9db33ac6..3d17fd55 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -26,6 +26,7 @@ #include <guichan/listmodel.hpp> #include <guichan/mouseinput.hpp> +#include "colour.h" #include "shoplistbox.h" #include "../configuration.h" @@ -65,6 +66,10 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) if (config.getValue("guialpha", 0.8) != mAlpha) mAlpha = config.getValue("guialpha", 0.8); + bool valid; + const int red = (textColour->getColour('H', valid) >> 16) & 0xFF; + const int green = (textColour->getColour('H', valid) >> 8) & 0xFF; + const int blue = textColour->getColour('H', valid) & 0xFF; const int alpha = mAlpha * 255; Graphics *graphics = static_cast<Graphics*>(gcnGraphics); @@ -80,7 +85,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) if (i == mSelected) { - backgroundColor = gcn::Color(235, 200, 115, alpha); + backgroundColor = gcn::Color(red, green, blue, alpha); } else if (mShopItems && mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck) |