diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | src/gui/chat.cpp | 9 | ||||
-rw-r--r-- | src/gui/setup.cpp | 14 | ||||
-rw-r--r-- | src/gui/setup_audio.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_joystick.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_keyboard.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 1 | ||||
-rw-r--r-- | src/gui/skill.cpp | 13 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.cpp | 126 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.h | 67 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 1 | ||||
-rw-r--r-- | tmw.cbp | 7 |
13 files changed, 42 insertions, 213 deletions
@@ -1,3 +1,14 @@ +2008-05-09 David Athay <ko2fan@gmail.com> + + * src/gui/setup_keyboard.cpp, src/gui/setup.cpp, + src/gui/widgets/tabbedarea.h, src/gui/widgets/tabbedarea.cpp, + src/gui/chat.cpp, src/gui/tabbedcontainer.cpp, src/gui/skill.cpp, + src/gui/setup_audio.cpp, src/gui/setup_video.cpp, + src/gui/setup_joystick.cpp, src/gui/tabbedcontainer.h, tmw.cbp: + Changed the tabbedarea to be transparant as before. Changed setup + window and skills dialog to use the new tabbed area. Removed tabbed + container as it is no longer used. Fixed a crash with the chat window. + 2008-05-08 David Athay <ko2fan@gmail.com> * src/net/chathandler.cpp: Fixed initialisation in case. diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 3d63491c..fec2394b 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -152,7 +152,7 @@ ChatWindow::chatLog(std::string line, int own, const std::string &channelName) break; case BY_PLAYER: tmp.nick += ": "; - lineColor = "##5"; // Equiv. to BrowserBox::YELLOW + lineColor = "##3"; // Equiv. to BrowserBox::BLUE break; case BY_OTHER: tmp.nick += ": "; @@ -506,10 +506,17 @@ ChatWindow::createNewChannelTab(const std::string &channelName) BrowserBox *textOutput = new BrowserBox(BrowserBox::AUTO_WRAP); textOutput->setOpaque(false); textOutput->disableLinksAndUserColors(); + textOutput->setMaxRow((int) config.getValue("ChatLogLength", 0)); ScrollArea *scrollArea = new ScrollArea(textOutput); scrollArea->setPosition(scrollArea->getFrameSize(), scrollArea->getFrameSize()); scrollArea->setScrollPolicy(gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS); scrollArea->setOpaque(false); + scrollArea->setWidth(getChildrenArea().width - 2 * scrollArea->getFrameSize()); + scrollArea->setHeight(getChildrenArea().height - 2 * scrollArea->getFrameSize() - + mChatInput->getHeight() - 5); + scrollArea->logic(); + textOutput->setWidth(scrollArea->getChildrenArea().width); + textOutput->setHeight(scrollArea->getChildrenArea().height); // Add channel to the tabbed area mChatTabs->addTab(channelName, scrollArea); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index b69cb9f1..d1f8a38a 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -30,7 +30,8 @@ #include "setup_joystick.h" #include "setup_video.h" #include "setup_keyboard.h" -#include "tabbedcontainer.h" + +#include "widgets/tabbedarea.h" #include "../utils/dtor.h" #include "../utils/gettext.h" @@ -63,26 +64,25 @@ Setup::Setup(): add(btn); } - TabbedContainer *panel = new TabbedContainer(); + TabbedArea *panel = new TabbedArea(); panel->setDimension(gcn::Rectangle(5, 5, 250, 205)); - panel->setOpaque(false); SetupTab *tab; tab = new Setup_Video(); - panel->addTab(tab, _("Video")); + panel->addTab(_("Video"), tab); mTabs.push_back(tab); tab = new Setup_Audio(); - panel->addTab(tab, _("Audio")); + panel->addTab(_("Audio"), tab); mTabs.push_back(tab); tab = new Setup_Joystick(); - panel->addTab(tab, _("Joystick")); + panel->addTab(_("Joystick"), tab); mTabs.push_back(tab); tab = new Setup_Keyboard(); - panel->addTab(tab, "Keyboard"); + panel->addTab(_("Keyboard"), tab); mTabs.push_back(tab); add(panel); diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index a02b3c20..1ed4fc94 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -44,6 +44,7 @@ Setup_Audio::Setup_Audio(): mMusicSlider(new Slider(0, 128)) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 250, 200)); gcn::Label *sfxLabel = new gcn::Label(_("Sfx volume")); gcn::Label *musicLabel = new gcn::Label(_("Music volume")); diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index dfa446ab..57adef28 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -40,6 +40,8 @@ Setup_Joystick::Setup_Joystick(): mJoystickEnabled(new CheckBox(_("Enable joystick"))) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 250, 200)); + mJoystickEnabled->setPosition(10, 10); mCalibrateLabel->setPosition(10, 25); mCalibrateButton->setPosition(10, 30 + mCalibrateLabel->getHeight()); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index e88080b5..2b785dd5 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -75,6 +75,7 @@ Setup_Keyboard::Setup_Keyboard(): { keyboard.setSetupKeyboard(this); setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 250, 200)); refreshKeys(); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index fcdb6c51..eb3c3df2 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -128,6 +128,7 @@ Setup_Video::Setup_Video(): mOverlayDetailField(new gcn::Label("")) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 250, 200)); ScrollArea *scrollArea = new ScrollArea(mModeList); gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity")); diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 58ec8043..0a3c244a 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -33,7 +33,8 @@ #include "scrollarea.h" #include "windowcontainer.h" #include "progressbar.h" -#include "tabbedcontainer.h" + +#include "widgets/tabbedarea.h" #include "../localplayer.h" @@ -47,23 +48,22 @@ SkillDialog::SkillDialog(): setCloseButton(true); setDefaultSize(windowContainer->getWidth() - 255, 25, 230, 425); - TabbedContainer *panel = new TabbedContainer(); + TabbedArea *panel = new TabbedArea(); panel->setDimension(gcn::Rectangle(5, 5, 225, 420)); - panel->setOpaque(false); Skill_Tab* tab; // Add each type of skill tab to the panel tab = new Skill_Tab("Weapon"); - panel->addTab(tab, _("Weapons")); + panel->addTab(_("Weapons"), tab); mTabs.push_back(tab); tab = new Skill_Tab("Magic"); - panel->addTab(tab, _("Magic")); + panel->addTab(_("Magic"), tab); mTabs.push_back(tab); tab = new Skill_Tab("Craft"); - panel->addTab(tab, _("Crafts")); + panel->addTab(_("Crafts"), tab); mTabs.push_back(tab); add(panel); @@ -105,6 +105,7 @@ void SkillDialog::update() Skill_Tab::Skill_Tab(std::string type): type(type) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 225, 420)); int skillNum = getSkillNum(); mSkillNameLabels.resize(skillNum); diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp deleted file mode 100644 index d6267e65..00000000 --- a/src/gui/tabbedcontainer.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#include <algorithm> - -#include "tabbedcontainer.h" - -#include "button.h" - -#include "../utils/tostring.h" -#include "../utils/dtor.h" - -#define TABWIDTH 60 -#define TABHEIGHT 20 - -TabbedContainer::TabbedContainer(): - mActiveContent(0) -{ -} - -TabbedContainer::~TabbedContainer() -{ - for_each(mTabs.begin(), mTabs.end(), make_dtor(mTabs)); - - mTabs.clear(); - mContents.clear(); -} - -void TabbedContainer::addTab(gcn::Widget *widget, const std::string &caption) -{ - int tabNumber = mTabs.size(); - - Button *tab = new Button(caption, toString(tabNumber), this); - - tab->setSize(TABWIDTH, TABHEIGHT); - add(tab, TABWIDTH * tabNumber, 0); - - mTabs[caption] = tab; - - mContents.push_back(widget); - widget->setPosition(0, TABHEIGHT); - - // If this is the first tab in this container, make it visible - if (!mActiveContent) { - mActiveContent = widget; - add(mActiveContent); - tab->setLogged(true); - } - - mWidgets[widget] = caption; -} - -void TabbedContainer::removeTab(const std::string &caption) -{ - gcn::ActionEvent actionEvent(this, "0"); - action(actionEvent); - remove(mTabs[caption]); - mTabs.erase(caption); -} - -void TabbedContainer::logic() -{ - if (mActiveContent) { - mActiveContent->setSize( - getWidth() - 2 * mActiveContent->getFrameSize(), - getHeight() - TABHEIGHT - 2 * mActiveContent->getFrameSize()); - } - - Container::logic(); -} - -void TabbedContainer::action(const gcn::ActionEvent &event) -{ - int tabNo; - std::stringstream ss(event.getId()); - ss >> tabNo; - - gcn::Widget *newContent = mContents[tabNo]; - - if (newContent) { - if (mActiveContent) { - // Unhighlight old tab - ((Button*)mTabs[mWidgets[mActiveContent]])->setLogged(false); - remove(mActiveContent); - } - mActiveContent = newContent; - // Highlight new tab - ((Button*)mTabs[mWidgets[mActiveContent]])->setLogged(true); - add(newContent); - } -} - -void TabbedContainer::setOpaque(bool opaque) -{ - Container::setOpaque(opaque); -} - -short TabbedContainer::getNumberOfTabs() -{ - return mTabs.size(); -} - -std::string TabbedContainer::getActiveWidget() -{ - return mWidgets[mActiveContent]; -} diff --git a/src/gui/tabbedcontainer.h b/src/gui/tabbedcontainer.h deleted file mode 100644 index 7f8deef9..00000000 --- a/src/gui/tabbedcontainer.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_TABPANE_H -#define _TMW_TABPANE_H - -#include <iosfwd> -#include <vector> -#include <map> - -#include <guichan/actionlistener.hpp> - -#include <guichan/widgets/container.hpp> - -#include "../guichanfwd.h" - -class TabbedContainer : public gcn::Container, public gcn::ActionListener -{ - public: - TabbedContainer(); - ~TabbedContainer(); - - void addTab(gcn::Widget *widget, const std::string &caption); - - void removeTab(const std::string &caption); - - void logic(); - - void action(const gcn::ActionEvent &event); - - void setOpaque(bool opaque); - - short getNumberOfTabs(); - - std::string getActiveWidget(); - - private: - typedef std::vector<gcn::Widget*> Widgets; - typedef Widgets::iterator WidgetIterator; - std::map<std::string, gcn::Widget*> mTabs; // tabs mapped to their channel name - Widgets mContents; // The contents of the tabs - - std::map<gcn::Widget*, std::string> mWidgets; - gcn::Widget *mActiveContent; -}; - -#endif diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index a36688e2..7821190b 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -57,7 +57,7 @@ void TabbedArea::draw(gcn::Graphics *graphics) return; } - gcn::TabbedArea::draw(graphics); + drawChildren(graphics); } gcn::Widget* TabbedArea::getWidget(const std::string &name) diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 0c5d18f7..bc623427 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -65,7 +65,6 @@ class TabbedArea : public gcn::TabbedArea * Overload the remove tab function as its broken in guichan 0.8 */ void removeTab(gcn::Tab *tab); - }; #endif @@ -46,10 +46,12 @@ <Option output="tmw" prefix_auto="1" extension_auto="1" /> <Option type="0" /> <Option compiler="gcc" /> + <Option parameters="-d /home/dathay/Programming/tmwdata/trunk" /> <Compiler> <Add option="-W" /> <Add option="-g" /> <Add option="`sdl-config --cflags`" /> + <Add option="-DUSE_OPENGL" /> </Compiler> <Linker> <Add option="`sdl-config --libs`" /> @@ -58,6 +60,7 @@ <Add library="SDL_mixer" /> <Add library="SDL_ttf" /> <Add library="SDL_image" /> + <Add library="GL" /> <Add library="physfs" /> <Add library="enet" /> <Add library="libxml2" /> @@ -360,10 +363,6 @@ <Unit filename="src/gui/status.h"> <Option target="default" /> </Unit> - <Unit filename="src/gui/tabbedcontainer.cpp" /> - <Unit filename="src/gui/tabbedcontainer.h"> - <Option target="default" /> - </Unit> <Unit filename="src/gui/textbox.cpp" /> <Unit filename="src/gui/textbox.h"> <Option target="default" /> |