2 * Copyright 2005 Timo Hirvonen
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
);
17 struct list_head node
;
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
25 * Useful for colors, format strings and plugin options.
32 /* NULL if not toggle-able */
36 extern struct list_head option_head
;
37 extern int nr_options
;
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
,
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
;
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
);
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
);