diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-04-24 22:03:58 -0700 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-04-24 22:03:58 -0700 |
commit | 1fdea14cfa6e248c4ff8a29c800215fd2a874cc4 (patch) | |
tree | aced2a81f0f1f1a22dcbf48cfce052ada9e3e789 /remote_plot.c | |
parent | dea5d1b4b9a724b996b6e9dbf2ebb291972dabdc (diff) |
Add checkbuttons and scrolled_window, now checkbuttons have no effect yet
Diffstat (limited to 'remote_plot.c')
-rw-r--r-- | remote_plot.c | 147 |
1 files changed, 146 insertions, 1 deletions
diff --git a/remote_plot.c b/remote_plot.c index 0ba3635..0cd7d92 100644 --- a/remote_plot.c +++ b/remote_plot.c @@ -5,6 +5,7 @@ // plplot example ext-cairo-test.c // https://docs.gtk.org/gtk4/class.DrawingArea.html // https://www.gtk.org/docs/getting-started/hello-world/ +// https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/print-editor/print-editor.c #include <libssh/libssh.h> #include <stdlib.h> @@ -350,6 +351,141 @@ static void activate (GtkApplication *app, gpointer user_data) data->area = gtk_drawing_area_new (); GtkWidget *button; GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL,1); + GtkWidget *checkbutton[VOLTLEN+TEMPLEN]; + GtkWidget *scrolled_window; + const char *checkbutton_names[]={ + "0x630_BMS_Cell_4_Voltage", + "0x630_BMS_Cell_3_Voltage", + "0x630_BMS_Cell_2_Voltage", + "0x630_BMS_Cell_1_Voltage", + "0x631_BMS_Cell_8_Voltage", + "0x631_BMS_Cell_7_Voltage", + "0x631_BMS_Cell_6_Voltage", + "0x631_BMS_Cell_5_Voltage", + "0x632_BMS_Cell_12_Voltage", + "0x632_BMS_Cell_11_Voltage", + "0x632_BMS_Cell_10_Voltage", + "0x632_BMS_Cell_9_Voltage", + "0x633_BMS_Cell_4_Voltage", + "0x633_BMS_Cell_3_Voltage", + "0x633_BMS_Cell_2_Voltage", + "0x633_BMS_Cell_1_Voltage", + "0x634_BMS_Cell_8_Voltage", + "0x634_BMS_Cell_7_Voltage", + "0x634_BMS_Cell_6_Voltage", + "0x634_BMS_Cell_5_Voltage", + "0x635_BMS_Cell_12_Voltage", + "0x635_BMS_Cell_11_Voltage", + "0x635_BMS_Cell_10_Voltage", + "0x635_BMS_Cell_9_Voltage", + "0x636_BMS_Cell_4_Voltage", + "0x636_BMS_Cell_3_Voltage", + "0x636_BMS_Cell_2_Voltage", + "0x636_BMS_Cell_1_Voltage", + "0x637_BMS_Cell_8_Voltage", + "0x637_BMS_Cell_7_Voltage", + "0x637_BMS_Cell_6_Voltage", + "0x637_BMS_Cell_5_Voltage", + "0x638_BMS_Cell_12_Voltage", + "0x638_BMS_Cell_11_Voltage", + "0x638_BMS_Cell_10_Voltage", + "0x638_BMS_Cell_9_Voltage", + "0x639_BMS_Cell_4_Voltage", + "0x639_BMS_Cell_3_Voltage", + "0x639_BMS_Cell_2_Voltage", + "0x639_BMS_Cell_1_Voltage", + "0x63a_BMS_Cell_8_Voltage", + "0x63a_BMS_Cell_7_Voltage", + "0x63a_BMS_Cell_6_Voltage", + "0x63a_BMS_Cell_5_Voltage", + "0x63b_BMS_Cell_12_Voltage", + "0x63b_BMS_Cell_11_Voltage", + "0x63b_BMS_Cell_10_Voltage", + "0x63b_BMS_Cell_9_Voltage", + "0x63c_BMS_Cell_4_Voltage", + "0x63c_BMS_Cell_3_Voltage", + "0x63c_BMS_Cell_2_Voltage", + "0x63c_BMS_Cell_1_Voltage", + "0x63d_BMS_Cell_8_Voltage", + "0x63d_BMS_Cell_7_Voltage", + "0x63d_BMS_Cell_6_Voltage", + "0x63d_BMS_Cell_5_Voltage", + "0x63e_BMS_Cell_12_Voltage", + "0x63e_BMS_Cell_11_Voltage", + "0x63e_BMS_Cell_10_Voltage", + "0x63e_BMS_Cell_9_Voltage", + "0x63f_BMS_Cell_4_Voltage", + "0x63f_BMS_Cell_3_Voltage", + "0x63f_BMS_Cell_2_Voltage", + "0x63f_BMS_Cell_1_Voltage", + "0x640_BMS_Cell_8_Voltage", + "0x640_BMS_Cell_7_Voltage", + "0x640_BMS_Cell_6_Voltage", + "0x640_BMS_Cell_5_Voltage", + "0x641_BMS_Cell_12_Voltage", + "0x641_BMS_Cell_11_Voltage", + "0x641_BMS_Cell_10_Voltage", + "0x641_BMS_Cell_9_Voltage", + "0x642_BMS_Cell_4_Voltage", + "0x642_BMS_Cell_3_Voltage", + "0x642_BMS_Cell_2_Voltage", + "0x642_BMS_Cell_1_Voltage", + "0x643_BMS_Cell_8_Voltage", + "0x643_BMS_Cell_7_Voltage", + "0x643_BMS_Cell_6_Voltage", + "0x643_BMS_Cell_5_Voltage", + "0x644_BMS_Cell_12_Voltage", + "0x644_BMS_Cell_11_Voltage", + "0x644_BMS_Cell_10_Voltage", + "0x644_BMS_Cell_9_Voltage", + "0x645_BMS_Cell_4_Voltage", + "0x645_BMS_Cell_3_Voltage", + "0x645_BMS_Cell_2_Voltage", + "0x645_BMS_Cell_1_Voltage", + "0x646_BMS_Cell_8_Voltage", + "0x646_BMS_Cell_7_Voltage", + "0x646_BMS_Cell_6_Voltage", + "0x646_BMS_Cell_5_Voltage", + "0x647_BMS_Cell_12_Voltage", + "0x647_BMS_Cell_11_Voltage", + "0x647_BMS_Cell_10_Voltage", + "0x647_BMS_Cell_9_Voltage", + "0x680_BMS_Section_4_Temp", + "0x680_BMS_Section_3_Temp", + "0x680_BMS_Section_2_Temp", + "0x680_BMS_Section_1_Temp", + "0x683_BMS_Section_4_Temp", + "0x683_BMS_Section_3_Temp", + "0x683_BMS_Section_2_Temp", + "0x683_BMS_Section_1_Temp", + "0x686_BMS_Section_4_Temp", + "0x686_BMS_Section_3_Temp", + "0x686_BMS_Section_2_Temp", + "0x686_BMS_Section_1_Temp", + "0x689_BMS_Section_4_Temp", + "0x689_BMS_Section_3_Temp", + "0x689_BMS_Section_2_Temp", + "0x689_BMS_Section_1_Temp", + "0x68c_BMS_Section_4_Temp", + "0x68c_BMS_Section_3_Temp", + "0x68c_BMS_Section_2_Temp", + "0x68c_BMS_Section_1_Temp", + "0x68f_BMS_Section_4_Temp", + "0x68f_BMS_Section_3_Temp", + "0x68f_BMS_Section_2_Temp", + "0x68f_BMS_Section_1_Temp", + "0x692_BMS_Section_4_Temp", + "0x692_BMS_Section_3_Temp", + "0x692_BMS_Section_2_Temp", + "0x692_BMS_Section_1_Temp", + "0x695_BMS_Section_4_Temp", + "0x695_BMS_Section_3_Temp", + "0x695_BMS_Section_2_Temp", + "0x695_BMS_Section_1_Temp" + }; + + for(int i=0;i<(VOLTLEN+TEMPLEN);i++) + checkbutton[i]=gtk_check_button_new_with_label(checkbutton_names[i]); window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "remote_plot"); @@ -364,9 +500,18 @@ static void activate (GtkApplication *app, gpointer user_data) button = gtk_button_new_with_label ("Print data"); g_signal_connect (button, "clicked", G_CALLBACK (print_data), user_data); + // https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/print-editor/print-editor.c + scrolled_window=gtk_scrolled_window_new(); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE); + gtk_widget_set_vexpand (scrolled_window, TRUE); + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), box); + gtk_box_append(GTK_BOX(box), button); gtk_box_append(GTK_BOX(box), data->area); - gtk_window_set_child (GTK_WINDOW (window), box); + for(int i=0;i<(VOLTLEN+TEMPLEN);i++) + gtk_box_append(GTK_BOX(box), checkbutton[i]); + gtk_window_set_child (GTK_WINDOW (window), scrolled_window); gtk_window_present (GTK_WINDOW (window)); |