From 415b89fa99c1999bfcddd06d90caaba95d94a33b Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 4 Aug 2024 19:02:00 +0200 Subject: [PATCH] WIP: introducing : time_dependent_results_and_time_controls --- include/signal.h | 3 ++- include/widget.h | 28 ++++++++++++------- src/prefer.c | 4 +-- src/signal.c | 8 ++++-- src/widget/data/dispatch.c | 2 +- src/widget/data/results.c | 2 +- src/widget/rules/tree_tools/compare.c | 10 ++++--- src/widget/synth/dispatch.c | 29 +++++++++++++++++++- src/widget/synth/time.c | 39 +++++++++++++++++++++++++++ src/widget/topbar/dispatch.c | 10 ++++--- src/widget/topbar/left.c | 3 ++- 11 files changed, 112 insertions(+), 26 deletions(-) create mode 100644 src/widget/synth/time.c diff --git a/include/signal.h b/include/signal.h index 466067f..da7068d 100644 --- a/include/signal.h +++ b/include/signal.h @@ -43,7 +43,8 @@ * g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); * and the only signal function outside "signals.c". - * It is found in "init.c", where all the various windows are declared as static : + * It is found in [ deprec "init.c" >> now "widget / dispatch.c" ] + * where all the various windows are declared as static : * (static GtkWindow *main_window, *dialog_window, *text_window;) * and where are all the functions useful for initiating and designing these windows. diff --git a/include/widget.h b/include/widget.h index 35c2c17..693eb91 100644 --- a/include/widget.h +++ b/include/widget.h @@ -42,19 +42,19 @@ void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_wind void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window); -// called in topbar.c -// functions are in dispatch.c +// called in topbar +// functions are in topbar / dispatch.c void *widget_get_main_window(); void *widget_get_dialog_window(); void *widget_get_text_window(); -// functions are in topbar +// functions are in topbar / left.c -void *widget_get_btt_synth(); -void *widget_get_btt_state(); -void *widget_get_btt_rules(); -void *widget_get_btt_data(); +void *widget_get_btt_synth(); // {return btt_SYNTH;} +void *widget_get_btt_state(); // {return btt_STATE;} +void *widget_get_btt_rules(); // {return btt_RULES;} +void *widget_get_btt_data(); // {return btt_DATA;} void window_header_bar_left (GtkWidget *header_bar); void window_header_bar_right (GtkWidget *header_bar); @@ -72,9 +72,17 @@ 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 W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 = ad hoc (pour mon écran) #define H_IMAGE_LOCAL 800 +/******************************************************************************/ +/* S Y N T H */ +/******************************************************************************/ +// called in : src/widget/synth/dispatch.c +// defined in : src/widget/synth/time.c + +void *widget_get_time_dependent_results_and_time_controls(); + /******************************************************************************/ /* S T A T E */ /******************************************************************************/ @@ -115,8 +123,8 @@ void *widget_get_selected_rule_images(); /******************************************************************************/ /* D A T A */ /******************************************************************************/ -// in : data.c -// called by topbar.c.widget_design_text_window() +// in : data / ..._page +// called by topbar / .widget_design_text_window() void *widget_get_measures_page(); void *widget_get_results_page(); diff --git a/src/prefer.c b/src/prefer.c index e6e0a30..eea4e17 100644 --- a/src/prefer.c +++ b/src/prefer.c @@ -42,10 +42,10 @@ // de la fonction : pref_set_store_restore_reset () // ! WARNING ! Cette méthode d'identification est dangereuse: -// Si un utilisateur modifie l'apparence d'un bouton (par préférence...) +// Si un utilisateur modifie l'apparence d'un bouton (parce que préférence...) // il ne comprendra pas facilement pourquoi cette légère modification // qui n'aurait du concerner que l'aspect du bouton -// a en même temps modifié le comportement du programme. +// a en même temps modifié profondément le comportement du programme. // Les "symbolics" (les noms) des icônes devraient être déclarées une seule fois (ici)) // de façon à ce qu'une seule variable soit utilisée pour les deux fonctions. diff --git a/src/signal.c b/src/signal.c index 73eb845..e83fd43 100644 --- a/src/signal.c +++ b/src/signal.c @@ -234,11 +234,12 @@ static void switch_state_rules_data(); void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data) { - if (fsm_get_exec_edit ()) { + if (fsm_get_exec_edit ()) { // TODO (or NOT ?) et si je ne suis pas sur la page SYNTH gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "power-profile-balanced-rtl-symbolic"); fsm_set_exec_edit (EXEC); + // TODO set_btt_SYNTH_active (TRUE) } else { @@ -249,6 +250,7 @@ void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data) // gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); // works once only ! fsm_set_exec_edit (EDIT); + // TODO set_btt_SYNTH_active (FALSE) } switch_state_rules_data(); @@ -287,7 +289,9 @@ static void switch_state_rules_data() } } -// TODO Il doit y avoir plus élégant,... +// TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!! +// >>> voir le détail dans prefer.c : +// Les noms d'icônes sont utilisés pour deux fonctions distinctes... void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) { const char *toggled_button_name diff --git a/src/widget/data/dispatch.c b/src/widget/data/dispatch.c index 9e82172..9b50b9b 100644 --- a/src/widget/data/dispatch.c +++ b/src/widget/data/dispatch.c @@ -31,7 +31,7 @@ #include "../../../include/signal.h" #include "../../../include/widget.h" -// "graph", "chart" and "diagram" are ambiguous terms, sometimes used interchangeably. +// "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably. // https://www.mathsisfun.com/data/data-graph.php #define PARTITION_A 700 diff --git a/src/widget/data/results.c b/src/widget/data/results.c index c9eb2e1..d62e44f 100644 --- a/src/widget/data/results.c +++ b/src/widget/data/results.c @@ -48,7 +48,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 bar graph vertical.png"))); - gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations")); + gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations")); 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"))); diff --git a/src/widget/rules/tree_tools/compare.c b/src/widget/rules/tree_tools/compare.c index babc668..13aec6b 100644 --- a/src/widget/rules/tree_tools/compare.c +++ b/src/widget/rules/tree_tools/compare.c @@ -92,11 +92,13 @@ static GtkWidget *pop (Stack *stack) return popped; } +/* WARNING si mal utilisé >> erreur de segmentation... static GtkWidget *peek(Stack *stack) { if (isEmpty(stack)) { printf("Stack is empty\n"); return NULL; } return stack->arr[stack->top]; } +*/ // ----------------------------------------------------------- // J'imagine un tableau de vignettes, toutes de même taille. @@ -215,7 +217,7 @@ static GtkWidget *do_rtfd (Stack stack) // TODO push_images_onto_stack (stack); // totalement inutile ici - peek (NULL); // idem +// peek (NULL); // idem + Erreur de segmentation // free_intlist (NULL); // idem // add_to_mylist (0); // idem @@ -236,8 +238,8 @@ static void *push_images_onto_stack (Stack stack) clock_t start, end; printf("compare.c push_images_onto_stack() start >> "); start = clock(); - - push(&stack, GTK_WIDGET (gtk_picture_new_for_filename +/* + push(&stack, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); push(&stack, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"))); @@ -281,7 +283,7 @@ static void *push_images_onto_stack (Stack stack) ("/home/jean/Gem-Graph/gem-graph-client/data/image/riboflavin.png"))); push(&stack, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/hb.png"))); - +*/ end = clock(); long double t = (long double)(end - start) / CLOCKS_PER_SEC; printf(" << %9Lg sec\n", t); diff --git a/src/widget/synth/dispatch.c b/src/widget/synth/dispatch.c index da9498f..4c5111b 100644 --- a/src/widget/synth/dispatch.c +++ b/src/widget/synth/dispatch.c @@ -33,5 +33,32 @@ #include "../../../include/widget.h" -void *widget_get_synth_page() {return GTK_WIDGET (widget_get_space_view());} +static void *widget_get_space_vs_non_time_dependent_analysis() +{ + GtkWidget *space_vs_non_time_dependent_analysis = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + gtk_paned_set_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), + GTK_WIDGET (widget_get_space_view())); + 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); + + return space_vs_non_time_dependent_analysis; +} + +void *widget_get_synth_page() +{ + GtkWidget *space_and_analysis_vs_history = gtk_paned_new (GTK_ORIENTATION_VERTICAL); + gtk_paned_set_start_child (GTK_PANED (space_and_analysis_vs_history), + 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_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); + + return space_and_analysis_vs_history; +} diff --git a/src/widget/synth/time.c b/src/widget/synth/time.c new file mode 100644 index 0000000..c6ae677 --- /dev/null +++ b/src/widget/synth/time.c @@ -0,0 +1,39 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Stock * +* * +* 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/base.h" +#include "../../../include/signal.h" +#include "../../../include/widget.h" + +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")); +} + diff --git a/src/widget/topbar/dispatch.c b/src/widget/topbar/dispatch.c index 21fe6e8..b2c2d56 100644 --- a/src/widget/topbar/dispatch.c +++ b/src/widget/topbar/dispatch.c @@ -49,11 +49,15 @@ void widget_design_main_window (GtkWindow *main_window) window_header_bar_left (header_bar); window_header_bar_right (header_bar); - // use the next line to select the page that will be presented first + // use the next lineS to select the page that will be presented first // it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) - // gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE); - gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE); + +// THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) gtk_window_present (GTK_WINDOW (main_window)); } diff --git a/src/widget/topbar/left.c b/src/widget/topbar/left.c index 6436899..5da3633 100644 --- a/src/widget/topbar/left.c +++ b/src/widget/topbar/left.c @@ -38,6 +38,7 @@ /******************************************************************************/ static GtkButton *btt_SYNTH, *btt_STATE, *btt_RULES, *btt_DATA; + void *widget_get_btt_synth () {return btt_SYNTH;} void *widget_get_btt_state () {return btt_STATE;} void *widget_get_btt_rules () {return btt_RULES;} @@ -59,7 +60,7 @@ void window_header_bar_left (GtkWidget *header_bar) btt_SYNTH = GTK_BUTTON (gtk_check_button_new_with_label ("synth")); g_signal_connect (btt_SYNTH, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_SYNTH), group_state_rules_data); - gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_SYNTH), FALSE); + gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_SYNTH), FALSE); // << TODO btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);