[Scummvm-cvs-logs] SF.net SVN: scummvm:[43091] scummvm/branches/gsoc2009-16bit/backends

upthorn at users.sourceforge.net upthorn at users.sourceforge.net
Fri Aug 7 03:17:57 CEST 2009


Revision: 43091
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43091&view=rev
Author:   upthorn
Date:     2009-08-07 01:17:57 +0000 (Fri, 07 Aug 2009)

Log Message:
-----------
key remap dialog correctly reads keystrokes again, and can tell modified keys from unmodified keys (but does not yet print modifier prefixes, and actions mapped to modified keys still do not trigger)

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/backends/keymapper/hardware-key.h
    scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.cpp
    scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.h
    scummvm/branches/gsoc2009-16bit/backends/keymapper/remap-dialog.cpp
    scummvm/branches/gsoc2009-16bit/backends/platform/sdl/hardwarekeys.cpp

Modified: scummvm/branches/gsoc2009-16bit/backends/keymapper/hardware-key.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/keymapper/hardware-key.h	2009-08-06 18:25:32 UTC (rev 43090)
+++ scummvm/branches/gsoc2009-16bit/backends/keymapper/hardware-key.h	2009-08-07 01:17:57 UTC (rev 43091)
@@ -127,12 +127,32 @@
 		List<const HardwareKey*>::const_iterator it;
 
 		for (it = _keys.begin(); it != _keys.end(); it++) {
-			if ((*it)->key == keystate)
+			if ((*it)->key.keycode == keystate.keycode)
 				return (*it);
 		}
 		return 0;
 	}
 
+	const HardwareMod *findHardwareMod(const char *id) const {
+		List<const HardwareMod*>::const_iterator it;
+
+		for (it = _mods.begin(); it != _mods.end(); it++) {
+			if (strncmp((*it)->hwModId, id, HWKEY_ID_SIZE) == 0)
+				return (*it);
+		}
+		return 0;
+	}
+
+	const HardwareMod *findHardwareMod(const KeyState& keystate) const {
+		List<const HardwareMod*>::const_iterator it;
+
+		for (it = _mods.begin(); it != _mods.end(); it++) {
+			if ((*it)->modFlags == keystate.flags)
+				return (*it);
+		}
+		return 0;
+	}
+
 	const List<const HardwareKey*> &getHardwareKeys() const {
 		return _keys;
 	}

Modified: scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.cpp	2009-08-06 18:25:32 UTC (rev 43090)
+++ scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.cpp	2009-08-07 01:17:57 UTC (rev 43091)
@@ -272,6 +272,10 @@
 	return (_hardwareKeys) ? _hardwareKeys->findHardwareKey(key) : 0;
 }
 
+const HardwareMod *Keymapper::findHardwareMod(const KeyState& key) {
+	return (_hardwareKeys) ? _hardwareKeys->findHardwareMod(key) : 0;
+}
+
 } // end of namespace Common
 
 #endif // #ifdef ENABLE_KEYMAPPER

Modified: scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.h	2009-08-06 18:25:32 UTC (rev 43090)
+++ scummvm/branches/gsoc2009-16bit/backends/keymapper/keymapper.h	2009-08-07 01:17:57 UTC (rev 43091)
@@ -170,6 +170,11 @@
 	 */
 	const HardwareKey *findHardwareKey(const KeyState& key);
 
+	/**
+	 * Return a HardwareMod pointer for the given key state
+	 */
+	const HardwareMod *findHardwareMod(const KeyState& key);
+
 	Domain& getGlobalDomain() { return _globalDomain; }
 	Domain& getGameDomain() { return _gameDomain; }
 	const Stack<MapRecord>& getActiveStack() const { return _activeMaps; }

Modified: scummvm/branches/gsoc2009-16bit/backends/keymapper/remap-dialog.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/keymapper/remap-dialog.cpp	2009-08-06 18:25:32 UTC (rev 43090)
+++ scummvm/branches/gsoc2009-16bit/backends/keymapper/remap-dialog.cpp	2009-08-07 01:17:57 UTC (rev 43091)
@@ -239,11 +239,15 @@
 void RemapDialog::handleKeyUp(Common::KeyState state) {
 	if (_activeRemapAction) {
 		const HardwareKey *hwkey = _keymapper->findHardwareKey(state);
+		const HardwareMod *hwmod = _keymapper->findHardwareMod(state);
 
 		debug(0, "Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
 
 		if (hwkey) {
-			_activeRemapAction->mapKey(hwkey);
+			HardwareKey *temphwkey = new HardwareKey(*hwkey);
+			temphwkey->description = hwkey->description;
+			temphwkey->key.flags = hwmod->modFlags;
+			_activeRemapAction->mapKey(temphwkey);
 			_activeRemapAction->getParent()->saveMappings();
 			_changes = true;
 			stopRemapping();

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/hardwarekeys.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/hardwarekeys.cpp	2009-08-06 18:25:32 UTC (rev 43090)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/hardwarekeys.cpp	2009-08-07 01:17:57 UTC (rev 43091)
@@ -86,32 +86,32 @@
 	{"CARET", KEYCODE_CARET, '^', "^", kActionKeyType, ~0},
 	{"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, ~0},
 	{"BACKQUOTE", KEYCODE_BACKQUOTE, '`', "`", kActionKeyType, ~0},
-	{"a", KEYCODE_a, 'A', "A", kActionKeyType, ~0},
-	{"b", KEYCODE_b, 'B', "B", kActionKeyType, ~0},
-	{"c", KEYCODE_c, 'C', "C", kActionKeyType, ~0},
-	{"d", KEYCODE_d, 'D', "D", kActionKeyType, ~0},
-	{"e", KEYCODE_e, 'E', "E", kActionKeyType, ~0},
-	{"f", KEYCODE_f, 'F', "F", kActionKeyType, ~0},
-	{"g", KEYCODE_g, 'G', "G", kActionKeyType, ~0},
-	{"h", KEYCODE_h, 'H', "H", kActionKeyType, ~0},
-	{"i", KEYCODE_i, 'I', "I", kActionKeyType, ~0},
-	{"j", KEYCODE_j, 'J', "J", kActionKeyType, ~0},
-	{"k", KEYCODE_k, 'K', "K", kActionKeyType, ~0},
-	{"l", KEYCODE_l, 'L', "L", kActionKeyType, ~0},
-	{"m", KEYCODE_m, 'M', "M", kActionKeyType, ~0},
-	{"n", KEYCODE_n, 'N', "N", kActionKeyType, ~0},
-	{"o", KEYCODE_o, 'O', "O", kActionKeyType, ~0},
-	{"p", KEYCODE_p, 'P', "P", kActionKeyType, ~0},
-	{"q", KEYCODE_q, 'Q', "Q", kActionKeyType, ~0},
-	{"r", KEYCODE_r, 'R', "R", kActionKeyType, ~0},
-	{"s", KEYCODE_s, 'S', "S", kActionKeyType, ~0},
-	{"t", KEYCODE_t, 'T', "T", kActionKeyType, ~0},
-	{"u", KEYCODE_u, 'U', "U", kActionKeyType, ~0},
-	{"v", KEYCODE_v, 'V', "V", kActionKeyType, ~0},
-	{"w", KEYCODE_w, 'W', "W", kActionKeyType, ~0},
-	{"x", KEYCODE_x, 'X', "X", kActionKeyType, ~0},
-	{"y", KEYCODE_y, 'Y', "Y", kActionKeyType, ~0},
-	{"z", KEYCODE_z, 'Z', "Z", kActionKeyType, ~0},
+	{"a", KEYCODE_a, 'a', "A", kActionKeyType, ~0},
+	{"b", KEYCODE_b, 'b', "B", kActionKeyType, ~0},
+	{"c", KEYCODE_c, 'c', "C", kActionKeyType, ~0},
+	{"d", KEYCODE_d, 'd', "D", kActionKeyType, ~0},
+	{"e", KEYCODE_e, 'e', "E", kActionKeyType, ~0},
+	{"f", KEYCODE_f, 'f', "F", kActionKeyType, ~0},
+	{"g", KEYCODE_g, 'g', "G", kActionKeyType, ~0},
+	{"h", KEYCODE_h, 'h', "H", kActionKeyType, ~0},
+	{"i", KEYCODE_i, 'i', "I", kActionKeyType, ~0},
+	{"j", KEYCODE_j, 'j', "J", kActionKeyType, ~0},
+	{"k", KEYCODE_k, 'k', "K", kActionKeyType, ~0},
+	{"l", KEYCODE_l, 'l', "L", kActionKeyType, ~0},
+	{"m", KEYCODE_m, 'm', "M", kActionKeyType, ~0},
+	{"n", KEYCODE_n, 'n', "N", kActionKeyType, ~0},
+	{"o", KEYCODE_o, 'o', "O", kActionKeyType, ~0},
+	{"p", KEYCODE_p, 'p', "P", kActionKeyType, ~0},
+	{"q", KEYCODE_q, 'q', "Q", kActionKeyType, ~0},
+	{"r", KEYCODE_r, 'r', "R", kActionKeyType, ~0},
+	{"s", KEYCODE_s, 's', "S", kActionKeyType, ~0},
+	{"t", KEYCODE_t, 't', "T", kActionKeyType, ~0},
+	{"u", KEYCODE_u, 'u', "U", kActionKeyType, ~0},
+	{"v", KEYCODE_v, 'v', "V", kActionKeyType, ~0},
+	{"w", KEYCODE_w, 'w', "W", kActionKeyType, ~0},
+	{"x", KEYCODE_x, 'x', "X", kActionKeyType, ~0},
+	{"y", KEYCODE_y, 'y', "Y", kActionKeyType, ~0},
+	{"z", KEYCODE_z, 'z', "Z", kActionKeyType, ~0},
 	{"DELETE", KEYCODE_DELETE, 0, "Del", kActionKeyType, ~0},
 
 	// Numeric keypad


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