31 static void set_mono_theme(
void)
33 dlg.screen.atr = A_NORMAL;
34 dlg.shadow.atr = A_NORMAL;
35 dlg.dialog.atr = A_NORMAL;
36 dlg.title.atr = A_BOLD;
37 dlg.border.atr = A_NORMAL;
38 dlg.button_active.atr = A_REVERSE;
39 dlg.button_inactive.atr = A_DIM;
40 dlg.button_key_active.atr = A_REVERSE;
41 dlg.button_key_inactive.atr = A_BOLD;
42 dlg.button_label_active.atr = A_REVERSE;
43 dlg.button_label_inactive.atr = A_NORMAL;
44 dlg.inputbox.atr = A_NORMAL;
45 dlg.inputbox_border.atr = A_NORMAL;
46 dlg.searchbox.atr = A_NORMAL;
47 dlg.searchbox_title.atr = A_BOLD;
48 dlg.searchbox_border.atr = A_NORMAL;
49 dlg.position_indicator.atr = A_BOLD;
50 dlg.menubox.atr = A_NORMAL;
51 dlg.menubox_border.atr = A_NORMAL;
52 dlg.item.atr = A_NORMAL;
53 dlg.item_selected.atr = A_REVERSE;
55 dlg.tag_selected.atr = A_REVERSE;
56 dlg.tag_key.atr = A_BOLD;
57 dlg.tag_key_selected.atr = A_REVERSE;
58 dlg.check.atr = A_BOLD;
59 dlg.check_selected.atr = A_REVERSE;
60 dlg.uarrow.atr = A_BOLD;
61 dlg.darrow.atr = A_BOLD;
64 #define DLG_COLOR(dialog, f, b, h) \
66 dlg.dialog.fg = (f); \
67 dlg.dialog.bg = (b); \
68 dlg.dialog.hl = (h); \
71 static void set_classic_theme(
void)
104 static void set_blackbg_theme(
void)
146 static void set_bluetitle_theme(
void)
162 static int set_theme(
const char *theme)
166 set_bluetitle_theme();
167 else if (
strcmp(theme,
"classic") == 0)
169 else if (
strcmp(theme,
"bluetitle") == 0)
170 set_bluetitle_theme();
171 else if (
strcmp(theme,
"blackbg") == 0)
173 else if (
strcmp(theme,
"mono") == 0)
184 init_pair(pair, color->
fg, color->
bg);
186 color->
atr = A_BOLD | COLOR_PAIR(pair);
188 color->
atr = COLOR_PAIR(pair);
191 static void init_dialog_colors(
void)
193 init_one_color(&
dlg.screen);
194 init_one_color(&
dlg.shadow);
195 init_one_color(&
dlg.dialog);
196 init_one_color(&
dlg.title);
197 init_one_color(&
dlg.border);
198 init_one_color(&
dlg.button_active);
199 init_one_color(&
dlg.button_inactive);
200 init_one_color(&
dlg.button_key_active);
201 init_one_color(&
dlg.button_key_inactive);
202 init_one_color(&
dlg.button_label_active);
203 init_one_color(&
dlg.button_label_inactive);
204 init_one_color(&
dlg.inputbox);
205 init_one_color(&
dlg.inputbox_border);
206 init_one_color(&
dlg.searchbox);
207 init_one_color(&
dlg.searchbox_title);
208 init_one_color(&
dlg.searchbox_border);
209 init_one_color(&
dlg.position_indicator);
210 init_one_color(&
dlg.menubox);
211 init_one_color(&
dlg.menubox_border);
212 init_one_color(&
dlg.item);
213 init_one_color(&
dlg.item_selected);
214 init_one_color(&
dlg.tag);
215 init_one_color(&
dlg.tag_selected);
216 init_one_color(&
dlg.tag_key);
217 init_one_color(&
dlg.tag_key_selected);
218 init_one_color(&
dlg.check);
219 init_one_color(&
dlg.check_selected);
220 init_one_color(&
dlg.uarrow);
221 init_one_color(&
dlg.darrow);
227 static void color_setup(
const char *theme)
231 use_color = set_theme(theme);
232 if (use_color && has_colors()) {
234 init_dialog_colors();
247 for (i = 0; i <
height; i++) {
249 for (j = 0; j <
width; j++)
262 wattrset(stdscr,
dlg.screen.atr);
263 mvwaddstr(stdscr, 0, 1, (
char *)
dlg.backtitle);
265 for (i = 1; i <
COLS - 1; i++)
268 wnoutrefresh(stdscr);
283 getmaxyx(stdscr, height, width);
284 if (height < 19 || width < 80) {
290 color_setup(getenv(
"MENUCONFIG_COLOR"));
292 keypad(stdscr,
TRUE);
322 int tlen =
MIN(width - 2,
strlen(title));
323 wattrset(dialog,
dlg.title.atr);
324 mvwaddch(dialog, 0, (width - tlen) / 2 - 1,
' ');
325 mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen);
338 int newl, cur_x, cur_y;
339 int i, prompt_len, room, wlen;
344 prompt_len =
strlen(tempstr);
349 for (i = 0; i < prompt_len; i++) {
350 if (tempstr[i] ==
'\n')
354 if (prompt_len <= width - x * 2) {
355 wmove(win, y, (width - prompt_len) / 2);
356 waddstr(win, tempstr);
362 while (word && *word) {
370 room = width - cur_x;
373 (newl && wlen < 4 && sp
374 && wlen + 1 +
strlen(sp) > room
375 && (!(sp2 =
strchr(sp,
' '))
376 || wlen + 1 + (sp2 - sp) > room))) {
380 wmove(win, cur_y, cur_x);
382 getyx(win, cur_y, cur_x);
384 if (sp && *sp ==
' ') {
386 while (*++sp ==
' ') ;
403 wattrset(win, selected ?
dlg.button_active.atr
404 :
dlg.button_inactive.atr);
406 temp =
strspn(label,
" ");
408 wattrset(win, selected ?
dlg.button_label_active.atr
409 :
dlg.button_label_inactive.atr);
410 for (i = 0; i <
temp; i++)
412 wattrset(win, selected ?
dlg.button_key_active.atr
413 :
dlg.button_key_inactive.atr);
414 waddch(win, label[0]);
415 wattrset(win, selected ?
dlg.button_label_active.atr
416 :
dlg.button_label_inactive.atr);
417 waddstr(win, (
char *)label + 1);
418 wattrset(win, selected ?
dlg.button_active.atr
419 :
dlg.button_inactive.atr);
421 wmove(win, y, x + temp + 1);
429 chtype box, chtype
border)
434 for (i = 0; i <
height; i++) {
435 wmove(win, y + i, x);
436 for (j = 0; j <
width; j++)
439 else if (i == height - 1 && !j)
441 else if (!i && j == width - 1)
443 else if (i == height - 1 && j == width - 1)
447 else if (i == height - 1)
451 else if (j == width - 1)
454 waddch(win, box |
' ');
467 wattrset(win,
dlg.shadow.atr);
468 wmove(win, y + height, x + 2);
469 for (i = 0; i <
width; i++)
470 waddch(win,
winch(win) & A_CHARTEXT);
471 for (i = y + 1; i < y + height + 1; i++) {
472 wmove(win, i, x + width);
473 waddch(win,
winch(win) & A_CHARTEXT);
474 waddch(win,
winch(win) & A_CHARTEXT);
485 int i, in_paren = 0,
c;
487 for (i = 0; i <
strlen(
string); i++) {
492 if (
strchr(
">])",
c) && in_paren > 0)
523 }
while (key3 !=
ERR);
549 for (p = item_head;
p; p =
next) {
584 item_cur->
node.str[
sizeof(item_cur->
node.str) - 1] =
'\0';
612 return item_cur->
node.data;
617 return item_cur->
node.tag;
625 for (p = item_head;
p; p = p->
next)
643 for (p = item_head;
p; p = p->
next) {
653 return item_cur->
node.str;
658 return (item_cur->
node.selected != 0);
663 return (item_cur->
node.tag == tag);