WIP: measures process V

This commit is contained in:
Jean Sirmai 2024-08-07 19:45:24 +02:00
parent a332f3c3fb
commit 71e2e84d27
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 71 additions and 26 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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");
}
@ -129,3 +112,12 @@ 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 */
/******************************************************************************/
// ?
/******************************************************************************/
/* M E A S U R E S */
/******************************************************************************/

View File

@ -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;
}

View File

@ -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()
{