Display input labels across the top of the mixer window

Especially for the 18i20, having labels across the top as well as
along the bottom makes it easier to follow the grid.
This commit is contained in:
Geoffrey D. Bennett
2022-03-14 09:22:39 +10:30
parent 7df79349f9
commit c661b4a915
2 changed files with 23 additions and 15 deletions

View File

@@ -95,8 +95,9 @@ struct routing_dst {
// 0-based count within port_category // 0-based count within port_category
int port_num; int port_num;
// the mixer label widget for this destination // the mixer label widgets for this destination
GtkWidget *mixer_label; GtkWidget *mixer_label_top;
GtkWidget *mixer_label_bottom;
}; };
// entry in alsa_card elems (ALSA control elements) array // entry in alsa_card elems (ALSA control elements) array

View File

@@ -39,13 +39,13 @@ GtkWidget *create_mixer_controls(struct alsa_card *card) {
GtkWidget *l_left = gtk_label_new(name); GtkWidget *l_left = gtk_label_new(name);
gtk_grid_attach( gtk_grid_attach(
GTK_GRID(mixer_top), l_left, GTK_GRID(mixer_top), l_left,
0, i, 1, 1 0, i + 2, 1, 1
); );
GtkWidget *l_right = gtk_label_new(name); GtkWidget *l_right = gtk_label_new(name);
gtk_grid_attach( gtk_grid_attach(
GTK_GRID(mixer_top), l_right, GTK_GRID(mixer_top), l_right,
card->routing_out_count[PC_MIX] + 1, i, 1, 1 card->routing_out_count[PC_MIX] + 1, i + 2, 1, 1
); );
} }
@@ -74,7 +74,7 @@ GtkWidget *create_mixer_controls(struct alsa_card *card) {
// create the gain control and attach to the grid // create the gain control and attach to the grid
GtkWidget *w = make_gain_alsa_elem(elem); GtkWidget *w = make_gain_alsa_elem(elem);
gtk_grid_attach(GTK_GRID(mixer_top), w, input_num + 1, mix_num, 1, 1); gtk_grid_attach(GTK_GRID(mixer_top), w, input_num + 1, mix_num + 2, 1, 1);
// look up the r_dst entry for the mixer input number // look up the r_dst entry for the mixer input number
struct routing_dst *r_dst = get_mixer_r_dst(card, input_num + 1); struct routing_dst *r_dst = get_mixer_r_dst(card, input_num + 1);
@@ -83,17 +83,22 @@ GtkWidget *create_mixer_controls(struct alsa_card *card) {
continue; continue;
} }
// lookup the label for the mixer input // lookup the top label for the mixer input
GtkWidget *l = r_dst->mixer_label; GtkWidget *l_top = r_dst->mixer_label_top;
// if the label doesn't already exist, create it and attach it to // if the top label doesn't already exist the bottom doesn't
// the bottom of the grid // either; create them both and attach to the grid
if (!l) { if (!l_top) {
l = r_dst->mixer_label = gtk_label_new(""); l_top = r_dst->mixer_label_top = gtk_label_new("");
GtkWidget *l_bottom = r_dst->mixer_label_bottom = gtk_label_new("");
gtk_grid_attach( gtk_grid_attach(
GTK_GRID(mixer_top), l, GTK_GRID(mixer_top), l_top,
input_num, card->routing_in_count[PC_MIX] + input_num % 2, 3, 1 input_num, (input_num + 1) % 2, 3, 1
);
gtk_grid_attach(
GTK_GRID(mixer_top), l_bottom,
input_num, card->routing_in_count[PC_MIX] + input_num % 2 + 2, 3, 1
); );
} }
} }
@@ -120,7 +125,9 @@ void update_mixer_labels(struct alsa_card *card) {
card->routing_srcs, struct routing_src, routing_src_idx card->routing_srcs, struct routing_src, routing_src_idx
); );
if (r_dst->mixer_label) if (r_dst->mixer_label_top) {
gtk_label_set_text(GTK_LABEL(r_dst->mixer_label), r_src->name); gtk_label_set_text(GTK_LABEL(r_dst->mixer_label_top), r_src->name);
gtk_label_set_text(GTK_LABEL(r_dst->mixer_label_bottom), r_src->name);
}
} }
} }