This commit is a preparation for the configuration file parser.
The `int attr_*` variables have been moved into a separate struct.
Members of that struct are alphabetically ordered, so an attribute can
later be accessed by its name.
Added `int get_color_pair(short fg, short bg)` for returning or
creating a color pair number.
Added call to `use_default_colors()` for enabling access to the
terminal's default color (-1).
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
columns = screen_cols;
widget_init(&list_widget, rows, columns, SCREEN_CENTER, SCREEN_CENTER,
- attr_menu, WIDGET_BORDER | WIDGET_SUBWINDOW);
+ attrs.menu, WIDGET_BORDER | WIDGET_SUBWINDOW);
title = _("Sound Card");
mvwprintw(list_widget.window, 0, (columns - 2 - get_mbs_width(title)) / 2, " %s ", title);
menu = new_menu(items);
if (!menu)
fatal_error("cannot create menu");
- set_menu_fore(menu, attr_menu_selected);
- set_menu_back(menu, attr_menu);
+ set_menu_fore(menu, attrs.menu_selected);
+ set_menu_back(menu, attrs.menu);
set_menu_mark(menu, NULL);
if (initial_item)
set_current_item(menu, initial_item);
#include CURSESINC
#include "colors.h"
-int attr_mixer_frame;
-int attr_mixer_text;
-int attr_mixer_active;
-int attr_ctl_frame;
-int attr_ctl_mute;
-int attr_ctl_nomute;
-int attr_ctl_capture;
-int attr_ctl_nocapture;
-int attr_ctl_label;
-int attr_ctl_label_focus;
-int attr_ctl_mark_focus;
-int attr_ctl_bar_lo;
-#ifdef TRICOLOR_VOLUME_BAR
-int attr_ctl_bar_mi;
-int attr_ctl_bar_hi;
-#endif
-int attr_ctl_inactive;
-int attr_ctl_label_inactive;
-int attr_errormsg;
-int attr_infomsg;
-int attr_textbox;
-int attr_textfield;
-int attr_menu;
-int attr_menu_selected;
+struct attributes attrs;
+
+int get_color_pair(short fg, short bg)
+{
+ static int color_pairs_defined = 0;
+ short i, pair_fg, pair_bg;
+
+ for (i = 1; i <= color_pairs_defined; ++i) {
+ if (OK == pair_content(i, &pair_fg, &pair_bg))
+ if (pair_fg == fg && pair_bg == bg)
+ return COLOR_PAIR(i);
+ }
+
+ if (color_pairs_defined + 1 < COLOR_PAIRS) {
+ ++color_pairs_defined;
+ init_pair(color_pairs_defined, fg, bg);
+ return COLOR_PAIR(color_pairs_defined);
+ }
+
+ return 0;
+}
void init_colors(int use_color)
{
if (!!has_colors() == !!use_color) {
start_color();
+ use_default_colors();
- init_pair(1, COLOR_CYAN, COLOR_BLACK);
- init_pair(2, COLOR_YELLOW, COLOR_BLACK);
- init_pair(3, COLOR_WHITE, COLOR_GREEN);
- init_pair(4, COLOR_RED, COLOR_BLACK);
- init_pair(5, COLOR_WHITE, COLOR_BLACK);
- init_pair(6, COLOR_WHITE, COLOR_BLUE);
- init_pair(7, COLOR_RED, COLOR_BLUE);
- init_pair(8, COLOR_GREEN, COLOR_GREEN);
- init_pair(9, COLOR_WHITE, COLOR_RED);
+ get_color_pair(COLOR_CYAN, COLOR_BLACK); // COLOR_PAIR(1)
+ get_color_pair(COLOR_YELLOW, COLOR_BLACK);
+ get_color_pair(COLOR_WHITE, COLOR_GREEN);
+ get_color_pair(COLOR_RED, COLOR_BLACK);
+ get_color_pair(COLOR_WHITE, COLOR_BLACK);
+ get_color_pair(COLOR_WHITE, COLOR_BLUE);
+ get_color_pair(COLOR_RED, COLOR_BLUE);
+ get_color_pair(COLOR_GREEN, COLOR_GREEN);
+ get_color_pair(COLOR_WHITE, COLOR_RED); // COLOR_PAIR(9)
#ifdef TRICOLOR_VOLUME_BAR
- init_pair(10, COLOR_WHITE, COLOR_WHITE);
- init_pair(11, COLOR_RED, COLOR_RED);
+ get_color_pair(COLOR_WHITE, COLOR_WHITE);
+ get_color_pair(COLOR_RED, COLOR_RED);
#endif
- attr_mixer_frame = COLOR_PAIR(1);
- attr_mixer_text = COLOR_PAIR(1);
- attr_mixer_active = A_BOLD | COLOR_PAIR(2);
- attr_ctl_frame = A_BOLD | COLOR_PAIR(1);
- attr_ctl_mute = COLOR_PAIR(1);
- attr_ctl_nomute = A_BOLD | COLOR_PAIR(3);
- attr_ctl_capture = A_BOLD | COLOR_PAIR(4);
- attr_ctl_nocapture = COLOR_PAIR(5);
- attr_ctl_label = A_BOLD | COLOR_PAIR(6);
- attr_ctl_label_focus = A_BOLD | COLOR_PAIR(7);
- attr_ctl_mark_focus = A_BOLD | COLOR_PAIR(4);
- attr_ctl_bar_lo = A_BOLD | COLOR_PAIR(8);
+ attrs = (struct attributes) {
+ .mixer_frame = COLOR_PAIR(1),
+ .mixer_text = COLOR_PAIR(1),
+ .mixer_active = A_BOLD | COLOR_PAIR(2),
+ .ctl_frame = A_BOLD | COLOR_PAIR(1),
+ .ctl_mute = COLOR_PAIR(1),
+ .ctl_nomute = A_BOLD | COLOR_PAIR(3),
+ .ctl_capture = A_BOLD | COLOR_PAIR(4),
+ .ctl_nocapture = COLOR_PAIR(5),
+ .ctl_label = A_BOLD | COLOR_PAIR(6),
+ .ctl_label_focus = A_BOLD | COLOR_PAIR(7),
+ .ctl_mark_focus = A_BOLD | COLOR_PAIR(4),
+ .ctl_bar_lo = A_BOLD | COLOR_PAIR(8),
#ifdef TRICOLOR_VOLUME_BAR
- attr_ctl_bar_mi = A_BOLD | COLOR_PAIR(10);
- attr_ctl_bar_hi = A_BOLD | COLOR_PAIR(11);
+ .ctl_bar_mi = A_BOLD | COLOR_PAIR(10),
+ .ctl_bar_hi = A_BOLD | COLOR_PAIR(11),
#endif
- attr_ctl_inactive = COLOR_PAIR(5);
- attr_ctl_label_inactive = A_REVERSE | COLOR_PAIR(5);
- attr_errormsg = A_BOLD | COLOR_PAIR(9);
- attr_infomsg = A_BOLD | COLOR_PAIR(6);
- attr_textbox = A_BOLD | COLOR_PAIR(6);
- attr_textfield = A_REVERSE | COLOR_PAIR(5);
- attr_menu = A_BOLD | COLOR_PAIR(6);
- attr_menu_selected = A_REVERSE | COLOR_PAIR(6);
+ .ctl_inactive = COLOR_PAIR(5),
+ .ctl_label_inactive = A_REVERSE | COLOR_PAIR(5),
+ .errormsg = A_BOLD | COLOR_PAIR(9),
+ .infomsg = A_BOLD | COLOR_PAIR(6),
+ .textbox = A_BOLD | COLOR_PAIR(6),
+ .textfield = A_REVERSE | COLOR_PAIR(5),
+ .menu = A_BOLD | COLOR_PAIR(6),
+ .menu_selected = A_REVERSE | COLOR_PAIR(6)
+ };
} else {
- attr_mixer_frame = A_NORMAL;
- attr_mixer_text = A_NORMAL;
- attr_mixer_active = A_BOLD;
- attr_ctl_frame = A_BOLD;
- attr_ctl_mute = A_NORMAL;
- attr_ctl_nomute = A_BOLD;
- attr_ctl_capture = A_BOLD;
- attr_ctl_nocapture = A_NORMAL;
- attr_ctl_label = A_REVERSE;
- attr_ctl_label_focus = A_REVERSE | A_BOLD;
- attr_ctl_mark_focus = A_BOLD;
- attr_ctl_bar_lo = A_BOLD;
+ attrs = (struct attributes) {
+ .mixer_frame = A_NORMAL,
+ .mixer_text = A_NORMAL,
+ .mixer_active = A_BOLD,
+ .ctl_frame = A_BOLD,
+ .ctl_mute = A_NORMAL,
+ .ctl_nomute = A_BOLD,
+ .ctl_capture = A_BOLD,
+ .ctl_nocapture = A_NORMAL,
+ .ctl_label = A_REVERSE,
+ .ctl_label_focus = A_REVERSE | A_BOLD,
+ .ctl_mark_focus = A_BOLD,
+ .ctl_bar_lo = A_BOLD,
#ifdef TRICOLOR_VOLUME_BAR
- attr_ctl_bar_mi = A_BOLD;
- attr_ctl_bar_hi = A_BOLD;
+ .ctl_bar_mi = A_BOLD,
+ .ctl_bar_hi = A_BOLD,
#endif
- attr_ctl_inactive = A_NORMAL;
- attr_ctl_label_inactive = A_REVERSE;
- attr_errormsg = A_STANDOUT;
- attr_infomsg = A_NORMAL;
- attr_textbox = A_NORMAL;
- attr_textfield = A_REVERSE;
- attr_menu = A_NORMAL;
- attr_menu_selected = A_REVERSE;
+ .ctl_inactive = A_NORMAL,
+ .ctl_label_inactive = A_REVERSE,
+ .errormsg = A_STANDOUT,
+ .infomsg = A_NORMAL,
+ .textbox = A_NORMAL,
+ .textfield = A_REVERSE,
+ .menu = A_NORMAL,
+ .menu_selected = A_REVERSE,
+ };
}
}
#define TRICOLOR_VOLUME_BAR
-extern int attr_mixer_frame;
-extern int attr_mixer_text;
-extern int attr_mixer_active;
-extern int attr_ctl_frame;
-extern int attr_ctl_mute;
-extern int attr_ctl_nomute;
-extern int attr_ctl_capture;
-extern int attr_ctl_nocapture;
-extern int attr_ctl_label;
-extern int attr_ctl_label_focus;
-extern int attr_ctl_mark_focus;
-extern int attr_ctl_bar_lo;
+struct attributes {
+ // Alphabetically sorted
#ifdef TRICOLOR_VOLUME_BAR
-extern int attr_ctl_bar_mi;
-extern int attr_ctl_bar_hi;
+ int ctl_bar_hi;
#endif
-extern int attr_ctl_inactive;
-extern int attr_ctl_label_inactive;
-extern int attr_errormsg;
-extern int attr_infomsg;
-extern int attr_textbox;
-extern int attr_textfield;
-extern int attr_menu;
-extern int attr_menu_selected;
+ int ctl_bar_lo;
+#ifdef TRICOLOR_VOLUME_BAR
+ int ctl_bar_mi;
+#endif
+ int ctl_capture;
+ int ctl_frame;
+ int ctl_inactive;
+ int ctl_label;
+ int ctl_label_focus;
+ int ctl_label_inactive;
+ int ctl_mark_focus;
+ int ctl_mute;
+ int ctl_nocapture;
+ int ctl_nomute;
+ int errormsg;
+ int infomsg;
+ int menu;
+ int menu_selected;
+ int mixer_active;
+ int mixer_frame;
+ int mixer_text;
+ int textbox;
+ int textfield;
+};
+
+extern struct attributes attrs;
void init_colors(int use_color);
+int get_color_pair(short fg, short bg);
#endif
}
widget_init(&form_widget,
6, 36, SCREEN_CENTER, SCREEN_CENTER,
- attr_textbox, WIDGET_BORDER | WIDGET_SUBWINDOW | WIDGET_CURSOR_VISIBLE);
+ attrs.textbox, WIDGET_BORDER | WIDGET_SUBWINDOW | WIDGET_CURSOR_VISIBLE);
title = _("Sound Card");
mvwprintw(form_widget.window, 0, (36 - 2 - get_mbs_width(title)) / 2, " %s ", title);
fatal_error("cannot create field");
field_opts_off(fields[0], O_ACTIVE);
field_opts_off(fields[0], O_EDIT);
- set_field_fore(fields[0], attr_textbox);
- set_field_back(fields[0], attr_textbox);
+ set_field_fore(fields[0], attrs.textbox);
+ set_field_back(fields[0], attrs.textbox);
set_field_buffer(fields[0], 0, _("Device name:"));
fields[1] = new_field(1, 32, 2, 1, 0, 0);
field_opts_off(fields[1], O_AUTOSKIP);
field_opts_off(fields[1], O_NULLOK);
field_opts_off(fields[1], O_STATIC);
- set_field_fore(fields[1], attr_textfield);
- set_field_back(fields[1], attr_textfield);
+ set_field_fore(fields[1], attrs.textfield);
+ set_field_back(fields[1], attrs.textfield);
set_field_buffer(fields[1], 0, mixer_device_name);
form = new_form(fields);
return;
}
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
if (label_width_left)
for (i = 0; i < 4; ++i)
display_string_in_field(1 + i, 2, labels_left[i],
}
if (card_name)
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
else {
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
if (unplugged)
card_name = _("(unplugged)");
else
display_string_in_field(1, info_items_left, card_name, info_items_width, ALIGN_LEFT);
if (mixer_name)
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
else {
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
mixer_name = "-";
}
display_string_in_field(2, info_items_left, mixer_name, info_items_width, ALIGN_LEFT);
widths[i] = get_mbs_width(modes[i]);
if (4 + widths[0] + 6 + widths[1] + 6 + widths[2] + 1 <= info_items_width) {
wmove(mixer_widget.window, 3, info_items_left - 1);
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
for (i = 0; i < 3; ++i) {
wprintw(mixer_widget.window, " F%c:", '3' + i);
if (has_view_mode && (int)view_mode == i) {
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
wprintw(mixer_widget.window, "[%s]", modes[i]);
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
} else {
wprintw(mixer_widget.window, " %s ", modes[i]);
}
CMD_WITH_ARG(CMD_MIXER_SET_VIEW_MODE, i), -1);
}
} else {
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
display_string_in_field(3, info_items_left,
has_view_mode ? modes[view_mode] : "",
info_items_width, ALIGN_LEFT);
if (!has_info_items)
return;
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
if (!controls_count || screen_too_small) {
display_string_in_field(4, info_items_left, "", info_items_width, ALIGN_LEFT);
return;
int i;
clickable_clear(5, 0, -1, -1);
- wattrset(mixer_widget.window, attr_mixer_frame);
+ wattrset(mixer_widget.window, attrs.mixer_frame);
for (i = 5; i < screen_lines - 1; ++i)
mvwprintw(mixer_widget.window, i, 1, "%*s", screen_cols - 2, "");
}
top = 5;
if (boojum) {
left = (screen_cols - 46) / 2;
- wattrset(mixer_widget.window, attr_mixer_text);
+ wattrset(mixer_widget.window, attrs.mixer_text);
mvwaddstr(mixer_widget.window, top + 0, left, "In the midst of the word he was trying to say,");
mvwaddstr(mixer_widget.window, top + 1, left + 2, "In the midst of his laughter and glee,");
mvwaddstr(mixer_widget.window, top + 2, left, "He had softly and suddenly vanished away---");
mvwaddstr(mixer_widget.window, top + 3, left + 2, "For the Snark was a Boojum, you see.");
mvwchgat(mixer_widget.window, top + 3, left + 16, 3, /* ^^^ */
- attr_mixer_text | A_BOLD, PAIR_NUMBER(attr_mixer_text), NULL);
+ attrs.mixer_text | A_BOLD, PAIR_NUMBER(attrs.mixer_text), NULL);
mvwaddstr(mixer_widget.window, top + 5, left, "(Lewis Carroll, \"The Hunting of the Snark\")");
top += 8;
}
- wattrset(mixer_widget.window, attr_errormsg);
+ wattrset(mixer_widget.window, attrs.errormsg);
center_string(top, _("The sound device was unplugged."));
center_string(top + 1, _("Press F6 to select another sound card."));
}
y = 5;
if (y >= screen_lines - 1)
return;
- wattrset(mixer_widget.window, attr_infomsg);
+ wattrset(mixer_widget.window, attrs.infomsg);
if (view_mode == VIEW_MODE_PLAYBACK && are_there_any_controls())
msg = _("This sound device does not have any playback controls.");
else if (view_mode == VIEW_MODE_CAPTURE && are_there_any_controls())
left = first_control_x + col * (control_width + 1);
frame_left = left + (control_width - 4) / 2;
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_frame);
+ wattrset(mixer_widget.window, attrs.ctl_frame);
else
- wattrset(mixer_widget.window, attr_ctl_inactive);
+ wattrset(mixer_widget.window, attrs.ctl_inactive);
if (control->flags & (TYPE_PVOLUME | TYPE_CVOLUME)) {
mvwaddch(mixer_widget.window, base_y - volume_height - 1, frame_left, ACS_ULCORNER);
waddch(mixer_widget.window, ACS_HLINE);
chtype ch;
if (i + 1 > bar_height)
ch = ' ' | (control->flags & IS_ACTIVE ?
- attr_ctl_frame : 0);
+ attrs.ctl_frame : 0);
else {
ch = ACS_CKBOARD;
if (!(control->flags & IS_ACTIVE))
;
#ifdef TRICOLOR_VOLUME_BAR
else if (i > volume_height * 8 / 10)
- ch |= attr_ctl_bar_hi;
+ ch |= attrs.ctl_bar_hi;
else if (i > volume_height * 4 / 10)
- ch |= attr_ctl_bar_mi;
+ ch |= attrs.ctl_bar_mi;
#endif
else
- ch |= attr_ctl_bar_lo;
+ ch |= attrs.ctl_bar_lo;
}
mvwaddch(mixer_widget.window, base_y - i - 1,
frame_left + c + 1, ch);
clickable_set(base_y - volume_height, frame_left + 1, base_y, frame_left + 2,
CMD_MIXER_MOUSE_CLICK_VOLUME_BAR, control_index);
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
if (!(control->flags & HAS_VOLUME_1)) {
sprintf(buf, "%d", (int)lrint(volumes[0] * 100));
display_string_in_field(values_y, frame_left - 2, buf, 8, ALIGN_CENTER);
mvwprintw(mixer_widget.window, values_y, frame_left - 2,
"%3d", (int)lrint(volumes[0] * 100));
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_frame);
+ wattrset(mixer_widget.window, attrs.ctl_frame);
waddstr(mixer_widget.window, "<>");
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
wprintw(mixer_widget.window, "%-3d", (int)lrint(volumes[1] * 100));
}
}
mvwaddch(mixer_widget.window, base_y + 1, frame_left + 1,
switches[0]
/* TRANSLATORS: playback on; one character */
- ? _("O")[0] | (control->flags & IS_ACTIVE ? attr_ctl_nomute : 0)
+ ? _("O")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_nomute : 0)
/* TRANSLATORS: playback muted; one character */
- : _("M")[0] | (control->flags & IS_ACTIVE ? attr_ctl_mute : 0));
+ : _("M")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_mute : 0));
waddch(mixer_widget.window,
switches[1]
- ? _("O")[0] | (control->flags & IS_ACTIVE ? attr_ctl_nomute : 0)
- : _("M")[0] | (control->flags & IS_ACTIVE ? attr_ctl_mute : 0));
+ ? _("O")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_nomute : 0)
+ : _("M")[0] | (control->flags & IS_ACTIVE ? attrs.ctl_mute : 0));
clickable_set(base_y + 1, frame_left + 1, base_y + 1, frame_left + 2,
CMD_MIXER_MOUSE_CLICK_MUTE, control_index);
}
if (err < 0)
return;
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, switches[0] ? attr_ctl_capture : attr_ctl_nocapture);
+ wattrset(mixer_widget.window, switches[0] ? attrs.ctl_capture : attrs.ctl_nocapture);
/* TRANSLATORS: "left"; no more than two characters */
display_string_in_field(cswitch_y - 1, frame_left - 2, switches[0] ? _("L") : "", 2, ALIGN_RIGHT);
clickable_set(cswitch_y - 1, frame_left - 2, cswitch_y - 1, frame_left - 1,
CMD_WITH_ARG(CMD_MIXER_TOGGLE_CAPTURE, LEFT), control_index);
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, switches[1] ? attr_ctl_capture : attr_ctl_nocapture);
+ wattrset(mixer_widget.window, switches[1] ? attrs.ctl_capture : attrs.ctl_nocapture);
/* TRANSLATORS: "right"; no more than two characters */
display_string_in_field(cswitch_y - 1, frame_left + 4, switches[1] ? _("R") : "", 2, ALIGN_LEFT);
clickable_set(cswitch_y - 1, frame_left + 4, cswitch_y - 1, frame_left + 5,
s = _("CAPTURE");
if (switches[0] || switches[1]) {
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_capture);
+ wattrset(mixer_widget.window, attrs.ctl_capture);
display_string_in_field(cswitch_y, frame_left - 2, s, 8, ALIGN_CENTER);
} else {
i = get_mbs_width(s);
memset(buf, '-', i);
buf[i] = '\0';
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_nocapture);
+ wattrset(mixer_widget.window, attrs.ctl_nocapture);
display_string_in_field(cswitch_y, frame_left - 2, buf, 8, ALIGN_CENTER);
}
clickable_set(cswitch_y, frame_left - 2, cswitch_y, frame_left - 2 + 8,
if (err < 0)
return;
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
display_string_centered_in_control(base_y, col, buf, control_width);
clickable_set_relative(mixer_widget.window, 0, -control_name_width, 0, -2,
CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM, control_index);
if (control_index == focus_control_index) {
i = first_control_x + col * (control_width + 1) + (control_width - control_name_width) / 2;
- wattrset(mixer_widget.window, attr_ctl_mark_focus);
+ wattrset(mixer_widget.window, attrs.ctl_mark_focus);
mvwaddch(mixer_widget.window, name_y, i - 1, '<');
mvwaddch(mixer_widget.window, name_y, i + control_name_width, '>');
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_label_focus);
+ wattrset(mixer_widget.window, attrs.ctl_label_focus);
else
- wattrset(mixer_widget.window, attr_ctl_label_inactive);
+ wattrset(mixer_widget.window, attrs.ctl_label_inactive);
} else {
if (control->flags & IS_ACTIVE)
- wattrset(mixer_widget.window, attr_ctl_label);
+ wattrset(mixer_widget.window, attrs.ctl_label);
else
- wattrset(mixer_widget.window, attr_ctl_label_inactive);
+ wattrset(mixer_widget.window, attrs.ctl_label_inactive);
}
display_string_centered_in_control(name_y, col, control->name, control_name_width);
clickable_set_relative(mixer_widget.window, -1, -control_name_width, 0, -2,
}
} else {
s = "";
- wattrset(mixer_widget.window, attr_mixer_frame);
+ wattrset(mixer_widget.window, attrs.mixer_frame);
}
display_string_centered_in_control(channel_name_y, col, s,
control_name_width);
left = first_visible_control_index > 0 ? ACS_LARROW : ACS_VLINE;
right = first_visible_control_index + visible_controls < controls_count
? ACS_RARROW : ACS_VLINE;
- wattrset(mixer_widget.window, attr_mixer_frame);
+ wattrset(mixer_widget.window, attrs.mixer_frame);
for (y = y0; y <= y1; ++y) {
mvwaddch(mixer_widget.window, y, 0, left);
mvwaddch(mixer_widget.window, y, screen_cols - 1, right);
static const char title[] = " AlsaMixer v" SND_UTIL_VERSION_STR " ";
widget_init(&mixer_widget, screen_lines, screen_cols, 0, 0,
- attr_mixer_frame, WIDGET_BORDER);
+ attrs.mixer_frame, WIDGET_BORDER);
if (screen_cols >= (sizeof(title) - 1) + 2) {
- wattrset(mixer_widget.window, attr_mixer_active);
+ wattrset(mixer_widget.window, attrs.mixer_active);
mvwaddstr(mixer_widget.window, 0, (screen_cols - (sizeof(title) - 1)) / 2, title);
}
init_mixer_layout();
columns = screen_cols;
widget_init(&proc_widget, rows, columns, SCREEN_CENTER, SCREEN_CENTER,
- attr_menu, WIDGET_BORDER | WIDGET_SUBWINDOW);
+ attrs.menu, WIDGET_BORDER | WIDGET_SUBWINDOW);
title = _("Select File");
mvwprintw(proc_widget.window, 0, (columns - 2 - get_mbs_width(title)) / 2, " %s ", title);
menu = new_menu(items);
if (!menu)
fatal_error("cannot create menu");
- set_menu_fore(menu, attr_menu_selected);
- set_menu_back(menu, attr_menu);
+ set_menu_fore(menu, attrs.menu_selected);
+ set_menu_back(menu, attrs.menu);
set_menu_mark(menu, NULL);
menu_opts_off(menu, O_SHOWDESC);
lines[1] = strerror(err);
count = 2;
}
- create_text_box(lines, count, _("Error"), attr_errormsg);
+ create_text_box(lines, count, _("Error"), attrs.errormsg);
}
void show_alsa_error(const char *msg, int err)
lines[1] = snd_strerror(err);
count = 2;
}
- create_text_box(lines, count, _("Error"), attr_errormsg);
+ create_text_box(lines, count, _("Error"), attrs.errormsg);
}
static char *read_file(const char *file_name, unsigned int *file_size)
if (buf[i] == '\t')
buf[i] = ' ';
}
- create_text_box(lines, line_count, file_name, attr_textbox);
+ create_text_box(lines, line_count, file_name, attrs.textbox);
free(lines);
free(buf);
}
void show_text(const char *const *lines, unsigned int count, const char *title)
{
- create_text_box(lines, count, title, attr_textbox);
+ create_text_box(lines, count, title, attrs.textbox);
}
/**********************************************************************/