diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/browserbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/color.cpp (renamed from src/gui/colour.cpp) | 50 | ||||
-rw-r--r-- | src/gui/color.h (renamed from src/gui/colour.h) | 62 | ||||
-rw-r--r-- | src/gui/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/listbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/setup.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_colors.cpp (renamed from src/gui/setup_colours.cpp) | 56 | ||||
-rw-r--r-- | src/gui/setup_colors.h (renamed from src/gui/setup_colours.h) | 10 | ||||
-rw-r--r-- | src/gui/shoplistbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/table.cpp | 30 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 6 |
11 files changed, 122 insertions, 122 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 65659df6..4c4af2a4 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -24,7 +24,7 @@ #include <guichan/graphics.hpp> #include "browserbox.h" -#include "colour.h" +#include "color.h" #include "linkhandler.h" #include "truetypefont.h" @@ -254,7 +254,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) bool valid; if ((mHighMode & BACKGROUND)) { - graphics->setColor(gcn::Color(textColour->getColour('H', valid))); + graphics->setColor(gcn::Color(textcolor->getcolor('H', valid))); graphics->fillRectangle(gcn::Rectangle( mLinks[mSelectedLink].x1, mLinks[mSelectedLink].y1, @@ -265,7 +265,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) if ((mHighMode & UNDERLINE)) { - graphics->setColor(gcn::Color(textColour->getColour('<', valid))); + graphics->setColor(gcn::Color(textcolor->getcolor('<', valid))); graphics->drawLine( mLinks[mSelectedLink].x1, mLinks[mSelectedLink].y2, @@ -331,7 +331,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) else { bool valid; - int rgb = textColour->getColour(c, valid); + int rgb = textcolor->getcolor(c, valid); if (c == '<') { const int size = mLinks[link].x2 - mLinks[link].x1; diff --git a/src/gui/colour.cpp b/src/gui/color.cpp index cdb5a3fd..ebbfc638 100644 --- a/src/gui/colour.cpp +++ b/src/gui/color.cpp @@ -19,40 +19,40 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "colour.h" +#include "color.h" #include "../configuration.h" #include "../utils/gettext.h" #include "../utils/tostring.h" -Colour::Colour() +color::color() { - addColour('C', 0x000000, _("Chat")); - addColour('G', 0xff0000, _("GM")); - addColour('H', 0xebc873, _("Highlight")); - addColour('Y', 0x1fa052, _("Player")); - addColour('W', 0x0000ff, _("Whisper")); - addColour('I', 0xf1dc27, _("Is")); - addColour('P', 0xff00d8, _("Party")); - addColour('S', 0x8415e2, _("Server")); - addColour('L', 0x919191, _("Logger")); - addColour('<', 0xe50d0d, _("Hyperlink")); + addcolor('C', 0x000000, _("Chat")); + addcolor('G', 0xff0000, _("GM")); + addcolor('H', 0xebc873, _("Highlight")); + addcolor('Y', 0x1fa052, _("Player")); + addcolor('W', 0x0000ff, _("Whisper")); + addcolor('I', 0xf1dc27, _("Is")); + addcolor('P', 0xff00d8, _("Party")); + addcolor('S', 0x8415e2, _("Server")); + addcolor('L', 0x919191, _("Logger")); + addcolor('<', 0xe50d0d, _("Hyperlink")); commit(); } -Colour::~Colour() +color::~color() { for (ColVector::iterator col = mColVector.begin(), colEnd = mColVector.end(); col != colEnd; ++col) { - config.setValue("Colour" + col->text, toString(col->rgb)); + config.setValue("color" + col->text, toString(col->rgb)); } } -void Colour::setColour(const char c, const int rgb) +void color::setcolor(const char c, const int rgb) { for (ColVector::iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -67,7 +67,7 @@ void Colour::setColour(const char c, const int rgb) } } -int Colour::getColour(const char c, bool &valid) const +int color::getcolor(const char c, bool &valid) const { for (ColVector::const_iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -84,7 +84,7 @@ int Colour::getColour(const char c, bool &valid) const return 0x000000; } -std::string Colour::getElementAt(int i) +std::string color::getElementAt(int i) { if (i < 0 || i >= getNumberOfElements()) { @@ -93,7 +93,7 @@ std::string Colour::getElementAt(int i) return mColVector[i].text; } -char Colour::getColourCharAt(int i) +char color::getcolorCharAt(int i) { if (i < 0 || i >= getNumberOfElements()) { @@ -102,13 +102,13 @@ char Colour::getColourCharAt(int i) return mColVector[i].ch; } -void Colour::addColour(const char c, const int rgb, const std::string &text) +void color::addcolor(const char c, const int rgb, const std::string &text) { - int trueRgb = config.getValue("Colour" + text, rgb); - mColVector.push_back(ColourElem(c, trueRgb, text)); + int trueRgb = config.getValue("color" + text, rgb); + mColVector.push_back(colorElem(c, trueRgb, text)); } -int Colour::getColourAt(int i) +int color::getcolorAt(int i) { if (i < 0 || i >= getNumberOfElements()) { @@ -117,7 +117,7 @@ int Colour::getColourAt(int i) return mColVector[i].rgb; } -void Colour::setColourAt(int i, int rgb) +void color::setcolorAt(int i, int rgb) { if (i >= 0 && i < getNumberOfElements()) { @@ -125,7 +125,7 @@ void Colour::setColourAt(int i, int rgb) } } -void Colour::commit() +void color::commit() { for (ColVector::iterator i = mColVector.begin(), iEnd = mColVector.end(); i != iEnd; @@ -135,7 +135,7 @@ void Colour::commit() } } -void Colour::rollback() +void color::rollback() { for (ColVector::iterator i = mColVector.begin(), iEnd = mColVector.end(); i != iEnd; diff --git a/src/gui/colour.h b/src/gui/color.h index 6ea02840..2539c085 100644 --- a/src/gui/colour.h +++ b/src/gui/color.h @@ -27,110 +27,110 @@ #include <guichan/listmodel.hpp> -class Colour : public gcn::ListModel +class color : public gcn::ListModel { public: /** * Constructor */ - Colour(); + color(); /** * Destructor */ - ~Colour(); + ~color(); /** - * Define the colour replacement for a character + * Define the color replacement for a character * * @param c charater to be replaced - * @param rgb colour to replace character + * @param rgb color to replace character */ - void setColour(const char c, const int rgb); + void setcolor(const char c, const int rgb); /** - * Define the colour replacement for a character + * 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 setColour(const char c, const int r, const int g, const int b) + void setcolor(const char c, const int r, const int g, const int b) { - setColour(c, (r << 16) | (g << 8) | b); + setcolor(c, (r << 16) | (g << 8) | b); } /** - * Return the colour associated with a character, if exists + * Return the color associated with a character, if exists * * @param c character requested * @param valid indicate whether character is known */ - int getColour(const char c, bool &valid) const; + int getcolor(const char c, bool &valid) const; /** - * Return the number of colours known + * Return the number of colors known */ int getNumberOfElements() {return mColVector.size(); } /** - * Return the name of the ith colour + * Return the name of the ith color * - * @param i index of colour interested in + * @param i index of color interested in */ std::string getElementAt(int i); /** - * Get the colour for the element at index i in the current colour + * Get the color for the element at index i in the current color * model */ - int getColourAt(int i); + int getcolorAt(int i); /** - * Get the character used by the colour for the element at index i in - * the current colour model + * Get the character used by the color for the element at index i in + * the current color model */ - char getColourCharAt(int i); + char getcolorCharAt(int i); /** - * Set the colour for the element at index i + * Set the color for the element at index i */ - void setColourAt(int i, int rgb); + void setcolorAt(int i, int rgb); /** - * Commit the colours + * Commit the colors */ void commit(); /** - * Rollback the colours + * Rollback the colors */ void rollback(); private: - struct ColourElem + struct colorElem { - ColourElem(const char c, const int rgb, const std::string &text) : + 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<ColourElem> ColVector; + typedef std::vector<colorElem> ColVector; ColVector mColVector; /** - * Initialise colour + * Initialise color * * @param c character that needs initialising - * @param rgb default colour if not found in config - * @param text identifier of colour + * @param rgb default color if not found in config + * @param text identifier of color */ - void addColour(const char c, const int rgb, const std::string &text); + void addcolor(const char c, const int rgb, const std::string &text); }; -extern Colour *textColour; +extern color *textcolor; #endif diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 7779a503..87304bd1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -134,7 +134,7 @@ Gui::Gui(Graphics *graphics): gcn::Widget::setGlobalFont(mGuiFont); - // Load hits' colourful fonts + // Load hits' colorful fonts try { hitRedFont = new gcn::ImageFont("graphics/gui/hits_red.png", diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index b63d6424..118dbac1 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -23,7 +23,7 @@ #include <guichan/graphics.hpp> #include <guichan/listmodel.hpp> -#include "colour.h" +#include "color.h" #include "listbox.h" #include "../configuration.h" @@ -44,9 +44,9 @@ void ListBox::draw(gcn::Graphics *graphics) 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 red = (textcolor->getcolor('H', valid) >> 16) & 0xFF; + const int green = (textcolor->getcolor('H', valid) >> 8) & 0xFF; + const int blue = textcolor->getcolor('H', valid) & 0xFF; const int alpha = mAlpha * 255; graphics->setColor(gcn::Color(red, green, blue, alpha)); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 19575cfb..fa4e1a0a 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -22,7 +22,7 @@ #include "button.h" #include "setup.h" #include "setup_audio.h" -#include "setup_colours.h" +#include "setup_colors.h" #include "setup_joystick.h" #include "setup_keyboard.h" #include "setup_players.h" @@ -90,7 +90,7 @@ Setup::Setup(): panel->addTab(_("Keyboard"), tab); mTabs.push_back(tab); - tab = new Setup_Colours(); + tab = new Setup_colors(); panel->addTab(_("Colors"), tab); mTabs.push_back(tab); diff --git a/src/gui/setup_colours.cpp b/src/gui/setup_colors.cpp index f986fded..6b06b3f1 100644 --- a/src/gui/setup_colours.cpp +++ b/src/gui/setup_colors.cpp @@ -27,11 +27,11 @@ #include <guichan/widgets/slider.hpp> #include "browserbox.h" -#include "colour.h" +#include "color.h" #include "itemlinkhandler.h" #include "listbox.h" #include "scrollarea.h" -#include "setup_colours.h" +#include "setup_colors.h" #include "slider.h" #include "textfield.h" @@ -42,16 +42,16 @@ #include "../utils/gettext.h" #include "../utils/tostring.h" -Setup_Colours::Setup_Colours() : +Setup_colors::Setup_colors() : mSelected(-1) { setOpaque(false); - mColourBox = new ListBox(textColour); - mColourBox->setActionEventId("colour_box"); - mColourBox->addActionListener(this); + mcolorBox = new ListBox(textcolor); + mcolorBox->setActionEventId("color_box"); + mcolorBox->addActionListener(this); - mScroll = new ScrollArea(mColourBox); + mScroll = new ScrollArea(mcolorBox); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mPreview = new BrowserBox(BrowserBox::AUTO_WRAP); @@ -129,7 +129,7 @@ Setup_Colours::Setup_Colours() : setDimension(gcn::Rectangle(0, 0, 290, 250)); } -Setup_Colours::~Setup_Colours() +Setup_colors::~Setup_colors() { delete mRedLabel; delete mRedSlider; @@ -146,13 +146,13 @@ Setup_Colours::~Setup_Colours() delete mScroll; } -void Setup_Colours::action(const gcn::ActionEvent &event) +void Setup_colors::action(const gcn::ActionEvent &event) { - if (event.getId() == "colour_box") + if (event.getId() == "color_box") { - mSelected = mColourBox->getSelected(); - int col = textColour->getColourAt(mSelected); - char ch = textColour->getColourCharAt(mSelected); + mSelected = mcolorBox->getSelected(); + int col = textcolor->getcolorAt(mSelected); + char ch = textcolor->getcolorCharAt(mSelected); std::string msg; if (ch == '<') @@ -173,26 +173,26 @@ void Setup_Colours::action(const gcn::ActionEvent &event) if (event.getId() == "slider_red") { mRedText->setText(toString(std::floor(mRedSlider->getValue()))); - updateColour(); + updatecolor(); return; } if (event.getId() == "slider_green") { mGreenText->setText(toString(std::floor(mGreenSlider->getValue()))); - updateColour(); + updatecolor(); return; } if (event.getId() == "slider_blue") { mBlueText->setText(toString(std::floor(mBlueSlider->getValue()))); - updateColour(); + updatecolor(); return; } } -void Setup_Colours::setEntry(gcn::Slider *s, TextField *t, int value) +void Setup_colors::setEntry(gcn::Slider *s, TextField *t, int value) { s->setValue(value); char buffer[100]; @@ -200,43 +200,43 @@ void Setup_Colours::setEntry(gcn::Slider *s, TextField *t, int value) t->setText(buffer); } -void Setup_Colours::apply() +void Setup_colors::apply() { - textColour->commit(); + textcolor->commit(); } -void Setup_Colours::cancel() +void Setup_colors::cancel() { - textColour->rollback(); - int col = textColour->getColourAt(mSelected); + textcolor->rollback(); + int col = textcolor->getcolorAt(mSelected); setEntry(mRedSlider, mRedText, col >> 16); setEntry(mGreenSlider, mGreenText, (col >> 8) & 0xff); setEntry(mBlueSlider, mBlueText, col & 0xff); } -void Setup_Colours::listen(const TextField *tf) +void Setup_colors::listen(const TextField *tf) { if (tf == mRedText) { mRedSlider->setValue(tf->getValue()); - updateColour(); + updatecolor(); return; } if (tf == mGreenText) { mGreenSlider->setValue(tf->getValue()); - updateColour(); + updatecolor(); return; } if (tf == mBlueText) { mBlueSlider->setValue(tf->getValue()); - updateColour(); + updatecolor(); return; } } -void Setup_Colours::updateColour() +void Setup_colors::updatecolor() { if (mSelected == -1) { @@ -245,5 +245,5 @@ void Setup_Colours::updateColour() int rgb = static_cast<int>(mRedSlider->getValue()) << 16 | static_cast<int>(mGreenSlider->getValue()) << 8 | static_cast<int>(mBlueSlider->getValue()); - textColour->setColourAt(mSelected, rgb); + textcolor->setcolorAt(mSelected, rgb); } diff --git a/src/gui/setup_colours.h b/src/gui/setup_colors.h index 57d9e304..7a224249 100644 --- a/src/gui/setup_colours.h +++ b/src/gui/setup_colors.h @@ -36,19 +36,19 @@ class BrowserBox; -class Setup_Colours : public SetupTab, public gcn::ActionListener, +class Setup_colors : public SetupTab, public gcn::ActionListener, public TextFieldListener { public: - Setup_Colours(); - ~Setup_Colours(); + Setup_colors(); + ~Setup_colors(); void apply(); void cancel(); void action(const gcn::ActionEvent &event); void listen(const TextField *tf); private: - gcn::ListBox *mColourBox; + gcn::ListBox *mcolorBox; gcn::ScrollArea *mScroll; BrowserBox *mPreview; gcn::ScrollArea *mPreviewBox; @@ -70,6 +70,6 @@ class Setup_Colours : public SetupTab, public gcn::ActionListener, int mBlueValue; void setEntry(gcn::Slider *s, TextField *t, int value); - void updateColour(); + void updatecolor(); }; #endif diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index b5761535..66c12fc6 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -22,7 +22,7 @@ #include <guichan/font.hpp> #include <guichan/listmodel.hpp> -#include "colour.h" +#include "color.h" #include "shop.h" #include "shoplistbox.h" @@ -64,9 +64,9 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) 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 red = (textcolor->getcolor('H', valid) >> 16) & 0xFF; + const int green = (textcolor->getcolor('H', valid) >> 8) & 0xFF; + const int blue = textcolor->getcolor('H', valid) & 0xFF; const int alpha = mAlpha * 255; Graphics *graphics = static_cast<Graphics*>(gcnGraphics); diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 19039b2d..3bb6b6f3 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -23,7 +23,7 @@ #include <guichan/graphics.hpp> #include <guichan/key.hpp> -#include "colour.h" +#include "color.h" #include "table.h" #include "../configuration.h" @@ -199,7 +199,7 @@ void GuiTable::setSelectedRow(int selected) { mSelectedRow = 0; } - else if ((selected >= mModel->getRows() && !mWrappingEnabled) || + else if ((selected >= mModel->getRows() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedRow = mModel->getRows() - 1; @@ -224,7 +224,7 @@ void GuiTable::setSelectedColumn(int selected) { mSelectedColumn = 0; } - else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || + else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedColumn = mModel->getColumns() - 1; @@ -324,11 +324,11 @@ void GuiTable::draw(gcn::Graphics* graphics) if (!mLinewiseMode && c == mSelectedColumn && r == mSelectedRow) { bool valid; - const int red = - (textColour->getColour('H', valid) >> 16) & 0xFF; + const int red = + (textcolor->getcolor('H', valid) >> 16) & 0xFF; const int green = - (textColour->getColour('H', valid) >> 8) & 0xFF; - const int blue = textColour->getColour('H', valid) & 0xFF; + (textcolor->getcolor('H', valid) >> 8) & 0xFF; + const int blue = textcolor->getcolor('H', valid) & 0xFF; const int alpha = mAlpha * 127; graphics->setColor(gcn::Color(red, green, blue, alpha)); @@ -346,11 +346,11 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mLinewiseMode && r == mSelectedRow) { bool valid; - const int red = - (textColour->getColour('H', valid) >> 16) & 0xFF; + const int red = + (textcolor->getcolor('H', valid) >> 16) & 0xFF; const int green = - (textColour->getColour('H', valid) >> 8) & 0xFF; - const int blue = textColour->getColour('H', valid) & 0xFF; + (textcolor->getcolor('H', valid) >> 8) & 0xFF; + const int blue = textcolor->getcolor('H', valid) & 0xFF; const int alpha = mAlpha * 127; graphics->setColor(gcn::Color(red, green, blue, alpha)); @@ -401,25 +401,25 @@ void GuiTable::keyPressed(gcn::KeyEvent& keyEvent) else if (key.getValue() == gcn::Key::UP) { setSelectedRow(mSelectedRow - 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::DOWN) { setSelectedRow(mSelectedRow + 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::LEFT) { setSelectedColumn(mSelectedColumn - 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::RIGHT) { setSelectedColumn(mSelectedColumn + 1); - + keyEvent.consume(); } else if (key.getValue() == gcn::Key::HOME) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 31d35cb0..ab10590a 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -23,7 +23,7 @@ #include "dropdown.h" -#include "../colour.h" +#include "../color.h" #include "../listbox.h" #include "../scrollarea.h" @@ -40,7 +40,7 @@ Image *DropDown::buttons[2][2]; ImageRect DropDown::skin; float DropDown::mAlpha = config.getValue("guialpha", 0.8); -DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea, +DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea, gcn::ListBox *listBox, bool opacity): gcn::DropDown::DropDown(listModel, scrollArea, listBox), mOpaque(opacity) @@ -138,7 +138,7 @@ void DropDown::draw(gcn::Graphics* graphics) const int alpha = mAlpha * 255; gcn::Color faceColor = getBaseColor(); faceColor.a = alpha; - gcn::Color highlightColor = textColour->getColour('H', valid); + gcn::Color highlightColor = textcolor->getcolor('H', valid); highlightColor.a = alpha; gcn::Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; |