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