diff --git a/cold.c b/cold.c index 50199eb..c94470d 100644 --- a/cold.c +++ b/cold.c @@ -4,14 +4,38 @@ void print_text(GtkWidget *widget, gpointer data) {g_print (data);} -void click_print_do (GtkWindow *window, GtkWidget *grid, - char *label, char *text, int x, int y, int w, int h){ - GtkWidget *button = gtk_button_new_with_label (label); - gtk_grid_attach (GTK_GRID (grid), button, x, y, w, h); - g_signal_connect (button, "clicked", G_CALLBACK (print_text), text); - if (window) - g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); +GtkWidget *get_objects_and_situations_horizontal_pane(){ + GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + GtkWidget *frame_objects = gtk_frame_new ("Objects"); // define each class of object transparence + GtkWidget *frame_situations = gtk_frame_new ("Situations"); // facilitate each situation identification + gtk_widget_set_size_request (objects_and_situations_horizontal_pane, W_GL_AREA, H_STYLES_PANE); + gtk_widget_set_size_request (frame_objects, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max + gtk_widget_set_size_request (frame_situations, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max + gtk_paned_set_start_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (frame_objects)); + gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (frame_situations)); + return objects_and_situations_horizontal_pane; } + +GtkProgressBar *get_simulation_time_extent_buffer(){ + GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); + gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extent time) --->"); + gtk_progress_bar_set_show_text (buffer, TRUE); + return buffer; +} + +GtkScrolledWindow *get_scrolled_gl_area(){ + GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); + gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA); + gtk_scrolled_window_set_min_content_height (scrolled, H_GL_AREA); +// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); +// GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); + // (value, lower, upper, step_increment, page_increment, page_size) + GtkWidget *GLarea = gtk_gl_area_new(); + gtk_scrolled_window_set_child (scrolled, GLarea); +// https://docs.gtk.org/gtk4/class.GLArea.html + return scrolled; +} + GtkWidget *get_measures_page_new(){ GtkWidget *measures_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("movements"), 0, 0, 1, 1); @@ -77,7 +101,7 @@ void activate (GtkApplication *app, gpointer user_data) { window_bar (window, "window"); GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new()); - gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_LEFT); + gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); // GTK_POS_LEFT gtk_notebook_append_page (notebook, get_space_page_new(), gtk_label_new ("space")); gtk_notebook_append_page (notebook, get_rules_page_new(), gtk_label_new ("rules")); @@ -90,6 +114,15 @@ void activate (GtkApplication *app, gpointer user_data) { gtk_window_present (GTK_WINDOW (window)); } +void click_print_do (GtkWindow *window, GtkWidget *grid, + char *label, char *text, int x, int y, int w, int h){ + GtkWidget *button = gtk_button_new_with_label (label); + gtk_grid_attach (GTK_GRID (grid), button, x, y, w, h); + g_signal_connect (button, "clicked", G_CALLBACK (print_text), text); + if (window) + g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); +} + /*----------------------------------------------------------------------------*/ /* GtkBox GtkGrid GtkRevealer GtkStack diff --git a/cold.h b/cold.h index aab5101..1d3c02c 100644 --- a/cold.h +++ b/cold.h @@ -1,17 +1,16 @@ #include #include -#define W 1830 -#define H 1000 -#define W_GL_AREA 1800 - 34 -#define H_GL_AREA 1000 - 6 +#define W 1920 +#define H 960 +#define W_GL_AREA 1920 - 64 +#define H_GL_AREA 960 - 46 +#define H_STYLES_PANE 60 void print_text(GtkWidget *widget, gpointer data); - -void click_print_do (GtkWindow *window, GtkWidget *grid, - char *label, char *text, int x, int y, int w, int h); - +GtkScrolledWindow *get_scrolled_gl_area(); void window_bar(GtkWindow *window, char *title); - +GtkWidget *get_objects_and_situations_horizontal_pane(); +GtkProgressBar *get_simulation_time_extent_buffer(); void activate (GtkApplication *app, gpointer user_data); GtkWidget *get_space_page_new(); @@ -21,6 +20,9 @@ GtkWidget *get_results_page_new(); GtkWidget *get_discuss_page_new(); GtkWidget *get_help_page_new(); +void click_print_do (GtkWindow *window, GtkWidget *grid, + char *label, char *text, int x, int y, int w, int h); + // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery /* diff --git a/cold.o b/cold.o index d14ab50..a19c604 100644 Binary files a/cold.o and b/cold.o differ diff --git a/hot.c b/hot.c index bba010e..973a20d 100644 --- a/hot.c +++ b/hot.c @@ -8,10 +8,9 @@ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery GtkWidget *get_space_page_new(){ + /* GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); gtk_box_append (controls_box, gtk_button_new_with_label ("RUN")); - GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0); - GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, speed_adjust); // gtk_box_append (controls_box, scroll_speed); gtk_box_append (controls_box, gtk_button_new_with_label ("step")); @@ -19,11 +18,12 @@ GtkWidget *get_space_page_new(){ // gtk_level_bar_set_mode (slow_speed, GTK_LEVEL_BAR_MODE_CONTINUOUS); //_DISCRETE // gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up")); // GTK_WIDGET(slow_speed)); // gtk_box_append (controls_box, gtk_button_new_with_label ("step by step")); - GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); - gtk_progress_bar_set_text (buffer, "<>"); - gtk_progress_bar_set_show_text (buffer, TRUE); - gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); + GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); + gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extent time) --->"); + gtk_progress_bar_set_show_text (buffer, TRUE); +// gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); +*/ @@ -40,24 +40,34 @@ GtkWidget *get_space_page_new(){ gtk_box_append (XYZ_box, scroll_X); gtk_box_append (XYZ_box, scroll_Y); gtk_box_append (XYZ_box, scroll_Z); - +/* GtkWidget *bottom_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(bottom_grid), GTK_WIDGET(controls_box), 0, 0, 1, 1); +// gtk_grid_attach (GTK_GRID(bottom_grid), GTK_WIDGET(controls_box), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("Objects / Situations (transparences, styles)"), 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("zoom, +/- grid,\npresentation,\nstyles,..."), 1, 0, 1, 2); + gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("zoom, +/- grid,\npresentation,\n objects styles,..."), 1, 0, 1, 2); + GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + GtkWidget *frame_objects = gtk_frame_new ("Objects"); // define each class of object transparence + GtkWidget *frame_situations = gtk_frame_new ("Situations"); // facilitate each situation identification + gtk_widget_set_size_request (objects_and_situations_horizontal_pane, W_GL_AREA, H_STYLES_PANE); + gtk_widget_set_size_request (frame_objects, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max + gtk_widget_set_size_request (frame_situations, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max + gtk_paned_set_start_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (frame_objects)); + gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (frame_situations)); +*/ GtkWidget *space_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("Objects / Situations (transparences, styles)"), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (space_grid), get_objects_and_situations_horizontal_pane(), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_scrolled_gl_area()), 0, 1, 1, 10); gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("RUN"), 1, 0, 1, 1); + GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0); + GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, speed_adjust); gtk_grid_attach (GTK_GRID(space_grid), scroll_speed, 1, 1, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("STEP"), 1, 2, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(controls_box), 1, 3, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(buffer), 1, 3, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 3, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(bottom_grid), 0, 1, 2, 1); // ?! échec x_size -// gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("?"), 1, 1, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("Step"), 1, 2, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_simulation_time_extent_buffer()), 0, 2, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 3, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("zoom"), 1, 4, 1, 1); return space_grid; + } diff --git a/hot.o b/hot.o index 4103ee8..88bea5a 100644 Binary files a/hot.o and b/hot.o differ diff --git a/main.o b/main.o index eaf6c6a..b364a66 100644 Binary files a/main.o and b/main.o differ diff --git a/myprogram b/myprogram index 306f41e..dc6dc4d 100755 Binary files a/myprogram and b/myprogram differ diff --git a/warm.c b/warm.c index dd35605..13e9083 100644 --- a/warm.c +++ b/warm.c @@ -5,20 +5,6 @@ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery -GtkScrolledWindow *get_scrolled_gl_area(){ - GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); - gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA); - gtk_scrolled_window_set_min_content_height (scrolled, H_GL_AREA); -// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); -// GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); - // (value, lower, upper, step_increment, page_increment, page_size) - GtkWidget *GLarea = gtk_gl_area_new(); - gtk_scrolled_window_set_child (scrolled, GLarea); -// https://docs.gtk.org/gtk4/class.GLArea.html - - return scrolled; -} - GtkWidget *get_space_page_new_2024_04_30 (){ GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); @@ -60,6 +46,25 @@ GtkWidget *get_space_page_new_2024_04_30 (){ return space_grid; } + + + + + + + + + + + + + + + + + + + /* void activate (GtkApplication *app, gpointer user_data) { GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app)); window_bar (window, "window"); diff --git a/warm.h b/warm.h index 4bf9edb..d9eabd3 100644 --- a/warm.h +++ b/warm.h @@ -15,7 +15,7 @@ #include "cold.h" -GtkScrolledWindow *get_scrolled_gl_area(); +//GtkScrolledWindow *get_scrolled_gl_area(); GtkWidget *get_space_page_new_2024_04_30(); // sécurité 2024_04_30 1ère version /* diff --git a/warm.o b/warm.o index bb7d5b9..2584186 100644 Binary files a/warm.o and b/warm.o differ