From e3831394a55841ebf5bf895ef398932129c78e3d Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 8 Aug 2024 13:37:25 +0200 Subject: [PATCH] WIP: measures process IX --- include/signal.h | 9 ++++++- include/widget.h | 1 + src/signal.c | 11 +++++++- src/widget/measure/dispatch.c | 49 +++++++++++++++++++++++++---------- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/include/signal.h b/include/signal.h index f34e7f4..b26fd52 100644 --- a/include/signal.h +++ b/include/signal.h @@ -140,13 +140,20 @@ void on_clicked_topbar_right_measure (GtkWidget *btt_measure, gpointer data); /* M E A S U R E S */ /******************************************************************************/ +// access functions 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_do_select_a_second_rules_set (GtkWidget *btt, gpointer data); +void on_select_a_second_rules_set (GtkWidget *btt, gpointer data); + +// measurement triggers void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data); void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data); void on_measure_single_event_occurences_situations (GtkWidget *btt, gpointer data); void on_measure_time_elapsed_between_two_events (GtkWidget *btt, gpointer data); void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data); + +// correlate ? +void on_select_a_second_measurement(GtkWidget *btt, gpointer data); +void on_not_yet_defined(GtkWidget *btt, gpointer data); diff --git a/include/widget.h b/include/widget.h index 9fec4e4..1783ebf 100644 --- a/include/widget.h +++ b/include/widget.h @@ -264,3 +264,4 @@ void *widget_measure_event_occurences_dates(); void *widget_measure_event_occurences_situations(); void *widget_measure_time_elapsed_between_two_events(); void *widget_measure_third_event_occurences_in_between(); +void *widget_measure_do_we_select_another_measurement(); diff --git a/src/signal.c b/src/signal.c index 31c5fc2..b080229 100644 --- a/src/signal.c +++ b/src/signal.c @@ -399,14 +399,23 @@ void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data) -void on_measure_do_select_a_second_rules_set (GtkWidget *btt, gpointer data) +void on_select_a_second_rules_set (GtkWidget *btt, gpointer data) { gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), GTK_WIDGET (widget_measure_do_choose_an_event_type())); } +void on_select_a_second_measurement(GtkWidget *btt, gpointer data) +{ + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_measure_do_we_select_another_measurement())); +} +void on_not_yet_defined(GtkWidget *btt, gpointer data) +{ + printf("now, select another measurement to correlate with\n"); +} diff --git a/src/widget/measure/dispatch.c b/src/widget/measure/dispatch.c index 385ff96..4f754fb 100644 --- a/src/widget/measure/dispatch.c +++ b/src/widget/measure/dispatch.c @@ -69,6 +69,9 @@ static GtkWidget *btt_time_elapsed; static GtkWidget *btt_event_in_between; static GtkBox *correlation_measures_box; //TODO +static GtkWidget *correl; +static GtkWidget *btt_select_another_measurement_question; + // Measure concerns // - nb of occurences of the rule @@ -82,6 +85,26 @@ static GtkBox *correlation_measures_box; //TODO // Is this measure to be correlated to some others ? +void *widget_measure_do_we_select_another_measurement() +{ + printf("do_we_select_another_measurement ?\n"); + correlation_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + correl = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/correl icon.png"); + btt_select_another_measurement_question = + gtk_toggle_button_new_with_label ("select another measurement to correlate with ?"); + g_signal_connect (btt_select_another_measurement_question, "toggled", + G_CALLBACK (on_not_yet_defined), NULL); + gtk_box_append (correlation_measures_box, GTK_WIDGET (correl)); + gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_select_another_measurement_question)); + gtk_box_append (measure_page, GTK_WIDGET (correlation_measures_box)); + + return measure_page; +} + + + + void *widget_measure_event_occurences_nb() { // printf("measure event_occurences_nb\n"); @@ -135,6 +158,13 @@ void *widget_measure_do_depends_on_a_single_event() g_signal_connect (btt_select_date, "toggled", G_CALLBACK (on_measure_single_event_occurences_situations), NULL); + g_signal_connect (btt_select_nb, "toggled", + G_CALLBACK (on_select_a_second_measurement), NULL); + g_signal_connect (btt_select_date, "toggled", + G_CALLBACK (on_select_a_second_measurement), NULL); + g_signal_connect (btt_select_date, "toggled", + G_CALLBACK (on_select_a_second_measurement), NULL); + gtk_box_append (one_rule_measures_box, GTK_WIDGET (scale)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_nb)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_date)); @@ -143,19 +173,14 @@ void *widget_measure_do_depends_on_a_single_event() return measure_page; } - - - - void *widget_measure_do_select_a_second_rules_set() { -// printf("do_select_a_second_rules_set \n"); select_second_rules_set_box= GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); sizes_xy = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure compass icon.png"); btt_select_rules_second = gtk_toggle_button_new_with_label ("select a second rules set"); g_signal_connect (btt_select_rules_second, "toggled", - G_CALLBACK (on_measure_do_select_a_second_rules_set), NULL); + G_CALLBACK (on_select_a_second_rules_set), NULL); gtk_box_append (select_second_rules_set_box, GTK_WIDGET (sizes_xy)); gtk_box_append (select_second_rules_set_box, GTK_WIDGET (btt_select_rules_second)); @@ -166,7 +191,6 @@ void *widget_measure_do_select_a_second_rules_set() void *widget_measure_do_choose_an_event_type() { -// printf("do_choose_an_event_type \n"); gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two)); // ici, il faut inactiver le btt_select_second_of_two gtk_box_append (select_second_rules_set_box, @@ -181,6 +205,11 @@ void *widget_measure_do_choose_an_event_type() g_signal_connect (btt_event_in_between, "toggled", G_CALLBACK (on_measure_third_event_occurences_in_between), NULL); + g_signal_connect (btt_time_elapsed, "toggled", + G_CALLBACK (on_select_a_second_measurement), NULL); + g_signal_connect (btt_event_in_between, "toggled", + G_CALLBACK (on_select_a_second_measurement), NULL); + gtk_box_append (two_rules_measures_box, GTK_WIDGET (bridge)); gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_time_elapsed)); gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_event_in_between)); @@ -188,12 +217,6 @@ void *widget_measure_do_choose_an_event_type() return measure_page; } - - - - - - void *widget_measure_do_depends_on_one_or_two_events() { gtk_box_append (select_rules_first_box,