From 71d7a2e3d59e0ae4e13ef152a566d0f00293794a Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 1 Jul 2024 00:42:25 +0200 Subject: [PATCH] WIP: cleaning (systematic verifications II) --- include/base.h | 85 ++++++++++++++-------------------------------- include/callback.h | 49 ++++++++++++++------------ include/graphics.h | 32 +++++++++-------- include/parsing.h | 29 ++++++++-------- include/widgets.h | 57 +++++++++++++++---------------- src/main.c | 32 +++++++++-------- 6 files changed, 128 insertions(+), 156 deletions(-) diff --git a/include/base.h b/include/base.h index 89e5296..d941a87 100644 --- a/include/base.h +++ b/include/base.h @@ -4,29 +4,32 @@ * * * Base header * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2023 Arthur Menges * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* Copyright © 2021 Arthur Menges * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #pragma once #include #include @@ -70,15 +73,8 @@ enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // < used by graphics.h struct arrow_t { uint load; uint site; uint x; uint y; uint z; }; - -/******************************************************************************/ -/* U T I L I T I E S */ -/******************************************************************************/ - -static inline char *read_file(char *filename); // < used by : init.c - /* - I'm standing on Earth (or any spinning spheroid), + If I'm standing on Earth (or any spinning spheroid), looking towards its North pole. Then : @@ -96,8 +92,13 @@ static inline char *read_file(char *filename); // < used by : init.c #define NORTH 5 // - z yellow +/******************************************************************************/ +/* U T I L I T I E S */ +/******************************************************************************/ + /* - * char *read_file(char *filename) reads a file from filename into a provided buffer + * char *read_file(char *filename) + * reads a file from filename into a provided buffer * * @param filename, file name * contents, target ptr @@ -138,40 +139,4 @@ static inline char *read_file(char *filename) char *get_space_run_edit_specif(); char *get_rules_run_edit_specif(); -/* ->>> Dans : [space_page - mode RUN] doivent être : ------------------------------------------------------ - -(1) les commandes de mouvement: - - run/stop, slow down/speed up, step by step, do/undo/redo - + le buffer [elapsed time] qui montre le temps de simulation écoulé -(2) les commandes qui modifient la perception de l'espace (la caméra) - - son orientation (X,Y,Z), - + le zoom, - + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) -(3) les commandes qui modifient les apparences des objets et des situations d'intérêt - (+/- transparents, colorés, etc.) -(4) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.) -(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'ÉDITER L'ESPACE ! <<< - ->>> Dans : [space_page - mode EDIT] doivent être : ------------------------------------------------------ -(1) les commandes qui modifient la perception de l'espace (la caméra) - - son orientation (X,Y,Z), - + le zoom, - + les paramètres qui définissent la perspective (distances oeil/écran, écran/objet virtuel) -(2) les commandes qui modifient les apparences des objets et des situations d'intérêt - (+/- transparents, colorés, etc.) -(3) les commandes qui modifient l'apparence de l'espace (grilles, +/- surfaces, aspect des flèches, etc.) -(4) les commandes d'édition locales (drag and drop une flèche) - ('faire de la place' pour insérer) - (sélectionner pour déplacer ou enlever...) - NB ces commandes doivent être graphiques et/ou accessibles par raccourcis ou en ligne -(5) les commandes d'édition globales - (ex: introduire, retirer, transformer +/-aléatoirement (n) objets dans l'espace) - NB une action effectuée sur une zone d'intérêt devrait pouvoir être automatiquement appliquée - à d'autres zones d'intérêt identifiées comme similaires -(0) NB >>> AUCUNE COMMANDE NE DOIT PERMETTRE D'EXÉCUTER UN RUN ! <<< ->>> L'objectif est que l'utilisateur ait accès à une organsisation aussi ergonomique que possible ----- - i.e : chaque utilisateur devrait disposer de 'préférences' - c'est-à-dire avoir la possiblité de faire des choix ergonomiques personnalisés. -*/ - +/* (texts are in widgets_lab) */ diff --git a/include/callback.h b/include/callback.h index d0e37ab..5f21386 100644 --- a/include/callback.h +++ b/include/callback.h @@ -4,24 +4,26 @@ * * * Callbacks header * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -34,15 +36,6 @@ void on_main_window_activation (GtkApplication *app, gpointer user_data); void on_dialog_window_activation (GtkApplication *app, gpointer user_data); -void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data); -void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data); - -gboolean on_glarea_render (GtkGLArea *area, GdkGLContext *context); -void on_glarea_realize (GtkWidget *widget); -void on_glarea_unrealize (GtkWidget *widget); - -void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); - void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data); void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data); @@ -54,3 +47,15 @@ void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gp void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data); void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data); + +void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data); +void on_setup_user_tree_factory (GtkSignalListItemFactory *factory, + GObject* object, gpointer user_data); +void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, + GObject* object, gpointer user_data); + +gboolean on_glarea_render (GtkGLArea *area, GdkGLContext *context); +void on_glarea_realize (GtkWidget *widget); +void on_glarea_unrealize (GtkWidget *widget); + +void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); diff --git a/include/graphics.h b/include/graphics.h index 1a0cd64..c92b042 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2,27 +2,29 @@ * * * Gem-graph client * * * -* Graphics header * +* Graphics header * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2023 Arthur Menges * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* Copyright © 2021 Arthur Menges * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/include/parsing.h b/include/parsing.h index be49d25..037940f 100644 --- a/include/parsing.h +++ b/include/parsing.h @@ -4,25 +4,26 @@ * * * Model parsing header * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2023 Arthur Menges * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/include/widgets.h b/include/widgets.h index c551e1a..cfc644e 100644 --- a/include/widgets.h +++ b/include/widgets.h @@ -4,31 +4,33 @@ * * * Widgets header * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include -#define W 1920 +#define W 1920 // TODO 2024-06-30 #define H 960 #define W_IMAGE W - 320 #define H_IMAGE H - 126 @@ -39,19 +41,23 @@ void main_window_design (GtkWindow *main_window); void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window); +GtkButton *get_GtkButton (char *btt_name); + GtkFrame *get_frame_with_label(); + GtkWidget *get_selected_rules_vpaned_new(); +GtkWidget *get_rules_tree_hpaned_new(); + GtkWidget *get_TIME_EXEC_controls_box(); GtkWidget *get_SPACE_EDIT_controls_box(); -GtkButton *get_GtkButton (char *btt_name); +GtkWidget *get_OBJECTS_and_SITUATIONS(); + GtkWidget *get_window_child_STATE(); GtkWidget *get_window_child_RULES(); GtkWidget *get_window_child_DATA(); GtkWidget *get_text_view(); -GtkFrame *get_frame_with_label(); GtkWidget *get_rules_page_new(); -GtkBox *get_rules_user_tree_new(); GtkWidget *get_image_ALL_SPACE(); GtkWidget *get_image_GLUTAMATE(); @@ -62,28 +68,19 @@ GtkWidget *get_image_PHENYLALANINE(); GtkWidget *get_image_DOPAMINE(); GtkWidget *get_image_ATP(); GtkWidget *get_image_AMP(); -GtkWidget *get_rules_tree_hpaned_new(); GtkProgressBar *get_ELAPSED_TIME_ProgressBar(); + GtkBox *get_RUN_STOP_box(); GtkBox *get_ZOOM_box(); GtkBox *get_edit_TOOL_box(); GtkBox *get_XYZ_box(); -GtkWidget *get_OBJECTS_and_SITUATIONS(); +GtkBox *get_rules_user_tree_new(); GtkBox *get_ELAPSED_TIME_box(); -GtkButton *get_btt_run_xor_edit(); - -void window_bar(GtkWindow *window, char *title); +GtkScrolledWindow *get_user_rules_tree (); +void icons_for_fun (GtkHeaderBar *header_bar); // https://blog.gtk.org/2020/09/08/on-list-models/ < TODO -GtkScrolledWindow *get_user_rules_tree (); -void set_run_edit_mode(int prescribed_mode); -int get_run_edit_mode(); -GListModel* get_user_tree_model (GObject *item, gpointer root); -void on_setup_user_tree_factory (GtkSignalListItemFactory *factory, - GObject* object, gpointer user_data); -char *get_space_run_edit_specif(); -void icons_for_fun (GtkHeaderBar *header_bar); diff --git a/src/main.c b/src/main.c index cec371d..f1cb1eb 100644 --- a/src/main.c +++ b/src/main.c @@ -1,28 +1,30 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Gem-graph client * +* Gem-graph client * * * * Main * * * -* Copyright © 2021 Libre en Communs * -* Copyright © 2023 Adrien Bourmault * -* Copyright © 2023 Arthur Menges * -* Copyright © 2024 Jean Sirmai * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* Copyright © 2021 Arthur Menges * +* 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */