[Scummvm-cvs-logs] SF.net SVN: scummvm:[33497] scummvm/branches/gsoc2008-vkeybd
kenny-d at users.sourceforge.net
kenny-d at users.sourceforge.net
Fri Aug 1 18:44:51 CEST 2008
Revision: 33497
http://scummvm.svn.sourceforge.net/scummvm/?rev=33497&view=rev
Author: kenny-d
Date: 2008-08-01 16:44:49 +0000 (Fri, 01 Aug 2008)
Log Message:
-----------
Keymapper WIP:
* Renamed UserAction to simply Action
* Implemented simple automatic mapping algorithm
Modified Paths:
--------------
scummvm/branches/gsoc2008-vkeybd/backends/common/hardware-key.h
scummvm/branches/gsoc2008-vkeybd/backends/common/keymap-manager.cpp
scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.cpp
scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.h
scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.cpp
scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.h
scummvm/branches/gsoc2008-vkeybd/backends/module.mk
scummvm/branches/gsoc2008-vkeybd/dists/msvc8/scummvm.vcproj
Added Paths:
-----------
scummvm/branches/gsoc2008-vkeybd/backends/common/action.cpp
scummvm/branches/gsoc2008-vkeybd/backends/common/action.h
Removed Paths:
-------------
scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.cpp
scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.h
Copied: scummvm/branches/gsoc2008-vkeybd/backends/common/action.cpp (from rev 33449, scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.cpp)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/action.cpp (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/action.cpp 2008-08-01 16:44:49 UTC (rev 33497)
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* $URL$
+* $Id$
+*
+*/
+
+#include "backends/common/action.h"
+#include "backends/common/keymap.h"
+
+namespace Common {
+
+Action::Action(String des, ActionCategory cat, ActionType ty,
+ int pr, int gr, int fl) {
+ description = des;
+ category = cat;
+ type = ty;
+ priority = pr;
+ group = gr;
+ flags = fl;
+ _hwKey = 0;
+ _parent = 0;
+}
+
+void Action::setParent(Keymap *parent) {
+ _parent = parent;
+}
+
+void Action::mapKey(const HardwareKey *key) {
+ assert(_parent);
+ if (_hwKey) _parent->unregisterMapping(this);
+ _hwKey = key;
+ if (_hwKey) _parent->registerMapping(this, key);
+}
+
+const HardwareKey *Action::getMappedKey() const {
+ return _hwKey;
+}
+
+} // end of namespace Common
Property changes on: scummvm/branches/gsoc2008-vkeybd/backends/common/action.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: scummvm/branches/gsoc2008-vkeybd/backends/common/action.h (from rev 33449, scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.h)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/action.h (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/action.h 2008-08-01 16:44:49 UTC (rev 33497)
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* $URL$
+* $Id$
+*
+*/
+
+#ifndef COMMON_ACTION
+#define COMMON_ACTION
+
+#include "common/events.h"
+#include "common/func.h"
+#include "common/list.h"
+#include "common/str.h"
+
+namespace Common {
+
+struct HardwareKey;
+class Keymap;
+
+
+enum ActionType {
+ kGenericActionType,
+
+ // common actions
+ kDirectionUpAction,
+ kDirectionDownAction,
+ kDirectionLeftAction,
+ kDirectionRightAction,
+ kLeftClickAction,
+ kRightClickAction,
+ kSaveAction,
+ kMenuAction,
+ kVirtualKeyboardAction,
+ kRemapKeysAction,
+
+ kActionTypeMax
+};
+
+enum ActionCategory {
+ kGenericActionCategory,
+ // classes of action - probably need to be slightly more specific than this
+ kInGameAction, // effects the actual gameplay
+ kSystemAction, //show a menu / change volume / etc
+
+ kActionCategoryMax
+};
+
+struct Action {
+ /** unique id used for saving/loading to config */
+ int32 id;
+ /** Human readable description */
+ String description;
+ /** Events to be sent when mapped key is pressed */
+ List<Event> events;
+
+ ActionCategory category;
+ ActionType type;
+ int priority;
+ int group;
+ int flags;
+
+private:
+ /** Hardware key that is mapped to this Action */
+ const HardwareKey *_hwKey;
+ Keymap *_parent;
+
+public:
+ Action( String des = "",
+ ActionCategory cat = kGenericActionCategory,
+ ActionType ty = kGenericActionType,
+ int pr = 0, int gr = 0, int fl = 0 );
+
+ void setParent(Keymap *parent);
+
+ void mapKey(const HardwareKey *key);
+
+ const HardwareKey *getMappedKey() const;
+};
+
+struct ActionPriorityComp : public BinaryFunction<Action, Action, bool> {
+ bool operator()(const Action *x, const Action *y) const {
+ return x->priority > y->priority;
+ }
+ bool operator()(const Action &x, const Action &y) const {
+ return x.priority > y.priority;
+ }
+};
+
+} // end of namespace Common
+
+#endif
Property changes on: scummvm/branches/gsoc2008-vkeybd/backends/common/action.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/hardware-key.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/hardware-key.h 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/hardware-key.h 2008-08-01 16:44:49 UTC (rev 33497)
@@ -26,7 +26,7 @@
#ifndef COMMON_HARDWAREKEY
#define COMMON_HARDWAREKEY
-#include "backends/common/user-action.h"
+#include "backends/common/action.h"
namespace Common {
@@ -44,13 +44,13 @@
*/
KeyState key;
- UserActionCategory preferredCategory;
- UserActionType preferredType;
+ ActionCategory preferredCategory;
+ ActionType preferredType;
int16 group;
HardwareKey(KeyState ks = KeyState(), String des = "",
- UserActionCategory cat = kGenericUserActionCategory,
- UserActionType ty = kGenericUserActionType, int gr = 0) {
+ ActionCategory cat = kGenericActionCategory,
+ ActionType ty = kGenericActionType, int gr = 0) {
key = ks;
description = des;
preferredCategory = cat;
@@ -98,7 +98,15 @@
return 0;
}
+ List<HardwareKey*> getHardwareKeys() const {
+ return _keys;
+ }
+ uint count() const {
+ return _keys.size();
+ }
+
+
private:
void checkForKey(HardwareKey *key) {
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/keymap-manager.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/keymap-manager.cpp 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/keymap-manager.cpp 2008-08-01 16:44:49 UTC (rev 33497)
@@ -24,6 +24,7 @@
*/
#include "backends/common/keymap-manager.h"
+#include "common/algorithm.h"
namespace Common {
@@ -112,17 +113,17 @@
if (!key.hasPrefix(prefix.c_str()))
continue;
- // parse UserAction ID
+ // parse Action ID
const char *actionIdStart = key.c_str() + prefix.size();
char *err;
int32 actionId = (int32) strtol(actionIdStart, &err, 0);
if (err == actionIdStart) {
- warning("'%s' is not a valid UserAction ID", err);
+ warning("'%s' is not a valid Action ID", err);
continue;
}
- UserAction *ua = map->getUserAction(actionId);
+ Action *ua = map->getAction(actionId);
if (!ua) {
- warning("'%s' keymap does not contain UserAction with ID %d",
+ warning("'%s' keymap does not contain Action with ID %d",
name.c_str(), (int)actionId);
continue;
}
@@ -145,30 +146,72 @@
}
bool KeymapManager::isMapComplete(const Keymap *map) {
- return false;
+ const List<Action*>& actions = map->getActions();
+ List<Action*>::const_iterator it;
+ bool allMapped = true;
+ uint numberMapped = 0;
+ for (it = actions.begin(); it != actions.end(); it++) {
+ if ((*it)->getMappedKey()) {
+ numberMapped++;
+ } else {
+ allMapped = false;
+ break;
+ }
+ }
+ return (allMapped || numberMapped == _hardwareKeys->count());
}
void KeymapManager::saveKeymap(ConfigManager::Domain *domain,
const String& name,
const Keymap *map) {
- const Array<UserAction>& actions = map->getUserActions();
- Array<UserAction>::const_iterator it;
+ const List<Action*>& actions = map->getActions();
+ List<Action*>::const_iterator it;
char buf[11];
for (it = actions.begin(); it != actions.end(); it++) {
String key("km_");
- sprintf(buf, "%d", it->id);
+ sprintf(buf, "%d", (*it)->id);
key += name + "_" + buf;
- if (it->getMappedKey())
- sprintf(buf, "%d", it->getMappedKey()->id);
+ if ((*it)->getMappedKey())
+ sprintf(buf, "%d", (*it)->getMappedKey()->id);
else
strcpy(buf, "");
domain->setVal(key, buf);
}
}
-
void KeymapManager::automaticMap(Keymap *map) {
+ List<Action*> actions(map->getActions()), unmapped;
+ List<Action*>::iterator actIt;
+ List<HardwareKey*> keys = _hardwareKeys->getHardwareKeys();
+ List<HardwareKey*>::iterator keyIt, selectedKey;
+ // sort by priority
+ ActionPriorityComp priorityComp;
+ sort(actions.begin(), actions.end(), priorityComp);
+
+ for (actIt = actions.begin(); actIt != actions.end(); actIt++) {
+ selectedKey = keys.end();
+ Action *act = *actIt;
+ for (keyIt = keys.begin(); keyIt != keys.end(); keyIt++) {
+ if ((*keyIt)->preferredType == act->type) {
+ selectedKey = keyIt;
+ break;
+ } else if ((*keyIt)->preferredCategory == act->category) {
+ selectedKey = keyIt;
+ }
+ }
+ if (selectedKey != keys.end()) {
+ act->mapKey(*selectedKey);
+ keys.erase(selectedKey);
+ } else
+ unmapped.push_back(act);
+ }
+
+ actIt = unmapped.begin();
+ keyIt = keys.begin();
+ while (actIt != unmapped.end() && keyIt != keys.end())
+ (*actIt)->mapKey(*keyIt);
+
}
void KeymapManager::unregisterAllGameKeymaps() {
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.cpp 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.cpp 2008-08-01 16:44:49 UTC (rev 33497)
@@ -29,28 +29,24 @@
namespace Common {
Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap() {
- init();
- for (uint i = 0; i < _actions.size(); i++) {
- const HardwareKey *hwKey = _actions[i].getMappedKey();
+ List<Action*>::iterator it;
+ for (it = _actions.begin(); it != _actions.end(); it++) {
+ const HardwareKey *hwKey = (*it)->getMappedKey();
if (hwKey) {
- _keymap[hwKey->key] = &_actions[i];
+ _keymap[hwKey->key] = *it;
}
}
}
-void Keymap::init() {
- _actions.reserve(20);
-}
-
-void Keymap::addAction(UserAction& action) {
- if (findUserAction(action.id))
- error("UserAction with id %d already in KeyMap!", action.id);
- action.setParent(this);
+void Keymap::addAction(Action *action) {
+ if (findAction(action->id))
+ error("Action with id %d already in KeyMap!", action->id);
+ action->setParent(this);
_actions.push_back(action);
}
-void Keymap::registerMapping(UserAction *action, const HardwareKey *hwKey) {
- HashMap<KeyState, UserAction*>::iterator it;
+void Keymap::registerMapping(Action *action, const HardwareKey *hwKey) {
+ HashMap<KeyState, Action*>::iterator it;
it = _keymap.find(hwKey->key);
// if key is already mapped to an action then un-map it
if (it != _keymap.end())
@@ -59,36 +55,36 @@
_keymap[hwKey->key] = action;
}
-void Keymap::unregisterMapping(UserAction *action) {
+void Keymap::unregisterMapping(Action *action) {
const HardwareKey *hwKey = action->getMappedKey();
if (hwKey)
_keymap[hwKey->key] = 0;
}
-UserAction *Keymap::getUserAction(int32 id) {
- return findUserAction(id);
+Action *Keymap::getAction(int32 id) {
+ return findAction(id);
}
-UserAction *Keymap::findUserAction(int32 id) {
- Array<UserAction>::iterator it;
+Action *Keymap::findAction(int32 id) {
+ List<Action*>::iterator it;
for (it = _actions.begin(); it != _actions.end(); it++) {
- if (it->id == id)
- return &*it;
+ if ((*it)->id == id)
+ return *it;
}
return 0;
}
-const UserAction *Keymap::findUserAction(int32 id) const {
- Array<UserAction>::const_iterator it;
+const Action *Keymap::findAction(int32 id) const {
+ List<Action*>::const_iterator it;
for (it = _actions.begin(); it != _actions.end(); it++) {
- if (it->id == id)
- return &*it;
+ if ((*it)->id == id)
+ return *it;
}
return 0;
}
-UserAction *Keymap::getMappedAction(const KeyState& ks) const {
- HashMap<KeyState, UserAction*>::iterator it;
+Action *Keymap::getMappedAction(const KeyState& ks) const {
+ HashMap<KeyState, Action*>::iterator it;
it = _keymap.find(ks);
if (it == _keymap.end())
return 0;
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.h 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/keymap.h 2008-08-01 16:44:49 UTC (rev 33497)
@@ -26,11 +26,11 @@
#ifndef COMMON_KEYMAP
#define COMMON_KEYMAP
-#include "common/array.h"
-#include "common/keyboard.h"
#include "common/func.h"
#include "common/hashmap.h"
-#include "backends/common/user-action.h"
+#include "common/keyboard.h"
+#include "common/list.h"
+#include "backends/common/action.h"
namespace Common {
@@ -49,62 +49,60 @@
class Keymap {
public:
- Keymap() { init(); }
+ Keymap() {}
Keymap(const Keymap& km);
-private:
- void init();
public:
/**
- * Adds a new UserAction to this Map,
+ * Adds a new Action to this Map,
* adding it at the back of the internal array
- * @param action the UserAction to add
+ * @param action the Action to add
*/
- void addAction(UserAction& action);
+ void addAction(Action *action);
/**
- * Retrieves the UserAction with the given id
- * @param id id of UserAction to retrieve
- * @return Pointer to the UserAction or 0 if not found
+ * Retrieves the Action with the given id
+ * @param id id of Action to retrieve
+ * @return Pointer to the Action or 0 if not found
*/
- UserAction *getUserAction(int32 id);
+ Action *getAction(int32 id);
/**
- * Get a read-only array of all the UserActions contained in this Keymap
+ * Get a read-only array of all the Actions contained in this Keymap
*/
- const Array<UserAction>& getUserActions() const { return _actions; }
+ const List<Action*>& getActions() const { return _actions; }
/**
- * Find the UserAction that a key is mapped to
- * @param key the key that is mapped to the required UserAction
- * @return a pointer to the UserAction or 0 if no
+ * Find the Action that a key is mapped to
+ * @param key the key that is mapped to the required Action
+ * @return a pointer to the Action or 0 if no
*/
- UserAction *getMappedAction(const KeyState& ks) const;
+ Action *getMappedAction(const KeyState& ks) const;
private:
- friend struct UserAction;
+ friend struct Action;
/**
- * Registers a HardwareKey to the given UserAction
- * @param action UserAction in this Keymap
+ * Registers a HardwareKey to the given Action
+ * @param action Action in this Keymap
* @param key pointer to HardwareKey to map
- * @see UserAction::mapKey
+ * @see Action::mapKey
*/
- void registerMapping(UserAction *action, const HardwareKey *key);
+ void registerMapping(Action *action, const HardwareKey *key);
/**
- * Unregisters a HardwareKey from the given UserAction (if one is mapped)
- * @param action UserAction in this Keymap
- * @see UserAction::mapKey
+ * Unregisters a HardwareKey from the given Action (if one is mapped)
+ * @param action Action in this Keymap
+ * @see Action::mapKey
*/
- void unregisterMapping(UserAction *action);
+ void unregisterMapping(Action *action);
- UserAction *findUserAction(int32 id);
- const UserAction *findUserAction(int32 id) const;
+ Action *findAction(int32 id);
+ const Action *findAction(int32 id) const;
- void internalMapKey(UserAction *action, HardwareKey *hwKey);
+ void internalMapKey(Action *action, HardwareKey *hwKey);
- Array<UserAction> _actions;
- HashMap<KeyState, UserAction*> _keymap;
+ List<Action*> _actions;
+ HashMap<KeyState, Action*> _keymap;
};
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.cpp 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.cpp 2008-08-01 16:44:49 UTC (rev 33497)
@@ -86,7 +86,7 @@
bool Keymapper::mapKey(const KeyState& key, bool isKeyDown) {
if (!_currentMap) return false;
- UserAction *action = _currentMap->getMappedAction(key);
+ Action *action = _currentMap->getMappedAction(key);
if (!action) return false;
List<Event>::iterator it;
for (it = action->events.begin(); it != action->events.end(); it++) {
Modified: scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.h 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/keymapper.h 2008-08-01 16:44:49 UTC (rev 33497)
@@ -81,8 +81,8 @@
/**
* @brief Map a key press event.
- * If the active keymap contains a UserAction mapped to the given key, then
- * the UserAction's events are pushed into the EventManager's event queue.
+ * If the active keymap contains a Action mapped to the given key, then
+ * the Action's events are pushed into the EventManager's event queue.
* @param key key that was pressed
* @param isKeyDown true for key down, false for key up
* @return true if key was mapped
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.cpp 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.cpp 2008-08-01 16:44:49 UTC (rev 33497)
@@ -1,58 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* $URL$
-* $Id$
-*
-*/
-
-#include "backends/common/user-action.h"
-#include "backends/common/keymap.h"
-
-namespace Common {
-
-UserAction::UserAction(String des, UserActionCategory cat, UserActionType ty,
- int pr, int gr, int fl) {
- description = des;
- category = cat;
- type = ty;
- priority = pr;
- group = gr;
- flags = fl;
- _hwKey = 0;
- _parent = 0;
-}
-
-void UserAction::setParent(Keymap *parent) {
- _parent = parent;
-}
-
-void UserAction::mapKey(const HardwareKey *key) {
- assert(_parent);
- if (_hwKey) _parent->unregisterMapping(this);
- _hwKey = key;
- if (_hwKey) _parent->registerMapping(this, key);
-}
-
-const HardwareKey *UserAction::getMappedKey() const {
- return _hwKey;
-}
-
-} // end of namespace Common
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.h 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/common/user-action.h 2008-08-01 16:44:49 UTC (rev 33497)
@@ -1,98 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* $URL$
-* $Id$
-*
-*/
-
-#ifndef COMMON_USERACTION
-#define COMMON_USERACTION
-
-#include "common/events.h"
-#include "common/list.h"
-#include "common/str.h"
-
-namespace Common {
-
-struct HardwareKey;
-class Keymap;
-
-
-enum UserActionType {
- kGenericUserActionType,
-
- // common actions
- kDirectionUpUserAction,
- kDirectionDownUserAction,
- kDirectionLeftUserAction,
- kDirectionRightUserAction,
- kLeftClickUserAction,
- kRightClickUserAction,
- kSaveUserAction,
- kMenuUserAction,
-
- kUserActionTypeMax
-};
-
-enum UserActionCategory {
- kGenericUserActionCategory,
- // classes of action - probably need to be slightly more specific than this
- kInGameUserAction, // effects the actual gameplay
- kSystemUserAction, //show a menu / change volume / etc
-
- kUserActionCategoryMax
-};
-
-struct UserAction {
- /** unique id used for saving/loading to config */
- int32 id;
- /** Human readable description */
- String description;
- /** Events to be sent when mapped key is pressed */
- List<Event> events;
-
- UserActionCategory category;
- UserActionType type;
- int priority;
- int group;
- int flags;
-
-private:
- /** Hardware key that is mapped to this UserAction */
- const HardwareKey *_hwKey;
- Keymap *_parent;
-
-public:
- UserAction( String des = "",
- UserActionCategory cat = kGenericUserActionCategory,
- UserActionType ty = kGenericUserActionType,
- int pr = 0, int gr = 0, int fl = 0 );
-
- void setParent(Keymap *parent);
-
- void mapKey(const HardwareKey *key);
-
- const HardwareKey *getMappedKey() const;
-};
-
-} // end of namespace Common
-
-#endif
Modified: scummvm/branches/gsoc2008-vkeybd/backends/module.mk
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/module.mk 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/backends/module.mk 2008-08-01 16:44:49 UTC (rev 33497)
@@ -34,7 +34,7 @@
common/keymap.o \
common/keymap-manager.o \
common/keymapper.o \
- common/user-action.o \
+ common/action.o \
# Include common rules
include $(srcdir)/rules.mk
Modified: scummvm/branches/gsoc2008-vkeybd/dists/msvc8/scummvm.vcproj
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/dists/msvc8/scummvm.vcproj 2008-08-01 16:33:22 UTC (rev 33496)
+++ scummvm/branches/gsoc2008-vkeybd/dists/msvc8/scummvm.vcproj 2008-08-01 16:44:49 UTC (rev 33497)
@@ -1057,6 +1057,14 @@
Name="common"
>
<File
+ RelativePath="..\..\backends\common\action.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\backends\common\action.h"
+ >
+ </File>
+ <File
RelativePath="..\..\backends\common\hardware-key.h"
>
</File>
@@ -1085,14 +1093,6 @@
>
</File>
<File
- RelativePath="..\..\backends\common\user-action.cpp"
- >
- </File>
- <File
- RelativePath="..\..\backends\common\user-action.h"
- >
- </File>
- <File
RelativePath="..\..\backends\common\virtual-keyboard-gui.cpp"
>
</File>
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