X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcommand.c;h=733bf6a314567d26a04b78a4c84e26848b1f5640;hb=76a8fab4adc293982f355609b89dde88d5f355e0;hp=f94481ccc8026bfc73313bd16919da2deedc32dd;hpb=38880bd748572c2f3b05c6625ab1029ece2483c4;p=ncmpc.git diff --git a/src/command.c b/src/command.c index f94481c..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 @@ -61,6 +60,7 @@ extern void screen_resize(void); #define F4 KEY_F(4) #define F5 KEY_F(5) #define F6 KEY_F(6) +#define F7 KEY_F(7) static command_definition_t cmds[] = @@ -117,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", @@ -136,6 +138,10 @@ static command_definition_t cmds[] = { { 'a', 0, 0 }, 0, CMD_ADD, "add", N_("Add url/file to playlist") }, + { { '!', 0, 0 }, 0, CMD_GO_ROOT_DIRECTORY, "go-root-directory", + N_("Go to root directory") }, + { { '"', 0, 0 }, 0, CMD_GO_PARENT_DIRECTORY, "go-parent-directory", + N_("Go to parent directory") }, /* lists */ { { 11, 0, 0 }, 0, CMD_LIST_MOVE_UP, "move-up", @@ -187,6 +193,15 @@ static command_definition_t cmds[] = { {'6', F6, 0 }, 0, CMD_SCREEN_CLOCK, "screen-clock", N_("Clock screen") }, #endif +#ifdef ENABLE_LYRICS_SCREEN + { {'7', F7, 0 }, 0, CMD_SCREEN_LYRICS, "screen-lyrics", + N_("Lyrics screen") }, + { {ESC, 0, 0 }, 0, CMD_INTERRUPT, "lyrics-interrupt", + N_("Interrupt action") }, + { {'u', 0, 0 }, 0, CMD_LYRICS_UPDATE, "lyrics-update", + N_("Update Lyrics") }, +#endif + { { -1, -1, -1 }, 0, CMD_NONE, NULL, NULL } }; @@ -197,7 +212,7 @@ get_command_definitions(void) return cmds; } -char * +const char * key2str(int key) { static char buf[32]; @@ -273,7 +288,7 @@ command_dump_keys(void) } } -int +static int set_key_flags(command_definition_t *cp, command_t command, int flags) { int i; @@ -291,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; @@ -321,7 +336,7 @@ get_key_names(command_t command, int all) return NULL; } -char * +const char * get_key_description(command_t command) { int i; @@ -336,7 +351,7 @@ get_key_description(command_t command) return NULL; } -char * +const char * get_key_command_name(command_t command) { int i; @@ -367,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