Code

Makefile.am: disable dist-bzip2
[ncmpc.git] / src / command.c
index 85e499a00873ad2c985dbfbb1241c26b7b1006f2..5621b165650b34fd2197b846755ee3c3967ef242 100644 (file)
 #include <signal.h>
 #include <unistd.h>
 
-#undef DEBUG_KEYS
-
-#ifdef DEBUG_KEYS
-#define DK(x) x
-#else
-#define DK(x)
-#endif
-
 #define KEY_CTL(x) ((x) & 0x1f) /* KEY_CTL(A) == ^A == \1 */
 
 #define BS   KEY_BACKSPACE
@@ -64,6 +56,7 @@
 #define F6   KEY_F(6)
 #define F7   KEY_F(7)
 #define F8   KEY_F(8)
+#define F9   KEY_F(9)
 #define C(x) KEY_CTL(x)
 
 static command_definition_t cmds[] = {
@@ -111,7 +104,7 @@ static command_definition_t cmds[] = {
        { { '1', F1, 'h' }, 0, CMD_SCREEN_HELP, "screen-help",
          N_("Help screen") },
        { { '2', F2, 0 }, 0, CMD_SCREEN_PLAY, "screen-playlist",
-         N_("Playlist screen") },
+         N_("Queue screen") },
        { { '3', F3, 0 }, 0, CMD_SCREEN_FILE, "screen-browse",
          N_("Browse screen") },
 
@@ -138,15 +131,15 @@ static command_definition_t cmds[] = {
        { { '-', LEFT, 0 }, 0, CMD_VOLUME_DOWN, "volume-down",
          N_("Decrease volume") },
        { { ' ', 0, 0 }, 0, CMD_SELECT, "select",
-         N_("Select/deselect song in playlist") },
+         N_("Select/deselect song in queue") },
        { { '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") },
+         N_("Delete song from queue") },
        { { 'Z', 0, 0 }, 0, CMD_SHUFFLE, "shuffle",
-         N_("Shuffle playlist") },
+         N_("Shuffle queue") },
        { { 'c', 0, 0 }, 0, CMD_CLEAR, "clear",
-         N_("Clear playlist") },
+         N_("Clear queue") },
        { { 'r', 0, 0 }, 0, CMD_REPEAT, "repeat",
          N_("Toggle repeat mode") },
        { { 'z', 0, 0 }, 0, CMD_RANDOM, "random",
@@ -160,9 +153,9 @@ static command_definition_t cmds[] = {
        { { C('U'), 0, 0 }, 0, CMD_DB_UPDATE, "db-update",
          N_("Start a music database update") },
        { { 'S', 0, 0 }, 0, CMD_SAVE_PLAYLIST, "save",
-         N_("Save playlist") },
+         N_("Save queue") },
        { { 'a', 0, 0 }, 0, CMD_ADD, "add",
-         N_("Add url/file to playlist") },
+         N_("Add url/file to queue") },
 
        { { '!', 0, 0 }, 0, CMD_GO_ROOT_DIRECTORY, "go-root-directory",
          N_("Go to root directory") },
@@ -252,6 +245,10 @@ static command_definition_t cmds[] = {
          N_("Outputs screen") },
 #endif
 
+#ifdef ENABLE_CHAT_SCREEN
+       { {'9', F9, 0}, 0, CMD_SCREEN_CHAT, "screen-chat",
+         N_("Chat screen") },
+#endif
 
        { { -1, -1, -1 }, 0, CMD_NONE, NULL, NULL }
 };
@@ -417,7 +414,7 @@ get_key_command_name(command_t command)
 }
 
 command_t
-get_key_command_from_name(char *name)
+get_key_command_from_name(const char *name)
 {
        for (int i = 0; cmds[i].name; i++)
                if (strcmp(name, cmds[i].name) == 0)
@@ -427,7 +424,7 @@ get_key_command_from_name(char *name)
 }
 
 command_t
-find_key_command(int key, command_definition_t *c)
+find_key_command(int key, const command_definition_t *c)
 {
        assert(key != 0);
        assert(c != NULL);
@@ -453,7 +450,7 @@ get_keyboard_command(void)
        int key;
 
        key = wgetch(stdscr);
-       if (key == ERR)
+       if (key == ERR || key == '\0')
                return CMD_NONE;
 
 #ifdef HAVE_GETMOUSE