Add struct stat into struct directory, special case for symbolic links
[cmus.git] / options.h
blob0bb60b83b950d29f954698570dd3e2774e3cba38
1 /*
2 * Copyright 2005 Timo Hirvonen
3 */
5 #ifndef OPTIONS_H
6 #define OPTIONS_H
8 #include "list.h"
10 #define OPTION_MAX_SIZE 256
12 typedef void (*opt_get_cb)(unsigned int id, char *buf);
13 typedef void (*opt_set_cb)(unsigned int id, const char *buf);
14 typedef void (*opt_toggle_cb)(unsigned int id);
16 struct cmus_opt {
17 struct list_head node;
19 const char *name;
21 /* If there are many similar options you should write generic get(),
22 * set() and optionally toggle() and set id to index of option array or
23 * what ever.
25 * Useful for colors, format strings and plugin options.
27 unsigned int id;
29 opt_get_cb get;
30 opt_set_cb set;
32 /* NULL if not toggle-able */
33 opt_toggle_cb toggle;
36 extern struct list_head option_head;
37 extern int nr_options;
39 enum {
40 TREE_VIEW,
41 SORTED_VIEW,
42 PLAYLIST_VIEW,
43 QUEUE_VIEW,
44 BROWSER_VIEW,
45 FILTERS_VIEW,
46 NR_VIEWS
49 enum {
50 COLOR_CMDLINE_BG,
51 COLOR_CMDLINE_FG,
52 COLOR_ERROR,
53 COLOR_INFO,
55 COLOR_SEPARATOR,
56 COLOR_STATUSLINE_BG,
57 COLOR_STATUSLINE_FG,
58 COLOR_TITLELINE_BG,
60 COLOR_TITLELINE_FG,
61 COLOR_WIN_BG,
62 COLOR_WIN_CUR,
63 COLOR_WIN_CUR_SEL_BG,
65 COLOR_WIN_CUR_SEL_FG,
66 COLOR_WIN_DIR,
67 COLOR_WIN_FG,
68 COLOR_WIN_INACTIVE_CUR_SEL_BG,
70 COLOR_WIN_INACTIVE_CUR_SEL_FG,
71 COLOR_WIN_INACTIVE_SEL_BG,
72 COLOR_WIN_INACTIVE_SEL_FG,
73 COLOR_WIN_SEL_BG,
75 COLOR_WIN_SEL_FG,
76 COLOR_WIN_TITLE_BG,
77 COLOR_WIN_TITLE_FG,
78 NR_COLORS
81 #define BRIGHT (1 << 3)
83 extern char *output_plugin;
84 extern char *status_display_program;
85 extern int auto_reshuffle;
86 extern int confirm_run;
87 extern int show_hidden;
88 extern int show_remaining_time;
89 extern int play_library;
90 extern int repeat;
91 extern int shuffle;
93 extern const char * const aaa_mode_names[];
94 extern const char * const view_names[NR_VIEWS + 1];
96 extern int colors[NR_COLORS];
98 /* format string for track window (tree view) */
99 extern char *track_win_format;
100 extern char *track_win_alt_format;
102 /* format string for shuffle, sorted and play queue views */
103 extern char *list_win_format;
104 extern char *list_win_alt_format;
106 /* format string for currently playing track */
107 extern char *current_format;
108 extern char *current_alt_format;
110 /* format string for window title */
111 extern char *window_title_format;
112 extern char *window_title_alt_format;
114 extern char *id3_default_charset;
116 /* build option list */
117 void options_add(void);
119 /* load options from the config file */
120 void options_load(void);
122 int source_file(const char *filename);
124 /* save options */
125 void options_exit(void);
127 void option_add(const char *name, unsigned int id, opt_get_cb get,
128 opt_set_cb set, opt_toggle_cb toggle);
129 struct cmus_opt *option_find(const char *name);
130 void option_set(const char *name, const char *value);
131 int parse_enum(const char *buf, int minval, int maxval, const char * const names[], int *val);
133 #endif