diff --git a/cold.c b/cold.c index b237065..a1c71f4 100644 --- a/cold.c +++ b/cold.c @@ -4,7 +4,6 @@ void print_text(GtkWidget *widget, gpointer data) {g_print (data);} - GtkWidget *get_a_space_test_image(){ GtkWidget *image; image = GTK_WIDGET(get_scrolled_gl_area()); @@ -183,13 +182,13 @@ GtkWidget *get_space_page_new(){ // attach either : get_ELAPSED_TIME_box() or get_simulation_time_extent_buffer() // gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ELAPSED_TIME_box()), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_simulation_time_extent_buffer()), 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 2, 1, 10); + gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 1, 1, 4); + gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 5, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_RUN_STOP_box()), 1, 0, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), get_scroll_speed(), 1, 1, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_STEP_by_STEP_box()), 1, 2, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 3, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 4, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), get_scroll_speed(), 1, 2, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_STEP_by_STEP_box()), 1, 3, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 4, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 5, 1, 1); return space_grid; } diff --git a/cold.h b/cold.h index 66c4cdd..a82495f 100644 --- a/cold.h +++ b/cold.h @@ -20,6 +20,7 @@ GtkWidget *get_a_space_test_image(); GtkScrolledWindow *get_scrolled_gl_area(); GtkBox *get_RUN_STOP_box(); GtkBox *get_STEP_by_STEP_box(); +GtkBox *get_CONTROL_box(); GtkBox *get_ZOOM_box(); GtkBox *get_XYZ_box(); GtkWidget *get_scroll_speed(); diff --git a/cold.o b/cold.o index 6f6dcf5..a686977 100644 Binary files a/cold.o and b/cold.o differ diff --git a/main.o b/main.o index 4303358..0be068b 100644 Binary files a/main.o and b/main.o differ diff --git a/myprogram b/myprogram index dbe03d7..9dcb5ad 100755 Binary files a/myprogram and b/myprogram differ diff --git a/warm.c b/warm.c index c4af85b..386a8af 100644 --- a/warm.c +++ b/warm.c @@ -5,3 +5,102 @@ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery + + + + + + + + + + + + + + +/* + essai run-stop, speed et step by step dans une seule box controls + ----------------------------------------------------------------- + + +#include +#include +#include "cold.h" + +void print_text(GtkWidget *widget, gpointer data) {g_print (data);} + +GtkWidget *get_a_space_test_image(){ + GtkWidget *image; + image = GTK_WIDGET(get_scrolled_gl_area()); + image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/aXoris.png"); + image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/gg sketch.png"); + image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/E coli.png"); + image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/images/E coli resized.png"); + image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/E coli by David S. Goodsell (2009).png"); + return image; +} + +GtkWidget *get_scroll_speed(){ + GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0); + GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, speed_adjust); + return scroll_speed; +} + +// TODO cliquer sur "RUN" --> affiche "STOP" (et inversement) +GtkBox *get_RUN_STOP_box(){ + GtkBox *RUN_STOP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2 + + GtkWidget *RUN_Label = GTK_WIDGET (gtk_label_new (NULL)); // "RUN")); + const char *str = " RUN\n STOP"; + const char *format = "\%s"; + char *markup; + + markup = g_markup_printf_escaped (format, str); + gtk_label_set_markup (GTK_LABEL (RUN_Label), markup); // Sets the labels text and attributes from markup. + g_free (markup); + + gtk_label_set_max_width_chars (GTK_LABEL(RUN_Label), 12); + gtk_label_set_wrap (GTK_LABEL(RUN_Label), TRUE); + gtk_label_set_xalign (GTK_LABEL(RUN_Label), 0.5); // xalign value, between 0 and 1 + gtk_label_set_yalign (GTK_LABEL(RUN_Label), 0.5); + gtk_label_set_selectable (GTK_LABEL(RUN_Label), FALSE); // default = FALSE + gtk_label_set_single_line_mode (GTK_LABEL(RUN_Label), TRUE); // default = TRUE + // + gtk_box_append (RUN_STOP_box, RUN_Label); + return RUN_STOP_box; +} + +GtkBox *get_STEP_by_STEP_box(){ + GtkBox *STEP_by_STEP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GtkWidget *STEP_by_STEP_Label = GTK_WIDGET (gtk_label_new ("ONE\nSTEP")); + gtk_box_append (STEP_by_STEP_box, STEP_by_STEP_Label); + return STEP_by_STEP_box; +} + +GtkBox *get_CONTROL_box(){ + GtkBox *CONTROL_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); + gtk_box_append (CONTROL_box, GTK_WIDGET (get_RUN_STOP_box())); + gtk_box_append (CONTROL_box, GTK_WIDGET (get_scroll_speed())); + gtk_box_append (CONTROL_box, GTK_WIDGET (get_STEP_by_STEP_box())); + return CONTROL_box; +} + +GtkWidget *get_space_page_new(){ + + GtkWidget *space_grid = gtk_grid_new(); +// attach either : get_ELAPSED_TIME_box() or get_simulation_time_extent_buffer() +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ELAPSED_TIME_box()), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_simulation_time_extent_buffer()), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), get_a_space_test_image(), 0, 1, 1, 5); + gtk_grid_attach (GTK_GRID(space_grid), get_objects_and_situations_horizontal_pane(), 0, 6, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_RUN_STOP_box()), 1, 0, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), get_scroll_speed(), 1, 2, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_STEP_by_STEP_box()), 1, 3, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_CONTROL_box()), 1, 0, 1, 2); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_XYZ_box()), 1, 2, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_ZOOM_box()), 1, 3, 1, 1); + + return space_grid; +} +*/