Add CSS classes to controls and add more colour

This commit is contained in:
Geoffrey D. Bennett
2024-01-20 18:46:36 +10:30
parent 1caa75a7d2
commit ade852163b
4 changed files with 100 additions and 0 deletions

View File

@@ -38,8 +38,79 @@ button {
button:checked {
color: #ffffff;
border: 1px solid #202020;
}
button:hover {
background: #202020;
}
button:disabled {
background: #000000;
color: #505050;
}
/* Button controls that are always disabled because they indicate status */
button.fixed {
color: #ffffff;
}
/* Combobox controls that are always disabled because they indicate status */
combobox.fixed > box > button {
color: #ffffff;
}
/* Buttons that glow when on */
button.sync-status {
text-shadow: 0 0 5px #a00000, 0 0 15px #800000;
}
button.sync-status:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
button.input-select:checked {
color: #ffffff;
text-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00, 0 0 15px #00ff00;
}
button.input-link:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
button.autogain:checked {
text-shadow: 0 0 5px #0000ff, 0 0 15px #0000ff;
}
button.safe:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
button.inst:checked {
text-shadow: 0 0 5px #ff0000, 0 0 15px #ff0000;
}
.gen4 button.inst:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
button.air:checked {
text-shadow: 0 0 5px #ffc000, 0 0 15px #ffc000;
}
button.pad:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
button.phantom:checked {
text-shadow: 0 0 5px #ff0000, 0 0 15px #c00000;
}
.gen4 button.phantom:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}
/* Direct Monitor Checked (Solo) */
.direct-monitor:checked {
text-shadow: 0 0 5px #00c000, 0 0 15px #00c000;
}

View File

@@ -39,6 +39,8 @@ static void add_clock_source_control(
GtkWidget *l = gtk_label_new("Clock Source");
GtkWidget *w = make_combo_box_alsa_elem(clock_source);
gtk_widget_add_css_class(w, "clock-source");
gtk_widget_add_css_class(w, "fixed");
gtk_box_append(GTK_BOX(b), l);
gtk_box_append(GTK_BOX(b), w);
@@ -77,6 +79,8 @@ static void add_sync_status_control(
GtkWidget *l = gtk_label_new("Sync Status");
gtk_box_append(GTK_BOX(b), l);
GtkWidget *w = make_boolean_alsa_elem(sync_status, "Unlocked", "Locked");
gtk_widget_add_css_class(w, "sync-status");
gtk_widget_add_css_class(w, "fixed");
gtk_box_append(GTK_BOX(b), w);
}
@@ -159,6 +163,7 @@ static void create_input_link_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Link", NULL);
gtk_widget_add_css_class(w, "input-link");
int from, to;
get_two_num_from_string(elem->name, &from, &to);
@@ -186,6 +191,7 @@ static void create_input_autogain_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Autogain", NULL);
gtk_widget_add_css_class(w, "autogain");
gtk_widget_set_tooltip_text(
w,
"Autogain will listen to the input signal for 10 seconds and "
@@ -214,6 +220,7 @@ static void create_input_safe_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Safe", NULL);
gtk_widget_add_css_class(w, "safe");
gtk_widget_set_tooltip_text(
w,
"Enabling Safe Mode prevents the input from clipping by "
@@ -230,6 +237,7 @@ static void create_input_level_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Inst", NULL);
gtk_widget_add_css_class(w, "inst");
gtk_widget_set_tooltip_text(w, level_descr);
gtk_grid_attach(GTK_GRID(grid), w, column_num, current_row, 1, 1);
@@ -242,6 +250,7 @@ static void create_input_air_switch_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Air", NULL);
gtk_widget_add_css_class(w, "air");
gtk_widget_set_tooltip_text(w, air_descr);
gtk_grid_attach(GTK_GRID(grid), w, column_num, current_row, 1, 1);
@@ -254,6 +263,7 @@ static void create_input_air_enum_control(
int column_num
) {
GtkWidget *w = make_combo_box_alsa_elem(elem);
gtk_widget_add_css_class(w, "air");
gtk_widget_set_tooltip_text(w, air_descr);
gtk_grid_attach(GTK_GRID(grid), w, column_num, current_row, 1, 1);
@@ -266,6 +276,7 @@ static void create_input_pad_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "Pad", NULL);
gtk_widget_add_css_class(w, "pad");
gtk_widget_set_tooltip_text(
w,
"Enabling Pad engages a 10dB attenuator in the channel, giving "
@@ -282,6 +293,7 @@ static void create_input_phantom_control(
int column_num
) {
GtkWidget *w = make_boolean_alsa_elem(elem, "48V", NULL);
gtk_widget_add_css_class(w, "phantom");
gtk_widget_set_tooltip_text(w, phantom_descr);
int from, to;
@@ -578,6 +590,16 @@ static GtkWidget *create_main_window_controls(struct alsa_card *card) {
GtkWidget *top = gtk_grid_new();
gtk_widget_add_css_class(top, "window-content");
gtk_widget_add_css_class(top, "iface-mixer");
if (strstr(card->name, "4th Gen") ||
strstr(card->name, "Gen 4")) {
gtk_widget_add_css_class(top, "gen4");
} else if (strstr(card->name, "Scarlett")) {
gtk_widget_add_css_class(top, "scarlett");
} else if (strstr(card->name, "Clarett")) {
gtk_widget_add_css_class(top, "clarett");
}
gtk_grid_set_spacing(GTK_GRID(top), 10);
int input_count = get_max_elem_by_name(

View File

@@ -69,20 +69,24 @@ GtkWidget *create_iface_no_mixer_main(struct alsa_card *card) {
if (strstr(elem->name, "Level Capture Enum")) {
w = make_boolean_alsa_elem(elem, "Inst", NULL);
gtk_widget_add_css_class(w, "inst");
gtk_widget_set_tooltip_text(w, level_descr);
gtk_grid_attach(GTK_GRID(input_grid), w, line_num - 1, 1, 1, 1);
} else if (strstr(elem->name, "Air Capture Switch")) {
w = make_boolean_alsa_elem(elem, "Air", NULL);
gtk_widget_add_css_class(w, "air");
gtk_widget_set_tooltip_text(w, air_descr);
gtk_grid_attach(
GTK_GRID(input_grid), w, line_num - 1, 1 + !is_solo, 1, 1
);
} else if (strstr(elem->name, "Phantom Power Capture Switch")) {
w = make_boolean_alsa_elem(elem, "48V", NULL);
gtk_widget_add_css_class(w, "phantom");
gtk_widget_set_tooltip_text(w, phantom_descr);
gtk_grid_attach(GTK_GRID(input_grid), w, 0, 3, 1 + !is_solo, 1);
} else if (strcmp(elem->name, "Direct Monitor Playback Switch") == 0) {
w = make_boolean_alsa_elem(elem, "Direct Monitor", NULL);
gtk_widget_add_css_class(w, "direct-monitor");
gtk_widget_set_tooltip_text(
w,
"Direct Monitor sends the analogue input signals to the "
@@ -93,6 +97,7 @@ GtkWidget *create_iface_no_mixer_main(struct alsa_card *card) {
GtkWidget *l = gtk_label_new("Direct Monitor");
gtk_grid_attach(GTK_GRID(output_grid), l, 0, 0, 1, 1);
w = make_combo_box_alsa_elem(elem);
gtk_widget_add_css_class(w, "direct-monitor");
gtk_widget_set_tooltip_text(
w,
"Direct Monitor sends the analogue input signals to the "

View File

@@ -62,6 +62,8 @@ GtkWidget *make_input_select_alsa_elem(
data->button = gtk_toggle_button_new();
data->line_num = line_num;
gtk_widget_add_css_class(data->button, "input-select");
char s[20];
snprintf(s, 20, "%d", line_num);
gtk_button_set_label(GTK_BUTTON(data->button), s);