WIP: cleaning (simplified state page III)
This commit is contained in:
parent
98b17ebb16
commit
20747ca733
|
@ -169,9 +169,9 @@ GtkBox *get_XYZ_box(){
|
|||
GtkBox *XYZ_scrollbar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2q
|
||||
// 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);
|
||||
GtkAdjustment *X_adjust = gtk_adjustment_new (rand() % 100, 0, 380, 1, 0, 0);
|
||||
GtkAdjustment *Y_adjust = gtk_adjustment_new (rand() % 200, 0, 380, 1, 0, 0);
|
||||
GtkAdjustment *Z_adjust = gtk_adjustment_new (rand() % 300, 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);
|
||||
|
|
138
src/widgets.c
138
src/widgets.c
|
@ -33,7 +33,8 @@
|
|||
#define W 1920 // TODO 2024-06-30
|
||||
#define H 960 // Ad hoc (pour mon écran)
|
||||
#define H_STYLES_PANE 30
|
||||
#define LOWER_COMPARTMENT_PARTITION 1200
|
||||
#define LOWER_COMPARTMENT_PARTITION 1100 // 1186
|
||||
#define UPPER_COMPARTMENT_PARTITION 600
|
||||
|
||||
static GtkWindow *main_window, *dialog_window;
|
||||
static GtkButton *btt_open_STATE, *btt_open_RULES, *btt_open_DATA;
|
||||
|
@ -169,19 +170,21 @@ GtkWidget *get_selected_rules_vpaned_new() {
|
|||
static GtkBox *get_DO_UNDO_REDO_box(){
|
||||
GtkBox *DO_UNDO_REDO_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (DO_UNDO_REDO_box, GTK_WIDGET(gtk_label_new ("\
|
||||
a progress_bar (which shows elapsed time during simulation)")));
|
||||
a progress bar showing the time elapsed during the simulation")));
|
||||
gtk_box_append (DO_UNDO_REDO_box, GTK_WIDGET (gtk_progress_bar_new ()));
|
||||
GtkAdjustment *adjust = gtk_adjustment_new (30, 0, 100, 1, 0, 0);
|
||||
gtk_box_append (DO_UNDO_REDO_box,
|
||||
GTK_WIDGET (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjust)));
|
||||
gtk_box_append (DO_UNDO_REDO_box, GTK_WIDGET(gtk_label_new ("\
|
||||
DO - UNDO - REDO")));
|
||||
return DO_UNDO_REDO_box;
|
||||
}
|
||||
|
||||
static GtkBox *get_RUN_STOP_box(){
|
||||
GtkBox *RUN_STOP_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new ("\n\
|
||||
R U N / S T O P\
|
||||
SPEED UP <> SLOW DOWN\
|
||||
STEP by STEP (show active rule) \n")));
|
||||
GtkBox *RUN_STOP_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10));
|
||||
gtk_box_append (RUN_STOP_box, GTK_WIDGET (gtk_button_new_with_label ("R U N / S T O P")));
|
||||
gtk_box_append (RUN_STOP_box, GTK_WIDGET (gtk_button_new_with_label ("SPEED UP <> SLOW DOWN")));
|
||||
gtk_box_append (RUN_STOP_box, GTK_WIDGET (gtk_button_new_with_label ("STEP by STEP (+ show active rule)")));
|
||||
return RUN_STOP_box;
|
||||
}
|
||||
|
||||
|
@ -190,6 +193,7 @@ static GtkWidget *get_TIME_EXEC_CONTROLS_box() {
|
|||
gtk_paned_set_start_child (EXEC_CONTROLS_pane, GTK_WIDGET (get_DO_UNDO_REDO_box()));
|
||||
gtk_paned_set_end_child (EXEC_CONTROLS_pane, GTK_WIDGET (get_RUN_STOP_box()));
|
||||
gtk_paned_set_position (EXEC_CONTROLS_pane, LOWER_COMPARTMENT_PARTITION);
|
||||
gtk_widget_set_size_request (EXEC_CONTROLS_pane, 00, 200);
|
||||
return GTK_WIDGET (EXEC_CONTROLS_pane);
|
||||
}
|
||||
|
||||
|
@ -209,18 +213,13 @@ GtkWidget *get_SPACE_VIEW_box() {
|
|||
|
||||
gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||
gtk_box_append (central_box, GTK_WIDGET (right_box));
|
||||
gtk_widget_set_size_request (central_box, W - 00, 00);
|
||||
return GTK_WIDGET (central_box);
|
||||
}
|
||||
|
||||
static GtkWidget *get_SPACE_EDIT_CONTROLS_box(){
|
||||
GtkWidget *label_ad_hoc = gtk_label_new ("_____________\n\
|
||||
SPACE EDIT\n controls\n_____________");
|
||||
return GTK_WIDGET (label_ad_hoc);
|
||||
}
|
||||
|
||||
void set_check_button_active (GtkButton *button, int active){
|
||||
const char *lab = gtk_button_get_label (button);
|
||||
if (strcmp (lab, "state")) printf("set_check_button_active > %s\n", lab);
|
||||
return gtk_label_new
|
||||
("_____________\n SPACE EDIT\n controls\n'''''''''''''''''''''''");
|
||||
}
|
||||
|
||||
static void window_header_bar (GtkWindow *window, char *title){
|
||||
|
@ -257,31 +256,23 @@ static void window_header_bar (GtkWindow *window, char *title){
|
|||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA));
|
||||
|
||||
// https://iconduck.com/sets/adwaita-icon-theme https://iconduck.com/sets/carbon-icons
|
||||
|
||||
GtkButton *go_home = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (go_home, "go-home-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (go_home));
|
||||
|
||||
GtkButton *user_trash = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (user_trash, "user-trash-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (user_trash));
|
||||
|
||||
GtkButton *help_doc = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (help_doc, "emblem-documents-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_doc));
|
||||
|
||||
GtkButton *search = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (search, "user-trash-symbolic");
|
||||
gtk_button_set_icon_name (search, "emblem-documents-symbolic");
|
||||
gtk_button_set_icon_name (search, "preferences-desktop-appearance-symbolic");
|
||||
gtk_button_set_icon_name (search, "applications-utilities-symbolic");
|
||||
gtk_button_set_icon_name (search, "folder-saved-search-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (search));
|
||||
|
||||
GtkButton *preferences_desktop_appearance = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (preferences_desktop_appearance, "preferences-desktop-appearance-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_desktop_appearance));
|
||||
|
||||
GtkButton *open_menu = GTK_BUTTON (gtk_button_new ());
|
||||
gtk_button_set_icon_name (open_menu, "open-menu-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (open_menu));
|
||||
|
||||
}
|
||||
|
||||
void main_window_design (GtkWindow *main_window){
|
||||
|
@ -303,59 +294,64 @@ void main_window_design (GtkWindow *main_window){
|
|||
|
||||
static GtkBox *get_objects_box(){
|
||||
GtkBox *objects_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
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] \n", i);
|
||||
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (string)));
|
||||
GtkAdjustment *adjust = NULL;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 4);
|
||||
GtkScrollbar *scrollbar_i = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust);
|
||||
char tooltip_text[8];
|
||||
sprintf(tooltip_text, "\n%d\n", i);
|
||||
if (0 == i % 5) gtk_widget_set_tooltip_text (scrollbar_i, " membrane ");
|
||||
if (1 == i % 5) gtk_widget_set_tooltip_text (scrollbar_i, " co-enzyme A ");
|
||||
if (2 == i % 5) gtk_widget_set_tooltip_text (scrollbar_i, " ATP synthase ");
|
||||
if (3 == i % 5) gtk_widget_set_tooltip_text (scrollbar_i, " any object name ");
|
||||
if (4 == i % 5) gtk_widget_set_tooltip_text (scrollbar_i, tooltip_text);
|
||||
gtk_box_append (objects_box, gtk_label_new (" "));
|
||||
gtk_box_append (objects_box, scrollbar_i);
|
||||
}
|
||||
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" membrane \n")));
|
||||
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" co-enzyme A \n")));
|
||||
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ribosome \n")));
|
||||
gtk_box_append (objects_box, GTK_WIDGET (gtk_label_new (" ATP synthase \n")));
|
||||
return objects_box;
|
||||
}
|
||||
|
||||
static GtkBox *get_situations_box(){
|
||||
GtkBox *situations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
char string[7];
|
||||
for (int i = 0; i < 64; i++){
|
||||
sprintf(string, " [%d] \n", i);
|
||||
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (string)));
|
||||
GtkAdjustment *adjust = NULL;
|
||||
for (int i = 0; i < 128; i++) {
|
||||
adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 4);
|
||||
GtkScrollbar *scrollbar_i = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust);
|
||||
char tooltip_text[8];
|
||||
sprintf(tooltip_text, "\n%d\n", i);
|
||||
if (0 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " transcription ");
|
||||
if (1 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " transport Na/K ");
|
||||
if (2 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " ubiquitination ");
|
||||
if (3 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " glycolyse aérobie ");
|
||||
if (4 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " cycle de Krebs ");
|
||||
if (5 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " shunt des pentoses ");
|
||||
if (6 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, " any situation name ");
|
||||
if (7 == i % 8) gtk_widget_set_tooltip_text (scrollbar_i, tooltip_text);
|
||||
gtk_box_append (situations_box, gtk_label_new (" "));
|
||||
gtk_box_append (situations_box, scrollbar_i);
|
||||
}
|
||||
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transcription \n")));
|
||||
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" transport Na/K \n")));
|
||||
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" ubiquitination \n")));
|
||||
gtk_box_append (situations_box, GTK_WIDGET (gtk_label_new (" rotation moteur flagellaire \n")));
|
||||
return situations_box;
|
||||
}
|
||||
|
||||
static GtkWidget *get_frame_objects(){
|
||||
GtkWidget *scroll = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
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()));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll), frame_objects);
|
||||
return scroll;
|
||||
}
|
||||
|
||||
static GtkWidget *get_frame_situations(){
|
||||
GtkWidget *scroll = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
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()));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll), frame_situations);
|
||||
return scroll;
|
||||
}
|
||||
|
||||
static GtkWidget *get_OBJECTS_and_SITUATIONS(){
|
||||
GtkWidget *scroll_objects = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_objects), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
GtkWidget *frame_objects = gtk_frame_new (" Objects"); // defines each class of object transparency
|
||||
gtk_frame_set_child (GTK_FRAME (frame_objects), GTK_WIDGET (get_objects_box()));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_objects), frame_objects);
|
||||
|
||||
GtkWidget *scroll_situations = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_situations), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
GtkWidget *frame_situations = gtk_frame_new (" Situations"); // facilitates each situation identification
|
||||
gtk_frame_set_child (GTK_FRAME (frame_situations), GTK_WIDGET (get_situations_box()));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_situations), frame_situations);
|
||||
|
||||
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()));
|
||||
gtk_paned_set_start_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (scroll_objects));
|
||||
gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (scroll_situations));
|
||||
gtk_paned_set_position (objects_and_situations_horizontal_pane, UPPER_COMPARTMENT_PARTITION);
|
||||
gtk_widget_set_size_request (objects_and_situations_horizontal_pane, 0, 127);
|
||||
|
||||
return objects_and_situations_horizontal_pane;
|
||||
}
|
||||
|
||||
|
@ -415,3 +411,7 @@ GtkWidget *get_window_child_DATA () {
|
|||
|
||||
return GTK_WIDGET (data_box);
|
||||
}
|
||||
|
||||
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
|
||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||
|
||||
|
|
Loading…
Reference in New Issue