summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-19 17:31:47 -0600
committerIra Rice <irarice@gmail.com>2009-03-19 17:31:47 -0600
commita7a8ec7961fd7b1c8f83b92905f85c5a6e0358c0 (patch)
treeaf896d4eb3f6e48b8bf2c2a4a597331b5fc31cd0 /src
parent0221ab5dc5236e9e35fe6c832a52020551dafa85 (diff)
downloadmana-a7a8ec7961fd7b1c8f83b92905f85c5a6e0358c0.tar.gz
mana-a7a8ec7961fd7b1c8f83b92905f85c5a6e0358c0.tar.bz2
mana-a7a8ec7961fd7b1c8f83b92905f85c5a6e0358c0.tar.xz
mana-a7a8ec7961fd7b1c8f83b92905f85c5a6e0358c0.zip
Some minor cleanups in a few windows and build scripts, as well as
fixing tables to correct the highlights to draw where they're supposed to, as well as at the opacity they're supposed to. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/gui/color.cpp146
-rw-r--r--src/gui/color.h136
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/speechbubble.cpp2
-rw-r--r--src/gui/table.cpp25
6 files changed, 16 insertions, 303 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 93bac9ae..0176e617 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -61,10 +61,10 @@ SET(SRCS
gui/widgets/tab.h
gui/widgets/tabbedarea.cpp
gui/widgets/tabbedarea.h
+ gui/widgets/textpreview.cpp
+ gui/widgets/textpreview.h
gui/browserbox.cpp
gui/browserbox.h
- gui/buddywindow.cpp
- gui/buddywindow.h
gui/button.cpp
gui/button.h
gui/buy.cpp
@@ -114,7 +114,7 @@ SET(SRCS
gui/itempopup.cpp
gui/itempopup.h
gui/itemshortcutcontainer.cpp
- gui/itemshortcutcontainer.h\
+ gui/itemshortcutcontainer.h
gui/item_amount.cpp
gui/item_amount.h
gui/label.cpp
@@ -207,8 +207,6 @@ SET(SRCS
gui/textbox.h
gui/textfield.cpp
gui/textfield.h
- gui/textpreview.cpp
- gui/textpreview.h
gui/textrenderer.h
gui/trade.cpp
gui/trade.h
diff --git a/src/gui/color.cpp b/src/gui/color.cpp
deleted file mode 100644
index b68bf68b..00000000
--- a/src/gui/color.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Configurable text colors
- * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
- *
- * This file is part of Aethyra.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "color.h"
-
-#include "../configuration.h"
-
-#include "../utils/gettext.h"
-#include "../utils/stringutils.h"
-
-Color::Color()
-{
- addColor('C', 0x000000, _("Chat"));
- addColor('G', 0xff0000, _("GM"));
- addColor('H', 0xebc873, _("Highlight"));
- addColor('Y', 0x1fa052, _("Player"));
- addColor('W', 0x0000ff, _("Whisper"));
- addColor('I', 0xa08527, _("Is"));
- addColor('P', 0xff00d8, _("Party"));
- addColor('S', 0x8415e2, _("Server"));
- addColor('L', 0x919191, _("Logger"));
- addColor('<', 0xe50d0d, _("Hyperlink"));
- commit();
-}
-
-Color::~Color()
-{
- for (ColVector::iterator col = mColVector.begin(),
- colEnd = mColVector.end();
- col != colEnd;
- ++col)
- {
- config.setValue("Color" + col->text, toString(col->rgb));
- }
-}
-
-void Color::setColor(const char c, const int rgb)
-{
- for (ColVector::iterator col = mColVector.begin(),
- colEnd = mColVector.end();
- col != colEnd;
- ++col)
- {
- if (col->ch == c)
- {
- col->rgb = rgb;
- return;
- }
- }
-}
-
-int Color::getColor(const char c, bool &valid) const
-{
- for (ColVector::const_iterator col = mColVector.begin(),
- colEnd = mColVector.end();
- col != colEnd;
- ++col)
- {
- if (col->ch == c)
- {
- valid = true;
- return col->rgb;
- }
- }
- valid = false;
- return 0x000000;
-}
-
-std::string Color::getElementAt(int i)
-{
- if (i < 0 || i >= getNumberOfElements())
- {
- return "";
- }
- return mColVector[i].text;
-}
-
-char Color::getColorCharAt(int i)
-{
- if (i < 0 || i >= getNumberOfElements())
- {
- return 'C';
- }
- return mColVector[i].ch;
-}
-
-void Color::addColor(const char c, const int rgb, const std::string &text)
-{
- int trueRgb = (int) config.getValue("Color" + text, rgb);
- mColVector.push_back(ColorElem(c, trueRgb, text));
-}
-
-int Color::getColorAt(int i)
-{
- if (i < 0 || i >= getNumberOfElements())
- {
- return 0;
- }
- return mColVector[i].rgb;
-}
-
-void Color::setColorAt(int i, int rgb)
-{
- if (i >= 0 && i < getNumberOfElements())
- {
- mColVector[i].rgb = rgb;
- }
-}
-
-void Color::commit()
-{
- for (ColVector::iterator i = mColVector.begin(), iEnd = mColVector.end();
- i != iEnd;
- ++i)
- {
- i->committedRgb = i->rgb;
- }
-}
-
-void Color::rollback()
-{
- for (ColVector::iterator i = mColVector.begin(), iEnd = mColVector.end();
- i != iEnd;
- ++i)
- {
- i->rgb = i->committedRgb;
- }
-}
diff --git a/src/gui/color.h b/src/gui/color.h
deleted file mode 100644
index aca3d045..00000000
--- a/src/gui/color.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Configurable text colors
- * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
- *
- * This file is part of Aethyra.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef COLOR_H
-#define COLOR_H
-
-#include <string>
-#include <vector>
-
-#include <guichan/listmodel.hpp>
-
-class Color : public gcn::ListModel
-{
- public:
- /**
- * Constructor
- */
- Color();
-
- /**
- * Destructor
- */
- ~Color();
-
- /**
- * Define the color replacement for a character
- *
- * @param c charater to be replaced
- * @param rgb color to replace character
- */
- void setColor(const char c, const int rgb);
-
- /**
- * Define the color replacement for a character
- *
- * @param c character to be replaced
- * @param r red component
- * @param g green component
- * @param b blue component
- */
- void setColor(const char c, const int r, const int g, const int b)
- {
- setColor(c, (r << 16) | (g << 8) | b);
- }
-
- /**
- * Return the color associated with a character, if exists
- *
- * @param c character requested
- * @param valid indicate whether character is known
- */
- int getColor(const char c, bool &valid) const;
-
- /**
- * Return the number of colors known
- */
- int getNumberOfElements() {return mColVector.size(); }
-
- /**
- * Return the name of the ith color
- *
- * @param i index of color interested in
- */
- std::string getElementAt(int i);
-
- /**
- * Get the color for the element at index i in the current color
- * model
- */
- int getColorAt(int i);
-
- /**
- * Get the character used by the color for the element at index i in
- * the current color model
- */
- char getColorCharAt(int i);
-
- /**
- * Set the color for the element at index i
- */
- void setColorAt(int i, int rgb);
-
- /**
- * Commit the colors
- */
- void commit();
-
- /**
- * Rollback the colors
- */
- void rollback();
-
- private:
- struct ColorElem
- {
- ColorElem(const char c, const int rgb, const std::string &text) :
- ch(c), rgb(rgb), text(text) {}
- char ch;
- int rgb;
- int committedRgb;
- std::string text;
- };
- typedef std::vector<ColorElem> ColVector;
- ColVector mColVector;
-
- /**
- * Initialise color
- *
- * @param c character that needs initialising
- * @param rgb default color if not found in config
- * @param text identifier of color
- */
- void addColor(const char c, const int rgb, const std::string &text);
-};
-
-extern Color *textColor;
-
-#endif
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index c76c3750..a4042ae2 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -85,8 +85,6 @@ ItemPopup::ItemPopup():
add(mItemDescScroll);
add(mItemEffectScroll);
add(mItemWeightScroll);
-
- setLocationRelativeTo(getParent());
}
ItemPopup::~ItemPopup()
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 811fddfa..9e4c9234 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -60,8 +60,6 @@ SpeechBubble::SpeechBubble():
add(mCaption);
add(mSpeechArea);
-
- setLocationRelativeTo(getParent());
}
void SpeechBubble::setCaption(const std::string &name, const gcn::Color *color)
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index fa801865..17d8bfbf 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -320,29 +320,30 @@ void GuiTable::draw(gcn::Graphics* graphics)
widget->setDimension(bounds);
- if (!mLinewiseMode && c == mSelectedColumn && r == mSelectedRow)
+ graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
+ (int)(mAlpha * 255.0f)));
+
+ if (mLinewiseMode && r == mSelectedRow && c == 0)
+ {
+ graphics->fillRectangle(gcn::Rectangle(0, y_offset,
+ getWidth(), height));
+ }
+ else if (!mLinewiseMode &&
+ c == mSelectedColumn && r == mSelectedRow)
{
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
- (int)(mAlpha * 127.0f)));
- graphics->fillRectangle(bounds);
+ graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset,
+ width, height));
}
graphics->pushClipArea(bounds);
widget->draw(graphics);
graphics->popClipArea();
+
}
x_offset += width;
}
- if (mLinewiseMode && r == mSelectedRow)
- {
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
- (int)(mAlpha * 127.0f)));
- graphics->fillRectangle(gcn::Rectangle(0, y_offset,
- x_offset, height));
- }
-
y_offset += height;
}