From 71e2e84d2731e1fd16cd3d6570426d5d8ea38410 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 7 Aug 2024 19:45:24 +0200 Subject: [PATCH] WIP: measures process V --- include/fsm.h | 1 - include/prefer.h | 4 ++++ src/fsm.c | 32 ++++++++++++-------------------- src/prefer.c | 34 +++++++++++++++++++++++++++++++--- src/widget/measure/dispatch.c | 26 ++++++++++++++++++++++++-- 5 files changed, 71 insertions(+), 26 deletions(-) diff --git a/include/fsm.h b/include/fsm.h index 0162016..a78bbd2 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -56,7 +56,6 @@ void fsm_set_exec_edit (int value); void fsm_set_state_rules_data (int value); void fsm_set_store_restore_reset (int target, int value); -void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... bool fsm_get_preferences_state (); void fsm_set_preferences_state (bool value); diff --git a/include/prefer.h b/include/prefer.h index b9125aa..21c81df 100644 --- a/include/prefer.h +++ b/include/prefer.h @@ -34,3 +34,7 @@ void pref_set_store_restore_reset (int choice, int value); const char get_button_icon_name (int n); + +void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... + +void *prefer_add_measure (char *measure_name); diff --git a/src/fsm.c b/src/fsm.c index 2e01c4c..b2e958d 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -75,23 +75,6 @@ void fsm_set_state_rules_data (int choice) } -// ------------------------- O B J E C T S ------------------------------// -// >> transferred to prefer.c - - -// ---------------------- S I T U A T I O N S ---------------------------// - -static int reset_situations_to_value = -1; - -void fsm_reset_all_situations_transparencies_at_value (int value) -{ - debug_printing (reset_situations_to_value, value, 3); - // SITUATIONS_box_RESTORE_VALUES is sub_automaton 3 - reset_situations_to_value = value; - widget_reset_all_situations_transparencies_to_value (value); - preferences_have_been_modified = TRUE; -} - /******************************************************************************/ /* D E B U G G E R S */ @@ -116,8 +99,8 @@ static void debug_printing (int choice, int value, int sub_automaton) tab_0 [choice_EXEC_EDIT], tab_1 [choice]); break; - case (2) : printf("fsm_set_store_restore_reset >> prefer.c\n"); break; - case (3) : printf("fsm_reset_all_situations_transparencies_at_value : %3d\n", value); break; + case (2) : break; + case (3) : break; default : printf("default in automaton.debug_printing()\n"); } @@ -126,6 +109,15 @@ static void debug_printing (int choice, int value, int sub_automaton) /******************************************************************************/ -/* N O N E X C L U S I V E S E L E C T I O N S */ +/* N O N E X C L U S I V E S E L E C T I O N S */ /******************************************************************************/ // ? + + + +/******************************************************************************/ +/* M E A S U R E S */ +/******************************************************************************/ + + + diff --git a/src/prefer.c b/src/prefer.c index eea4e17..bab564c 100644 --- a/src/prefer.c +++ b/src/prefer.c @@ -58,6 +58,7 @@ static const char *icon_name [3] = { // transtypage vers un pointeur depuis un entier de taille différente vvv TODO const char *get_button_icon_name (int n) {return (const char*) icon_name [n];} +// ------------------------- O B J E C T S ------------------------------// struct preferences { int transparency [n_objects]; }; // may become a long, long list... struct preferences *pref_jean = NULL; // TODO (voir graphics_init(...)) @@ -69,19 +70,19 @@ void pref_set_store_restore_reset (int choice, int value) { switch (choice) { case (STORE) : - printf("STORE (value = %d)\n", value); + printf("Objects transparencies STORE (value = %3d) (see prefer.c)\n", value); for (int i = 0; i < n_objects; i++) { p [i] = widget_get_object_transparency (i); widget_set_object_transparency_to_value (i, p [i]); } break; case (RESTORE) : - printf("RESTORE (value = %d)\n", value); + printf("Objects transparencies RESTORE (value = %3d) (see prefer.c)\n", value); for (int i = 0; i < n_objects; i++) widget_set_object_transparency_to_value (i, p [i]); break; case (RESET) : - printf("RESET (value = %d)\n", value); + printf("Objects transparencies RESET (value = %3d) (see prefer.c)\n", value); for (int i = 0; i < n_objects; i++) widget_set_object_transparency_to_value (i, value); // i * 4 // rand() % 127 break; @@ -91,3 +92,30 @@ void pref_set_store_restore_reset (int choice, int value) fsm_set_preferences_state (TRUE); } + + + +// ---------------------- S I T U A T I O N S ---------------------------// + +static int reset_situations_to_value = -1; + +void fsm_reset_all_situations_transparencies_at_value (int value) +{ + printf("reset_all_situations_transparencies_at_value %3d (see prefer.c)\n", value); + reset_situations_to_value = value; + widget_reset_all_situations_transparencies_to_value (value); +} + + + +/******************************************************************************/ +/* M E A S U R E S */ +/******************************************************************************/ + +static void *list_measures; + +void *prefer_add_measure (char *measure_name) +{ + printf("prefer_add_measure %p <<< %s (see prefer.c)\n", list_measures, measure_name); + return NULL; +} diff --git a/src/widget/measure/dispatch.c b/src/widget/measure/dispatch.c index 0afa622..9dca7e4 100644 --- a/src/widget/measure/dispatch.c +++ b/src/widget/measure/dispatch.c @@ -31,6 +31,7 @@ #include "../../../include/base.h" #include "../../../include/signal.h" #include "../../../include/widget.h" +#include "../../../include/prefer.h" /******************************************************************************/ @@ -54,8 +55,29 @@ static GtkWidget *balance; static GtkWidget *btt_select_first_of_two; static GtkWidget *btt_select_second_of_two; -void *widget_measure_do_depends_on_a_single_event() {printf("measure depends on a single event\n"); return measure_page;} -void *widget_measure_do_depends_on_two_events() {printf("measure depends on two events\n"); return measure_page;} +// Measure concerns +// - nb of occurences of the rule +// - nb of objects / situations before / after > select target +// - time (date) of event +// - time elapsed between two events +// - occurence of events C between events A and B + +// Then, add this new measure to the list of measures + +// Is this measure to be correlated to some others ? + +void *widget_measure_do_depends_on_a_single_event() +{ + printf("measure depends on a single event\n"); + prefer_add_measure ("new measure from a single event"); + return measure_page; +} +void *widget_measure_do_depends_on_two_events() +{ + printf("measure depends on two events\n"); + prefer_add_measure ("new measure from two events"); + return measure_page; +} void *widget_measure_do_depends_on_one_or_two_events() {