E coli by David S. Goodsell (2009)

This commit is contained in:
Jean Sirmai 2024-05-06 17:14:52 +02:00
parent 51d36c1435
commit 11adaed2af
Signed by: jean
GPG Key ID: FB3115C340E057E3
12 changed files with 68 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

52
cold.c
View File

@ -16,6 +16,41 @@ GtkWidget *get_objects_and_situations_horizontal_pane(){
return objects_and_situations_horizontal_pane; return objects_and_situations_horizontal_pane;
} }
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;
}
GtkBox *get_XYZ_gtk_box(){
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);
return XYZ_box;
}
GtkProgressBar *get_simulation_time_extent_buffer(){ 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) --->");
@ -23,19 +58,28 @@ GtkProgressBar *get_simulation_time_extent_buffer(){
return buffer; 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());
gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA); gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA);
gtk_scrolled_window_set_min_content_height (scrolled, H_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 *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
// GtkAdjustment *height = 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) // (value, lower, upper, step_increment, page_increment, page_size)
GtkWidget *GLarea = gtk_gl_area_new(); // GtkWidget *GLarea = gtk_gl_area_new();
gtk_scrolled_window_set_child (scrolled, GLarea); // gtk_scrolled_window_set_child (scrolled, GLarea);
// https://docs.gtk.org/gtk4/class.GLArea.html // https://docs.gtk.org/gtk4/class.GLArea.html
return scrolled; return scrolled;
} }
/*---------------------------------------------------------------------------*/
GtkWidget *get_measures_page_new(){ GtkWidget *get_measures_page_new(){
GtkWidget *measures_grid = gtk_grid_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 ("movements"), 0, 0, 1, 1);
@ -94,6 +138,8 @@ void window_bar(GtkWindow *window, char *title){
GtkWidget *titlebar = gtk_header_bar_new(); GtkWidget *titlebar = gtk_header_bar_new();
gtk_window_set_title (window, title); gtk_window_set_title (window, title);
gtk_window_set_titlebar (window, titlebar); // header_bar gtk_window_set_titlebar (window, titlebar); // header_bar
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
} }
void activate (GtkApplication *app, gpointer user_data) { void activate (GtkApplication *app, gpointer user_data) {

3
cold.h
View File

@ -7,7 +7,10 @@
#define H_STYLES_PANE 60 #define H_STYLES_PANE 60
void print_text(GtkWidget *widget, gpointer data); void print_text(GtkWidget *widget, gpointer data);
GtkWidget *get_a_space_test_image();
GtkScrolledWindow *get_scrolled_gl_area(); GtkScrolledWindow *get_scrolled_gl_area();
GtkBox *get_XYZ_gtk_box();
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();
GtkProgressBar *get_simulation_time_extent_buffer(); GtkProgressBar *get_simulation_time_extent_buffer();

BIN
cold.o

Binary file not shown.

32
hot.c
View File

@ -8,6 +8,20 @@
// 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(){ GtkWidget *get_space_page_new(){
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)); 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, gtk_button_new_with_label ("RUN"));
@ -23,8 +37,6 @@ GtkWidget *get_space_page_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);
// gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); // 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 GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2
@ -40,7 +52,7 @@ GtkWidget *get_space_page_new(){
gtk_box_append (XYZ_box, scroll_X); gtk_box_append (XYZ_box, scroll_X);
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);
/*
GtkWidget *bottom_grid = gtk_grid_new(); 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 ("Objects / Situations (transparences, styles)"), 0, 1, 1, 1);
@ -55,19 +67,5 @@ GtkWidget *get_space_page_new(){
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 (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 (frame_situations));
*/ */
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_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(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.

2
warm.c
View File

@ -38,7 +38,7 @@ GtkWidget *get_space_page_new_2024_04_30 (){
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,\nstyles,..."), 1, 0, 1, 2);
GtkWidget *space_grid = gtk_grid_new(); 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(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(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_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 ("?"), 1, 1, 1, 1);

BIN
warm.o

Binary file not shown.