Handle streams separately in tree_add_track()
[cmus.git] / options.h
blob7606e4a1403bca183bba2e78b5d188200d280efa
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 HELP_VIEW,
47 NR_VIEWS
50 enum {
51 COLOR_CMDLINE_BG,
52 COLOR_CMDLINE_FG,
53 COLOR_ERROR,
54 COLOR_INFO,
56 COLOR_SEPARATOR,
57 COLOR_STATUSLINE_BG,
58 COLOR_STATUSLINE_FG,
59 COLOR_TITLELINE_BG,
61 COLOR_TITLELINE_FG,
62 COLOR_WIN_BG,
63 COLOR_WIN_CUR,
64 COLOR_WIN_CUR_SEL_BG,
66 COLOR_WIN_CUR_SEL_FG,
67 COLOR_WIN_DIR,
68 COLOR_WIN_FG,
69 COLOR_WIN_INACTIVE_CUR_SEL_BG,
71 COLOR_WIN_INACTIVE_CUR_SEL_FG,
72 COLOR_WIN_INACTIVE_SEL_BG,
73 COLOR_WIN_INACTIVE_SEL_FG,
74 COLOR_WIN_SEL_BG,
76 COLOR_WIN_SEL_FG,
77 COLOR_WIN_TITLE_BG,
78 COLOR_WIN_TITLE_FG,
79 NR_COLORS
82 #define BRIGHT (1 << 3)
84 extern char *output_plugin;
85 extern char *status_display_program;
86 extern char *server_password;
87 extern int auto_reshuffle;
88 extern int confirm_run;
89 extern int show_hidden;
90 extern int show_remaining_time;
91 extern int set_term_title;
92 extern int play_library;
93 extern int repeat;
94 extern int shuffle;
96 extern const char * const aaa_mode_names[];
97 extern const char * const view_names[NR_VIEWS + 1];
99 extern int colors[NR_COLORS];
101 /* format string for track window (tree view) */
102 extern char *track_win_format;
103 extern char *track_win_alt_format;
105 /* format string for shuffle, sorted and play queue views */
106 extern char *list_win_format;
107 extern char *list_win_alt_format;
109 /* format string for currently playing track */
110 extern char *current_format;
111 extern char *current_alt_format;
113 /* format string for window title */
114 extern char *window_title_format;
115 extern char *window_title_alt_format;
117 extern char *id3_default_charset;
119 /* build option list */
120 void options_add(void);
122 /* load options from the config file */
123 void options_load(void);
125 int source_file(const char *filename);
127 /* save options */
128 void options_exit(void);
130 void option_add(const char *name, unsigned int id, opt_get_cb get,
131 opt_set_cb set, opt_toggle_cb toggle);
132 struct cmus_opt *option_find(const char *name);
133 void option_set(const char *name, const char *value);
134 int parse_enum(const char *buf, int minval, int maxval, const char * const names[], int *val);
136 #endif