Code

screen_lyrics: new key to edit lyrics
[ncmpc.git] / src / command.h
1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2010 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  */
20 #ifndef COMMAND_H
21 #define COMMAND_H
23 #include "config.h"
25 #include <stddef.h>
27 #ifndef NCMPC_MINI
28 #include <stdio.h>
29 #endif
31 #define MAX_COMMAND_KEYS 3
33 /* commands */
34 typedef enum {
35         CMD_NONE = 0,
36         CMD_PLAY,
37         CMD_SELECT,
38         CMD_SELECT_ALL,
39         CMD_PAUSE,
40         CMD_STOP,
41         CMD_CROP,
42         CMD_TRACK_NEXT,
43         CMD_TRACK_PREVIOUS,
44         CMD_SEEK_FORWARD,
45         CMD_SEEK_BACKWARD,
46         CMD_SHUFFLE,
47         CMD_RANDOM,
48         CMD_CLEAR,
49         CMD_DELETE,
50         CMD_REPEAT,
51         CMD_SINGLE,
52         CMD_CONSUME,
53         CMD_CROSSFADE,
54         CMD_DB_UPDATE,
55         CMD_VOLUME_UP,
56         CMD_VOLUME_DOWN,
57         CMD_ADD,
58         CMD_SAVE_PLAYLIST,
59         CMD_TOGGLE_FIND_WRAP,
60         CMD_TOGGLE_AUTOCENTER,
61         CMD_SELECT_PLAYING,
62         CMD_SEARCH_MODE,
63         CMD_LIST_PREVIOUS,
64         CMD_LIST_NEXT,
65         CMD_LIST_TOP,
66         CMD_LIST_MIDDLE,
67         CMD_LIST_BOTTOM,
68         CMD_LIST_FIRST,
69         CMD_LIST_LAST,
70         CMD_LIST_NEXT_PAGE,
71         CMD_LIST_PREVIOUS_PAGE,
72         CMD_LIST_FIND,
73         CMD_LIST_FIND_NEXT,
74         CMD_LIST_RFIND,
75         CMD_LIST_RFIND_NEXT,
76         CMD_LIST_JUMP,
77         CMD_LIST_MOVE_UP,
78         CMD_LIST_MOVE_DOWN,
79         CMD_LIST_RANGE_SELECT,
80         CMD_LIST_SCROLL_UP_LINE,
81         CMD_LIST_SCROLL_DOWN_LINE,
82         CMD_LIST_SCROLL_UP_HALF,
83         CMD_LIST_SCROLL_DOWN_HALF,
84         CMD_MOUSE_EVENT,
85         CMD_SCREEN_UPDATE,
86         CMD_SCREEN_PREVIOUS,
87         CMD_SCREEN_NEXT,
88         CMD_SCREEN_SWAP,
89         CMD_SCREEN_PLAY,
90         CMD_SCREEN_FILE,
91         CMD_SCREEN_ARTIST,
92         CMD_SCREEN_SEARCH,
93         CMD_SCREEN_SONG,
94         CMD_SCREEN_KEYDEF,
95         CMD_SCREEN_HELP,
96         CMD_SCREEN_LYRICS,
97         CMD_SCREEN_OUTPUTS,
98         CMD_LYRICS_UPDATE,
99         CMD_LYRICS_EDIT,
100         CMD_INTERRUPT,
101         CMD_GO_ROOT_DIRECTORY,
102         CMD_GO_PARENT_DIRECTORY,
103         CMD_LOCATE,
104         CMD_QUIT
105 } command_t;
108 #ifndef NCMPC_MINI
109 /* command definition flags */
110 #define COMMAND_KEY_MODIFIED  0x01
111 #define COMMAND_KEY_CONFLICT  0x02
112 #endif
114 /* write key bindings flags */
115 #define KEYDEF_WRITE_HEADER  0x01
116 #define KEYDEF_WRITE_ALL     0x02
117 #define KEYDEF_COMMENT_ALL   0x04
119 typedef struct  {
120         int keys[MAX_COMMAND_KEYS];
121         char flags;
122         command_t command;
123         const char *name;
124         const char *description;
125 } command_definition_t;
127 #ifdef ENABLE_KEYDEF_SCREEN
128 command_definition_t *get_command_definitions(void);
129 #endif
131 command_t find_key_command(int key, command_definition_t *cmds);
133 void command_dump_keys(void);
135 #ifndef NCMPC_MINI
137 int check_key_bindings(command_definition_t *cmds, char *buf, size_t size);
138 int write_key_bindings(FILE *f, int all);
140 #endif
142 const char *key2str(int key);
143 const char *get_key_description(command_t command);
144 const char *get_key_command_name(command_t command);
145 const char *get_key_names(command_t command, int all);
146 command_t get_key_command(int key);
147 command_t get_key_command_from_name(char *name);
148 int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
150 command_t get_keyboard_command(void);
152 #endif