GTK4_GG_hack/display.c

134 lines
6.4 KiB
C
Raw Normal View History

#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
2024-05-08 07:50:04 +02:00
#include "cold.h"
2024-05-10 06:19:20 +02:00
#include "display.h"
#include "contain.h"
#include "texts.h"
//------------------------------------------------------------------------------
2024-05-08 07:50:04 +02:00
GtkWidget *get_test_image(){
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.
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-09 20:06:08 +02:00
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE, 0);
return image;
}
//------------------------------------------------------------------------------
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_widget_set_size_request (GTK_WIDGET (ZOOM_box), 30, 80);
gtk_box_append (ZOOM_box, ZOOM_Label);
return ZOOM_box;
}
//------------------------------------------------------------------------------
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-09 20:06:08 +02:00
gtk_widget_set_size_request (GTK_WIDGET (TOOL_box), 30, 120);
gtk_box_append (TOOL_box, ZOOM_Label);
return TOOL_box;
}
//------------------------------------------------------------------------------
GtkBox *get_XYZ_box(){
GtkBox *XYZ_labels_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
GtkBox *XYZ_scrollbar_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);
2024-05-09 20:06:08 +02:00
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 250);
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);
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("X Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
// gtk_box_set_baseline_position (XYZ_scrollbar_box, GTK_BASELINE_POSITION_BOTTOM);
return XYZ_labels_box;
}
//------------------------------------------------------------------------------
static GtkProgressBar *get_simulation_time_extent_buffer(){
GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
gtk_progress_bar_set_text (buffer, "<--- [buffer] (simulation extensive time) --->\n\
supports DO - UNDO - REDO functions");
gtk_progress_bar_set_show_text (buffer, TRUE);
2024-05-09 00:05:48 +02:00
gtk_widget_set_size_request (GTK_WIDGET (buffer), W_IMAGE, 0);
return buffer;
}
GtkBox *get_ELAPSED_TIME_box(){
GtkBox *ELAPSED_TIME_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_widget_set_size_request (GTK_WIDGET (ELAPSED_TIME_box), W_IMAGE, 50);
gtk_box_append (ELAPSED_TIME_box, GTK_WIDGET(get_simulation_time_extent_buffer()));
return ELAPSED_TIME_box;
}
//------------------------------------------------------------------------------
static GtkBox *get_objects_box(){
GtkBox *objects_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
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 (" cytochrome C ")));
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ATP synthase ")));
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" chromosome ")));
return objects_box;
}
static GtkBox *get_situations_box(){
GtkBox *situations_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transcription ")));
2024-05-08 07:50:04 +02:00
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" promotion opéron lactose ")));
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" translation ")));
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transport Na/K ")));
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" ubiquitination ")));
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" rotation du moteur flagellaire ")));
return situations_box;
}
static GtkWidget *get_frame_objects(){
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()));
return frame_objects;
}
static GtkWidget *get_frame_situations(){
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()));
return frame_situations;
}
GtkWidget *get_objects_and_situations_horizontal_pane(){
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;
}