diff options
author | Nicolas Bacca | 2004-01-26 07:40:14 +0000 |
---|---|---|
committer | Nicolas Bacca | 2004-01-26 07:40:14 +0000 |
commit | 240a599758d531a1d8cd73bd8bca59a768741f1a (patch) | |
tree | 453bea4ac1aa76152635bde78a14e8fb72fec00d /scumm | |
parent | a2038809b2e0c455717e5cb24b54b53251d4efa5 (diff) | |
download | scummvm-rg350-240a599758d531a1d8cd73bd8bca59a768741f1a.tar.gz scummvm-rg350-240a599758d531a1d8cd73bd8bca59a768741f1a.tar.bz2 scummvm-rg350-240a599758d531a1d8cd73bd8bca59a768741f1a.zip |
CE Keys dialog moved to new backend
svn-id: r12607
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/dialogs.cpp | 109 | ||||
-rw-r--r-- | scumm/dialogs.h | 19 |
2 files changed, 2 insertions, 126 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index b06f14cdb3..d33667ecda 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -40,10 +40,7 @@ #endif #ifdef _WIN32_WCE -#include "gapi_keys.h" -extern bool _get_key_mapping; -extern void save_key_mapping(); -extern void load_key_mapping(); +#include "backends/wince/CEKeysDialog.h" #endif using GUI::CommandSender; @@ -444,7 +441,7 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm) // Create the sub dialog(s) // #ifdef _WIN32_WCE - _keysDialog = new KeysDialog(scumm); + _keysDialog = new CEKeysDialog(); #endif } @@ -625,108 +622,6 @@ void ConfirmDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { ScummDialog::handleKeyDown(ascii, keycode, modifiers); } -#ifdef _WIN32_WCE - -#pragma mark - - -using GUI::ListWidget; -using GUI::kListNumberingZero; -using GUI::WIDGET_CLEARBG; -using GUI::kListSelectionChangedCmd; - -enum { - kMapCmd = 'map ' -}; - - -KeysDialog::KeysDialog(ScummEngine *scumm) - : ScummDialog(scumm, 30, 20, 260, 160) { - addButton(160, 20, "Map", kMapCmd, 'M'); // Map - addButton(160, 40, "OK", kOKCmd, 'O'); // OK - addButton(160, 60, "Cancel", kCloseCmd, 'C'); // Cancel - - _actionsList = new ListWidget(this, 10, 20, 140, 90); - _actionsList->setNumberingMode(kListNumberingZero); - - _actionTitle = new StaticTextWidget(this, 10, 120, 240, 16, "Choose an action to map", kTextAlignCenter); - _keyMapping = new StaticTextWidget(this, 10, 140, 240, 16, "", kTextAlignCenter); - - _actionTitle->setFlags(WIDGET_CLEARBG); - _keyMapping->setFlags(WIDGET_CLEARBG); - - // Get actions names - Common::StringList l; - - for (int i = 1; i < TOTAL_ACTIONS; i++) - l.push_back(getActionName(i)); - - _actionsList->setList(l); - - _actionSelected = -1; - _get_key_mapping = false; -} - -void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { - switch(cmd) { - - case kListSelectionChangedCmd: - if (_actionsList->getSelected() >= 0) { - char selection[100]; - - sprintf(selection, "Associated key : %s", getGAPIKeyName((unsigned int)getAction(_actionsList->getSelected() + 1)->action_key)); - _keyMapping->setLabel(selection); - _keyMapping->draw(); - } - break; - case kMapCmd: - if (_actionsList->getSelected() < 0) { - _actionTitle->setLabel("Please select an action"); - } - else { - char selection[100]; - - _actionSelected = _actionsList->getSelected() + 1; - sprintf(selection, "Associated key : %s", getGAPIKeyName((unsigned int)getAction(_actionSelected)->action_key)); - _actionTitle->setLabel("Press the key to associate"); - _keyMapping->setLabel(selection); - _keyMapping->draw(); - _get_key_mapping = true; - _actionsList->setEnabled(false); - } - _actionTitle->draw(); - break; - case kOKCmd: - save_key_mapping(); - close(); - break; - case kCloseCmd: - load_key_mapping(); - close(); - break; - default: - ScummDialog::handleCommand(sender, cmd, data); - } -} - -void KeysDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { - if (modifiers == 0xff && _get_key_mapping) { - // GAPI key was selected - char selection[100]; - - clearActionKey(ascii & 0xff); - getAction(_actionSelected)->action_key = (ascii & 0xff); - sprintf(selection, "Associated key : %s", getGAPIKeyName((unsigned int)getAction(_actionSelected)->action_key)); - _actionTitle->setLabel("Choose an action to map"); - _keyMapping->setLabel(selection); - _keyMapping->draw(); - _actionSelected = -1; - _actionsList->setEnabled(true); - _get_key_mapping = false; - } -} - -#endif - } // End of namespace Scumm #ifdef __PALM_OS__ diff --git a/scumm/dialogs.h b/scumm/dialogs.h index b649099a35..54a260b621 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -151,25 +151,6 @@ public: virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); }; -#ifdef _WIN32_WCE - -class KeysDialog : public ScummDialog { -public: - KeysDialog(ScummEngine *scumm); - - virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); - virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); - -protected: - - GUI::ListWidget *_actionsList; - GUI::StaticTextWidget *_actionTitle; - GUI::StaticTextWidget *_keyMapping; - int _actionSelected; -}; - -#endif - } // End of namespace Scumm #endif |