This commit is contained in:
Jean Sirmai 2024-05-06 12:45:24 +02:00
parent 109f40423e
commit 51d36c1435
Signed by: jean
GPG Key ID: FB3115C340E057E3
10 changed files with 98 additions and 48 deletions

49
cold.c
View File

@ -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

20
cold.h
View File

@ -1,17 +1,16 @@
#include <stdio.h>
#include <gtk/gtk.h>
#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
/*

BIN
cold.o

Binary file not shown.

42
hot.c
View File

@ -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;
}

BIN
hot.o

Binary file not shown.

BIN
main.o

Binary file not shown.

BIN
myprogram

Binary file not shown.

33
warm.c
View File

@ -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");

2
warm.h
View File

@ -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
/*

BIN
warm.o

Binary file not shown.