before improving the objects_and_situations_horizontal_pane

This commit is contained in:
Jean Sirmai 2024-05-06 21:45:02 +02:00
parent 11adaed2af
commit d687c3089d
Signed by: jean
GPG Key ID: FB3115C340E057E3
11 changed files with 113 additions and 362 deletions

94
cold.c
View File

@ -4,17 +4,6 @@
void print_text(GtkWidget *widget, gpointer data) {g_print (data);} void print_text(GtkWidget *widget, gpointer data) {g_print (data);}
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;
}
GtkWidget *get_a_space_test_image(){ GtkWidget *get_a_space_test_image(){
GtkWidget *image; GtkWidget *image;
@ -33,7 +22,45 @@ GtkWidget *get_scroll_speed(){
return scroll_speed; return scroll_speed;
} }
GtkBox *get_XYZ_gtk_box(){ // 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 = "<span style=\"oblique\">\%s</span>";
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_ZOOM_box(){
GtkBox *ZOOM_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new ("ZOOM\n ---\n(space\nstruct.)"));
gtk_box_append (ZOOM_box, ZOOM_Label);
return ZOOM_box;
}
GtkBox *get_XYZ_box(){
GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2 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 // GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
// (double min, double max, double step, const char** icons) // (double min, double max, double step, const char** icons)
@ -48,16 +75,31 @@ GtkBox *get_XYZ_gtk_box(){
gtk_box_append (XYZ_box, scroll_Y); gtk_box_append (XYZ_box, scroll_Y);
gtk_box_append (XYZ_box, scroll_Z); gtk_box_append (XYZ_box, scroll_Z);
// gtk_box_set_baseline_position (XYZ_box, GTK_BASELINE_POSITION_BOTTOM);
return XYZ_box; return XYZ_box;
} }
GtkProgressBar *get_simulation_time_extent_buffer(){ GtkBox *get_ELAPSED_TIME_box(){
GtkBox *ELAPSED_TIME_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
// GtkProgressBar *get_simulation_time_extent_buffer(){
GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extent time) --->"); gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extent time) --->");
gtk_progress_bar_set_show_text (buffer, TRUE); gtk_progress_bar_set_show_text (buffer, TRUE);
return buffer;
gtk_box_append (ELAPSED_TIME_box, GTK_WIDGET(buffer));
return ELAPSED_TIME_box;
} }
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 *get_scrolled_gl_area(){
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new());
@ -92,7 +134,9 @@ GtkWidget *get_measures_page_new(){
GtkWidget *get_results_page_new(){ GtkWidget *get_results_page_new(){
GtkWidget *results_grid = gtk_grid_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); gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Repartitions"), 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Correlations"), 0, 1, 1, 1);
gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Evolutions"), 0, 2, 1, 1);
return results_grid; return results_grid;
} }
@ -123,7 +167,7 @@ GtkWidget *get_rules_page_new(){
gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1));
gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2));
gtk_widget_set_size_request (hpaned, W, H); gtk_widget_set_size_request (hpaned, 100, H);
gtk_widget_set_size_request (frame1, 100, H); // < utile seulement pour la largeur min/max gtk_widget_set_size_request (frame1, 100, H); // < utile seulement pour la largeur min/max
// gtk_widget_set_size_request (frame2, 50, 100); // gtk_widget_set_size_request (frame2, 50, 100);
@ -133,6 +177,22 @@ GtkWidget *get_rules_page_new(){
} }
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_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), 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);
return space_grid;
}
void window_bar(GtkWindow *window, char *title){ void window_bar(GtkWindow *window, char *title){
GtkWidget *titlebar = gtk_header_bar_new(); GtkWidget *titlebar = gtk_header_bar_new();
@ -144,7 +204,7 @@ void window_bar(GtkWindow *window, char *title){
void activate (GtkApplication *app, gpointer user_data) { void activate (GtkApplication *app, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app)); GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
window_bar (window, "window"); window_bar (window, "E coli (with permission from David S. Goodsell, 2009)");
GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new()); GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); // GTK_POS_LEFT gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); // GTK_POS_LEFT

19
cold.h
View File

@ -1,3 +1,12 @@
/******************************************************************************/
/* */
/* E coli by David S. Goodsell (2009) */
/* --- */
/* Let this freeze frame guide us towards the model */
/* that alone can account for the phenomenon ! */
/* */
/******************************************************************************/
#include <stdio.h> #include <stdio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#define W 1920 #define W 1920
@ -9,10 +18,14 @@
void print_text(GtkWidget *widget, gpointer data); void print_text(GtkWidget *widget, gpointer data);
GtkWidget *get_a_space_test_image(); GtkWidget *get_a_space_test_image();
GtkScrolledWindow *get_scrolled_gl_area(); GtkScrolledWindow *get_scrolled_gl_area();
GtkBox *get_XYZ_gtk_box(); GtkBox *get_RUN_STOP_box();
GtkBox *get_STEP_by_STEP_box();
GtkBox *get_ZOOM_box();
GtkBox *get_XYZ_box();
GtkWidget *get_scroll_speed(); GtkWidget *get_scroll_speed();
void window_bar(GtkWindow *window, char *title); void window_bar(GtkWindow *window, char *title);
GtkWidget *get_objects_and_situations_horizontal_pane(); GtkWidget *get_objects_and_situations_horizontal_pane();
GtkBox *get_ELAPSED_TIME_box();
GtkProgressBar *get_simulation_time_extent_buffer(); GtkProgressBar *get_simulation_time_extent_buffer();
void activate (GtkApplication *app, gpointer user_data); void activate (GtkApplication *app, gpointer user_data);
@ -28,6 +41,8 @@ void click_print_do (GtkWindow *window, GtkWidget *grid,
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
/* /*
Dans : space_page_new() doivent être déclarées Dans : space_page_new() doivent être déclarées
et organisées de façon aussi ergonomique que possible : et organisées de façon aussi ergonomique que possible :
@ -42,5 +57,5 @@ et organisées de façon aussi ergonomique que possible :
- les commandes qui modifient les apparences des objets et des situations d'intérêt - les commandes qui modifient les apparences des objets et des situations d'intérêt
(+/- transparents, colorés, etc.) (+/- transparents, colorés, etc.)
*/ */

BIN
cold.o

Binary file not shown.

77
hot.c
View File

@ -1,71 +1,28 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
//#include "gg/graphics.h"
//#include "hot.h"
#include "warm.h" #include "warm.h"
#include "cold.h" #include "cold.h"
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
GtkWidget *get_space_page_new(){ static GtkWidget *get_frame_objects(){
GtkWidget *space_grid = gtk_grid_new();
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_a_space_test_image()), 0, 1, 1, 10);
gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("RUN"), 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_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(get_XYZ_gtk_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;
}
/*
GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
gtk_box_append (controls_box, gtk_button_new_with_label ("RUN"));
// gtk_box_append (controls_box, scroll_speed);
gtk_box_append (controls_box, gtk_button_new_with_label ("step"));
// 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] (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 ----"));
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,\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_objects = gtk_frame_new ("Objects"); // define each class of object transparence
gtk_widget_set_size_request (frame_objects, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max
return frame_objects;
}
static GtkWidget *get_frame_situations(){
GtkWidget *frame_situations = gtk_frame_new ("Situations"); // facilitate each situation identification
gtk_widget_set_size_request (frame_situations, 100, H_STYLES_PANE); // < utile seulement pour la largeur min/max
return frame_situations;
}
GtkWidget *get_objects_and_situations_horizontal_pane(){
GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame_situations = gtk_frame_new ("Situations"); // facilitate each situation identification 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 (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_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_start_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (get_frame_objects()));
gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (frame_situations)); gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (get_frame_situations()));
*/ return objects_and_situations_horizontal_pane;
}

60
hot.h
View File

@ -3,63 +3,3 @@
#include "warm.h" #include "warm.h"
#include "cold.h" #include "cold.h"
/* Comment afficher l'image produite par l'actuel gem-graph-client (2024-04-30)
dans la GLArea de la space_page que je viens de créer ?
Comment la connecter aux widgets qui la modifieront ?
<>
#include "gg/graphics.h" provoque une erreur fatale:
GL/glu.h : Aucun fichier ou dossier de ce type
> Je dois modifier mon Makefile +/- charger cette bibliothèque ?
Ci-dessous les fichiers de gem-graph-client listés par : $grep -r "gl_area" :
gg/draw.c: * Draws the current buffer to a gl_area
gg/draw.c: * @param gl_area, ptr to the gl_area widget
gg/init.c: * Initializes the buffer of a gl_area
gg/init.c: * @param gl_area, ptr to the gl_area widget
gg/init.c: * Initializes the shaders of a gl_area and link them to a program
gg/init.c: * @param gl_area, ptr to the gl_area widget
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
gg/graphics.c: * Shutdowns a gl_area
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
gg/GtkGLArea.c: void *gl_area;
gg/GtkGLArea.c: gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
gg/GtkGLArea.c: GtkWidget *gl_area;
gg/GtkGLArea.c: gl_area = GTK_WIDGET(gtk_gl_area_new());
gg/GtkGLArea.c: assert(gl_area);
gg/GtkGLArea.c: //gtk_widget_set_size_request(gl_area, 1000, 1000);
gg/GtkGLArea.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(gl_area), true);
gg/GtkGLArea.c: gtk_widget_set_hexpand(gl_area, TRUE);
gg/GtkGLArea.c: gtk_widget_set_vexpand(gl_area, TRUE);
gg/GtkGLArea.c: //gtk_widget_set_halign(gl_area, GTK_ALIGN_CENTER);
gg/GtkGLArea.c: //gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER);
gg/GtkGLArea.c: g_signal_connect(GTK_GL_AREA(gl_area),
gg/GtkGLArea.c: g_signal_connect(gl_area,
gg/GtkGLArea.c: g_signal_connect(gl_area,
gg/GtkGLArea.c: stack_index[stack_index_size-1].gl_area = (void*)gl_area;
gg/GtkGLArea.c: gtk_box_append(GTK_BOX(target_widget), gl_area);
gg/GtkGLArea.c: gtk_widget_show(GTK_WIDGET(gl_area));
gg/events.c: if(gtk_gl_area_get_error(area) != NULL) {
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
gg/events.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true);
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
gg/graphics.h: * Structure describing a gl_area and its parameters, used to create a table
gg/graphics.h: * of Gem-graph client current gl_areas
gg/graphics.h: * Dynamic array of ptrs to dynamically allocated gl_area_entry
gg/graphics.h: * Initializes a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Draws the current buffer to a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Shutdowns a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Initializes the shaders of a gl_area and link them to a program
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
gg/graphics.h: * Initializes the buffer of a gl_area
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
*/

BIN
hot.o

Binary file not shown.

BIN
main.o

Binary file not shown.

BIN
myprogram

Binary file not shown.

165
warm.c
View File

@ -5,168 +5,3 @@
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
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_a_space_test_image()), 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;
}
/* 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();
gtk_window_set_child (window, grid);
click_print_do (NULL, grid, "(I)", "n°1\n", 0,0,1,1);
click_print_do (NULL, grid, "(II)", "n°2\n", 1,0,1,1);
click_print_do (window, grid, "Quit", "bye !\n", 2,0,1,1);
GtkWidget *grid_2 = gtk_grid_new();
GtkWidget* notebook = gtk_notebook_new ();
gtk_grid_attach (GTK_GRID (grid), notebook, 0, 3, 1, 1);
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), grid_2, gtk_label_new ("hello !"));
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), gtk_button_new_with_label ("me too !"), NULL);
gtk_grid_attach (GTK_GRID (grid_2), gtk_button_new_with_label ("here am I !"), 0, 0, 1, 1);
GtkWidget *box_3 = gtk_box_new (0, 0);
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("30"));
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("31"));
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
GtkWidget *grid_3 = gtk_grid_new();
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame1 = gtk_frame_new ("hello ?");
GtkWidget *frame2 = gtk_frame_new ("it's me !");
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, 400, 200);
// gtk_widget_set_size_request (frame1, 50, 100); < utile seulement pour la largeur min/max
// gtk_widget_set_size_request (frame2, 50, 100);
gtk_grid_attach (GTK_GRID (grid), hpaned, 0, 4, 3, 1);
gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1);
gtk_window_present (GTK_WINDOW (window));
}
*
static void activate_old (GtkApplication *app, gpointer user_data) {
GtkWindow *window = GTK_WINDOW (gtk_application_window_new (app));
window_bar (window, "window");
GtkWidget *grid = gtk_grid_new();
gtk_window_set_child (window, grid);
click_print_do (NULL, grid, "(I)", "n°1\n", 0,0,1,1);
click_print_do (NULL, grid, "(II)", "n°2\n", 1,0,1,1);
click_print_do (window, grid, "Quit", "bye !\n", 2,0,1,1);
GtkWidget *switcher = gtk_stack_switcher_new();
// GtkWidget *sidebar = gtk_stack_sidebar_new();
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 1, 3, 1);
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_VERTICAL);
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_HORIZONTAL);
GtkStack *stack = GTK_STACK (gtk_stack_new());
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), stack);
// gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), stack);
GtkWidget *box_0 = gtk_box_new (0, 0);
GtkWidget *box_1 = gtk_box_new (0, 0);
GtkWidget *box_2 = gtk_box_new (0, 0);
gtk_stack_add_titled (stack, box_0, "n°0", "A");
gtk_stack_add_titled (stack, box_1, "n°1", "B");
gtk_stack_add_titled (stack, box_2, "n°2", "C");
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
gtk_selection_model_select_item (stack_selection_model, 1, 1);
printf("selected page name is [%s] \n", gtk_stack_get_visible_child_name (stack));
GtkWidget *grid_3 = gtk_grid_new();
gtk_grid_attach (GTK_GRID (grid_3), gtk_button_new_with_label ("0,0 1,1"), 0, 0, 1, 1);
gtk_stack_add_child (stack, grid_3);
// gtk_stack_page_set_visible (GTK_STACK_PAGE(stack_selection_model_get_item()), TRUE);
GtkWidget *box_3 = gtk_box_new (0, 0);
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("30"));
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("31"));
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
GtkWidget *grid_2 = gtk_grid_new();
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame1 = gtk_frame_new ("hello ?");
GtkWidget *frame2 = gtk_frame_new ("it's me !");
gtk_frame_set_child ( GTK_FRAME(frame2), grid_2);
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, 400, 200);
// gtk_widget_set_size_request (frame1, 50, 100); < utile seulement pour la largeur min/max
// gtk_widget_set_size_request (frame2, 50, 100);
gtk_grid_attach (GTK_GRID (grid), hpaned, 0, 3, 3, 1);
gtk_grid_attach (GTK_GRID (grid_2), gtk_button_new_with_label ("in the right pane"), 0, 0, 1, 1);
gtk_window_present (GTK_WINDOW (window));
}
*/

60
warm.h
View File

@ -15,62 +15,6 @@
#include "cold.h" #include "cold.h"
//GtkScrolledWindow *get_scrolled_gl_area(); // https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
GtkWidget *get_space_page_new_2024_04_30(); // sécurité 2024_04_30 1ère version // https://stackoverflow.com/questions/20122232/gtklistc-code-how-to-get-the-selection-of-a-gtklist
/*
* https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
* https://stackoverflow.com/questions/20122232/gtklistc-code-how-to-get-the-selection-of-a-gtklist
*
GtkWidget *switcher = gtk_stack_switcher_new();
GtkWidget *sidebar = gtk_stack_sidebar_new();
gtk_grid_attach (GTK_GRID (grid), switcher, 0, 1, 3, 1);
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_VERTICAL);
gtk_orientable_set_orientation (GTK_ORIENTABLE (switcher), GTK_ORIENTATION_HORIZONTAL);
GtkStack *stack = GTK_STACK (gtk_stack_new());
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), stack);
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), stack);
GtkWidget *page_0 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
GtkWidget *page_1 = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
GtkWidget *box_0 = gtk_box_new (0, 0);
GtkWidget *box_1 = gtk_box_new (0, 0);
GtkWidget *box_2 = gtk_box_new (0, 0);
GtkWidget *box_3 = gtk_box_new (0, 0);
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("00"));
gtk_box_append (GTK_BOX (box_0), gtk_button_new_with_label ("01"));
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("10"));
gtk_box_append (GTK_BOX (box_1), gtk_button_new_with_label ("11"));
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("20"));
gtk_box_append (GTK_BOX (box_2), gtk_button_new_with_label ("21"));
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("30"));
gtk_box_append (GTK_BOX (box_3), gtk_button_new_with_label ("31"));
gtk_stack_add_titled (stack, box_0, "n°0", "A");
gtk_stack_add_titled (stack, box_1, "n°1", "B");
gtk_stack_add_titled (stack, box_2, "n°2", "C");
gtk_grid_attach (GTK_GRID (grid), box_3, 0, 2, 1, 1);
GtkWidget* combo = gtk_combo_box_new_with_entry (void);
gtk_grid_attach (GTK_GRID (grid), combo, 0, 2, 2, 1);
// GtkStackPage *page_2 = gtk_stack_add_titled (stack, box_1, "any name", "C");
// gtk_stack_page_set_name (page_2, "n°2");
GtkSelectionModel *stack_selection_model = gtk_stack_get_pages (stack);
gtk_selection_model_select_item (stack_selection_model, 1, 1);
printf("selected page name is [%s] (how do I get its title ?)\n",
gtk_stack_get_visible_child_name (stack));
// gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_CROSSFADE);
)
* Toujours pas moyen de voir les stack pages !
// gtk_stack_page_set_visible (GTK_STACK_PAGE (gtk_stack_get_visible_child (stack)), TRUE);
// gtk_stack_page_set_visible GTK_WIDGET(gtk_stack_get_visible_child (stack)), TRUE);
// gtk_stack_page_set_visible ( stack_selection_model, TRUE);
// gboolean gtk_selection_model_is_selected (GtkSelectionModel* model, guint position);
// gtk_selection_model_get_selected_item()
*
*
*
*/

BIN
warm.o

Binary file not shown.