Add 10 more custom key binding. Issue: #218

This commit is contained in:
QC 2015-09-02 10:05:02 +02:00
parent 583e824726
commit 9d7518c7ab
3 changed files with 75 additions and 72 deletions

View File

@ -32,6 +32,16 @@ typedef enum _KeyBindingAction
CUSTOM_7,
CUSTOM_8,
CUSTOM_9,
CUSTOM_10,
CUSTOM_11,
CUSTOM_12,
CUSTOM_13,
CUSTOM_14,
CUSTOM_15,
CUSTOM_16,
CUSTOM_17,
CUSTOM_18,
CUSTOM_19,
ROW_LEFT,
ROW_RIGHT,
ROW_UP,

View File

@ -182,6 +182,56 @@ DefaultBinding bindings[NUM_ABE] =
.name = "kb-custom-9",
.keybinding = "Alt+9"
},
{
.id = CUSTOM_10,
.name = "kb-custom-10",
.keybinding = "Alt+0"
},
{
.id = CUSTOM_11,
.name = "kb-custom-11",
.keybinding = "Alt+Shift+1"
},
{
.id = CUSTOM_12,
.name = "kb-custom-12",
.keybinding = "Alt+Shift+2"
},
{
.id = CUSTOM_13,
.name = "kb-custom-13",
.keybinding = "Alt+Shift+3"
},
{
.id = CUSTOM_14,
.name = "kb-custom-14",
.keybinding = "Alt+Shift+4"
},
{
.id = CUSTOM_15,
.name = "kb-custom-15",
.keybinding = "Alt+Shift+5"
},
{
.id = CUSTOM_16,
.name = "kb-custom-16",
.keybinding = "Alt+Shift+6"
},
{
.id = CUSTOM_17,
.name = "kb-custom-17",
.keybinding = "Alt+Shift+7"
},
{
.id = CUSTOM_18,
.name = "kb-custom-18",
.keybinding = "Alt+Shift+8"
},
{
.id = CUSTOM_19,
.name = "kb-custom-19",
.keybinding = "Alt+Shift+9"
},
{
.id = ROW_LEFT,
.name = "kb-row-left",

View File

@ -1208,78 +1208,6 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
textbox_hide ( state.case_indicator );
}
}
else if ( abe_test_action ( CUSTOM_1, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 0 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_2, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 1 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_3, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 2 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_4, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 3 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_5, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 4 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_6, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 5 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_7, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 6 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_8, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 7 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
else if ( abe_test_action ( CUSTOM_9, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( 8 & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
// Special delete entry command.
else if ( abe_test_action ( DELETE_ENTRY, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
@ -1290,6 +1218,21 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
}
}
else{
for ( unsigned int a = CUSTOM_1; a <= CUSTOM_19; a++ ) {
if ( abe_test_action ( a, ev.xkey.state, key ) ) {
if ( state.selected < state.filtered_lines ) {
*( state.selected_line ) = state.line_map[state.selected];
}
state.retv = MENU_QUICK_SWITCH | ( ( a - CUSTOM_1 ) & MENU_LOWER_MASK );
state.quit = TRUE;
break;
}
}
// Skip if we detected key before.
if ( state.quit ) {
continue;
}
int rc = textbox_keypress ( state.text, &ev );
// Row is accepted.
if ( rc < 0 ) {