summaryrefslogtreecommitdiff
path: root/src/gui/browserbox.cpp
diff options
context:
space:
mode:
authorDouglas Boffey <DougABoffey@netscape.net>2008-09-04 16:56:10 +0000
committerDouglas Boffey <DougABoffey@netscape.net>2008-09-04 16:56:10 +0000
commit7946cd875877870e7cab002cba099d21cf9fc063 (patch)
tree38dd4c1c4a766edda7b3156e2bc1af08dbd94a6a /src/gui/browserbox.cpp
parent27e8d20ad8b5590995d1d4af3563f8956f180373 (diff)
downloadmana-7946cd875877870e7cab002cba099d21cf9fc063.tar.gz
mana-7946cd875877870e7cab002cba099d21cf9fc063.tar.bz2
mana-7946cd875877870e7cab002cba099d21cf9fc063.tar.xz
mana-7946cd875877870e7cab002cba099d21cf9fc063.zip
Added code to change text colouring
Diffstat (limited to 'src/gui/browserbox.cpp')
-rw-r--r--src/gui/browserbox.cpp72
1 files changed, 21 insertions, 51 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 4f771a7e..b7d08cab 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -29,6 +29,7 @@
#include "browserbox.h"
#include "linkhandler.h"
+#include "colour.h"
#ifdef USE_OPENGL
#include "../configuration.h"
@@ -135,12 +136,12 @@ void BrowserBox::addRow(const std::string &row)
mLinks.push_back(bLink);
- newRow += "##L" + bLink.caption;
+ newRow += "##<" + bLink.caption;
tmp.erase(0, idx3 + 2);
if(tmp != "")
{
- newRow += "##P";
+ newRow += "##>";
}
idx1 = tmp.find("@@");
}
@@ -290,7 +291,8 @@ BrowserBox::draw(gcn::Graphics *graphics)
if ((mHighMode & UNDERLINE))
{
- graphics->setColor(gcn::Color(LINK));
+ bool valid;
+ graphics->setColor(gcn::Color(textColour->getColour('<', valid)));
graphics->drawLine(
mLinks[mSelectedLink].x1,
mLinks[mSelectedLink].y2,
@@ -317,58 +319,26 @@ BrowserBox::draw(gcn::Graphics *graphics)
if ( (mUseLinksAndUserColors && (j + 3) <= row.size()) ||
(!mUseLinksAndUserColors && (j == 0)) )
{
- // Check for color change in format "##x", x = [L,P,0..9]
+ // Check for color change in format "##x"
if ((row.at(j) == '#') && (row.at(j + 1) == '#'))
{
- switch (row.at(j + 2))
+ char c = row.at(j + 2);
+ if (c == '>')
{
- case 'L': // Link color
- prevColor = selColor;
- selColor = LINK;
- break;
- case 'P': // Previous color
- selColor = prevColor;
- break;
- case '1':
- prevColor = selColor;
- selColor = RED;
- break;
- case '2':
- prevColor = selColor;
- selColor = GREEN;
- break;
- case '3':
- prevColor = selColor;
- selColor = BLUE;
- break;
- case '4':
- prevColor = selColor;
- selColor = ORANGE;
- break;
- case '5':
- prevColor = selColor;
- selColor = YELLOW;
- break;
- case '6':
- prevColor = selColor;
- selColor = PINK;
- break;
- case '7':
- prevColor = selColor;
- selColor = PURPLE;
- break;
- case '8':
- prevColor = selColor;
- selColor = GRAY;
- break;
- case '9':
- prevColor = selColor;
- selColor = BROWN;
- break;
- case '0':
- default:
+ selColor = prevColor;
+ }
+ else
+ {
+ bool valid;
+ int rgb = textColour->getColour(c, valid);
+ if (c == '<')
+ {
prevColor = selColor;
- selColor = BLACK;
+ }
+ if (valid)
+ {
+ selColor = rgb;
+ }
}
j += 3;