// Description: // Keyboard/Trigger helpers. // // Copyright (C) 2001 Frank Becker // // 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 // #if (__GNUC__ == 2 ) && (GNUC_MINOR__ < 96) #include #define ostringstream ostrstream #else #include #endif #include #include bool Keys::convertStringToTrigger( string & keyname, Trigger & trigger) { // XTRACE(); if( keyname == "MOTION") { trigger.type = eMotionTrigger; trigger.data1= 0; trigger.data2= 0; trigger.data3= 0; return true; } if( keyname.substr(0,11) == "MOUSEBUTTON") { trigger.type = eButtonTrigger; if( keyname.length() == 12) { trigger.data1= keyname[11] - '0'; } else { trigger.data1= 1; //default to button 1 } // trigger.data1= atoi( keyname.substr(11,1).c_str()); trigger.data2= 0; trigger.data3= 0; return true; } trigger.type = eKeyTrigger; unsigned int i; for( i=0; i