2024-05-07 20:48:01 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <gtk-4.0/gtk/gtk.h>
|
2024-05-08 07:50:04 +02:00
|
|
|
|
2024-05-07 20:48:01 +02:00
|
|
|
#include "cold.h"
|
2024-05-10 06:19:20 +02:00
|
|
|
#include "display.h"
|
|
|
|
#include "contain.h"
|
2024-05-08 23:43:23 +02:00
|
|
|
#include "texts.h"
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-11 23:08:59 +02:00
|
|
|
GtkWidget *get_image_ALL_SPACE(){
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkWidget *image;
|
2024-05-08 07:50:04 +02:00
|
|
|
// forget > GTK_WIDGET(get_scrolled_gl_area());
|
|
|
|
// Use GtkImage if you want to display a fixed-size icon
|
|
|
|
// and GtkPicture if you want to display a (maybe) scaled picture.
|
2024-05-12 07:39:06 +02:00
|
|
|
image = gtk_image_new_from_file("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/aXoris.png");
|
|
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/gg sketch.png");
|
|
|
|
image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/E coli (Goodsell).png");
|
2024-05-10 14:37:44 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE, H_IMAGE);
|
2024-05-07 20:48:01 +02:00
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
2024-05-11 23:08:59 +02:00
|
|
|
GtkWidget *get_image_GLUTAMATE(){
|
2024-05-12 07:39:06 +02:00
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/glutamate.png");
|
2024-05-11 23:08:59 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_GLUTAMINE(){
|
2024-05-12 07:39:06 +02:00
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/glutamine.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_HISTIDINE(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/histidine.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_HISTAMINE(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/histamine.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_PHENYLALANINE(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/phénylalanine.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_DOPAMINE(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/dopamine.png");
|
2024-05-11 23:08:59 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
2024-05-12 08:15:54 +02:00
|
|
|
GtkWidget *get_image_ATP(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/ATP.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *get_image_AMP(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/AMP.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
2024-05-12 21:53:10 +02:00
|
|
|
GtkWidget *get_user_tree(){
|
|
|
|
GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/01/Gtk4/Getting_Started_with_GTK/image/arbre utilisateur.png");
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
//------------------------------------------------------------------------------
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-10 14:37:44 +02:00
|
|
|
// TODO cliquer sur "RUN" --> affiche "STOP" (et inversement)
|
|
|
|
static GtkWidget *get_scroll_speed(){
|
|
|
|
GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0);
|
|
|
|
GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, speed_adjust);
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (scroll_speed), 140, 2);
|
|
|
|
return scroll_speed;
|
|
|
|
}
|
2024-05-10 15:10:34 +02:00
|
|
|
|
2024-05-10 15:41:35 +02:00
|
|
|
static GtkBox *get_SPEED_box(){
|
2024-05-10 15:10:34 +02:00
|
|
|
GtkBox *SPEED_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
|
|
|
gtk_box_append (SPEED_box, GTK_WIDGET(gtk_label_new ("\n")));
|
|
|
|
gtk_box_append (SPEED_box, get_scroll_speed());
|
|
|
|
return SPEED_box;
|
|
|
|
}
|
|
|
|
|
2024-05-10 14:37:44 +02:00
|
|
|
GtkBox *get_RUN_STOP_box(){
|
|
|
|
GtkBox *RUN_STOP_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20));
|
|
|
|
// gtk_box_append (RUN_STOP_box, gtk_label_new ("\n"));
|
|
|
|
gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" R U N\n S T O P")));
|
2024-05-10 15:10:34 +02:00
|
|
|
gtk_box_append (RUN_STOP_box, GTK_WIDGET (get_SPEED_box()));
|
2024-05-10 14:37:44 +02:00
|
|
|
gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" STEP\n(show active rule) ")));
|
|
|
|
// gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
|
|
|
return RUN_STOP_box;
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkBox *get_ZOOM_box(){
|
|
|
|
GtkBox *ZOOM_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
2024-05-10 08:19:35 +02:00
|
|
|
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
|
|
|
|
"\n TOOLS\n ---\n zoom\n ---\n (space\n struct.)\n\
|
|
|
|
---\n (arrows\n struct.)\n"));
|
2024-05-10 15:10:34 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (ZOOM_box), 10, 80);
|
2024-05-07 20:48:01 +02:00
|
|
|
gtk_box_append (ZOOM_box, ZOOM_Label);
|
|
|
|
return ZOOM_box;
|
|
|
|
}
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkBox *get_edit_TOOL_box(){
|
|
|
|
GtkBox *TOOL_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
|
|
|
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new ("TOOLS\n ---\n(space\nstruct.)"));
|
2024-05-10 15:10:34 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (TOOL_box), 10, 120);
|
2024-05-07 20:48:01 +02:00
|
|
|
gtk_box_append (TOOL_box, ZOOM_Label);
|
|
|
|
return TOOL_box;
|
|
|
|
}
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkBox *get_XYZ_box(){
|
2024-05-08 23:43:23 +02:00
|
|
|
GtkBox *XYZ_labels_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
|
2024-05-10 08:19:35 +02:00
|
|
|
GtkBox *XYZ_scrollbar_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2q
|
2024-05-07 20:48:01 +02:00
|
|
|
// 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);
|
2024-05-10 15:10:34 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 500);
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
|
|
|
|
gtk_box_append (XYZ_scrollbar_box, scroll_X);
|
|
|
|
gtk_box_append (XYZ_scrollbar_box, scroll_Y);
|
|
|
|
gtk_box_append (XYZ_scrollbar_box, scroll_Z);
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-10 08:19:35 +02:00
|
|
|
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
|
2024-05-08 23:43:23 +02:00
|
|
|
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
|
2024-05-10 08:19:35 +02:00
|
|
|
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("")));
|
2024-05-08 23:43:23 +02:00
|
|
|
return XYZ_labels_box;
|
2024-05-07 20:48:01 +02:00
|
|
|
}
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
//------------------------------------------------------------------------------
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-10 15:41:35 +02:00
|
|
|
GtkProgressBar *get_ELAPSED_TIME_ProgressBar(){ // To rename : DO - UNDO - REDO ?
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
|
2024-05-10 08:19:35 +02:00
|
|
|
gtk_progress_bar_set_text (buffer,\
|
|
|
|
"\n<--- [buffer] (simulation extensive time) --->\n\
|
|
|
|
supports DO - UNDO - REDO functions\n");
|
2024-05-07 20:48:01 +02:00
|
|
|
gtk_progress_bar_set_show_text (buffer, TRUE);
|
2024-05-10 15:10:34 +02:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (buffer), W - 400, 0);
|
2024-05-08 23:43:23 +02:00
|
|
|
return buffer;
|
|
|
|
}
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
//------------------------------------------------------------------------------
|
2024-05-07 20:48:01 +02:00
|
|
|
|
2024-05-10 15:41:35 +02:00
|
|
|
// Chaque label "objet" ou "situation" sera remplacé par un curseur "transparence" (vertical)
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
static GtkBox *get_objects_box(){
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkBox *objects_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
2024-05-10 23:56:28 +02:00
|
|
|
GtkAdjustment *adjust = gtk_adjustment_new (0, 0, 255, 1, 0, 0);
|
|
|
|
if (0) for (int i = 0; i < 10; i++)
|
|
|
|
gtk_box_append (objects_box, gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust));
|
|
|
|
char string[7];
|
|
|
|
for (int i = 0; i < 16; i++){
|
|
|
|
sprintf(string, "[%d] ", i);
|
|
|
|
if (0) printf("%s\n", string); // répété deux fois ! pourquoi ?
|
|
|
|
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (string)));
|
|
|
|
}
|
2024-05-07 20:48:01 +02:00
|
|
|
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" membrane ")));
|
|
|
|
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" co-enzyme A ")));
|
|
|
|
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ribosome ")));
|
|
|
|
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ATP synthase ")));
|
|
|
|
return objects_box;
|
|
|
|
}
|
|
|
|
|
2024-05-08 23:43:23 +02:00
|
|
|
static GtkBox *get_situations_box(){
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkBox *situations_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
2024-05-10 23:56:28 +02:00
|
|
|
char string[7];
|
|
|
|
for (int i = 0; i < 64; i++){
|
|
|
|
sprintf(string, "[%d] ", i);
|
|
|
|
if (0) printf("%s\n", string); // répété deux fois ! pourquoi ?
|
|
|
|
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (string)));
|
|
|
|
}
|
2024-05-07 20:48:01 +02:00
|
|
|
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transcription ")));
|
|
|
|
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transport Na/K ")));
|
|
|
|
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" ubiquitination ")));
|
2024-05-10 23:56:28 +02:00
|
|
|
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" rotation moteur flagellaire ")));
|
2024-05-07 20:48:01 +02:00
|
|
|
return situations_box;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *get_frame_objects(){
|
2024-05-10 23:14:45 +02:00
|
|
|
GtkWidget *scroll = gtk_scrolled_window_new ();
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkWidget *frame_objects = gtk_frame_new (" Objects"); // defines each class of object transparence
|
|
|
|
gtk_widget_set_size_request (frame_objects, 0, H_STYLES_PANE); // < utile seulement pour la largeur min/max
|
|
|
|
gtk_frame_set_child (GTK_FRAME (frame_objects), GTK_WIDGET (get_objects_box()));
|
2024-05-10 23:14:45 +02:00
|
|
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll), frame_objects);
|
|
|
|
return scroll;
|
2024-05-07 20:48:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *get_frame_situations(){
|
2024-05-10 23:14:45 +02:00
|
|
|
GtkWidget *scroll = gtk_scrolled_window_new ();
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkWidget *frame_situations = gtk_frame_new (" Situations"); // facilitates each situation identification
|
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (frame_situations), 0, H_STYLES_PANE); // < utile seulement pour la largeur min/max
|
|
|
|
gtk_frame_set_child (GTK_FRAME (frame_situations), GTK_WIDGET (get_situations_box()));
|
2024-05-10 23:14:45 +02:00
|
|
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll), frame_situations);
|
|
|
|
return scroll;
|
2024-05-07 20:48:01 +02:00
|
|
|
}
|
|
|
|
|
2024-05-10 08:19:35 +02:00
|
|
|
GtkWidget *get_OBJECTS_and_SITUATIONS(){
|
2024-05-07 20:48:01 +02:00
|
|
|
GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
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 (get_frame_situations()));
|
|
|
|
return objects_and_situations_horizontal_pane;
|
2024-05-08 11:13:33 +02:00
|
|
|
}
|
|
|
|
|