/** * Load all the hotkeys from the file at filename, marking them as userdefined * if isUserDefined is set. */ static void loadHotkeysFromFile( const char* filename, int isUserDefined, int warnIfNotFound ) { char line[1100]; FILE* f = fopen(filename,"r"); if( !f ) { if( warnIfNotFound ) { fprintf(stderr,_("Failed to open hotkey definition file: %s\n"), filename ); } return; } while ( fgets(line,sizeof(line),f)!=NULL ) { int append = 0; if ( *line=='#' ) continue; char* pt = strchr(line,':'); if ( pt==NULL ) continue; *pt = '\0'; char* keydefinition = pt+1; chomp( keydefinition ); keydefinition = trimspaces( keydefinition ); char* action = line; if( line[0] == '+' ) { append = 1; action++; } hotkeySetFull( action, keydefinition, append, isUserDefined ); } fclose(f); }
Hotkey* hotkeySet( char* action, char* keydefinition, int append ) { int isUserDefined = 1; return hotkeySetFull( action, keydefinition, append, isUserDefined ); }