153
154
155
156
157
158
159
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if(m&KMOD_SHIFT) i|=MOD_SHIFT;
if(m&KMOD_ALT) i|=MOD_ALT;
if(m&KMOD_META) i|=MOD_META;
if((m&KMOD_NUM) && kb->m[i|MOD_NUMLOCK].cmd) i|=MOD_NUMLOCK;
return kb->m+i;
}
int exec_key_binding(SDL_Event*ev,int editing,int x,int y,int(*cb)(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux),void*aux) {
const UserCommand*cmd=find_key_binding(ev,editing);
int prev=0;
int i;
switch(cmd->cmd) {
case 0:
return 0;
case '^':
return cb(0,cmd->n*'\0\1'+'^\0',0,0,0,aux);
case '=': case '-': case '+':
return cb(0,cmd->cmd*'\1\0'+'\0 ',cmd->n,0,0,aux);
case '\'':
return cb(0,'\' ',cmd->n,0,0,aux);
case '!':
system(cmd->txt);
return 0;
case 's':
sqlite3_reset(cmd->stmt);
sqlite3_clear_bindings(cmd->stmt);
break;
default:
fprintf(stderr,"Confusion in exec_key_binding()\n");
return 0;
}
}
|