Changeset 7403 for code/trunk/src/modules/notifications/dispatchers
- Timestamp:
- Sep 11, 2010, 10:20:44 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/notifications (added) merged: 7319,7324,7326,7338-7343,7348-7349,7351,7354-7355,7358-7360,7362,7395,7398-7400
- Property svn:mergeinfo changed
-
code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
r7285 r7403 38 38 #include "core/input/KeyBinderManager.h" 39 39 #include "core/input/KeyBinder.h" 40 #include "util/SubString.h" 40 41 41 42 #include <sstream> … … 88 89 std::stringstream stream; 89 90 stream << this->getPreMessage(); 90 //TODO: Add niceifyer. 91 stream << KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand()); 91 stream << this->bindingNiceifyer(KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand())); 92 92 stream << this->getPostMessage(); 93 std::string* message = new std::string(stream.str()); 94 return *message; 93 return *(new std::string(stream.str())); 94 } 95 96 /** 97 @brief 98 Transforms the input binding into a human readable form. 99 @param binding 100 The binding to be transformed 101 @return 102 Returns a human readable version of the input binding. 103 */ 104 const std::string& CommandNotification::bindingNiceifyer(const std::string& binding) 105 { 106 SubString string = SubString(binding, "."); 107 std::string name; 108 std::string group; 109 switch(string.size()) 110 { 111 case 0: 112 return binding; 113 case 1: 114 return binding; 115 case 2: 116 group = string[0]; 117 default: 118 name = string.subSet(1, string.size()).join("."); 119 } 120 121 std::stringstream stream; 122 if(group.compare("Keys") == 0) 123 stream << "Key " << name.substr(3); 124 else if(group.compare("MouseButtons") == 0) 125 stream << "Mouse " << name; 126 else if(group.compare("JoyStickButtons") == 0) 127 stream << "Joystick " << name; 128 else if(group.compare("JoyStickAxes") == 0) 129 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6); 130 else if(group.compare("MouseAxes") == 0) 131 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis"; 132 else 133 return binding; 134 135 return *(new std::string(stream.str())); 95 136 } 96 137 -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
r7285 r7403 104 104 { this->postMessage_ = message; } 105 105 106 const std::string& bindingNiceifyer(const std::string& binding); 107 106 108 }; 107 109
Note: See TracChangeset
for help on using the changeset viewer.