From 533dc5f8e4d209fb721d64bce36a44bd14ede4c2 Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Wed, 10 Aug 2011 06:59:23 +1000 Subject: BADA: Camera button can now set shortcuts --- backends/platform/bada/form.cpp | 57 ++++++++++++++++++++++++++--------------- backends/platform/bada/form.h | 3 ++- 2 files changed, 38 insertions(+), 22 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/bada/form.cpp b/backends/platform/bada/form.cpp index eb9c828b1b..8546c12345 100755 --- a/backends/platform/bada/form.cpp +++ b/backends/platform/bada/form.cpp @@ -284,6 +284,26 @@ void BadaAppForm::setVolume(bool up, bool minMax) { } } +void BadaAppForm::setShortcut() { + int index = getShortcutIndex(); + _shortcutIndex = (index == -1 ? 0 : index + 1); + _shortcutTimer = g_system->getMillis(); + + switch (_shortcutIndex) { + case SHORTCUT_F5: + g_system->displayMessageOnOSD(_("Game Menu")); + break; + + case SHORTCUT_ESCAPE: + g_system->displayMessageOnOSD(_("Escape")); + break; + + default: + g_system->displayMessageOnOSD(_("Set Buttons")); + _shortcutIndex = SHORTCUT_SWAP_MOUSE; + } +} + void BadaAppForm::OnTouchDoublePressed(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo) { @@ -327,24 +347,8 @@ void BadaAppForm::OnTouchPressed(const Control &source, Touch touch; _touchCount = touch.GetPointCount(); if (_touchCount > 1) { - int index = getShortcutIndex(); - _shortcutIndex = (index == -1 ? 0 : index + 1); - _shortcutTimer = g_system->getMillis(); - - switch (_shortcutIndex) { - case SHORTCUT_F5: - g_system->displayMessageOnOSD(_("Game Menu")); - break; - - case SHORTCUT_ESCAPE: - g_system->displayMessageOnOSD(_("Escape")); - break; - - default: - g_system->displayMessageOnOSD(_("Swap Buttons")); - _shortcutIndex = SHORTCUT_SWAP_MOUSE; - } - } else if (getShortcutIndex() == -1) { + setShortcut(); + } else if (getShortcutIndex() == -1 && _buttonState != MoveOnly) { pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, currentPosition); } @@ -369,14 +373,18 @@ void BadaAppForm::OnTouchReleased(const Control &source, case SHORTCUT_SWAP_MOUSE: switch (_buttonState) { case LeftButton: - _buttonState = RightButtonOnce; g_system->displayMessageOnOSD(_("Right Once")); + _buttonState = RightButtonOnce; break; case RightButtonOnce: g_system->displayMessageOnOSD(_("Right Active")); _buttonState = RightButton; break; case RightButton: + g_system->displayMessageOnOSD(_("Move Active")); + _buttonState = MoveOnly; + break; + case MoveOnly: g_system->displayMessageOnOSD(_("Left Active")); _buttonState = LeftButton; break; @@ -409,6 +417,13 @@ void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) { setVolume(false, true); return; + case KEY_CAMERA: + // display the soft keyboard + _buttonState = LeftButton; + _shortcutTimer = -1; + pushKey(Common::KEYCODE_F7); + return; + default: break; } @@ -425,8 +440,8 @@ void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) { return; case KEY_CAMERA: - // display the soft keyboard - pushKey(Common::KEYCODE_F7); + _touchCount = 1; + setShortcut(); return; default: diff --git a/backends/platform/bada/form.h b/backends/platform/bada/form.h index 157cc8e365..6d0b491b37 100755 --- a/backends/platform/bada/form.h +++ b/backends/platform/bada/form.h @@ -91,6 +91,7 @@ private: void pushEvent(Common::EventType type, const Osp::Graphics::Point ¤tPosition); void terminate(); + void setShortcut(); void setVolume(bool up, bool minMax); int getShortcutIndex(); @@ -99,7 +100,7 @@ private: Osp::Base::Runtime::Mutex *_eventQueueLock; Common::Queue _eventQueue; enum {InitState, ActiveState, ClosingState, DoneState, ErrorState} _state; - enum {LeftButton, RightButtonOnce, RightButton} _buttonState; + enum {LeftButton, RightButtonOnce, RightButton, MoveOnly} _buttonState; uint32 _shortcutTimer; int _shortcutIndex; int _touchCount; -- cgit v1.2.3