diff --git a/iPDC/assets/utility_tools.ui b/iPDC/assets/utility_tools.ui index 55b2faf..bb9d77f 100644 --- a/iPDC/assets/utility_tools.ui +++ b/iPDC/assets/utility_tools.ui @@ -897,44 +897,6 @@ 0 - - - - True - False - - - True - True - True - rgb(253,0,0) - - - 0 - 0 - - - - - True - False - IITdh - - - 1 - 0 - - - - - False - True - 1 - - - - - @@ -974,39 +936,7 @@ - - - True - False - - - True - True - True - rgb(253,0,0) - - - 0 - 0 - - - - - True - False - IITdh - - - 1 - 0 - - - - - False - True - 1 - + @@ -1050,39 +980,7 @@ - - - True - False - - - True - True - True - rgb(253,0,0) - - - 0 - 0 - - - - - True - False - IITdh - - - 1 - 0 - - - - - False - True - 1 - + diff --git a/iPDC/assets/utility_tools.ui~ b/iPDC/assets/utility_tools.ui~ index 8ddf063..2d15355 100644 --- a/iPDC/assets/utility_tools.ui~ +++ b/iPDC/assets/utility_tools.ui~ @@ -932,12 +932,6 @@ 1 - - - - - - @@ -1123,7 +1117,7 @@ False Voltage Magnitude - + diff --git a/iPDC/inc/utility_tools.h b/iPDC/inc/utility_tools.h index 456aa81..41943d1 100644 --- a/iPDC/inc/utility_tools.h +++ b/iPDC/inc/utility_tools.h @@ -41,6 +41,9 @@ struct _UtData GtkWidget *swad; GtkWidget *maplabel; GtkWidget *graphlabel; + GtkWidget *gl1; + GtkWidget *gl2; + GtkWidget *gl3; }; UtData *utdata; diff --git a/iPDC/src/utility_tools.c b/iPDC/src/utility_tools.c index c3ea1b3..8af4d40 100644 --- a/iPDC/src/utility_tools.c +++ b/iPDC/src/utility_tools.c @@ -313,6 +313,9 @@ void utility_tools(GtkButton *but, gpointer udata) utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq")); utdata->maplabel = GTK_WIDGET(gtk_builder_get_object(builder, "maplabel")); 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_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_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 = temp_visptr->next; index++;