ui: editable signal values and their pencil align right with the read-only ones
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e29c889483
commit
c15c89c00a
1 file changed
+3
-4
@@ -131,16 +131,15 @@ GtkWidget* build_info_grid(App& app, std::size_t index, const SignalInfo& sig,
|
|||||||
GtkWidget* name_label = gtk_label_new(row.label);
|
GtkWidget* name_label = gtk_label_new(row.label);
|
||||||
gtk_widget_set_halign(name_label, GTK_ALIGN_START);
|
gtk_widget_set_halign(name_label, GTK_ALIGN_START);
|
||||||
gtk_grid_attach(GTK_GRID(grid), name_label, 0, r, 1, 1);
|
gtk_grid_attach(GTK_GRID(grid), name_label, 0, r, 1, 1);
|
||||||
// An editable value sits against its label with the pencil right after it; a read-only one is pushed to
|
// Every value is pushed to the right edge; an editable one carries its pencil right after it.
|
||||||
// the right edge, so the two kinds read as two columns.
|
|
||||||
const bool editable = row.edit >= 0;
|
const bool editable = row.edit >= 0;
|
||||||
GtkWidget* cell = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
|
GtkWidget* cell = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
|
||||||
gtk_widget_set_hexpand(cell, true);
|
gtk_widget_set_hexpand(cell, true);
|
||||||
gtk_widget_set_halign(cell, editable ? GTK_ALIGN_START : GTK_ALIGN_END);
|
gtk_widget_set_halign(cell, GTK_ALIGN_END);
|
||||||
GtkWidget* value = gtk_label_new(row.value.c_str());
|
GtkWidget* value = gtk_label_new(row.value.c_str());
|
||||||
gtk_widget_add_css_class(value, "numeric");
|
gtk_widget_add_css_class(value, "numeric");
|
||||||
if (row.id != nullptr) gtk_widget_set_name(value, row.id);
|
if (row.id != nullptr) gtk_widget_set_name(value, row.id);
|
||||||
gtk_label_set_xalign(GTK_LABEL(value), editable ? 0.0f : 1.0f);
|
gtk_label_set_xalign(GTK_LABEL(value), 1.0f);
|
||||||
gtk_label_set_wrap(GTK_LABEL(value), !editable);
|
gtk_label_set_wrap(GTK_LABEL(value), !editable);
|
||||||
gtk_box_append(GTK_BOX(cell), value);
|
gtk_box_append(GTK_BOX(cell), value);
|
||||||
if (!row.unit.empty()) {
|
if (!row.unit.empty()) {
|
||||||
|
|||||||
Reference in new issue
Block a user