diff --git a/cold.c b/cold.c index 94916a1..4794d90 100644 --- a/cold.c +++ b/cold.c @@ -12,6 +12,59 @@ void click_print_do (GtkWindow *window, GtkWidget *grid, if (window) g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); } +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); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transports"), 1, 0, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects"), 0, 1, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations"), 1, 1, 1, 1); + return measures_grid; +} + +GtkWidget *get_results_page_new(){ + GtkWidget *results_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Here are some results :"), 0, 0, 1, 1); + return results_grid; +} + +GtkWidget *get_discuss_page_new(){ + GtkWidget *discuss_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1); + return discuss_grid; +} + +GtkWidget *get_help_page_new(){ + GtkWidget *help_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID (help_grid), gtk_button_new_with_label ("Can I help you ?"), 0, 0, 1, 1); + return help_grid; +} + + +GtkWidget *get_rules_page_new(){ + GtkWidget *rules_grid = gtk_grid_new(); + GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); + + GtkWidget *frame1 = gtk_frame_new ("hello ?"); + GtkWidget *frame2 = gtk_frame_new ("it's me !"); + + GtkWidget *grid_3 = gtk_grid_new(); + gtk_frame_set_child ( GTK_FRAME(frame2), grid_3); + + gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); + gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); + gtk_widget_set_size_request (hpaned, 600, 600); + gtk_widget_set_size_request (frame1, 100, 0); // < utile seulement pour la largeur min/max +// gtk_widget_set_size_request (frame2, 50, 100); + +// gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1); + return rules_grid; +} + + void window_bar(GtkWindow *window, char *title){ GtkWidget *titlebar = gtk_header_bar_new(); diff --git a/exec.o b/exec.o index 12389b1..4fcb0fc 100755 Binary files a/exec.o and b/exec.o differ diff --git a/hot.c b/hot.c index 1a48834..113d7fb 100644 --- a/hot.c +++ b/hot.c @@ -5,19 +5,9 @@ #include "warm.h" #include "cold.h" -GtkWidget *get_space_page_new(){ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery - GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); - gtk_scrolled_window_set_min_content_width (scrolled, 628); // ad hoc ... - gtk_scrolled_window_set_min_content_height (scrolled, 600); -// 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 - +GtkWidget *get_space_page_new(){ GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP")); // GtkLevelBar *slow_speed = GTK_LEVEL_BAR (gtk_level_bar_new ()); // or __new_for_interval(0,100); @@ -49,7 +39,7 @@ GtkWidget *get_space_page_new(){ gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("zoom, +/- grid,\npresentation,\nstyles,..."), 1, 0, 1, 2); GtkWidget *space_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(scrolled), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_scrolled_gl_area()), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 0, 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); diff --git a/warm.c b/warm.c index 7c9aef1..e4b24f4 100644 --- a/warm.c +++ b/warm.c @@ -3,59 +3,64 @@ //#include "warm.h" #include "cold.h" -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); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transports"), 1, 0, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects"), 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations"), 1, 1, 1, 1); - return measures_grid; +// 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, 628); // ad hoc ... + gtk_scrolled_window_set_min_content_height (scrolled, 600); +// 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_results_page_new(){ - GtkWidget *results_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Here are some results :"), 0, 0, 1, 1); - return results_grid; +GtkWidget *get_space_page_new_2024_04_30 (){ + + GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP")); +// GtkLevelBar *slow_speed = GTK_LEVEL_BAR (gtk_level_bar_new ()); // or __new_for_interval(0,100); +// 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, "<<-- BUFFER -->>"); + gtk_progress_bar_set_show_text (buffer, TRUE); + gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); + + GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2 + // GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier + // (double min, double max, double step, const char** icons) + GtkAdjustment *X_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); + GtkAdjustment *Y_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); + GtkAdjustment *Z_adjust = gtk_adjustment_new (0, 0, 380, 1, 0, 0); + GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust); + GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust); + GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust); + + 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_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); + + GtkWidget *space_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_scrolled_gl_area()), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 0, 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); + + return space_grid; } -GtkWidget *get_discuss_page_new(){ - GtkWidget *discuss_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1); - return discuss_grid; -} - -GtkWidget *get_help_page_new(){ - GtkWidget *help_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID (help_grid), gtk_button_new_with_label ("Can I help you ?"), 0, 0, 1, 1); - return help_grid; -} - - -GtkWidget *get_rules_page_new(){ - GtkWidget *rules_grid = gtk_grid_new(); - GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); - - GtkWidget *frame1 = gtk_frame_new ("hello ?"); - GtkWidget *frame2 = gtk_frame_new ("it's me !"); - - GtkWidget *grid_3 = gtk_grid_new(); - gtk_frame_set_child ( GTK_FRAME(frame2), grid_3); - - gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); - gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); - gtk_widget_set_size_request (hpaned, 600, 600); - gtk_widget_set_size_request (frame1, 100, 0); // < utile seulement pour la largeur min/max -// gtk_widget_set_size_request (frame2, 50, 100); - -// gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1); - return rules_grid; -} - -/*void activate (GtkApplication *app, gpointer user_data) { +/* void activate (GtkApplication *app, gpointer user_data) { GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app)); window_bar (window, "window"); GtkWidget *grid = gtk_grid_new(); diff --git a/warm.h b/warm.h index 497dd4b..15b5337 100644 --- a/warm.h +++ b/warm.h @@ -14,6 +14,8 @@ #include #include "cold.h" +GtkWidget *get_scrolled_gl_area(); +GtkWidget *get_space_page_new_2024_04_30(); // sécurité 2024_04_30 1ère version /* * https://blog.gtk.org/2020/09/08/on-list-models/ < TODO