Code

screen_interface: add method mouse(), replacing CMD_MOUSE_EVENT
[ncmpc.git] / src / command.h
index a1d5858d974d582332f4f0e658310b6f91de48ec..aa794c64cded5415e9c5cd521cb5c3eaddf6b00d 100644 (file)
@@ -1,28 +1,30 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
-
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
-
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
-
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+ */
 
 #ifndef COMMAND_H
 #define COMMAND_H
 
 #include "config.h"
+#include "Compiler.h"
 
 #include <stddef.h>
+#include <stdbool.h>
 
 #ifndef NCMPC_MINI
 #include <stdio.h>
@@ -49,6 +51,7 @@ typedef enum {
        CMD_DELETE,
        CMD_REPEAT,
        CMD_SINGLE,
+       CMD_CONSUME,
        CMD_CROSSFADE,
        CMD_DB_UPDATE,
        CMD_VOLUME_UP,
@@ -57,6 +60,7 @@ typedef enum {
        CMD_SAVE_PLAYLIST,
        CMD_TOGGLE_FIND_WRAP,
        CMD_TOGGLE_AUTOCENTER,
+       CMD_SELECT_PLAYING,
        CMD_SEARCH_MODE,
        CMD_LIST_PREVIOUS,
        CMD_LIST_NEXT,
@@ -79,7 +83,6 @@ typedef enum {
        CMD_LIST_SCROLL_DOWN_LINE,
        CMD_LIST_SCROLL_UP_HALF,
        CMD_LIST_SCROLL_DOWN_HALF,
-       CMD_MOUSE_EVENT,
        CMD_SCREEN_UPDATE,
        CMD_SCREEN_PREVIOUS,
        CMD_SCREEN_NEXT,
@@ -93,7 +96,9 @@ typedef enum {
        CMD_SCREEN_HELP,
        CMD_SCREEN_LYRICS,
        CMD_SCREEN_OUTPUTS,
+       CMD_SCREEN_CHAT,
        CMD_LYRICS_UPDATE,
+       CMD_EDIT,
        CMD_INTERRUPT,
        CMD_GO_ROOT_DIRECTORY,
        CMD_GO_PARENT_DIRECTORY,
@@ -123,27 +128,54 @@ typedef struct  {
 
 #ifdef ENABLE_KEYDEF_SCREEN
 command_definition_t *get_command_definitions(void);
+size_t get_cmds_max_name_width(command_definition_t *cmds);
 #endif
 
-command_t find_key_command(int key, command_definition_t *cmds);
+gcc_pure
+command_t
+find_key_command(int key, const command_definition_t *cmds);
 
 void command_dump_keys(void);
 
 #ifndef NCMPC_MINI
 
-int check_key_bindings(command_definition_t *cmds, char *buf, size_t size);
-int write_key_bindings(FILE *f, int all);
+/**
+ * @return true on success, false on error
+ */
+bool
+check_key_bindings(command_definition_t *cmds, char *buf, size_t size);
+
+/**
+ * @return true on success, false on error
+ */
+bool
+write_key_bindings(FILE *f, int all);
 
 #endif
 
+gcc_pure
 const char *key2str(int key);
+
+gcc_pure
 const char *get_key_description(command_t command);
+
+gcc_pure
 const char *get_key_command_name(command_t command);
-const char *get_key_names(command_t command, int all);
+
+gcc_pure
+const char *get_key_names(command_t command, bool all);
+
+gcc_pure
 command_t get_key_command(int key);
-command_t get_key_command_from_name(char *name);
-int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
 
-command_t get_keyboard_command(void);
+gcc_pure
+command_t
+get_key_command_from_name(const char *name);
+
+/**
+ * @return true on success, false on error
+ */
+bool
+assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
 
 #endif