summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--NEWS2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gui/popup_box.cpp139
-rw-r--r--src/gui/popup_box.h71
-rw-r--r--src/gui/setup_players.cpp10
-rw-r--r--src/gui/setup_players.h4
-rw-r--r--src/gui/viewport.h2
8 files changed, 17 insertions, 221 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a1768b6..53a5022e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-19 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/setup_players.cpp, src/gui/popup_box.h, src/gui/viewport.h,
+ src/gui/popup_box.cpp, src/gui/setup_players.h, src/Makefile.am:
+ Removed the PopupBox class and used gcn::DropDown instead. It has
+ clipping issues, but it would be better to fix those instead of using
+ this complicated workaround.
+
2008-05-16 David Athay <ko2fan@gmail.com>
* src/gui/popupmenu.cpp: Applied QOAL's patch to fix popup bug.
diff --git a/NEWS b/NEWS
index 834c8064..94fb60cb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- Fixed display of critical hits
+
0.0.24.1 (7 April 2008)
- Added /clear command to clear chat window
- Added ability to close quit dialog by pressing ESC
diff --git a/src/Makefile.am b/src/Makefile.am
index f69caaf5..97767896 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,8 +78,6 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \
gui/passwordfield.h \
gui/playerbox.cpp \
gui/playerbox.h \
- gui/popup_box.cpp \
- gui/popup_box.h \
gui/popupmenu.cpp \
gui/popupmenu.h \
gui/progressbar.cpp \
diff --git a/src/gui/popup_box.cpp b/src/gui/popup_box.cpp
deleted file mode 100644
index 4cac2169..00000000
--- a/src/gui/popup_box.cpp
+++ /dev/null
@@ -1,139 +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
- */
-
-#include "popup_box.h"
-#include "window.h"
-#include "browserbox.h"
-
-#include <iostream>
-#include <sstream>
-
-class PoppedSelectionWindow : public Window
-{
-public:
- PoppedSelectionWindow(PopupBox *owner):
- mOwner(owner)
- {
- setResizable(false);
- setTitleBarHeight(0);
- mShowTitle = false;
-
- mBrowserBox = new BrowserBox();
- mBrowserBox->setPosition(4, 4);
- mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND);
- mBrowserBox->setOpaque(false);
- add(mBrowserBox);
- mBrowserBox->setLinkHandler(owner);
-
- initModel();
- }
-
- void initModel(void)
- {
- mBrowserBox->clearRows();
- gcn::ListModel *model = mOwner->getListModel();
- for (int i = 0; i < model->getNumberOfElements(); i++) {
- std::stringstream s;
- s << "@@" << i << "|" << model->getElementAt(i) << "@@";
- mBrowserBox->addRow(s.str());
- }
-
- setContentSize(mBrowserBox->getWidth() + 8, mBrowserBox->getHeight() + 8);
- }
-
-protected:
- BrowserBox *mBrowserBox;
- PopupBox *mOwner;
-};
-
-PopupBox::PopupBox(gcn::ListModel *list_model) :
- DropDown(list_model),
- mWindow(NULL)
-{
-}
-
-PopupBox::~PopupBox(void)
-{
- if (mWindow)
- delete mWindow;
-}
-
-////////////////////////////////////////
-// Widget ops
-
-void
-PopupBox::draw(gcn::Graphics *graphics)
-{
- // fill background
- graphics->setColor(gcn::Color(0xd0, 0xd0, 0xd0));
- graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
-
- // draw frame-ish object
- graphics->setColor(gcn::Color(0xc0, 0xc0, 0xc0));
- graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
- graphics->setColor(gcn::Color(0xe0, 0xe0, 0xe0));
- graphics->drawLine(0, getHeight(), getWidth(), getHeight());
- graphics->drawLine(getWidth(), 0, getWidth(), getHeight());
-
- graphics->drawText(getListModel()->getElementAt(getSelected()), 0, 0);
-}
-
-////////////////////////////////////////
-// MouseListener ops
-
-void
-PopupBox::mousePressed(gcn::MouseEvent& mouseEvent)
-{
- if (0 <= mouseEvent.getY()
- && mouseEvent.getY() < getHeight()
- && mouseEvent.getX() >= 0
- && mouseEvent.getX() < getWidth()
- && mouseEvent.getButton() == gcn::MouseEvent::LEFT
- && mouseEvent.getSource() == this) {
- if (mWindow == NULL) {
- mWindow = new PoppedSelectionWindow(this);
- mWindow->resizeToContent();
- }
-
- int x, y;
- getAbsolutePosition(x, y);
- mWindow->setPosition(mouseEvent.getX() + x,
- mouseEvent.getY() + y);
- mWindow->setVisible(true);
- mWindow->requestMoveToTop();
- }
-}
-
-////////////////////////////////////////
-// LinkHandler ops
-
-void
-PopupBox::handleLink(const std::string &link)
-{
- if (mWindow)
- mWindow->setVisible(false);
-
- std::stringstream s;
- s << link;
- int index;
- s >> index;
- setSelected(index);
-}
diff --git a/src/gui/popup_box.h b/src/gui/popup_box.h
deleted file mode 100644
index 1e3b155e..00000000
--- a/src/gui/popup_box.h
+++ /dev/null
@@ -1,71 +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
- */
-
-#ifndef _TMW_POPUP_BOX_H
-#define _TMW_POPUP_BOX_H
-
-#include <guichan/widgets/dropdown.hpp>
-
-#include "../guichanfwd.h"
-#include "linkhandler.h"
-
-class PoppedSelectionWindow;
-
-/**
- * Popup box widget. Appears as a box that `pops out' into a separate floating window when selected.
- *
- * API adapted from guichan's listbox API. Typewise
- */
-class PopupBox : public gcn::DropDown,
- public LinkHandler
-{
-public:
- /**
- * Constructor.
- *
- * \param listModel the list model to use.
- */
- PopupBox(gcn::ListModel *list_model = NULL);
-
- /**
- * Destructor.
- */
- virtual ~PopupBox(void);
-
- // Overriding Widget
-
- virtual void draw(gcn::Graphics* graphics);
-
-
- // Overriding MouseListener
-
- virtual void mousePressed(gcn::MouseEvent& mouseEvent);
-
-
- // Implementing Linkhandler
- void handleLink(const std::string& link);
-
-protected:
- PoppedSelectionWindow *mWindow;
-};
-
-
-#endif /* !defined(_TMW_POPUP_BOX_H) */
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 16c916b4..ae0e7271 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -24,10 +24,10 @@
#include "setup_players.h"
#include <vector>
+#include <guichan/widgets/dropdown.hpp>
#include <guichan/widgets/label.hpp>
-#include "popup_box.h"
-#include "button.h"
+#include "button.h"
#include "checkbox.h"
#include "ok_dialog.h"
@@ -127,7 +127,7 @@ public:
gcn::Widget *widget = new gcn::Label(name);
mWidgets.push_back(widget);
- PopupBox *choicebox = new PopupBox(new PlayerRelationListModel());
+ gcn::DropDown *choicebox = new gcn::DropDown(new PlayerRelationListModel());
choicebox->setSelected(player_relations.getRelation(name));
mWidgets.push_back(choicebox);
}
@@ -137,7 +137,7 @@ public:
virtual void updateModelInRow(int row)
{
- PopupBox *choicebox = dynamic_cast<PopupBox *>(getElementAt(row, RELATION_CHOICE_COLUMN));
+ gcn::DropDown *choicebox = dynamic_cast<gcn::DropDown *>(getElementAt(row, RELATION_CHOICE_COLUMN));
player_relations.setRelation(getPlayerAt(row),
static_cast<PlayerRelation::relation>(choicebox->getSelected()));
}
@@ -207,7 +207,7 @@ Setup_Players::Setup_Players():
mDefaultTrading(new CheckBox("allow trading", player_relations.getDefault() & PlayerRelation::TRADE)),
mDefaultWhisper(new CheckBox("allow whispers", player_relations.getDefault() & PlayerRelation:: WHISPER)),
mDeleteButton(new Button("Delete", ACTION_DELETE, this)),
- mIgnoreActionChoicesBox(new PopupBox(new IgnoreChoicesListModel()))
+ mIgnoreActionChoicesBox(new gcn::DropDown(new IgnoreChoicesListModel()))
{
setOpaque(false);
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 2c6ccc82..b04023ab 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -27,7 +27,6 @@
#include "scrollarea.h"
#include "button.h"
#include "table.h"
-#include "popup_box.h"
#include <guichan/actionlistener.hpp>
#include "../guichanfwd.h"
@@ -52,7 +51,6 @@ public:
virtual void updatedPlayer(const std::string &name);
private:
-
StaticTableModel *mPlayerTableTitleModel;
PlayerTableModel *mPlayerTableModel;
GuiTable *mPlayerTable;
@@ -64,7 +62,7 @@ private:
gcn::CheckBox *mDefaultWhisper;
Button *mDeleteButton;
- PopupBox *mIgnoreActionChoicesBox;
+ gcn::DropDown *mIgnoreActionChoicesBox;
};
#endif
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index a91ab14d..8d3fbd3c 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -132,7 +132,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
* Changes viewpoint by relative pixel coordinates.
*/
void
- scrollBy (float x, float y) { mPixelViewX += x; mPixelViewY += y; }
+ scrollBy(float x, float y) { mPixelViewX += x; mPixelViewY += y; }
private:
/**