Code

command: Added the new jump command.
[ncmpc.git] / src / command.h
1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2009 The Music Player Daemon Project
3  * Project homepage: http://musicpd.org
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.
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.
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_CROSSFADE,
52         CMD_DB_UPDATE,
53         CMD_VOLUME_UP,
54         CMD_VOLUME_DOWN,
55         CMD_ADD,
56         CMD_SAVE_PLAYLIST,
57         CMD_TOGGLE_FIND_WRAP,
58         CMD_TOGGLE_AUTOCENTER,
59         CMD_SEARCH_MODE,
60         CMD_LIST_PREVIOUS,
61         CMD_LIST_NEXT,
62         CMD_LIST_FIRST,
63         CMD_LIST_LAST,
64         CMD_LIST_NEXT_PAGE,
65         CMD_LIST_PREVIOUS_PAGE,
66         CMD_LIST_FIND,
67         CMD_LIST_FIND_NEXT,
68         CMD_LIST_RFIND,
69         CMD_LIST_RFIND_NEXT,
70         CMD_LIST_JUMP,
71         CMD_LIST_MOVE_UP,
72         CMD_LIST_MOVE_DOWN,
73         CMD_LIST_VISUAL_SELECT,
74         CMD_MOUSE_EVENT,
75         CMD_SCREEN_UPDATE,
76         CMD_SCREEN_PREVIOUS,
77         CMD_SCREEN_NEXT,
78         CMD_SCREEN_PLAY,
79         CMD_SCREEN_FILE,
80         CMD_SCREEN_ARTIST,
81         CMD_SCREEN_SEARCH,
82         CMD_SCREEN_KEYDEF,
83         CMD_SCREEN_HELP,
84         CMD_SCREEN_LYRICS,
85         CMD_SCREEN_OUTPUTS,
86         CMD_LYRICS_UPDATE,
87         CMD_INTERRUPT,
88         CMD_GO_ROOT_DIRECTORY,
89         CMD_GO_PARENT_DIRECTORY,
90         CMD_VIEW,
91         CMD_LOCATE,
92         CMD_QUIT
93 } command_t;
96 #ifndef NCMPC_MINI
97 /* command definition flags */
98 #define COMMAND_KEY_MODIFIED  0x01
99 #define COMMAND_KEY_CONFLICT  0x02
100 #endif
102 /* write key bindings flags */
103 #define KEYDEF_WRITE_HEADER  0x01
104 #define KEYDEF_WRITE_ALL     0x02
105 #define KEYDEF_COMMENT_ALL   0x04
107 typedef struct  {
108         int keys[MAX_COMMAND_KEYS];
109         char flags;
110         command_t command;
111         const char *name;
112         const char *description;
113 } command_definition_t;
115 #ifdef ENABLE_KEYDEF_SCREEN
116 command_definition_t *get_command_definitions(void);
117 #endif
119 command_t find_key_command(int key, command_definition_t *cmds);
121 void command_dump_keys(void);
123 #ifndef NCMPC_MINI
125 int check_key_bindings(command_definition_t *cmds, char *buf, size_t size);
126 int write_key_bindings(FILE *f, int all);
128 #endif
130 const char *key2str(int key);
131 const char *get_key_description(command_t command);
132 const char *get_key_command_name(command_t command);
133 const char *get_key_names(command_t command, int all);
134 command_t get_key_command(int key);
135 command_t get_key_command_from_name(char *name);
136 int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
138 command_t get_keyboard_command(void);
140 #endif