From 5208a224e45bdad097ce86c671dda4f9687ad890 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 3 Jul 2024 22:30:08 +0200 Subject: [PATCH] WIP: cleaning (before systematic re-verifications) --- include/callbacks.h | 2 + include/widgets.h | 38 +--- src/callbacks.c | 6 + src/{parsing.c => parse.c} | 0 src/widget.c/heads.c | 7 + src/widget.c/labo | 123 ------------ src/widget.c/labo.c | 375 +++++++++++++++++++++++++++++++++++++ src/widget.c/rules.c | 310 +----------------------------- src/widget.c/state.c | 102 +++------- 9 files changed, 423 insertions(+), 540 deletions(-) rename src/{parsing.c => parse.c} (100%) delete mode 100644 src/widget.c/labo create mode 100644 src/widget.c/labo.c diff --git a/include/callbacks.h b/include/callbacks.h index 0396937..48d4906 100644 --- a/include/callbacks.h +++ b/include/callbacks.h @@ -59,3 +59,5 @@ void on_glarea_realize (GtkWidget *widget); void on_glarea_unrealize (GtkWidget *widget); void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); + +void on_reset_image (GtkWidget *btt_reset, gpointer data); diff --git a/include/widgets.h b/include/widgets.h index f66c917..8f0b110 100644 --- a/include/widgets.h +++ b/include/widgets.h @@ -46,48 +46,12 @@ GtkWidget *widget_get_STATE_page(); GtkWidget *widget_get_RULES_page(); GtkWidget *widget_get_STOCK_page(); -//-------------------------------------------------------- - -GtkWidget *get_selected_rules_vpaned_new(); -GtkWidget *get_rules_tree_hpaned_new(); -GtkWidget *get_rules_page_new(); - -//GtkWidget *get_TIME_EXEC_controls_box(); -//GtkWidget *get_SPACE_EDIT_controls_box(); -//GtkWidget *get_OBJECTS_and_SITUATIONS(); - -GtkWidget *get_text_view(); - -//GtkWidget *get_image_ALL_SPACE(); -/* -GtkWidget *get_image_GLUTAMATE(); -GtkWidget *get_image_GLUTAMINE(); -GtkWidget *get_image_HISTIDINE(); -GtkWidget *get_image_HISTAMINE(); -GtkWidget *get_image_PHENYLALANINE(); -GtkWidget *get_image_DOPAMINE(); -GtkWidget *get_image_ATP(); -GtkWidget *get_image_AMP(); -*/ -GtkFrame *get_frame_with_label(); - -GtkProgressBar *get_ELAPSED_TIME_ProgressBar(); - -//GtkBox *get_RUN_STOP_box(); -//GtkBox *get_ZOOM_box(); -//GtkBox *get_edit_TOOL_box(); -//GtkBox *get_XYZ_box(); -//GtkBox *get_rules_user_tree_new(); -//GtkBox *get_ELAPSED_TIME_box(); - struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;}; void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child); struct TreeNode_t *create_user_tree_node (const gchar* text); void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root); - GtkScrolledWindow *get_user_rules_tree (); void icons_for_fun (GtkHeaderBar *header_bar); - -// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO +GtkWidget *get_window_child_DATA_lab(); diff --git a/src/callbacks.c b/src/callbacks.c index 504746d..005e9c0 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -231,6 +231,8 @@ static void switch_STATE_RULES_DATA() { break; case (DATA) : + if (0) gtk_window_set_child (get_main_window(), + GTK_WIDGET (get_window_child_DATA_lab ())); gtk_window_set_child (get_main_window(), GTK_WIDGET (widget_get_STOCK_page())); break; @@ -304,3 +306,7 @@ void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, printf ("callback.c (line 300) - WRITE_CURRENT_MODEL\n"); } +void on_reset_image (GtkWidget *btt_reset, gpointer data) { + printf ("callback.on_reset_image() <> Comment remettre tous les curseurs à zéro ?\n"); +} + diff --git a/src/parsing.c b/src/parse.c similarity index 100% rename from src/parsing.c rename to src/parse.c diff --git a/src/widget.c/heads.c b/src/widget.c/heads.c index 88d41e1..9702a93 100644 --- a/src/widget.c/heads.c +++ b/src/widget.c/heads.c @@ -46,6 +46,13 @@ void set_dialog_window (GtkApplication *app) { dialog_window = GTK_WINDOW (gtk_application_window_new (app)); } +GtkButton *get_GtkButton (char *btt_name) { + if (strcmp (btt_name, "state")) return btt_open_STATE; + if (strcmp (btt_name, "rules")) return btt_open_RULES; + if (strcmp (btt_name, "data analysis")) return btt_open_DATA; + return NULL; +} + //------------------------------------------------------------------------------ void widget_DIALOG_WINDOW_design (GtkWindow *main_window, GtkWindow *dialog_window){ diff --git a/src/widget.c/labo b/src/widget.c/labo deleted file mode 100644 index a7b2808..0000000 --- a/src/widget.c/labo +++ /dev/null @@ -1,123 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * -* * -* Gem-graph client * -* * -* Widgets header * -* * -* Copyright © 2021 Libre en Communs * -* Copyright © 2021 Jean Sirmai * -* * -* This file is part of Gem-graph. * -* * -* This program is free software: you can redistribute it and/or modify it * -* under the terms of the GNU Affero General Public License * -* as published by the Free Software Foundation, * -* either version 3 of the License, * -* or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; * -* without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. * -* See the GNU Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with this program. If not, see . * -* * -* * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -#include "../../include/widgets.h" - -// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO -// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery -// https://iconduck.com/sets/adwaita-icon-theme https://iconduck.com/sets/carbon-icons - - -GtkButton *get_GtkButton (char *btt_name) { - if (strcmp (btt_name, "state")) return btt_open_STATE; - if (strcmp (btt_name, "rules")) return btt_open_RULES; - if (strcmp (btt_name, "data analysis")) return btt_open_DATA; - return NULL; -} - - -GtkFrame *get_frame_with_label() { // EN ATTENDANT DE SAVOIR UTILISER : GtkTextTagTable , GtkTextBuffer - GtkFrame *space_specif = GTK_FRAME(gtk_frame_new ("Space (run / edit) specifications")); - GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (get_space_run_edit_specif())); - gtk_frame_set_child (GTK_FRAME (space_specif), GTK_WIDGET (any_Label)); - return space_specif; -} - -GtkWidget *get_edit_rules_page_new() { - GtkPaned *hpaned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - - GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); - GtkWidget *édition_de_la_règle_sélectionnée = gtk_frame_new ("Édition de la règle sélectionnée"); - - gtk_paned_set_start_child (hpaned, GTK_WIDGET (arbre_des_règles)); - gtk_paned_set_end_child (hpaned, GTK_WIDGET (édition_de_la_règle_sélectionnée)); - // gtk_widget_set_size_request (GTK_WIDGET (hpaned), W, H); - gtk_paned_set_wide_handle (hpaned, TRUE); - - return GTK_WIDGET (hpaned); -} - -GtkWidget *get_edit_measures_page_new() { - GtkWidget *measures_grid = gtk_grid_new(); - return measures_grid; -} - -GtkWidget *get_edit_results_page_new() { - GtkWidget *xxx_grid = gtk_grid_new(); - return xxx_grid; -} - -GtkWidget *get_edit_discuss_page_new() { - GtkWidget *xxx_grid = gtk_grid_new(); - return xxx_grid; -} - -GtkWidget *get_edit_help_page_new() { - GtkWidget *edit_help_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(edit_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); - return edit_help_grid; -} - -GtkWidget *get_measures_page_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 ("transports"), 1, 0, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects"), 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations"), 1, 1, 1, 1); - return measures_grid; -} - -GtkWidget *get_results_page_new() { - GtkWidget *results_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Repartitions"), 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Correlations"), 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Evolutions"), 0, 2, 1, 1); - return results_grid; -} - -GtkWidget *get_discuss_page_new() { - GtkWidget *discuss_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1); - return discuss_grid; -} - -GtkWidget *get_help_page_new() { - GtkWidget *run_help_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(run_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); - return run_help_grid; -} - - - - - - - diff --git a/src/widget.c/labo.c b/src/widget.c/labo.c new file mode 100644 index 0000000..a9baf3e --- /dev/null +++ b/src/widget.c/labo.c @@ -0,0 +1,375 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Widgets header * +* * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Jean Sirmai * +* * +* This file is part of Gem-graph. * +* * +* This program is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Affero General Public License * +* as published by the Free Software Foundation, * +* either version 3 of the License, * +* or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; * +* without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. * +* See the GNU Affero General Public License for more details. * +* * +* You should have received a copy of the GNU Affero General Public License * +* along with this program. If not, see . * +* * +* * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include "../../include/widgets.h" + +// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO +// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery +// https://iconduck.com/sets/adwaita-icon-theme https://iconduck.com/sets/carbon-icons + + + +/* +GtkFrame *get_frame_with_label() { // EN ATTENDANT DE SAVOIR UTILISER : GtkTextTagTable , GtkTextBuffer + GtkFrame *space_specif = GTK_FRAME(gtk_frame_new ("Space (run / edit) specifications")); + GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (get_space_run_edit_specif())); + gtk_frame_set_child (GTK_FRAME (space_specif), GTK_WIDGET (any_Label)); + return space_specif; +} +*/ + +GtkWidget *get_edit_rules_page_new() { + GtkPaned *hpaned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); + + GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); + GtkWidget *édition_de_la_règle_sélectionnée = gtk_frame_new ("Édition de la règle sélectionnée"); + + gtk_paned_set_start_child (hpaned, GTK_WIDGET (arbre_des_règles)); + gtk_paned_set_end_child (hpaned, GTK_WIDGET (édition_de_la_règle_sélectionnée)); + // gtk_widget_set_size_request (GTK_WIDGET (hpaned), W, H); + gtk_paned_set_wide_handle (hpaned, TRUE); + + return GTK_WIDGET (hpaned); +} + +GtkWidget *get_edit_measures_page_new() { + GtkWidget *measures_grid = gtk_grid_new(); + return measures_grid; +} + +GtkWidget *get_edit_results_page_new() { + GtkWidget *xxx_grid = gtk_grid_new(); + return xxx_grid; +} + +GtkWidget *get_edit_discuss_page_new() { + GtkWidget *xxx_grid = gtk_grid_new(); + return xxx_grid; +} + +/* +GtkWidget *get_edit_help_page_new() { + GtkWidget *edit_help_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID(edit_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); + return edit_help_grid; +} +*/ + +GtkWidget *get_measures_page_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 ("transports"), 1, 0, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("transformations"), 2, 0, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("objects"), 0, 1, 1, 1); + gtk_grid_attach (GTK_GRID (measures_grid), gtk_button_new_with_label ("situations"), 1, 1, 1, 1); + return measures_grid; +} + +GtkWidget *get_results_page_new() { + GtkWidget *results_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Repartitions"), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Correlations"), 0, 1, 1, 1); + gtk_grid_attach (GTK_GRID(results_grid), gtk_button_new_with_label ("Evolutions"), 0, 2, 1, 1); + return results_grid; +} + +GtkWidget *get_discuss_page_new() { + GtkWidget *discuss_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Interpretations"), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID (discuss_grid), gtk_button_new_with_label ("Discussions"), 0, 1, 1, 1); + return discuss_grid; +} + +/* +GtkWidget *get_help_page_new() { + GtkWidget *run_help_grid = gtk_grid_new(); + gtk_grid_attach (GTK_GRID(run_help_grid), GTK_WIDGET(get_frame_with_label()), 0, 0, 1, 1); + return run_help_grid; +} +*/ + +//--------------------------------------------------------------------------- + +GtkWidget *get_window_child_DATA_lab () { + if (0) printf("widgets.get_window_child_DATA (line 279)\n"); + GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32)); + + GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------"); + gtk_frame_set_label_align (GTK_FRAME (frame_rule_effect), 0.5); + GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box)); + + GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic\n----------"); + gtk_frame_set_label_align (GTK_FRAME (frame_rule_topic), 0.5); + GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box)); + + GtkWidget* frame_data_type = gtk_frame_new ("data type\n----------"); + gtk_frame_set_label_align (GTK_FRAME (frame_data_type), 0.5); + GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box)); + + GtkWidget* frame_interpretations = gtk_frame_new ("interpretation\n---------------"); + gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5); + GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box)); + + GtkWidget* frame_discussions = gtk_frame_new ("discussion\n------------"); + gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5); + GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box)); + + GtkWidget* frame_separator = gtk_frame_new ("\n"); + + GtkWidget* frame_game = gtk_frame_new ("game\n------"); + gtk_frame_set_label_align (GTK_FRAME (frame_game), 0.5); + GtkBox *game_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_game), GTK_WIDGET (game_box)); + + GtkWidget* frame_help = gtk_frame_new ("help\n-----"); + gtk_frame_set_label_align (GTK_FRAME (frame_help), 0.5); + GtkBox *help_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); + gtk_frame_set_child (GTK_FRAME (frame_help), GTK_WIDGET (help_box)); + + gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect)); + gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic)); + gtk_box_append (data_box, GTK_WIDGET (frame_data_type)); + gtk_box_append (data_box, GTK_WIDGET (frame_interpretations)); + gtk_box_append (data_box, GTK_WIDGET (frame_discussions)); + gtk_box_append (data_box, GTK_WIDGET (frame_separator)); + gtk_box_append (data_box, GTK_WIDGET (frame_game)); + gtk_box_append (data_box, GTK_WIDGET (frame_help)); + + gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement")); + gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport")); + gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation")); + + gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects")); + gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations")); + + gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (rule_topic_box, gtk_button_new_with_label ("accuracy")); + gtk_box_append (rule_topic_box, gtk_button_new_with_label ("pattern recognition")); + + gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions")); + gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions")); + gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations")); + + gtk_box_append (interpretations_box, gtk_button_new_with_label ("stochastic")); + gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic")); + + gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (interpretations_box, gtk_button_new_with_label ("physical")); + gtk_box_append (interpretations_box, gtk_button_new_with_label ("chemical")); + gtk_box_append (interpretations_box, gtk_button_new_with_label ("biological")); + gtk_box_append (interpretations_box, gtk_button_new_with_label ("social")); + gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + + gtk_box_append (discussions_box, gtk_button_new_with_label ("context")); + gtk_box_append (discussions_box, gtk_button_new_with_label ("methodology")); + gtk_box_append (discussions_box, gtk_button_new_with_label ("comparisons")); + gtk_box_append (discussions_box, gtk_button_new_with_label ("to improve")); + gtk_box_append (discussions_box, gtk_button_new_with_label ("summary")); + + gtk_box_append (game_box, gtk_button_new_with_label ("single player")); + gtk_box_append (game_box, gtk_button_new_with_label ("multiple players")); + gtk_box_append (game_box, gtk_button_new_with_label ("edition facilities")); + + gtk_box_append (help_box, gtk_button_new_with_label ("modelization")); + gtk_box_append (help_box, gtk_button_new_with_label ("measurements")); + gtk_box_append (help_box, gtk_button_new_with_label ("results")); + gtk_box_append (help_box, gtk_button_new_with_label ("data analysis")); + + gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (help_box, gtk_button_new_with_label ("preferences")); + + //SWITCH_TO (DATA); + return GTK_WIDGET (data_box); +} + +char *get_space_run_edit_specif(){ + return "\n\ +\ +>>> Dans : [space_page - mode RUN] doivent être : ------------------------------------------------------\n\n\ +(1) les commandes de mouvement:\n\ + - run/stop, slow down/speed up, step by step, do/undo/redo\n\ + + le buffer [elapsed time] qui montre le temps de simulation écoulé\n\n\ +(2) les commandes qui modifient la perception de l'espace (la caméra)\n\ + - son orientation (X,Y,Z),\n\ + + l'orientation (X,Y,Z) de l'état dans l'espace (six possibilités),\n\ + + le zoom,\n\ + + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) \n\n\ +(3) les commandes qui modifient les apparences des objets et des situations d'intérêt\n\ + (+/- transparents, colorés, etc.)\n\n\ +(4) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.)\n\n\ +\ +(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'ÉDITER L'ESPACE ! <<<\n\n\n\ +\ +>>> Dans : [space_page - mode EDIT] doivent être : ------------------------------------------------------\n\n\ +(1) les commandes qui modifient la perception de l'espace (la caméra)\n\ + - son orientation (X,Y,Z),\n\ + + l'orientation (X,Y,Z) de l'état dans l'espace (six possibilités),\n\ + + le zoom,\n\ + + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) \n\n\ +(2) les commandes qui modifient les apparences des objets et des situations d'intérêt\n\ + (+/- transparents, colorés, etc.)\n\n\ +(3) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.)\n\n\ +(4) les commandes d'édition locales (drag and drop une flèche)\n\ + ('faire de la place' pour insérer)\n\ + (sélectionner pour déplacer ou enlever...)\n\ + NB ces commandes doivent être graphiques et/ou accessibles par raccourcis ou en ligne\n\n\ +(5) les commandes d'édition globales\n\ + (ex: introduire, retirer, transformer +/-aléatoirement (n) objets dans l'espace)\n\n\n\ + NB une action effectuée sur une zone d'intérêt devrait pouvoir être automatiquement appliquée\n\ + à d'autres zones d'intérêt identifiées comme similaires\n\n\ +\ +(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'EXÉCUTER UN RUN ! <<<\n\n\n\ +\ +>>> L'objectif est que l'utilisateur ait accès à une organsisation aussi ergonomique que possible -----\n\n\ + i.e : chaque utilisateur devrait disposer de 'préférences'\n\ + c'est-à-dire avoir la possiblité de faire des choix ergonomiques personnalisés.\n"; +} + + +void icons_for_fun (GtkHeaderBar *header_bar) // https://iconduck.com/sets/adwaita-icon-theme +// https://iconduck.com/sets/carbon-icons < pas mal ... +// https://thenounproject.com/icon/train-134324/ +// ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix... +{ + 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_biblio = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (help_biblio, "accessories-dictionary-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_biblio)); + + 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 *help_about = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (help_about, "help-about-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_about)); + + GtkButton *help_faq = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (help_faq, "help-faq-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_faq)); + + GtkButton *terminal = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (terminal, "utilities-terminal-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (terminal)); + + GtkButton *search = GTK_BUTTON (gtk_button_new ()); + 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 *preferences_system = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (preferences_system, "preferences-system-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_system)); + + GtkButton *document_properties = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (document_properties, "document-properties-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (document_properties)); + + GtkButton *text_edit = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (text_edit, "text-editor-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (text_edit)); + + GtkButton *applications_utilities = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (applications_utilities, "applications-utilities-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (applications_utilities)); + + 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)); + + GtkButton *power_max = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (power_max, "power-profile-performance-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_max)); + + GtkButton *power_middle = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (power_middle, "power-profile-balanced-rtl-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_middle)); + + GtkButton *power_low = GTK_BUTTON (gtk_button_new ()); + gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic"); + gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low)); + +// gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "process-stop-symbolic"); +} + +void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) { + struct TreeNode_t *a = create_user_tree_node("We, the people");add_child_node(tree_root, a); + struct TreeNode_t *b = create_user_tree_node("in Order to"); add_child_node(tree_root, b); + struct TreeNode_t *c = create_user_tree_node("do establish"); add_child_node(tree_root, c); + struct TreeNode_t *aa = create_user_tree_node("aware of"); add_child_node(a, aa); + struct TreeNode_t *aaa = create_user_tree_node("our rights"); add_child_node(aa, aaa); + struct TreeNode_t *aab = create_user_tree_node("our duties"); add_child_node(aa, aab); + struct TreeNode_t *aaaa = create_user_tree_node("read"); add_child_node(aaa, aaaa); + struct TreeNode_t *aaab = create_user_tree_node("write"); add_child_node(aaa, aaab); + struct TreeNode_t *aaac = create_user_tree_node("copy"); add_child_node(aaa, aaac); + struct TreeNode_t *aaad = create_user_tree_node("edit"); add_child_node(aaa, aaad); + struct TreeNode_t *aaaba= create_user_tree_node("code"); add_child_node(aaab, aaaba); + struct TreeNode_t *aaabb= create_user_tree_node("language"); add_child_node(aaab, aaabb); + struct TreeNode_t *aaabc= create_user_tree_node("any art..."); add_child_node(aaab, aaabc); + struct TreeNode_t *aaadb= create_user_tree_node("publish"); add_child_node(aaac, aaadb); + struct TreeNode_t *aaada= create_user_tree_node("create"); add_child_node(aaad, aaada); + struct TreeNode_t *aaba = create_user_tree_node("learn"); add_child_node(aab, aaba); + struct TreeNode_t *aabb = create_user_tree_node("help"); add_child_node(aab, aabb); + struct TreeNode_t *ba = create_user_tree_node("promote"); add_child_node(b, ba); + struct TreeNode_t *bb = create_user_tree_node("individual"); add_child_node(b, bb); + struct TreeNode_t *bc = create_user_tree_node("and common"); add_child_node(b, bc); + struct TreeNode_t *bca = create_user_tree_node("education"); add_child_node(bc, bca); + struct TreeNode_t *bcb = create_user_tree_node("mutual"); add_child_node(bc, bcb); + struct TreeNode_t *bcc = create_user_tree_node("support"); add_child_node(bc, bcc); + struct TreeNode_t *bcd = create_user_tree_node("health"); add_child_node(bc, bcd); + struct TreeNode_t *bcda = create_user_tree_node("mental"); add_child_node(bcd, bcda); + struct TreeNode_t *bcdb = create_user_tree_node("physical"); add_child_node(bcd, bcdb); + struct TreeNode_t *ca = create_user_tree_node("free"); add_child_node(c, ca); + struct TreeNode_t *cb = create_user_tree_node("code"); add_child_node(c, cb); + struct TreeNode_t *cc = create_user_tree_node("access"); add_child_node(c, cc); +} + + + + + + diff --git a/src/widget.c/rules.c b/src/widget.c/rules.c index 198c15f..bfe67af 100644 --- a/src/widget.c/rules.c +++ b/src/widget.c/rules.c @@ -29,9 +29,6 @@ #include "../../include/widgets.h" -// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO -// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery - #define W 1920 // TODO 2024-06-30 #define H 960 // Ad hoc (pour mon écran) #define W_IMAGE W - 320 @@ -40,8 +37,6 @@ #define W_IMAGE_LOCAL W / 16 #define H_IMAGE_LOCAL H / 16 -//------------------------------------------------------------------------------ - static GtkWidget *get_image_GLUTAMATE(){ GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png"); gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE_LOCAL, H_IMAGE_LOCAL); @@ -84,34 +79,7 @@ static GtkWidget *get_image_AMP(){ return image; } -//------------------------------------------------------------------------------ - -/* -static GtkBox *get_RUN_STOP_box_lab(){ - GtkBox *RUN_STOP_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20)); - gtk_box_append (RUN_STOP_box, GTK_WIDGET (get_UNDO_SPEED_box())); - gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" STEP\n(show active rule) "))); - gtk_box_append (RUN_STOP_box, GTK_WIDGET (get_DO_SPEED_box())); - gtk_box_append (RUN_STOP_box, GTK_WIDGET(gtk_label_new (" R U N\n S T O P"))); - return RUN_STOP_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.)")); - gtk_widget_set_size_request (GTK_WIDGET (TOOL_box), 10, 120); - gtk_box_append (TOOL_box, ZOOM_Label); - return TOOL_box; -} - -//------------------------------------------------------------------------------ - -GtkWidget *get_selected_rules_vpaned_new() { +static GtkWidget *get_selected_rules_vpaned_new() { GtkPaned *EXEC_CONTROLS_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); @@ -130,10 +98,7 @@ GtkWidget *get_selected_rules_vpaned_new() { return GTK_WIDGET (EXEC_CONTROLS_pane); } -//------------------------------------------------------------------------------ - - -GtkBox *get_rules_comparator_new(){ +static GtkBox *get_rules_comparator_new(){ GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); gtk_box_append (comparator, GTK_WIDGET (get_image_ATP())); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); @@ -152,7 +117,7 @@ GtkBox *get_rules_comparator_new(){ return comparator; } -GtkWidget *get_rules_tree_hpaned_new(){ +static GtkWidget *get_rules_tree_hpaned_new(){ GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre"); @@ -167,20 +132,6 @@ GtkWidget *get_rules_tree_hpaned_new(){ return GTK_WIDGET (H_tree_vs_comparison); } -GtkWidget *get_rules_page_new(){ - GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - -// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); -// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection"); - - gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (get_rules_tree_hpaned_new())); - gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (get_selected_rules_vpaned_new())); - gtk_paned_set_position (H_tree_vs_selected, 600); // WARNING : c'est une position "absolue" - gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE); - // gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_selected), W, H); // inutile... ? - return GTK_WIDGET (H_tree_vs_selected); -} - GtkWidget *widget_get_RULES_page() { GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); @@ -192,258 +143,3 @@ GtkWidget *widget_get_RULES_page() { return GTK_WIDGET (H_tree_vs_selected); } -//--------------------------------------------------------------------------- - -GtkWidget *get_window_child_DATA_lab () { - if (0) printf("widgets.get_window_child_DATA (line 279)\n"); - GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32)); - - GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------"); - gtk_frame_set_label_align (GTK_FRAME (frame_rule_effect), 0.5); - GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box)); - - GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic\n----------"); - gtk_frame_set_label_align (GTK_FRAME (frame_rule_topic), 0.5); - GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box)); - - GtkWidget* frame_data_type = gtk_frame_new ("data type\n----------"); - gtk_frame_set_label_align (GTK_FRAME (frame_data_type), 0.5); - GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box)); - - GtkWidget* frame_interpretations = gtk_frame_new ("interpretation\n---------------"); - gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5); - GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box)); - - GtkWidget* frame_discussions = gtk_frame_new ("discussion\n------------"); - gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5); - GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box)); - - GtkWidget* frame_separator = gtk_frame_new ("\n"); - - GtkWidget* frame_game = gtk_frame_new ("game\n------"); - gtk_frame_set_label_align (GTK_FRAME (frame_game), 0.5); - GtkBox *game_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_game), GTK_WIDGET (game_box)); - - GtkWidget* frame_help = gtk_frame_new ("help\n-----"); - gtk_frame_set_label_align (GTK_FRAME (frame_help), 0.5); - GtkBox *help_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8)); - gtk_frame_set_child (GTK_FRAME (frame_help), GTK_WIDGET (help_box)); - - gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect)); - gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic)); - gtk_box_append (data_box, GTK_WIDGET (frame_data_type)); - gtk_box_append (data_box, GTK_WIDGET (frame_interpretations)); - gtk_box_append (data_box, GTK_WIDGET (frame_discussions)); - gtk_box_append (data_box, GTK_WIDGET (frame_separator)); - gtk_box_append (data_box, GTK_WIDGET (frame_game)); - gtk_box_append (data_box, GTK_WIDGET (frame_help)); - - gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement")); - gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport")); - gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation")); - - gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects")); - gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations")); - - gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (rule_topic_box, gtk_button_new_with_label ("accuracy")); - gtk_box_append (rule_topic_box, gtk_button_new_with_label ("pattern recognition")); - - gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions")); - gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions")); - gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations")); - - gtk_box_append (interpretations_box, gtk_button_new_with_label ("stochastic")); - gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic")); - - gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (interpretations_box, gtk_button_new_with_label ("physical")); - gtk_box_append (interpretations_box, gtk_button_new_with_label ("chemical")); - gtk_box_append (interpretations_box, gtk_button_new_with_label ("biological")); - gtk_box_append (interpretations_box, gtk_button_new_with_label ("social")); - gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - - gtk_box_append (discussions_box, gtk_button_new_with_label ("context")); - gtk_box_append (discussions_box, gtk_button_new_with_label ("methodology")); - gtk_box_append (discussions_box, gtk_button_new_with_label ("comparisons")); - gtk_box_append (discussions_box, gtk_button_new_with_label ("to improve")); - gtk_box_append (discussions_box, gtk_button_new_with_label ("summary")); - - gtk_box_append (game_box, gtk_button_new_with_label ("single player")); - gtk_box_append (game_box, gtk_button_new_with_label ("multiple players")); - gtk_box_append (game_box, gtk_button_new_with_label ("edition facilities")); - - gtk_box_append (help_box, gtk_button_new_with_label ("modelization")); - gtk_box_append (help_box, gtk_button_new_with_label ("measurements")); - gtk_box_append (help_box, gtk_button_new_with_label ("results")); - gtk_box_append (help_box, gtk_button_new_with_label ("data analysis")); - - gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (help_box, gtk_button_new_with_label ("preferences")); - - //SWITCH_TO (DATA); - return GTK_WIDGET (data_box); -} - -char *get_space_run_edit_specif(){ - return "\n\ -\ ->>> Dans : [space_page - mode RUN] doivent être : ------------------------------------------------------\n\n\ -(1) les commandes de mouvement:\n\ - - run/stop, slow down/speed up, step by step, do/undo/redo\n\ - + le buffer [elapsed time] qui montre le temps de simulation écoulé\n\n\ -(2) les commandes qui modifient la perception de l'espace (la caméra)\n\ - - son orientation (X,Y,Z),\n\ - + l'orientation (X,Y,Z) de l'état dans l'espace (six possibilités),\n\ - + le zoom,\n\ - + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) \n\n\ -(3) les commandes qui modifient les apparences des objets et des situations d'intérêt\n\ - (+/- transparents, colorés, etc.)\n\n\ -(4) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.)\n\n\ -\ -(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'ÉDITER L'ESPACE ! <<<\n\n\n\ -\ ->>> Dans : [space_page - mode EDIT] doivent être : ------------------------------------------------------\n\n\ -(1) les commandes qui modifient la perception de l'espace (la caméra)\n\ - - son orientation (X,Y,Z),\n\ - + l'orientation (X,Y,Z) de l'état dans l'espace (six possibilités),\n\ - + le zoom,\n\ - + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) \n\n\ -(2) les commandes qui modifient les apparences des objets et des situations d'intérêt\n\ - (+/- transparents, colorés, etc.)\n\n\ -(3) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.)\n\n\ -(4) les commandes d'édition locales (drag and drop une flèche)\n\ - ('faire de la place' pour insérer)\n\ - (sélectionner pour déplacer ou enlever...)\n\ - NB ces commandes doivent être graphiques et/ou accessibles par raccourcis ou en ligne\n\n\ -(5) les commandes d'édition globales\n\ - (ex: introduire, retirer, transformer +/-aléatoirement (n) objets dans l'espace)\n\n\n\ - NB une action effectuée sur une zone d'intérêt devrait pouvoir être automatiquement appliquée\n\ - à d'autres zones d'intérêt identifiées comme similaires\n\n\ -\ -(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'EXÉCUTER UN RUN ! <<<\n\n\n\ -\ ->>> L'objectif est que l'utilisateur ait accès à une organsisation aussi ergonomique que possible -----\n\n\ - i.e : chaque utilisateur devrait disposer de 'préférences'\n\ - c'est-à-dire avoir la possiblité de faire des choix ergonomiques personnalisés.\n"; -} - - -void icons_for_fun (GtkHeaderBar *header_bar) // https://iconduck.com/sets/adwaita-icon-theme -// https://iconduck.com/sets/carbon-icons < pas mal ... -// https://thenounproject.com/icon/train-134324/ -// ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix... -{ - 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_biblio = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_biblio, "accessories-dictionary-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_biblio)); - - 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 *help_about = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_about, "help-about-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_about)); - - GtkButton *help_faq = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_faq, "help-faq-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_faq)); - - GtkButton *terminal = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (terminal, "utilities-terminal-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (terminal)); - - GtkButton *search = GTK_BUTTON (gtk_button_new ()); - 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 *preferences_system = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (preferences_system, "preferences-system-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_system)); - - GtkButton *document_properties = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (document_properties, "document-properties-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (document_properties)); - - GtkButton *text_edit = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (text_edit, "text-editor-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (text_edit)); - - GtkButton *applications_utilities = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (applications_utilities, "applications-utilities-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (applications_utilities)); - - 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)); - - GtkButton *power_max = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_max, "power-profile-performance-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_max)); - - GtkButton *power_middle = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_middle, "power-profile-balanced-rtl-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_middle)); - - GtkButton *power_low = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low)); - -// gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "process-stop-symbolic"); -} - -void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) { - struct TreeNode_t *a = create_user_tree_node("We, the people");add_child_node(tree_root, a); - struct TreeNode_t *b = create_user_tree_node("in Order to"); add_child_node(tree_root, b); - struct TreeNode_t *c = create_user_tree_node("do establish"); add_child_node(tree_root, c); - struct TreeNode_t *aa = create_user_tree_node("aware of"); add_child_node(a, aa); - struct TreeNode_t *aaa = create_user_tree_node("our rights"); add_child_node(aa, aaa); - struct TreeNode_t *aab = create_user_tree_node("our duties"); add_child_node(aa, aab); - struct TreeNode_t *aaaa = create_user_tree_node("read"); add_child_node(aaa, aaaa); - struct TreeNode_t *aaab = create_user_tree_node("write"); add_child_node(aaa, aaab); - struct TreeNode_t *aaac = create_user_tree_node("copy"); add_child_node(aaa, aaac); - struct TreeNode_t *aaad = create_user_tree_node("edit"); add_child_node(aaa, aaad); - struct TreeNode_t *aaaba= create_user_tree_node("code"); add_child_node(aaab, aaaba); - struct TreeNode_t *aaabb= create_user_tree_node("language"); add_child_node(aaab, aaabb); - struct TreeNode_t *aaabc= create_user_tree_node("any art..."); add_child_node(aaab, aaabc); - struct TreeNode_t *aaadb= create_user_tree_node("publish"); add_child_node(aaac, aaadb); - struct TreeNode_t *aaada= create_user_tree_node("create"); add_child_node(aaad, aaada); - struct TreeNode_t *aaba = create_user_tree_node("learn"); add_child_node(aab, aaba); - struct TreeNode_t *aabb = create_user_tree_node("help"); add_child_node(aab, aabb); - struct TreeNode_t *ba = create_user_tree_node("promote"); add_child_node(b, ba); - struct TreeNode_t *bb = create_user_tree_node("individual"); add_child_node(b, bb); - struct TreeNode_t *bc = create_user_tree_node("and common"); add_child_node(b, bc); - struct TreeNode_t *bca = create_user_tree_node("education"); add_child_node(bc, bca); - struct TreeNode_t *bcb = create_user_tree_node("mutual"); add_child_node(bc, bcb); - struct TreeNode_t *bcc = create_user_tree_node("support"); add_child_node(bc, bcc); - struct TreeNode_t *bcd = create_user_tree_node("health"); add_child_node(bc, bcd); - struct TreeNode_t *bcda = create_user_tree_node("mental"); add_child_node(bcd, bcda); - struct TreeNode_t *bcdb = create_user_tree_node("physical"); add_child_node(bcd, bcdb); - struct TreeNode_t *ca = create_user_tree_node("free"); add_child_node(c, ca); - struct TreeNode_t *cb = create_user_tree_node("code"); add_child_node(c, cb); - struct TreeNode_t *cc = create_user_tree_node("access"); add_child_node(c, cc); -} - - diff --git a/src/widget.c/state.c b/src/widget.c/state.c index ddb4523..cef7b8e 100644 --- a/src/widget.c/state.c +++ b/src/widget.c/state.c @@ -1,27 +1,28 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Gem-graph client * +* Gem-graph client * * * -* Widgets * +* Main * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2023 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Jean Sirmai * * * * This file is part of Gem-graph. * * * -* This program is free software: you can redistribute it and/or modify it * -* under the terms of the GNU Affero General Public License * -* as publishedby the Free Software Foundation, * -* either version 3 of the License, or (at your option) any later version. * +* This program is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Affero General Public License * +* as published by the Free Software Foundation, * +* either version 3 of the License, * +* or (at your option) any later version. * * * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * -* See the GNU Affero General Public License for more details. * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; * +* without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. * +* See the GNU Affero General Public License for more details. * * * -* You should have received a copy of the GNU Affero General Public License * -* along with this program. If not, see . * +* You should have received a copy of the GNU Affero General Public License * +* along with this program. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -30,35 +31,12 @@ #include "../../include/callbacks.h" #include "../../include/widgets.h" -#define W 1920 // TODO 2024-06-30 -#define H 960 // Ad hoc (pour mon écran) +#define W 1920 // TODO 2024-06-30 (Ad hoc pour mon écran) +#define H 960 #define H_STYLES_PANE 30 -#define LOWER_COMPARTMENT_PARTITION 1100 // 1186 +#define LOWER_COMPARTMENT_PARTITION 1100 #define UPPER_COMPARTMENT_PARTITION 600 -/* -static GtkWidget *get_scroll_speed(){ - GtkAdjustment *speed_adjust = gtk_adjustment_new (100, 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), 120, 2); - return scroll_speed; -} - -static GtkBox *get_UNDO_SPEED_box(){ - GtkBox *SPEED_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); - gtk_box_append (SPEED_box, GTK_WIDGET(gtk_label_new ("< UNDO <\n"))); - gtk_box_append (SPEED_box, get_scroll_speed()); - return SPEED_box; -} - -static GtkBox *get_DO_SPEED_box(){ - GtkBox *SPEED_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); - gtk_box_append (SPEED_box, GTK_WIDGET(gtk_label_new ("> DO >\n"))); - gtk_box_append (SPEED_box, get_scroll_speed()); - return SPEED_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 = 2q @@ -70,7 +48,7 @@ GtkBox *get_XYZ_box(){ 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, 500); + gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 440); gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") gtk_box_append (XYZ_scrollbar_box, scroll_X); @@ -102,23 +80,6 @@ static GtkBox *get_RUN_STOP_box(){ return RUN_STOP_box; } -static GtkWidget *get_OBJECTS_and_SITUATIONS(); - -GtkWidget *get_edit_space_page_new() { - GtkWidget *space_grid = gtk_grid_new(); - GtkWidget *image = gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"); - gtk_grid_attach (GTK_GRID(space_grid), image, 0, 0, 1, 3); - gtk_grid_attach (GTK_GRID(space_grid), get_OBJECTS_and_SITUATIONS(), 0, 4, 1, 1); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET (get_XYZ_box()), 1, 0, 1, 2); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET (get_ZOOM_box()), 1, 2, 1, 2); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET (get_edit_TOOL_box()), 1, 3, 1, 2); - gtk_widget_set_size_request (space_grid, W, H); - return space_grid; -} - -//------------------------------------------------------------------------------ - 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 ("\ @@ -132,21 +93,15 @@ static GtkBox *get_DO_UNDO_REDO_box(){ return DO_UNDO_REDO_box; } - - - - - - - - - - static GtkBox *get_OBJECTS_box(){ GtkBox *objects_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset"); + g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_reset_image), NULL); + gtk_box_append (objects_box, btt_reset); GtkAdjustment *adjust = NULL; for (int i = 0; i < 32; i++) { - adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 4); + // (value, lower, upper, step_increment, page_increment, page_size) + adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 0); GtkScrollbar *scrollbar_i = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust)); char tooltip_text[8]; sprintf(tooltip_text, "\n%d\n", i); @@ -163,6 +118,9 @@ static GtkBox *get_OBJECTS_box(){ static GtkBox *get_SITUATIONS_box(){ GtkBox *situations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset"); + g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_reset_image), NULL); + gtk_box_append (situations_box, btt_reset); GtkAdjustment *adjust = NULL; for (int i = 0; i < 128; i++) { adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 4); @@ -219,13 +177,12 @@ GtkWidget *get_SPACE_VIEW_box() { // TODO GtkWidget *image = gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli (Goodsell) 2.png"); + ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"); gtk_box_append (central_box, GTK_WIDGET (image)); // ui_setup_glarea (0, GTK_WIDGET (central_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 (GTK_WIDGET (central_box), W - 00, 00); return GTK_WIDGET (central_box); } @@ -239,7 +196,6 @@ 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 (GTK_WIDGET (EXEC_CONTROLS_pane), 00, 200); return GTK_WIDGET (EXEC_CONTROLS_pane); }