aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2005-01-10 22:06:49 +0000
committerMax Horn2005-01-10 22:06:49 +0000
commitcffd917165a14e981d61342458a9d054d3c14705 (patch)
tree3aa6658993fa842477a7ab10b2a21dbf7625a531 /gui
parente79458130835528ddf693fba868243cbbfb4ee9a (diff)
downloadscummvm-rg350-cffd917165a14e981d61342458a9d054d3c14705.tar.gz
scummvm-rg350-cffd917165a14e981d61342458a9d054d3c14705.tar.bz2
scummvm-rg350-cffd917165a14e981d61342458a9d054d3c14705.zip
system.h was being included in tons of places, without any good reason; reduced this (total dependencies on system.h went down from 193 to 85 files)
svn-id: r16527
Diffstat (limited to 'gui')
-rw-r--r--gui/EditTextWidget.cpp2
-rw-r--r--gui/ListWidget.cpp4
-rw-r--r--gui/PopUpWidget.cpp6
-rw-r--r--gui/about.cpp5
-rw-r--r--gui/browser.cpp2
-rw-r--r--gui/console.cpp2
-rw-r--r--gui/dialog.cpp13
-rw-r--r--gui/message.cpp4
-rw-r--r--gui/newgui.cpp1
-rw-r--r--gui/newgui.h3
-rw-r--r--gui/object.h4
-rw-r--r--gui/options.cpp1
12 files changed, 33 insertions, 14 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp
index 5ad3b23286..1e788aef91 100644
--- a/gui/EditTextWidget.cpp
+++ b/gui/EditTextWidget.cpp
@@ -42,7 +42,7 @@ EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, cons
}
void EditTextWidget::handleTickle() {
- uint32 time = g_system->getMillis();
+ uint32 time = getMillis();
if (_caretTime < time) {
_caretTime = time + kCaretBlinkTime;
drawCaret(_caretVisible);
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 0496c0c16c..5bd59827cb 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -110,7 +110,7 @@ void ListWidget::scrollBarRecalc() {
}
void ListWidget::handleTickle() {
- uint32 time = g_system->getMillis();
+ uint32 time = getMillis();
if (_editMode && _caretTime < time) {
_caretTime = time + kCaretBlinkTime;
drawCaret(_caretVisible);
@@ -172,7 +172,7 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
// Only works in a useful fashion if the list entries are sorted.
// TODO: Maybe this should be off by default, and instead we add a
// method "enableQuickSelect()" or so ?
- uint32 time = g_system->getMillis();
+ uint32 time = getMillis();
if (_quickSelectTime < time) {
_quickSelectStr = (char)ascii;
} else {
diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp
index aa7f4cbab2..ac72892a7d 100644
--- a/gui/PopUpWidget.cpp
+++ b/gui/PopUpWidget.cpp
@@ -19,9 +19,9 @@
*/
#include "stdafx.h"
-#include "gui/PopUpWidget.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
+#include "gui/PopUpWidget.h"
#include "base/engine.h"
namespace GUI {
@@ -102,7 +102,7 @@ PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY)
_clickY = clickY - _y;
// Time the popup was opened
- _openTime = g_system->getMillis();
+ _openTime = getMillis();
}
void PopUpDialog::drawDialog() {
@@ -125,7 +125,7 @@ void PopUpDialog::handleMouseUp(int x, int y, int button, int clickCount) {
// Mouse was released. If it wasn't moved much since the original mouse down,
// let the popup stay open. If it did move, assume the user made his selection.
int dist = (_clickX - x) * (_clickX - x) + (_clickY - y) * (_clickY - y);
- if (dist > 3 * 3 || g_system->getMillis() - _openTime > 300) {
+ if (dist > 3 * 3 || getMillis() - _openTime > 300) {
setResult(_selection);
close();
}
diff --git a/gui/about.cpp b/gui/about.cpp
index e2bb3ac3fd..96a6fc50a9 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -21,6 +21,7 @@
#include "stdafx.h"
#include "base/engine.h"
#include "base/version.h"
+#include "common/system.h"
#include "gui/about.h"
#include "gui/newgui.h"
#include "gui/widget.h"
@@ -114,7 +115,7 @@ AboutDialog::AboutDialog()
}
void AboutDialog::open() {
- _scrollTime = g_system->getMillis() + kScrollStartDelay;
+ _scrollTime = getMillis() + kScrollStartDelay;
_scrollPos = 0;
_modifiers = 0;
_willClose = false;
@@ -193,7 +194,7 @@ void AboutDialog::drawDialog() {
void AboutDialog::handleTickle() {
- const uint32 t = g_system->getMillis();
+ const uint32 t = getMillis();
int scrollOffset = ((int)t - (int)_scrollTime) / kScrollMillisPerPixel;
if (scrollOffset > 0) {
// Scroll faster when shift is pressed
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 5b86a662cb..9e42f6900e 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -25,6 +25,8 @@
#include "backends/fs/fs.h"
+#include "common/system.h"
+
namespace GUI {
#ifdef MACOSX
diff --git a/gui/console.cpp b/gui/console.cpp
index 48387e7e9d..b9d2374c92 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -25,6 +25,8 @@
#include "base/engine.h"
#include "base/version.h"
+#include "common/system.h"
+
#include "graphics/font.h"
namespace GUI {
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index f2ee027f56..dde31feeb2 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -21,9 +21,11 @@
#include <ctype.h>
#include "stdafx.h"
-#include "newgui.h"
-#include "dialog.h"
-#include "widget.h"
+#include "gui/newgui.h"
+#include "gui/dialog.h"
+#include "gui/widget.h"
+
+#include "common/system.h"
namespace GUI {
@@ -294,4 +296,9 @@ ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint3
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
}
+
+uint32 GuiObject::getMillis() {
+ return g_system->getMillis();
+}
+
} // End of namespace GUI
diff --git a/gui/message.cpp b/gui/message.cpp
index 5ee78027e5..d5d44238df 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -156,12 +156,12 @@ void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
TimedMessageDialog::TimedMessageDialog(const Common::String &message, uint32 duration)
: MessageDialog(message, 0, 0) {
- _timer = g_system->getMillis() + duration;
+ _timer = getMillis() + duration;
}
void TimedMessageDialog::handleTickle() {
MessageDialog::handleTickle();
- if (g_system->getMillis() > _timer)
+ if (getMillis() > _timer)
close();
}
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 206cec532b..c6fb6b8683 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -19,6 +19,7 @@
*/
#include "stdafx.h"
+#include "common/system.h"
#include "common/util.h"
#include "gui/newgui.h"
#include "gui/dialog.h"
diff --git a/gui/newgui.h b/gui/newgui.h
index ed4f69dd96..4acce206f7 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -25,9 +25,10 @@
#include "common/singleton.h"
#include "common/stack.h"
#include "common/str.h"
-#include "common/system.h" // For events
#include "graphics/fontman.h"
+class OSystem;
+
namespace GUI {
class Dialog;
diff --git a/gui/object.h b/gui/object.h
index f581940444..3ca5248228 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -75,6 +75,10 @@ public:
protected:
virtual void releaseFocus() = 0;
+
+ // Convenience alias for OSystem::getMillis().
+ // This is a bit hackish, of course :-).
+ uint32 getMillis();
};
} // End of namespace GUI
diff --git a/gui/options.cpp b/gui/options.cpp
index 58afa3e37b..1a6cd0f2f6 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -30,6 +30,7 @@
#include "backends/fs/fs.h"
#include "common/config-manager.h"
#include "common/scaler.h"
+#include "common/system.h"
#include "sound/mididrv.h"
#include "sound/mixer.h"