summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-13 22:44:23 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-13 22:44:23 +0000
commit4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435 (patch)
treeaf49a9d05531e9cf9c87b6ad543338c2d68de4ee /src/gui
parent1ae9c54d120338e4165d168c72ef16eb7f76ac18 (diff)
downloadmana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.gz
mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.bz2
mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.xz
mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.zip
* Committing some cleanups by Doener
* Fixed some compiler warnings * Restored a USE_OPENGL check around OpenGL headers * Fixed error about FALSE not being defined * Fixed issue with font to become speechFont when the latter is not installed
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chargedialog.cpp7
-rw-r--r--src/gui/chargedialog.h2
-rw-r--r--src/gui/chat.cpp8
-rw-r--r--src/gui/chat.h5
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/popupmenu.cpp20
-rw-r--r--src/gui/popupmenu.h5
-rw-r--r--src/gui/updatewindow.cpp25
-rw-r--r--src/gui/window.cpp17
-rw-r--r--src/gui/window.h1
10 files changed, 32 insertions, 60 deletions
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index 726e73ff..25f4297e 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -46,7 +46,7 @@ void ChargeDialog::action(const std::string& eventId)
}
// update the dialog
-void ChargeDialog::draw(gcn::Graphics *graphics)
+void ChargeDialog::logic()
{
// calculate time since the last attack was made
char_info->lastAttackTime += .01; // this a hack until someone explains
@@ -54,6 +54,7 @@ void ChargeDialog::draw(gcn::Graphics *graphics)
if(char_info->lastAttackTime > 1){char_info->lastAttackTime=1;}
// reset the progress bar to display accurate time since attack
- progBar->setProgress(char_info->lastAttackTime);
- Window::draw(graphics);
+ progBar->setProgress(char_info->lastAttackTime);
+
+ Window::logic();
}
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index e544a602..92eb1dd4 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -51,7 +51,7 @@ class ChargeDialog : public Window, public gcn::ActionListener
// action listener
void action(const std::string&);
- void draw(gcn::Graphics *graphics);
+ void logic();
};
extern ChargeDialog* chargeDialog;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ce5593f9..1a7eca65 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -53,7 +53,7 @@ ChatWindow::ChatWindow(const std::string &logfile):
scrollArea->getBorderSize(), scrollArea->getBorderSize());
scrollArea->setScrollPolicy(
gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
- //scrollArea->setOpaque(false);
+ scrollArea->setOpaque(false);
add(scrollArea);
add(chatInput);
@@ -151,12 +151,6 @@ void ChatWindow::chat_log(CHATSKILL action)
chat_log(const_msg(action), BY_SERVER);
}
-void ChatWindow::draw(gcn::Graphics *graphics)
-{
- // Draw the window border/background and children
- Window::draw(graphics);
-}
-
void ChatWindow::action(const std::string& eventId)
{
if (eventId == "chatinput")
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 28c3ab0c..34e9c027 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -133,11 +133,6 @@ class ChatWindow : public Window, public gcn::ActionListener,
*/
void chat_log(CHATSKILL);
- /*
- * Draws the chat box.
- */
- void draw(gcn::Graphics *graphics);
-
/**
* Performs action.
*/
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 81e6c5df..37e5daff 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -118,7 +118,7 @@ Gui::Gui(Graphics *graphics)
catch (gcn::Exception e)
{
try {
- guiFont = new gcn::ImageFont(
+ speechFont = new gcn::ImageFont(
"data/graphics/gui/rpgfont_wider.png",
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\"
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 36c246a6..5e8294a1 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -34,6 +34,7 @@ PopupMenu::PopupMenu():
{
setResizable(false);
setTitleBarHeight(0);
+ title = false;
browserBox = new BrowserBox();
browserBox->setPosition(4, 4);
@@ -120,25 +121,6 @@ void PopupMenu::showPopup(int mx, int my)
setVisible(true);
}
-void PopupMenu::draw(gcn::Graphics* graphics)
-{
- int x, y;
- getAbsolutePosition(x, y);
-
- ((Graphics*) graphics)->drawImageRect(x, y, getWidth(), getHeight(),
- border);
-
- if (mContent != NULL)
- {
- graphics->pushClipArea(getContentDimension());
- graphics->pushClipArea(gcn::Rectangle(
- 0, 0, mContent->getWidth(), mContent->getHeight()));
- mContent->draw(graphics);
- graphics->popClipArea();
- graphics->popClipArea();
- }
-}
-
void PopupMenu::handleLink(const std::string& link)
{
// Talk To action
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index c21d4758..bb68852b 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -58,11 +58,6 @@ class PopupMenu : public Window, public LinkHandler
void showPopup(int mx, int my);
/**
- * Draws updated popup menu
- */
- void draw(gcn::Graphics* graphics);
-
- /**
* Handles link action.
*/
void handleLink(const std::string& link);
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 7ad9b175..15c7afb3 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -117,14 +117,17 @@ int updateProgress(void *ptr,
labelString << (char *)ptr << " (" << (int)(progress*100) << "%)";
updaterWindow->setLabel(labelString.str());
updaterWindow->setProgress(progress);
- if(state!=UPDATE) {
+
+ if (state != UPDATE) {
// If the action was canceled return an error code to stop the thread
return -1;
}
+
return 0;
}
-int downloadThread(void *ptr) {
+int downloadThread(void *ptr)
+{
CURL *curl;
CURLcode res;
FILE *outfile;
@@ -134,7 +137,7 @@ int downloadThread(void *ptr) {
logger->log("Downloading: %s", url.c_str());
curl = curl_easy_init();
- if(curl)
+ if (curl)
{
downloadComplete = false;
progress = 0.0f;
@@ -142,7 +145,7 @@ int downloadThread(void *ptr) {
outfile = fopen(fileName.c_str(), "wb");
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateProgress);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr);
@@ -152,17 +155,23 @@ int downloadThread(void *ptr) {
curl_easy_cleanup(curl);
downloadComplete = true;
}
+
+ return 0;
}
-int download(std::string url) {
+int download(std::string url)
+{
thread = SDL_CreateThread(downloadThread, (void *)url.c_str());
- if ( thread == NULL ) {
+
+ if (thread == NULL) {
logger->log("Unable to create thread");
- return 0;
}
+
+ return 0;
}
-void updateData() {
+void updateData()
+{
updaterWindow = new UpdaterWindow();
state = UPDATE;
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index aa8569f2..fdbeb699 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -34,6 +34,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
gcn::Window(caption),
parent(parent),
snapSize(8),
+ title(true),
modal(modal),
resizable(false),
mMouseResize(false),
@@ -128,18 +129,12 @@ void Window::draw(gcn::Graphics* graphics)
border);
// Draw title
- graphics->setFont(getFont());
- graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
-
- if (mContent != NULL)
- {
- graphics->pushClipArea(getContentDimension());
- graphics->pushClipArea(gcn::Rectangle(
- 0, 0, mContent->getWidth(), mContent->getHeight()));
- mContent->draw(graphics);
- graphics->popClipArea();
- graphics->popClipArea();
+ if (title) {
+ graphics->setFont(getFont());
+ graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
}
+
+ drawContent(graphics);
}
void Window::setContentWidth(int width)
diff --git a/src/gui/window.h b/src/gui/window.h
index 0a089b49..7441c804 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -155,6 +155,7 @@ class Window : public gcn::Window, public ConfigListener
gcn::Container *chrome; /**< Contained container */
Window *parent; /**< The parent window */
int snapSize; /**< Snap distance to window edge */
+ bool title; /**< Window has a title bar */
bool modal; /**< Window is modal */
bool resizable; /**< Window can be resized */