From 20deb6a9ebfdf653e089c8372a028f715e645421 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 9 Aug 2024 09:21:04 +0200 Subject: [PATCH] WIP: measures process XI --- include/signal.h | 4 ++- include/widget.h | 7 ++-- src/signal.c | 21 ++++++------ src/widget/measure/dispatch.c | 61 +++++++++++++++++++++++++---------- 4 files changed, 63 insertions(+), 30 deletions(-) diff --git a/include/signal.h b/include/signal.h index 9b0a664..dd8498b 100644 --- a/include/signal.h +++ b/include/signal.h @@ -156,6 +156,8 @@ 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); +void on_skip_this_step (GtkWidget *btt, gpointer data); void on_something_else (GtkWidget *btt, gpointer data); +void on_closing_page (GtkWidget *btt, gpointer data); + diff --git a/include/widget.h b/include/widget.h index 753b2e2..135fc94 100644 --- a/include/widget.h +++ b/include/widget.h @@ -259,10 +259,13 @@ void *widget_measure_do_depends_on_a_single_event(); void *widget_measure_do_depends_on_two_events(); void *widget_measure_do_select_a_second_rules_set(); void *widget_measure_do_choose_an_event_type(); +void *widget_measure_do_correlate(); +void *widget_measure_do_insert_in_measurements_list(); +void *widget_measure_do_end_creation_of_measurement_process(); + void *widget_measure_event_occurences_nb(); 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(); -void *widget_not_yet_defined(); + diff --git a/src/signal.c b/src/signal.c index 2948c2e..ff710ff 100644 --- a/src/signal.c +++ b/src/signal.c @@ -394,33 +394,34 @@ void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data) GTK_WIDGET (widget_measure_do_select_a_second_rules_set())); } - - - - - 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())); + GTK_WIDGET (widget_measure_do_correlate())); } -void on_not_yet_defined (GtkWidget *btt, gpointer data) +void on_skip_this_step (GtkWidget *btt, gpointer data) { gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), - GTK_WIDGET (widget_not_yet_defined ())); + GTK_WIDGET (widget_measure_do_insert_in_measurements_list ())); } void on_something_else (GtkWidget *btt, gpointer data) { - printf("insert in measurements list (this print comes from signal.c)\n"); + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process())); +} + +void on_closing_page (GtkWidget *btt, gpointer data) +{ + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_get_synth_page())); } void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data) diff --git a/src/widget/measure/dispatch.c b/src/widget/measure/dispatch.c index c694f3c..787ced6 100644 --- a/src/widget/measure/dispatch.c +++ b/src/widget/measure/dispatch.c @@ -68,14 +68,17 @@ static GtkWidget *bridge; static GtkWidget *btt_time_elapsed; static GtkWidget *btt_event_in_between; -static GtkBox *correlation_measures_box; //TODO +static GtkBox *correlation_measures_box; static GtkWidget *correl; -static GtkWidget *btt_select_another_measurement_question; +static GtkWidget *btt_skip_this_step; -static GtkBox *insertion_in_list_measurements_box; //TODO +static GtkBox *insertion_in_list_measurements_box; static GtkWidget *insert; static GtkWidget *btt_insert_in_measurements_list; +static GtkBox *last_one; //TODO +static GtkWidget *clean; +static GtkWidget *btt_end; // Measure concerns // - nb of occurences of the rule @@ -86,10 +89,28 @@ static GtkWidget *btt_insert_in_measurements_list; // Then, add this new measure to the list of measures -// Is this measure to be correlated to some others ? +// Is this measure to be correlated with some others ? -void *widget_not_yet_defined() +void *widget_measure_do_end_creation_of_measurement_process() +{ + last_one = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + clean = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/clean.png"); + btt_end = gtk_toggle_button_new_with_label + ("click to end the creation of a new measurement process"); + g_signal_connect (btt_end, "toggled", G_CALLBACK (on_closing_page), NULL); + + gtk_box_append (last_one, GTK_WIDGET (clean)); + gtk_box_append (last_one, GTK_WIDGET (btt_end)); + gtk_box_append (last_one, GTK_WIDGET (gtk_label_new + (" < will be redirected to the 'SYNTY' page"))); + gtk_box_append (measure_page, GTK_WIDGET (last_one)); + + return measure_page; +} + +void *widget_measure_do_insert_in_measurements_list() { // printf("insert in measurements list\n"); insertion_in_list_measurements_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); @@ -100,32 +121,36 @@ void *widget_not_yet_defined() g_signal_connect (btt_insert_in_measurements_list, "toggled", G_CALLBACK (on_something_else), NULL); gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (insert)); + gtk_box_append (insertion_in_list_measurements_box, + GTK_WIDGET (gtk_label_new + ("Specify the frequency with which this measurement must be carried out and "))); gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (btt_insert_in_measurements_list)); gtk_box_append (measure_page, GTK_WIDGET (insertion_in_list_measurements_box)); return measure_page; } -void *widget_measure_do_we_select_another_measurement() +void *widget_measure_do_correlate() { // printf("Could this measurement be related to another one ?\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/buoy.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); + ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/harbor.png"); + btt_skip_this_step = + gtk_toggle_button_new_with_label ("next"); + g_signal_connect (btt_skip_this_step, "toggled", + G_CALLBACK (on_skip_this_step), 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 (correlation_measures_box, + GTK_WIDGET (gtk_label_new + ("The current measurement will be inserted in the list of available measures.\n\ +Two measurements or more can be selected there to study potential correlations."))); + gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_skip_this_step)); 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"); @@ -187,6 +212,7 @@ void *widget_measure_do_depends_on_a_single_event() 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 (gtk_label_new (" select one > "))); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_nb)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_date)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_situation)); @@ -215,7 +241,7 @@ void *widget_measure_do_choose_an_event_type() 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, - gtk_toggle_button_new_with_label ("< done > a second set of rules was selected")); + gtk_label_new (" < done. A second set of rules was selected")); two_rules_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); bridge = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure temperature icon.png"); @@ -232,6 +258,7 @@ void *widget_measure_do_choose_an_event_type() 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 (gtk_label_new (" select one > "))); 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)); gtk_box_append (measure_page, GTK_WIDGET (two_rules_measures_box)); @@ -241,7 +268,7 @@ void *widget_measure_do_choose_an_event_type() 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")); + gtk_label_new ("< done. A set of rules was selected")); // ici, il faut inactiver le btt_select_rules_first select_one_or_two_rules_events_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); balance = gtk_picture_new_for_filename