From aad356f5f598e4e1f475d065377f931e7a5938e2 Mon Sep 17 00:00:00 2001 From: Nicolas Bacca Date: Sun, 29 Jan 2006 23:23:17 +0000 Subject: Knakos patch & Smartphone fixes svn-id: r20305 --- backends/wince/CEActionsPocket.cpp | 26 ++++++++++++++++++++++---- backends/wince/CEActionsPocket.h | 9 +++++---- backends/wince/CEActionsSmartphone.cpp | 22 +++++++++++++++++++--- backends/wince/CEActionsSmartphone.h | 5 +++-- backends/wince/CEgui/Panel.cpp | 2 +- 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp index 050fd77a48..1698347cc5 100644 --- a/backends/wince/CEActionsPocket.cpp +++ b/backends/wince/CEActionsPocket.cpp @@ -30,6 +30,8 @@ #include "common/config-manager.h" +#include "gui/KeysDialog.h" + #ifdef _WIN32_WCE #define KEY_ALL_SKIP 3457 #endif @@ -47,7 +49,8 @@ const String pocketActionNames[] = { "Free look", "Zoom up", "Zoom down", - "FT Cheat" + "FT Cheat", + "Bind Keys" }; void CEActionsPocket::init(GameDetector &detector) { @@ -165,6 +168,8 @@ void CEActionsPocket::initInstanceGame() { // FT Cheat _action_enabled[POCKET_ACTION_FT_CHEAT] = true; _key_action[POCKET_ACTION_FT_CHEAT].setAscii(86); // shift-V + // Key bind method + _action_enabled[POCKET_ACTION_BINDKEYS] = true; } @@ -172,6 +177,8 @@ CEActionsPocket::~CEActionsPocket() { } bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) { + static bool keydialogrunning = false; + if (!pushed) { switch(action) { case POCKET_ACTION_RIGHTCLICK: @@ -220,9 +227,20 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) { _CESystem->swap_zoom_down(); return true; case POCKET_ACTION_QUIT: - GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); - if (alert.runModal() == GUI::kMessageOK) - _mainSystem->quit(); + { + GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); + if (alert.runModal() == GUI::kMessageOK) + _mainSystem->quit(); + return true; + } + case POCKET_ACTION_BINDKEYS: + if (!keydialogrunning) { + keydialogrunning = true; + GUI::KeysDialog *keysDialog = new GUI::KeysDialog(); + keysDialog->runModal(); + delete keysDialog; + keydialogrunning = false; + } return true; } return false; diff --git a/backends/wince/CEActionsPocket.h b/backends/wince/CEActionsPocket.h index 4f7620f8fa..1c6fd783ea 100644 --- a/backends/wince/CEActionsPocket.h +++ b/backends/wince/CEActionsPocket.h @@ -46,11 +46,12 @@ enum pocketActionType { POCKET_ACTION_RIGHTCLICK, POCKET_ACTION_CURSOR, POCKET_ACTION_FREELOOK, - POCKET_ACTION_ZOOM_UP, - POCKET_ACTION_ZOOM_DOWN, - POCKET_ACTION_FT_CHEAT, + POCKET_ACTION_ZOOM_UP, + POCKET_ACTION_ZOOM_DOWN, + POCKET_ACTION_FT_CHEAT, + POCKET_ACTION_BINDKEYS, - POCKET_ACTION_LAST + POCKET_ACTION_LAST }; class CEActionsPocket : public GUI::Actions { diff --git a/backends/wince/CEActionsSmartphone.cpp b/backends/wince/CEActionsSmartphone.cpp index b5802915b3..553afea71d 100644 --- a/backends/wince/CEActionsSmartphone.cpp +++ b/backends/wince/CEActionsSmartphone.cpp @@ -33,6 +33,8 @@ #include "common/config-manager.h" +#include "gui/KeysDialog.h" + #ifdef _WIN32_WCE #define KEY_ALL_SKIP 3457 #endif @@ -47,13 +49,14 @@ const String smartphoneActionNames[] = { "Save", "Skip", "Zone", - "FT Cheat" + "FT Cheat", + "Bind Keys" }; #ifdef SIMU_SMARTPHONE -const int ACTIONS_SMARTPHONE_DEFAULT[] = { 0x111, 0x112, 0x114, 0x113, 0x11a, 0x11b, VK_LWIN, VK_ESCAPE, VK_F8, 0 }; +const int ACTIONS_SMARTPHONE_DEFAULT[] = { 0x111, 0x112, 0x114, 0x113, 0x11a, 0x11b, VK_LWIN, VK_ESCAPE, VK_F8, 0, VK_RETURN }; #else -const int ACTIONS_SMARTPHONE_DEFAULT[] = { '4', '6', '8', '2', 0x11a, 0x11b, '0', VK_ESCAPE, '9', 0 }; +const int ACTIONS_SMARTPHONE_DEFAULT[] = { '4', '6', '8', '2', 0x11a, 0x11b, '0', VK_ESCAPE, '9', 0, VK_RETURN }; #endif void CEActionsSmartphone::init(GameDetector &detector) { @@ -150,6 +153,8 @@ void CEActionsSmartphone::initInstanceGame() { // FT Cheat _action_enabled[SMARTPHONE_ACTION_FT_CHEAT] = true; _key_action[SMARTPHONE_ACTION_FT_CHEAT].setAscii(86); // shift-V + // Bind keys + _action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true; } @@ -157,6 +162,8 @@ CEActionsSmartphone::~CEActionsSmartphone() { } bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) { + static bool keydialogrunning = false; + if (!pushed) { switch (action) { case SMARTPHONE_ACTION_RIGHTCLICK: @@ -201,6 +208,15 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) { case SMARTPHONE_ACTION_ZONE: _CESystem->switch_zone(); return true; + case SMARTPHONE_ACTION_BINDKEYS: + if (!keydialogrunning) { + keydialogrunning = true; + GUI::KeysDialog *keysDialog = new GUI::KeysDialog(); + keysDialog->runModal(); + delete keysDialog; + keydialogrunning = false; + } + return true; } return false; diff --git a/backends/wince/CEActionsSmartphone.h b/backends/wince/CEActionsSmartphone.h index 11789e1111..ff7811d739 100644 --- a/backends/wince/CEActionsSmartphone.h +++ b/backends/wince/CEActionsSmartphone.h @@ -47,9 +47,10 @@ enum smartphoneActionType { SMARTPHONE_ACTION_SAVE, SMARTPHONE_ACTION_SKIP, SMARTPHONE_ACTION_ZONE, - SMARTPHONE_ACTION_FT_CHEAT, + SMARTPHONE_ACTION_FT_CHEAT, + SMARTPHONE_ACTION_BINDKEYS, - SMARTPHONE_ACTION_LAST + SMARTPHONE_ACTION_LAST }; diff --git a/backends/wince/CEgui/Panel.cpp b/backends/wince/CEgui/Panel.cpp index 1f1f67f7d9..6b918bb82b 100644 --- a/backends/wince/CEgui/Panel.cpp +++ b/backends/wince/CEgui/Panel.cpp @@ -27,7 +27,7 @@ namespace CEGUI { Panel::Panel(int interleave_first, int interleave) : Toolbar() { _interleave = interleave; - _currentItem = _x + interleave_first; + _currentItem = interleave_first; } -- cgit v1.2.3