2 * Copyright (c) 2006-2011 Ed Schouten <ed@80386.nl>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * @brief Initialization, destruction and rendering functions for interface.
35 #include "gui_internal.h"
42 gui_draw_init_pre(void)
44 /* We need the termcap before chroot() */
49 gui_draw_init_post(void)
51 /* Lock playq from main thread */
52 gui_mtx
= g_mutex_new();
55 PDC_set_title(APP_NAME
);
65 config_getopt_bool("gui.color.enabled") && has_colors();
66 gui_draw_ratio
= config_getopt_percentage("gui.ratio");
68 if (gui_draw_colors
) {
70 #ifdef NCURSES_VERSION
72 #endif /* NCURSES_VERSION */
74 init_pair(GUI_COLOR_BAR
,
75 config_getopt_color("gui.color.bar.fg"),
76 config_getopt_color("gui.color.bar.bg"));
77 init_pair(GUI_COLOR_BLOCK
,
78 config_getopt_color("gui.color.block.fg"),
79 config_getopt_color("gui.color.block.bg"));
80 init_pair(GUI_COLOR_SELECT
,
81 config_getopt_color("gui.color.select.fg"),
82 config_getopt_color("gui.color.select.bg"));
83 init_pair(GUI_COLOR_DESELECT
,
84 config_getopt_color("gui.color.deselect.fg"),
85 config_getopt_color("gui.color.deselect.bg"));
86 init_pair(GUI_COLOR_MARKED
,
87 config_getopt_color("gui.color.marked.fg"),
88 config_getopt_color("gui.color.marked.bg"));
98 gui_draw_init_abort(void)
104 gui_draw_destroy(void)
107 gui_msgbar_destroy();
109 gui_browser_destroy();
116 gui_draw_resize(void)
119 wnoutrefresh(stdscr
);
123 gui_browser_resize();
128 gui_draw_color_number(const char *name
)
130 if (strcmp(name
, "black") == 0)
131 return (COLOR_BLACK
);
132 else if (strcmp(name
, "red") == 0)
134 else if (strcmp(name
, "green") == 0)
135 return (COLOR_GREEN
);
136 else if (strcmp(name
, "yellow") == 0)
137 return (COLOR_YELLOW
);
138 else if (strcmp(name
, "blue") == 0)
140 else if (strcmp(name
, "magenta") == 0)
141 return (COLOR_MAGENTA
);
142 else if (strcmp(name
, "cyan") == 0)
144 else if (strcmp(name
, "white") == 0)
145 return (COLOR_WHITE
);
146 #ifdef NCURSES_VERSION
147 else if (strcmp(name
, "default") == 0)
149 #endif /* NCURSES_VERSION */
157 gui_msgbar_refresh();