add legend entries dynamically
This commit is contained in:
parent
a8faacf61f
commit
6a733aa270
|
@ -897,44 +897,6 @@
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<!-- n-columns=2 n-rows=1 -->
|
|
||||||
<object class="GtkGrid">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColorButton">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
<property name="rgba">rgb(253,0,0)</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">IITdh</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
|
@ -974,39 +936,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=1 -->
|
<placeholder/>
|
||||||
<object class="GtkGrid">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColorButton">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
<property name="rgba">rgb(253,0,0)</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">IITdh</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
|
@ -1050,39 +980,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=1 -->
|
<placeholder/>
|
||||||
<object class="GtkGrid">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColorButton">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
<property name="rgba">rgb(253,0,0)</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">IITdh</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
|
|
|
@ -932,12 +932,6 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1123,7 +1117,7 @@
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="label" translatable="yes">Voltage Magnitude</property>
|
<property name="label" translatable="yes">Voltage Magnitude</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="scale" value="2"/>
|
<attribute name="scale" value="1"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -41,6 +41,9 @@ struct _UtData
|
||||||
GtkWidget *swad;
|
GtkWidget *swad;
|
||||||
GtkWidget *maplabel;
|
GtkWidget *maplabel;
|
||||||
GtkWidget *graphlabel;
|
GtkWidget *graphlabel;
|
||||||
|
GtkWidget *gl1;
|
||||||
|
GtkWidget *gl2;
|
||||||
|
GtkWidget *gl3;
|
||||||
};
|
};
|
||||||
|
|
||||||
UtData *utdata;
|
UtData *utdata;
|
||||||
|
|
|
@ -313,6 +313,9 @@ void utility_tools(GtkButton *but, gpointer udata)
|
||||||
utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
|
utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
|
||||||
utdata->maplabel = GTK_WIDGET(gtk_builder_get_object(builder, "maplabel"));
|
utdata->maplabel = GTK_WIDGET(gtk_builder_get_object(builder, "maplabel"));
|
||||||
utdata->graphlabel = GTK_WIDGET(gtk_builder_get_object(builder, "graphlabel"));
|
utdata->graphlabel = GTK_WIDGET(gtk_builder_get_object(builder, "graphlabel"));
|
||||||
|
utdata->gl1 = GTK_WIDGET(gtk_builder_get_object(builder, "gl1"));
|
||||||
|
utdata->gl2 = GTK_WIDGET(gtk_builder_get_object(builder, "gl2"));
|
||||||
|
utdata->gl3 = GTK_WIDGET(gtk_builder_get_object(builder, "gl3"));
|
||||||
|
|
||||||
gtk_widget_set_sensitive(utdata->voltage, FALSE);
|
gtk_widget_set_sensitive(utdata->voltage, FALSE);
|
||||||
gtk_widget_set_visible(utdata->algorithm, FALSE);
|
gtk_widget_set_visible(utdata->algorithm, FALSE);
|
||||||
|
@ -407,6 +410,25 @@ void utility_tools(GtkButton *but, gpointer udata)
|
||||||
live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_dfreq), &color);
|
live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_dfreq), &color);
|
||||||
live_chart_chart_add_serie(chart_dfreq, temp_visptr->serie_dfreq);
|
live_chart_chart_add_serie(chart_dfreq, temp_visptr->serie_dfreq);
|
||||||
|
|
||||||
|
// create a grid with gtkcolorbutton and gtklabel
|
||||||
|
GtkWidget *grid = gtk_grid_new();
|
||||||
|
GtkWidget *color_button = gtk_color_button_new_with_rgba(&color);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid), color_button, 0, 0, 1, 1);
|
||||||
|
gchar *label_text = g_strdup_printf("%d", llptr->pmuid);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||||
|
// TODO: customise the line color
|
||||||
|
gtk_box_pack_start(GTK_BOX(utdata->gl1), grid, FALSE, FALSE, 0);
|
||||||
|
GtkWidget *grid2 = gtk_grid_new();
|
||||||
|
GtkWidget *color_button2 = gtk_color_button_new_with_rgba(&color);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid2), color_button2, 0, 0, 1, 1);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid2), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||||
|
gtk_box_pack_start(GTK_BOX(utdata->gl2), grid2, FALSE, FALSE, 0);
|
||||||
|
GtkWidget *grid3 = gtk_grid_new();
|
||||||
|
GtkWidget *color_button3 = gtk_color_button_new_with_rgba(&color);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid3), color_button3, 0, 0, 1, 1);
|
||||||
|
gtk_grid_attach(GTK_GRID(grid3), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||||
|
gtk_box_pack_start(GTK_BOX(utdata->gl3), grid3, FALSE, FALSE, 0);
|
||||||
|
|
||||||
temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
|
temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
|
||||||
temp_visptr = temp_visptr->next;
|
temp_visptr = temp_visptr->next;
|
||||||
index++;
|
index++;
|
||||||
|
|
Loading…
Reference in New Issue