aboutsummaryrefslogtreecommitdiff
path: root/gui/launcher.cpp
diff options
context:
space:
mode:
authorMax Horn2007-03-17 16:05:16 +0000
committerMax Horn2007-03-17 16:05:16 +0000
commitcfe7ecd6d914026080698e5c6330a0ee1db6b8a9 (patch)
tree211980eee679900594820063bc940beff53910cf /gui/launcher.cpp
parentb765e998f7831a2beaeeb423ee7d66bb23810216 (diff)
downloadscummvm-rg350-cfe7ecd6d914026080698e5c6330a0ee1db6b8a9.tar.gz
scummvm-rg350-cfe7ecd6d914026080698e5c6330a0ee1db6b8a9.tar.bz2
scummvm-rg350-cfe7ecd6d914026080698e5c6330a0ee1db6b8a9.zip
Don't track the modifier state, use the eventmanager instead (this also fixes bug #1657322, GUI: 'Mass Add' button text does not revert after mass add)
svn-id: r26174
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r--gui/launcher.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 4649eda5c4..7ea863c512 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -27,6 +27,7 @@
#include "base/version.h"
#include "common/config-manager.h"
+#include "common/events.h"
#include "common/fs.h"
#include "common/util.h"
#include "common/system.h"
@@ -479,7 +480,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
#pragma mark -
LauncherDialog::LauncherDialog()
- : Dialog(0, 0, 320, 200), _modifiers(0) {
+ : Dialog(0, 0, 320, 200) {
_drawingHints |= THEME_HINT_MAIN_DIALOG;
const int screenW = g_system->getOverlayWidth();
@@ -561,6 +562,8 @@ void LauncherDialog::open() {
// re-launch the same game again.
ConfMan.setActiveDomain("");
Dialog::open();
+
+ updateButtons();
}
void LauncherDialog::close() {
@@ -616,7 +619,8 @@ void LauncherDialog::updateListing() {
}
void LauncherDialog::addGame() {
- bool massAdd = (_modifiers & OSystem::KBD_SHIFT) != 0;
+ int modifiers = g_system->getEventManager()->getModifierState();
+ bool massAdd = (modifiers & OSystem::KBD_SHIFT) != 0;
if (massAdd) {
MessageDialog alert("Do you really want to run the mass game detector? "
@@ -792,23 +796,13 @@ void LauncherDialog::editGame(int item) {
}
void LauncherDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
- _modifiers = modifiers;
Dialog::handleKeyDown(ascii, keycode, modifiers);
-
- if ((modifiers & OSystem::KBD_SHIFT) != 0) {
- _addButton->setLabel("Mass Add...");
- _addButton->draw();
- }
+ updateButtons();
}
void LauncherDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
- _modifiers = modifiers;
Dialog::handleKeyUp(ascii, keycode, modifiers);
-
- if ((modifiers & OSystem::KBD_SHIFT) == 0) {
- _addButton->setLabel("Add Game...");
- _addButton->draw();
- }
+ updateButtons();
}
void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -869,6 +863,17 @@ void LauncherDialog::updateButtons() {
_removeButton->setEnabled(enable);
_removeButton->draw();
}
+
+ // Update the label of the "Add" button depending on whether shift is pressed or not
+ int modifiers = g_system->getEventManager()->getModifierState();
+ const char *newAddButtonLabel = ((modifiers & OSystem::KBD_SHIFT) != 0)
+ ? "Mass Add..."
+ : "Add Game...";
+
+ if (_addButton->getLabel() != newAddButtonLabel) {
+ _addButton->setLabel(newAddButtonLabel);
+ _addButton->draw();
+ }
}
void LauncherDialog::reflowLayout() {