Code

added missing copyright headers
[ncmpc.git] / src / command.h
1 /*
2  * (c) 2004-2008 The Music Player Daemon Project
3  * http://www.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  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  */
20 #ifndef COMMAND_H
21 #define COMMAND_H
23 #include "config.h"
25 #include <stddef.h>
26 #include <stdio.h>
28 #define MAX_COMMAND_KEYS 3
30 /* commands */
31 typedef enum {
32         CMD_NONE = 0,
33         CMD_PLAY,
34         CMD_SELECT,
35         CMD_SELECT_ALL,
36         CMD_PAUSE,
37         CMD_STOP,
38         CMD_CROP,
39         CMD_TRACK_NEXT,
40         CMD_TRACK_PREVIOUS,
41         CMD_SEEK_FORWARD,
42         CMD_SEEK_BACKWARD,
43         CMD_SHUFFLE,
44         CMD_RANDOM,
45         CMD_CLEAR,
46         CMD_DELETE,
47         CMD_REPEAT,
48         CMD_CROSSFADE,
49         CMD_DB_UPDATE,
50         CMD_VOLUME_UP,
51         CMD_VOLUME_DOWN,
52         CMD_ADD,
53         CMD_SAVE_PLAYLIST,
54         CMD_TOGGLE_FIND_WRAP,
55         CMD_TOGGLE_AUTOCENTER,
56         CMD_SEARCH_MODE,
57         CMD_LIST_PREVIOUS,
58         CMD_LIST_NEXT,
59         CMD_LIST_FIRST,
60         CMD_LIST_LAST,
61         CMD_LIST_NEXT_PAGE,
62         CMD_LIST_PREVIOUS_PAGE,
63         CMD_LIST_FIND,
64         CMD_LIST_FIND_NEXT,
65         CMD_LIST_RFIND,
66         CMD_LIST_RFIND_NEXT,
67         CMD_LIST_MOVE_UP,
68         CMD_LIST_MOVE_DOWN,
69         CMD_MOUSE_EVENT,
70         CMD_SCREEN_UPDATE,
71         CMD_SCREEN_PREVIOUS,
72         CMD_SCREEN_NEXT,
73         CMD_SCREEN_PLAY,
74         CMD_SCREEN_FILE,
75         CMD_SCREEN_ARTIST,
76         CMD_SCREEN_SEARCH,
77         CMD_SCREEN_KEYDEF,
78         CMD_SCREEN_HELP,
79         CMD_SCREEN_LYRICS,
80         CMD_SCREEN_OUTPUTS,
81         CMD_LYRICS_UPDATE,
82         CMD_INTERRUPT,
83         CMD_GO_ROOT_DIRECTORY,
84         CMD_GO_PARENT_DIRECTORY,
85         CMD_VIEW,
86         CMD_LOCATE,
87         CMD_QUIT
88 } command_t;
91 /* command definition flags */
92 #define COMMAND_KEY_MODIFIED  0x01
93 #define COMMAND_KEY_CONFLICT  0x02
95 /* write key bindings flags */
96 #define KEYDEF_WRITE_HEADER  0x01
97 #define KEYDEF_WRITE_ALL     0x02
98 #define KEYDEF_COMMENT_ALL   0x04
100 typedef struct  {
101         int keys[MAX_COMMAND_KEYS];
102         char flags;
103         command_t command;
104         const char *name;
105         const char *description;
106 } command_definition_t;
108 #ifdef ENABLE_KEYDEF_SCREEN
109 command_definition_t *get_command_definitions(void);
110 #endif
112 command_t find_key_command(int key, command_definition_t *cmds);
114 void command_dump_keys(void);
115 int check_key_bindings(command_definition_t *cmds, char *buf, size_t size);
116 int write_key_bindings(FILE *f, int all);
118 const char *key2str(int key);
119 const char *get_key_description(command_t command);
120 const char *get_key_command_name(command_t command);
121 const char *get_key_names(command_t command, int all);
122 command_t get_key_command(int key);
123 command_t get_key_command_from_name(char *name);
124 int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
126 command_t get_keyboard_command(void);
128 #endif