From a7f6288db09e483b8228ef26fcf7a10f484fa5b3 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 4 Aug 2024 23:23:12 +0200 Subject: [PATCH] WIP: cleaning the 'gtk_widget_set_size_request()' --- include/widget.h | 19 ++++++- src/graphics/stack.c | 4 +- src/widget/data/dispatch.c | 18 ++----- src/widget/data/measure.c | 3 -- src/widget/data/results.c | 2 +- src/widget/rules/selected/image.c | 55 ++++++++++---------- src/widget/rules/tree_tools/compare.c | 8 ++- src/widget/rules/tree_tools/freq.c | 2 +- src/widget/rules/tree_tools/pilot_box.c | 15 ++++-- src/widget/state/bottom.c | 3 +- src/widget/state/middle.c | 67 ++++++++++--------------- src/widget/state/top.c | 17 +++---- src/widget/synth/dispatch.c | 39 ++++++++++++-- src/widget/synth/time.c | 7 ++- src/widget/tree.c | 58 ++++++++++----------- 15 files changed, 171 insertions(+), 146 deletions(-) diff --git a/include/widget.h b/include/widget.h index 693eb91..cc7cd82 100644 --- a/include/widget.h +++ b/include/widget.h @@ -37,6 +37,9 @@ // called in dispatch.c // functions are in topbar.c +#define W_MY_SCREEN_1920 1920 // 1920 x 960 = ad hoc (pour mon écran)) +#define H_MY_SCREEN_1000 1000 + void widget_design_main_window (GtkWindow *main_window); void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window); void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window); @@ -72,8 +75,20 @@ void *widget_get_data_page(); // in : src/widget/data /dispatch.c void *widget_get_stock_text (gchar *text_name); -#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 = ad hoc (pour mon écran) -#define H_IMAGE_LOCAL 800 +#define W_TREE_160 160 +#define W_DO_UNDO_REDO_BOX_1300 1300 +#define H_XYZ_BOX_200 200 +#define H_OBJECTS_SITUATIONS_130 130 +#define W_COMPARATOR_64 64 +#define W_RULES_USE_90 90 + +#define W_IMAGE_800 800 +#define W_IMAGE_100 100 + +#define ARBITRARY_PARTITION_1600 1600 +#define ARBITRARY_PARTITION_750 750 +#define ARBITRARY_PARTITION_600 600 + /******************************************************************************/ /* S Y N T H */ diff --git a/src/graphics/stack.c b/src/graphics/stack.c index ffbc8b5..d4c969d 100644 --- a/src/graphics/stack.c +++ b/src/graphics/stack.c @@ -28,6 +28,8 @@ #include "../../include/graphics.h" #include "../../include/signal.h" +#define GL_AREA_1000 1000 + struct stack_index_t { long stack_id; void *container_widget; @@ -297,7 +299,7 @@ bool graphics_setup_glarea(int target_mode, GtkWidget *target_widget) gl_area = GTK_WIDGET(gtk_gl_area_new()); assert(gl_area); - gtk_widget_set_size_request(gl_area, 1000, 1000); + gtk_widget_set_size_request(gl_area, GL_AREA_1000, GL_AREA_1000); gtk_gl_area_set_auto_render(GTK_GL_AREA(gl_area), true); gtk_widget_set_hexpand(gl_area, TRUE); gtk_widget_set_vexpand(gl_area, TRUE); diff --git a/src/widget/data/dispatch.c b/src/widget/data/dispatch.c index 9b50b9b..3eb5041 100644 --- a/src/widget/data/dispatch.c +++ b/src/widget/data/dispatch.c @@ -34,30 +34,18 @@ // "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably. // https://www.mathsisfun.com/data/data-graph.php -#define PARTITION_A 700 -#define PARTITION_B 700 +#define PARTITION_700 700 + void *widget_get_data_page() { GtkWidget *measures_and_results = gtk_paned_new (GTK_ORIENTATION_VERTICAL); gtk_paned_set_start_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_measures_page())); gtk_paned_set_end_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_results_page())); - gtk_paned_set_position (GTK_PANED (measures_and_results), PARTITION_B); + gtk_paned_set_position (GTK_PANED (measures_and_results), PARTITION_700); gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE); return measures_and_results; } -/*void *widget_get_data_page() -{ - GtkWidget *measures_and_data_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_paned_set_start_child (GTK_PANED(measures_and_data_horizontal_pane), GTK_WIDGET (widget_get_stock_and_analysis_page())); - gtk_paned_set_end_child (GTK_PANED(measures_and_data_horizontal_pane), GTK_WIDGET (widget_get_operations_on_results_page())); - gtk_paned_set_position (GTK_PANED (measures_and_data_horizontal_pane), PARTITION_A); - gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_data_horizontal_pane), FALSE); - gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_data_horizontal_pane), FALSE); - gtk_widget_set_size_request (measures_and_data_horizontal_pane, 1920, 800); - - return measures_and_data_horizontal_pane; -}*/ diff --git a/src/widget/data/measure.c b/src/widget/data/measure.c index d465b53..8f8ad26 100644 --- a/src/widget/data/measure.c +++ b/src/widget/data/measure.c @@ -58,11 +58,8 @@ void *widget_get_measures_page () gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic)); GtkWidget* frame_measures = gtk_frame_new ("measures"); -// GtkBox *measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); gtk_frame_set_child (GTK_FRAME (frame_measures), GTK_WIDGET (data_box)); -// gtk_widget_set_size_request (GTK_WIDGET (data_box), 200, 0); - return GTK_WIDGET (frame_measures); } diff --git a/src/widget/data/results.c b/src/widget/data/results.c index d62e44f..f69990b 100644 --- a/src/widget/data/results.c +++ b/src/widget/data/results.c @@ -52,7 +52,7 @@ void *widget_get_results_page () { gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/data correlations (4, horizontal).png"))); - gtk_widget_set_size_request (GTK_WIDGET (data_box), 1800, 700); + gtk_widget_set_size_request (GTK_WIDGET (data_box), 1800, 700); // provisoire TODO return GTK_WIDGET (data_box); } diff --git a/src/widget/rules/selected/image.c b/src/widget/rules/selected/image.c index 2d5ff55..c2b2af8 100644 --- a/src/widget/rules/selected/image.c +++ b/src/widget/rules/selected/image.c @@ -36,7 +36,7 @@ static void *get_rule_before() { GtkWidget *rule_before = GTK_WIDGET (gtk_picture_new_for_filename \ ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")); - gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, H_IMAGE_LOCAL); + gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, W_IMAGE_800); // OK (provisoire) return GTK_WIDGET (rule_before); } @@ -44,49 +44,48 @@ static void *get_rule_after() { GtkWidget *rule_after = GTK_WIDGET (gtk_picture_new_for_filename \ ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png")); - gtk_widget_set_size_request (GTK_WIDGET (rule_after), 0, H_IMAGE_LOCAL); + gtk_widget_set_size_request (GTK_WIDGET (rule_after), 0, W_IMAGE_800); // OK (provisoire)) return GTK_WIDGET (rule_after); } static GtkBox *rec_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)); - // 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 (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); - gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 400); + 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)); + // 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 (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); + gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 0, H_XYZ_BOX_200); // OK (required) - 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_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") + 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_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") GtkWidget *btt_reset = gtk_toggle_button_new (); gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic"); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new (""))); - return XYZ_labels_box; + gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new (""))); + return XYZ_labels_box; } static GtkBox *rec_ZOOM_box() { - GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); - GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\ + GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\ "\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\ ---\n arrows\n struct.\n ---\n orient\n state\n in space\n")); - gtk_widget_set_size_request (GTK_WIDGET (ZOOM_box), 10, 80); - gtk_box_append (ZOOM_box, ZOOM_Label); - return ZOOM_box; + gtk_box_append (ZOOM_box, ZOOM_Label); + return ZOOM_box; } diff --git a/src/widget/rules/tree_tools/compare.c b/src/widget/rules/tree_tools/compare.c index 13aec6b..8ad813c 100644 --- a/src/widget/rules/tree_tools/compare.c +++ b/src/widget/rules/tree_tools/compare.c @@ -31,8 +31,6 @@ #include "../../../../include/widget.h" #include "../../../../include/signal.h" -#define W_IMAGE_ABSURD 1920 / 32 // 1920 x 960 ad hoc (pour mon écran) -#define H_IMAGE_ABSURD 960 #define MAX_SIZE 255 // ----------------------------------------------------------------------------- @@ -150,10 +148,10 @@ static GtkWidget *do_rtfd (Stack stack_b); void *widget_get_an_impression_of_what_a_rules_comparator_could_be(){ GtkBox *compare_left = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_widget_set_size_request (GTK_WIDGET (compare_left), W_IMAGE_ABSURD, H_IMAGE_ABSURD); + gtk_widget_set_size_request (GTK_WIDGET (compare_left), W_COMPARATOR_64, 0); GtkBox *compare_right = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_widget_set_size_request (GTK_WIDGET (compare_right), W_IMAGE_ABSURD, H_IMAGE_ABSURD); + gtk_widget_set_size_request (GTK_WIDGET (compare_right), W_COMPARATOR_64, 0); initialize(&stack_b); @@ -217,7 +215,7 @@ static GtkWidget *do_rtfd (Stack stack) // TODO push_images_onto_stack (stack); // totalement inutile ici -// peek (NULL); // idem + Erreur de segmentation +// peek (NULL); // idem + Erreur de segmentation // free_intlist (NULL); // idem // add_to_mylist (0); // idem diff --git a/src/widget/rules/tree_tools/freq.c b/src/widget/rules/tree_tools/freq.c index d8fbf69..e3c9690 100644 --- a/src/widget/rules/tree_tools/freq.c +++ b/src/widget/rules/tree_tools/freq.c @@ -43,7 +43,7 @@ void *widget_get_rules_use () // GtkWidget *frame_rules_use = gtk_frame_new (" Rules use"); // gtk_frame_set_child (GTK_FRAME (frame_rules_use), GTK_WIDGET (scroll_rules_use)); - gtk_widget_set_size_request (GTK_WIDGET (scroll_rules_use), W_IMAGE_LOCAL * 1.5, 0);//H_IMAGE_LOCAL); + gtk_widget_set_size_request (GTK_WIDGET (scroll_rules_use), W_RULES_USE_90, 0); // OK (required) gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_rules_use), GTK_WIDGET (rules_use_box)); diff --git a/src/widget/rules/tree_tools/pilot_box.c b/src/widget/rules/tree_tools/pilot_box.c index 259b434..d4c2da4 100644 --- a/src/widget/rules/tree_tools/pilot_box.c +++ b/src/widget/rules/tree_tools/pilot_box.c @@ -47,15 +47,22 @@ void *widget_get_rules_pilot_box () return rules_pilot_box; } +static void *get_image_many_bars_vertical () +{ + GtkBox *image_many_bars_vertical_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + gtk_box_append (image_many_bars_vertical_box, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/data many bars vertical.png"))); + gtk_widget_set_size_request (GTK_WIDGET (image_many_bars_vertical_box), W_IMAGE_100, 0); + return image_many_bars_vertical_box; +} + void *widget_get_rules_tree_tools () { GtkBox *rules_tree_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_user_rules_tree())); - gtk_box_append (rules_tree_box, GTK_WIDGET (gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/data many bars vertical.png"))); - gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_rules_use ())); + gtk_box_append (rules_tree_box, GTK_WIDGET (get_image_many_bars_vertical())); + gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_rules_use())); gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_an_impression_of_what_a_rules_comparator_could_be())); - gtk_widget_set_size_request (GTK_WIDGET (rules_tree_box), W_IMAGE_LOCAL * 7.4, 0);//H_IMAGE_LOCAL); return GTK_WIDGET (rules_tree_box); } diff --git a/src/widget/state/bottom.c b/src/widget/state/bottom.c index 6b577d4..57201b4 100644 --- a/src/widget/state/bottom.c +++ b/src/widget/state/bottom.c @@ -31,7 +31,6 @@ #include "../../../include/widget.h" #include "../../../include/signal.h" -#define LOWER_COMPARTMENT_PARTITION 1300 /* L'image de l'état de l'espace (au centre) fait partie d'un panneau "milieu", * qui est encadré par les deux panneaux: "haut" et "bas". @@ -65,7 +64,7 @@ void *widget_get_sequence_control() GTK_WIDGET (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjust))); gtk_box_append (DO_UNDO_REDO_box, GTK_WIDGET(gtk_label_new ("\ DO - UNDO - REDO"))); - gtk_widget_set_size_request (GTK_WIDGET (DO_UNDO_REDO_box), LOWER_COMPARTMENT_PARTITION, 0); + gtk_widget_set_size_request (GTK_WIDGET (DO_UNDO_REDO_box), W_DO_UNDO_REDO_BOX_1300, 0); // OK (required) gtk_box_append (SEQUENCE_CONTROL_box, GTK_WIDGET (DO_UNDO_REDO_box)); gtk_box_append (SEQUENCE_CONTROL_box, GTK_WIDGET (gtk_button_new_with_label ("R U N / S T O P"))); diff --git a/src/widget/state/middle.c b/src/widget/state/middle.c index 8b65fa2..ed02983 100644 --- a/src/widget/state/middle.c +++ b/src/widget/state/middle.c @@ -32,57 +32,44 @@ #include "../../../include/signal.h" -/* L'image de l'état de l'espace (au centre) fait partie d'un panneau "milieu", - * qui est encadré par les deux panneaux: "haut" et "bas". - * La partie droite du panneau "milieu" est elle-même un panneau de commandes. - * - * Si l'on nomme ces panneaux selon leur fonction, on trouvera: - * - CONTROL ou EDIT en bas permet de contrôler / choisir un état et / ou de l'éditer. - * ce panneau peut avoir deux apparences (et fonctions) différentes: - * - en mode EDIT, seuls les outils d'édition de l'état sont disponibles - * - en mode EXEC, seuls les outils de déplacement dans la séquence sont disponibles - * - CAMERA à droite permet de choisir la position de la caméra - * - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations - * afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */ - static GtkBox *rec_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)); - // 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 (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); - gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 400); + 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)); + // 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 (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); + gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, H_XYZ_BOX_200); // (provisoire) TODO - 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_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") + 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_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") GtkWidget *btt_reset = gtk_toggle_button_new (); gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic"); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); - gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new (""))); - return XYZ_labels_box; + gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); + gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new (""))); + return XYZ_labels_box; } static GtkBox *rec_ZOOM_box() { - GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); - GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\ + GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\ "\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\ ---\n arrows\n struct.\n ---\n orient\n state\n in space\n")); - gtk_widget_set_size_request (GTK_WIDGET (ZOOM_box), 10, 80); - gtk_box_append (ZOOM_box, ZOOM_Label); - return ZOOM_box; +// gtk_widget_set_size_request (GTK_WIDGET (ZOOM_box), 10, 80); + gtk_box_append (ZOOM_box, ZOOM_Label); + return ZOOM_box; } @@ -97,7 +84,7 @@ void *widget_get_space_view() // TODO gtk_box_append (central_box, GTK_WIDGET (gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"))); + ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"))); // ui_setup_glarea (0, GTK_WIDGET (central_box)); gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); diff --git a/src/widget/state/top.c b/src/widget/state/top.c index b0562a8..06270c3 100644 --- a/src/widget/state/top.c +++ b/src/widget/state/top.c @@ -31,7 +31,6 @@ #include "../../../include/widget.h" #include "../../../include/signal.h" -#define UPPER_COMPARTMENT_PARTITION 600 /******************************************************************************/ /* O B J E C T S */ @@ -201,15 +200,15 @@ void *widget_get_graph_view_control() 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 (scroll_objects)); - gtk_paned_set_end_child (GTK_PANED(objects_and_situations_horizontal_pane), GTK_WIDGET (scroll_situations)); - gtk_paned_set_position (GTK_PANED (objects_and_situations_horizontal_pane), UPPER_COMPARTMENT_PARTITION); - gtk_paned_set_shrink_start_child (GTK_PANED (objects_and_situations_horizontal_pane), FALSE); - gtk_paned_set_shrink_end_child (GTK_PANED (objects_and_situations_horizontal_pane), FALSE); - gtk_widget_set_size_request (objects_and_situations_horizontal_pane, 0, 127); + GtkWidget *objects_vs_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + gtk_paned_set_start_child (GTK_PANED(objects_vs_situations_horizontal_pane), GTK_WIDGET (scroll_objects)); + gtk_paned_set_end_child (GTK_PANED(objects_vs_situations_horizontal_pane), GTK_WIDGET (scroll_situations)); + gtk_paned_set_position (GTK_PANED (objects_vs_situations_horizontal_pane), ARBITRARY_PARTITION_600); + gtk_paned_set_shrink_start_child (GTK_PANED (objects_vs_situations_horizontal_pane), FALSE); + gtk_paned_set_shrink_end_child (GTK_PANED (objects_vs_situations_horizontal_pane), FALSE); + gtk_widget_set_size_request (objects_vs_situations_horizontal_pane, 0, H_OBJECTS_SITUATIONS_130); // OK (required)) - return objects_and_situations_horizontal_pane; + return objects_vs_situations_horizontal_pane; } diff --git a/src/widget/synth/dispatch.c b/src/widget/synth/dispatch.c index 4c5111b..23f006e 100644 --- a/src/widget/synth/dispatch.c +++ b/src/widget/synth/dispatch.c @@ -41,9 +41,9 @@ static void *widget_get_space_vs_non_time_dependent_analysis() gtk_paned_set_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png"))); - gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), 1600); - gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); - gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); + gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), ARBITRARY_PARTITION_1600); + gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), TRUE); + gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), TRUE); return space_vs_non_time_dependent_analysis; } @@ -55,10 +55,41 @@ void *widget_get_synth_page() GTK_WIDGET (widget_get_space_vs_non_time_dependent_analysis())); gtk_paned_set_end_child (GTK_PANED (space_and_analysis_vs_history), GTK_WIDGET (widget_get_time_dependent_results_and_time_controls())); - gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), 600); + gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), ARBITRARY_PARTITION_750); gtk_paned_set_shrink_start_child (GTK_PANED (space_and_analysis_vs_history), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (space_and_analysis_vs_history), FALSE); + gtk_widget_set_size_request (space_and_analysis_vs_history, 0, H_MY_SCREEN_1000); // OK (required)) return space_and_analysis_vs_history; } +/* +jean@n-guix-port:~/Gem-Graph/gem-graph-client [env] $ grep -r 'gtk_paned_set_position' +grep: bin/gem-graph-client : fichiers binaires correspondent +src/widget/data/dispatch.c: gtk_paned_set_position (GTK_PANED (measures_and_results), PARTITION_B); +src/widget/data/dispatch.c: gtk_paned_set_position (GTK_PANED (measures_and_data_horizontal_pane), PARTITION_A); +src/widget/state/top.c: gtk_paned_set_position (GTK_PANED (objects_and_situations_horizontal_pane), UPPER_COMPARTMENT_PARTITION); +src/widget/rules/dispatch.c: gtk_paned_set_position (tree_vs_selected, 340); // WARNING : c'est une position "absolue" +src/widget/rules/selected/dispatch.c: gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 640); // WARNING : c'est une position "absolue" +src/widget/synth/dispatch.c: gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), 1600); +src/widget/synth/dispatch.c: gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), 600); + +jean@n-guix-port:~/Gem-Graph/gem-graph-client [env] $ grep -r 'gtk_paned_set_shrink_' +grep: bin/gem-graph-client : fichiers binaires correspondent +src/widget/data/dispatch.c: gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE); +src/widget/data/dispatch.c: gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE); +src/widget/data/dispatch.c: gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_data_horizontal_pane), FALSE); +src/widget/data/dispatch.c: gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_data_horizontal_pane), FALSE); +src/widget/state/top.c: gtk_paned_set_shrink_start_child (GTK_PANED (objects_and_situations_horizontal_pane), FALSE); +src/widget/state/top.c: gtk_paned_set_shrink_end_child (GTK_PANED (objects_and_situations_horizontal_pane), FALSE); +src/widget/rules/dispatch.c: gtk_paned_set_shrink_start_child (tree_vs_selected, FALSE); +src/widget/rules/dispatch.c: gtk_paned_set_shrink_end_child (tree_vs_selected, FALSE); +src/widget/rules/selected/dispatch.c: gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE); +src/widget/rules/selected/dispatch.c: gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit_pane, FALSE); +src/widget/synth/dispatch.c: gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), TRUE); +src/widget/synth/dispatch.c: gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), TRUE); +src/widget/synth/dispatch.c: gtk_paned_set_shrink_start_child (GTK_PANED (space_and_analysis_vs_history), FALSE); +src/widget/synth/dispatch.c: gtk_paned_set_shrink_end_child (GTK_PANED (space_and_analysis_vs_history), FALSE); + +*/ + diff --git a/src/widget/synth/time.c b/src/widget/synth/time.c index c6ae677..476c095 100644 --- a/src/widget/synth/time.c +++ b/src/widget/synth/time.c @@ -33,7 +33,10 @@ void *widget_get_time_dependent_results_and_time_controls() { - return GTK_WIDGET (gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")); + GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); + gtk_box_append (time_box, GTK_WIDGET(widget_get_sequence_control())); + gtk_box_append (time_box, GTK_WIDGET(gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png"))); + return time_box; } diff --git a/src/widget/tree.c b/src/widget/tree.c index dc02824..b0842c1 100644 --- a/src/widget/tree.c +++ b/src/widget/tree.c @@ -85,38 +85,38 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root) void *widget_get_user_rules_tree () { - struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,"); - widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); + struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,"); + widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); - GtkStringList *model = gtk_string_list_new(NULL); - gtk_string_list_append (model, tree_root->text); - GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new()); - g_signal_connect (factory, "setup", G_CALLBACK(on_setup_user_tree_factory), NULL); - g_signal_connect (factory, "bind", G_CALLBACK(on_bind_user_tree_factory), NULL); + GtkStringList *model = gtk_string_list_new(NULL); + gtk_string_list_append (model, tree_root->text); + GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new()); + g_signal_connect (factory, "setup", G_CALLBACK(on_setup_user_tree_factory), NULL); + g_signal_connect (factory, "bind", G_CALLBACK(on_bind_user_tree_factory), NULL); - GtkTreeListModel *tree_model = gtk_tree_list_model_new( - G_LIST_MODEL (model), - FALSE, // Passthrough - False in actual usage with dynamic children retrieval - TRUE, // FALSE, // autoexpand - (GtkTreeListModelCreateModelFunc) &get_user_tree_model, - tree_root, - NULL // (GDestroyNotify) free_user_tree_node - ); + GtkTreeListModel *tree_model = gtk_tree_list_model_new( + G_LIST_MODEL (model), + FALSE, // Passthrough - False in actual usage with dynamic children retrieval + TRUE, // FALSE, // autoexpand + (GtkTreeListModelCreateModelFunc) &get_user_tree_model, + tree_root, + NULL // (GDestroyNotify) free_user_tree_node + ); - GtkSingleSelection *selection_model = gtk_single_selection_new (G_LIST_MODEL (tree_model)); - gtk_single_selection_set_autoselect (selection_model, FALSE); - gtk_single_selection_set_can_unselect (selection_model, TRUE); - GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model), GTK_LIST_ITEM_FACTORY (factory)); - GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); -// Allocation height too small. Tried to allocate 1922x1030, but GtkNotebook 0x25cd4c0 needs at least 1922x1064. -// even if I remove (comment) the next line : - gtk_scrolled_window_set_child (scrolled_window, list_view); - gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_vexpand (GTK_WIDGET (scrolled_window), TRUE); - gtk_widget_set_visible (GTK_WIDGET (scrolled_window), TRUE); - gtk_widget_set_visible (GTK_WIDGET (list_view), TRUE); + GtkSingleSelection *selection_model = gtk_single_selection_new (G_LIST_MODEL (tree_model)); + gtk_single_selection_set_autoselect (selection_model, FALSE); + gtk_single_selection_set_can_unselect (selection_model, TRUE); + GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model), + GTK_LIST_ITEM_FACTORY (factory)); + GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); + gtk_scrolled_window_set_child (scrolled_window, list_view); + gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_set_vexpand (GTK_WIDGET (scrolled_window), TRUE); + gtk_widget_set_visible (GTK_WIDGET (scrolled_window), TRUE); + gtk_widget_set_visible (GTK_WIDGET (list_view), TRUE); - gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), W_IMAGE_LOCAL * 3, 0); - return scrolled_window; + gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), W_TREE_160, 0); // OK (required) + + return scrolled_window; }