X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcommand.c;h=733bf6a314567d26a04b78a4c84e26848b1f5640;hb=76a8fab4adc293982f355609b89dde88d5f355e0;hp=3210f39d9bb242e2a8a314831caac37ed802cb83;hpb=aee50deefe83ea3a79255cb64a252c58775f8a5b;p=ncmpc.git diff --git a/src/command.c b/src/command.c index 3210f39..733bf6a 100644 --- a/src/command.c +++ b/src/command.c @@ -30,6 +30,8 @@ #include "config.h" #include "ncmpc.h" #include "command.h" +#include "mpdclient.h" +#include "screen.h" #undef DEBUG_KEYS @@ -39,9 +41,6 @@ #define DK(x) #endif -extern void sigstop(void); -extern void screen_resize(void); - #define BS KEY_BACKSPACE #define DEL KEY_DC #define UP KEY_UP @@ -118,6 +117,8 @@ static command_definition_t cmds[] = N_("Decrease volume") }, { { ' ', 0, 0 }, 0, CMD_SELECT, "select", N_("Select/deselect song in playlist") }, + { { 't', 0, 0 }, 0, CMD_SELECT_ALL, "select_all", + N_("Select all listed items") }, { { DEL, 'd', 0 }, 0, CMD_DELETE, "delete", N_("Delete song from playlist") }, { { 'Z', 0, 0 }, 0, CMD_SHUFFLE, "shuffle", @@ -211,7 +212,7 @@ get_command_definitions(void) return cmds; } -char * +const char * key2str(int key) { static char buf[32]; @@ -287,7 +288,7 @@ command_dump_keys(void) } } -int +static int set_key_flags(command_definition_t *cp, command_t command, int flags) { int i; @@ -305,7 +306,7 @@ set_key_flags(command_definition_t *cp, command_t command, int flags) return 1; } -char * +const char * get_key_names(command_t command, int all) { int i; @@ -335,7 +336,7 @@ get_key_names(command_t command, int all) return NULL; } -char * +const char * get_key_description(command_t command) { int i; @@ -350,7 +351,7 @@ get_key_description(command_t command) return NULL; } -char * +const char * get_key_command_name(command_t command) { int i; @@ -381,21 +382,21 @@ get_key_command_from_name(char *name) } -command_t +command_t find_key_command(int key, command_definition_t *cmds) { - int i; + int i; + + i=0; + while (key && cmds && cmds[i].name) { + if (cmds[i].keys[0] == key || + cmds[i].keys[1] == key || + cmds[i].keys[2] == key) + return cmds[i].command; + i++; + } - i=0; - while( key && cmds && cmds[i].name ) - { - if( cmds[i].keys[0] == key || - cmds[i].keys[1] == key || - cmds[i].keys[2] == key ) - return cmds[i].command; - i++; - } - return CMD_NONE; + return CMD_NONE; } command_t