1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2020 The Music Player Daemon Project
3  * Project homepage: http://musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef COMMAND_H
21 #define COMMAND_H
22 
23 #include "config.h"
24 #include "util/Compiler.h"
25 
26 #include <stddef.h>
27 
28 /* commands */
29 enum class Command : unsigned {
30 #ifdef ENABLE_KEYDEF_SCREEN
31 	SCREEN_KEYDEF,
32 #endif
33 	QUIT,
34 
35 	/* movement */
36 	LIST_PREVIOUS,
37 	LIST_NEXT,
38 	LIST_TOP,
39 	LIST_MIDDLE,
40 	LIST_BOTTOM,
41 	LIST_FIRST,
42 	LIST_LAST,
43 	LIST_PREVIOUS_PAGE,
44 	LIST_NEXT_PAGE,
45 	LIST_RANGE_SELECT,
46 	LIST_SCROLL_DOWN_LINE,
47 	LIST_SCROLL_UP_LINE,
48 	LIST_SCROLL_DOWN_HALF,
49 	LIST_SCROLL_UP_HALF,
50 	SELECT_PLAYING,
51 
52 	/* basic screens */
53 	SCREEN_HELP,
54 	SCREEN_PLAY,
55 	SCREEN_FILE,
56 
57 	/* player commands */
58 	PLAY,
59 	PAUSE,
60 	STOP,
61 	CROP,
62 	TRACK_NEXT,
63 	TRACK_PREVIOUS,
64 	SEEK_FORWARD,
65 	SEEK_BACKWARD,
66 	VOLUME_UP,
67 	VOLUME_DOWN,
68 	SELECT,
69 	SELECT_ALL,
70 	DELETE,
71 	SHUFFLE,
72 	CLEAR,
73 	REPEAT,
74 	RANDOM,
75 	SINGLE,
76 	CONSUME,
77 	CROSSFADE,
78 	DB_UPDATE,
79 	SAVE_PLAYLIST,
80 	ADD,
81 	GO_ROOT_DIRECTORY,
82 	GO_PARENT_DIRECTORY,
83 	LOCATE,
84 
85 	/* lists */
86 	LIST_MOVE_UP,
87 	LIST_MOVE_DOWN,
88 	SCREEN_UPDATE,
89 
90 	/* ncmpc options */
91 	TOGGLE_FIND_WRAP,
92 	TOGGLE_AUTOCENTER,
93 
94 	/* change screen */
95 	SCREEN_NEXT,
96 	SCREEN_PREVIOUS,
97 	SCREEN_SWAP,
98 
99 	/* find */
100 	LIST_FIND,
101 	LIST_FIND_NEXT,
102 	LIST_RFIND,
103 	LIST_RFIND_NEXT,
104 	LIST_JUMP,
105 
106 	/* extra screens */
107 #ifdef ENABLE_LIBRARY_PAGE
108 	LIBRARY_PAGE,
109 #endif
110 #ifdef ENABLE_SEARCH_SCREEN
111 	SCREEN_SEARCH,
112 	SEARCH_MODE,
113 #endif
114 #ifdef ENABLE_SONG_SCREEN
115 	SCREEN_SONG,
116 #endif
117 #ifdef ENABLE_LYRICS_SCREEN
118 	SCREEN_LYRICS,
119 	INTERRUPT,
120 	LYRICS_UPDATE,
121 	EDIT,
122 #endif
123 #ifdef ENABLE_OUTPUTS_SCREEN
124 	SCREEN_OUTPUTS,
125 #endif
126 #ifdef ENABLE_CHAT_SCREEN
127 	SCREEN_CHAT,
128 #endif
129 
130 	NONE,
131 };
132 
133 typedef struct  {
134 	const char *name;
135 	const char *description;
136 } command_definition_t;
137 
138 const command_definition_t *
139 get_command_definitions();
140 
141 gcc_const
142 size_t
143 get_cmds_max_name_width();
144 
145 gcc_pure
146 const char *get_key_description(Command command);
147 
148 gcc_pure
149 const char *get_key_command_name(Command command);
150 
151 gcc_pure
152 Command
153 get_key_command_from_name(const char *name);
154 
155 #endif
156