[Scummvm-cvs-logs] SF.net SVN: scummvm: [26978] scummvm/trunk

knakos at users.sourceforge.net knakos at users.sourceforge.net
Sun May 27 21:00:28 CEST 2007


Revision: 26978
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26978&view=rev
Author:   knakos
Date:     2007-05-27 12:00:28 -0700 (Sun, 27 May 2007)

Log Message:
-----------
simplified code by moving key naming to the sdl port (where it belongs)

Modified Paths:
--------------
    scummvm/trunk/backends/platform/wince/CEDevice.cpp
    scummvm/trunk/backends/platform/wince/CEDevice.h
    scummvm/trunk/gui/KeysDialog.cpp

Modified: scummvm/trunk/backends/platform/wince/CEDevice.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/CEDevice.cpp	2007-05-27 18:56:54 UTC (rev 26977)
+++ scummvm/trunk/backends/platform/wince/CEDevice.cpp	2007-05-27 19:00:28 UTC (rev 26978)
@@ -154,66 +154,3 @@
 		return true;
 	return (_wcsnicmp(platformType, TEXT("SmartPhone"), 10) == 0);
 }
-
-Common::String CEDevice::getKeyName(unsigned int keyCode) {
-	switch (keyCode) {
-		case SDLK_F1:
-			return "Softkey A";
-		case SDLK_F2:
-			return "Softkey B";
-		case SDLK_F3:
-			return "Talk";
-		case SDLK_F4:
-			return "End";
-		case SDLK_APP1:
-			return "Application 1";
-		case SDLK_APP2:
-			return "Application 2";
-		case SDLK_APP3:
-			return "Application 3";
-		case SDLK_APP4:
-			return "Application 4";
-		case SDLK_APP5:
-			return "Application 5";
-		case SDLK_APP6:
-			return "Application 6";
-		case SDLK_LSUPER:
-			return "Home";
-		case SDLK_ESCAPE:
-			return "Back";
-		case SDLK_UP:
-			return "Up";
-		case SDLK_DOWN:
-			return "Down";
-		case SDLK_LEFT:
-			return "Left";
-		case SDLK_RIGHT:
-			return "Right";
-		case SDLK_RETURN:
-			return "Action";
-		case SDLK_F10:
-			return "Record";
-		case SDLK_F6:
-			return "Volume Up";
-		case SDLK_F7:
-			return "Volume Down";
-		case SDLK_F17:
-			return "Flip";
-		case SDLK_F18:
-			return "Power";
-		case SDLK_F16:
-			return "Speaker";
-		case SDLK_F8:
-			return "Star";
-		case SDLK_F9:
-			return "Pound";
-		case SDLK_F11:
-			return "Symbol";
-		case SDLK_F19:
-			return "Red Key";
-		case 0:
-			return "None";
-		default:
-			return SDL_GetKeyName((SDLKey)keyCode);
-	}
-}

Modified: scummvm/trunk/backends/platform/wince/CEDevice.h
===================================================================
--- scummvm/trunk/backends/platform/wince/CEDevice.h	2007-05-27 18:56:54 UTC (rev 26977)
+++ scummvm/trunk/backends/platform/wince/CEDevice.h	2007-05-27 19:00:28 UTC (rev 26978)
@@ -39,7 +39,6 @@
 		static bool hasWideResolution();
 		static bool hasSmartphoneResolution();
 		static bool isSmartphone();
-		static Common::String getKeyName(unsigned int keyCode);
 
 	private:
 		static DWORD reg_access(TCHAR *key, TCHAR *val, DWORD data);

Modified: scummvm/trunk/gui/KeysDialog.cpp
===================================================================
--- scummvm/trunk/gui/KeysDialog.cpp	2007-05-27 18:56:54 UTC (rev 26977)
+++ scummvm/trunk/gui/KeysDialog.cpp	2007-05-27 19:00:28 UTC (rev 26978)
@@ -32,16 +32,13 @@
 namespace GUI {
 
 enum {
-	kMapCmd					= 'map ',
-	kOKCmd					= 'ok  '
+	kMapCmd	= 'map ',
+	kOKCmd	= 'ok  '
 };
 
 KeysDialog::KeysDialog(const Common::String &title)
 	: GUI::Dialog("keysdialog") {
 
-//tmp
-//	addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, "Choose", kChooseCmd, 0, ws);
-//tmp
 	new ButtonWidget(this, "keysdialog_map", "Map", kMapCmd, 0);
 	new ButtonWidget(this, "keysdialog_ok", "OK", kOKCmd, 0);
 	new ButtonWidget(this, "keysdialog_cancel", "Cancel", kCloseCmd, 0);
@@ -73,23 +70,18 @@
 	case kListSelectionChangedCmd:
 		if (_actionsList->getSelected() >= 0) {
 			char selection[100];
-#ifdef __SYMBIAN32__
-			uint16 key = Actions::Instance()->getMapping(_actionsList->getSelected());
 
-			if (key != 0) {
-				// ScummVM mappings for F1-F9 are different from SDL so remap back to sdl
-				if (key >= 315 && key <= 323) {
-					key = key - 315 + SDLK_F1;
-				}
-			}
-
+			uint16 key = Actions::Instance()->getMapping(_actionsList->getSelected());
+#ifdef __SYMBIAN32__
+			// ScummVM mappings for F1-F9 are different from SDL so remap back to sdl
+			if (key >= 315 && key <= 323)
+				key = key - 315 + SDLK_F1;
+#endif
 			if (key != 0)
 				sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
 			else
 				sprintf(selection, "Associated key : none");
-#else
-			sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)(_actionsList->getSelected()))).c_str());
-#endif
+
 			_keyMapping->setLabel(selection);
 			_keyMapping->draw();
 		}
@@ -102,21 +94,17 @@
 			char selection[100];
 
 			_actionSelected = _actionsList->getSelected();
-#ifdef __SYMBIAN32__
 			uint16 key = Actions::Instance()->getMapping(_actionSelected);
-			if (key != 0) {
-				// ScummVM mappings for F1-F9 are different from SDL so remap back to sdl
-				if (key >= 315 && key <= 323) {
-					key = key - 315 + SDLK_F1;
-				}
-
+#ifdef __SYMBIAN32__
+			// ScummVM mappings for F1-F9 are different from SDL so remap back to sdl
+			if (key >= 315 && key <= 323)
+				key = key - 315 + SDLK_F1;
+#endif
+			if (key != 0) 
 				sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
-			}
 			else
 				sprintf(selection, "Associated key : none");
-#else
-			sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)_actionSelected)).c_str());
-#endif
+
 			_actionTitle->setLabel("Press the key to associate");
 			_keyMapping->setLabel(selection);
 			_keyMapping->draw();
@@ -137,29 +125,25 @@
 }
 
 void KeysDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers){
-	if (!Actions::Instance()->mappingActive()) {
+	if (!Actions::Instance()->mappingActive())
 		Dialog::handleKeyDown(ascii,keycode,modifiers);
-	}
 }
 
 void KeysDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
 #ifdef __SYMBIAN32__
 	if (Actions::Instance()->mappingActive()) {
 #else
-		// GAPI key was selected
-		if (modifiers == 0xff  && Actions::Instance()->mappingActive()) {
+	if (modifiers == 0xff  && Actions::Instance()->mappingActive()) {	// GAPI key was selected
 #endif
 		char selection[100];
 
 		Actions::Instance()->setMapping((ActionType)_actionSelected, ascii);
-#ifdef __SYMBIAN32__
+
 		if (ascii != 0)
 			sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey) keycode));
 		else
 			sprintf(selection, "Associated key : none");
-#else
-		sprintf(selection, "Associated key : %s", CEDevice::getKeyName(Actions::Instance()->getMapping((ActionType)_actionSelected)).c_str());
-#endif
+
 		_actionTitle->setLabel("Choose an action to map");
 		_keyMapping->setLabel(selection);
 		_keyMapping->draw();
@@ -167,10 +151,8 @@
 		_actionSelected = -1;
 		_actionsList->setEnabled(true);
 		Actions::Instance()->beginMapping(false);
-	}
-	else {
+	} else 
 		Dialog::handleKeyUp(ascii,keycode,modifiers);
-	}
 }
 
 } // namespace GUI


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list