Compare commits

...

2 Commits

Author SHA1 Message Date
Jean Sirmai 1508ffc620
WIP: measures process VI 2024-08-08 00:10:12 +02:00
Jean Sirmai 71e2e84d27
WIP: measures process V 2024-08-07 19:45:24 +02:00
9 changed files with 129 additions and 32 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

@ -144,3 +144,6 @@ void on_start_new_measure (GtkWidget *btt_new_measure, gpointer data);
void on_select_rules_first (GtkWidget *btt_new_measure, gpointer data);
void on_measure_depends_on_a_single_event (GtkWidget *btt, gpointer data);
void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data);
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data);
void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data);

View File

@ -257,3 +257,5 @@ void *widget_measure_do_select_rules_first();
void *widget_measure_do_depends_on_one_or_two_events();
void *widget_measure_do_depends_on_a_single_event();
void *widget_measure_do_depends_on_two_events();
void *widget_measure_single_event_occurences_nb();
void *widget_measure_single_event_occurences_dates();

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");
}
@ -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 */
/******************************************************************************/

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

@ -393,3 +393,17 @@ void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data)
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_depends_on_two_events()));
}
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_single_event_occurences_nb()));
}
void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_single_event_occurences_dates()));
}

View File

@ -31,14 +31,13 @@
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
#include "../../../include/prefer.h"
/******************************************************************************/
/* M E A S U R E S */
/******************************************************************************/
#define PARTITION_MEASURE 40
static GtkBox *measure_page;
static GtkBox *edit_a_new_measure_box;
@ -54,11 +53,70 @@ 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;}
static GtkBox *select_nb_or_date_box;
static GtkWidget *scale;
static GtkWidget *btt_select_nb;
static GtkWidget *btt_select_date;
// 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_single_event_occurences_nb()
{
printf("measure single_event_occurences_nb\n");
return measure_page;
}
void *widget_measure_single_event_occurences_dates()
{
printf("measure single_event_occurences_dates\n");
return measure_page;
}
void *widget_measure_do_depends_on_a_single_event()
{
prefer_add_measure ("new measure from a single event");
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_second_of_two));
select_nb_or_date_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
scale = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/camera icon.png");
btt_select_nb = gtk_toggle_button_new_with_label ("count the number of occurences");
btt_select_date = gtk_toggle_button_new_with_label ("save occurences dates");
g_signal_connect (btt_select_nb, "toggled",
G_CALLBACK (on_measure_single_event_occurences_nb), NULL);
g_signal_connect (btt_select_date, "toggled",
G_CALLBACK (on_measure_single_event_occurences_dates), NULL);
gtk_box_append (select_nb_or_date_box, GTK_WIDGET (scale));
gtk_box_append (select_nb_or_date_box, GTK_WIDGET (btt_select_nb));
gtk_box_append (select_nb_or_date_box, GTK_WIDGET (btt_select_date));
gtk_box_append (measure_page, GTK_WIDGET (select_nb_or_date_box));
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");
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two));
scale = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure tool scale icon.png");
return measure_page;
}
void *widget_measure_do_depends_on_one_or_two_events()
{
gtk_box_append (select_rules_first_box,
gtk_toggle_button_new_with_label ("< done > a set of rules was selected"));
select_one_or_two_rules_events_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
balance = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/balance icon.png");
@ -72,7 +130,6 @@ void *widget_measure_do_depends_on_one_or_two_events()
gtk_box_append (select_one_or_two_rules_events_box, GTK_WIDGET (balance));
gtk_box_append (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two));
gtk_box_append (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_second_of_two));
measure_page = widget_get_measure_page();
gtk_box_append (measure_page, GTK_WIDGET (select_one_or_two_rules_events_box));
return measure_page;
@ -89,7 +146,6 @@ void *widget_measure_do_select_rules_first ()
gtk_box_append (select_rules_first_box, GTK_WIDGET (pressure));
gtk_box_append (select_rules_first_box, GTK_WIDGET (btt_select_rules_first));
measure_page = widget_get_measure_page();
gtk_box_append (measure_page, GTK_WIDGET (select_rules_first_box));
return measure_page;

View File

@ -36,8 +36,7 @@
void *widget_get_rule_analyse()
{
return gtk_label_new (" ______________________\n RULE INVESTIGATION\n\
tools\n '''''''''''''''''''''''''''''''''''''''\n\
(camera, transparencies)");
tools\n '''''''''''''''''''''''''''''''''''''''");
}