From 1508ffc620875ff2bcc4e6bf016e571f71a01c2f Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 8 Aug 2024 00:10:12 +0200 Subject: [PATCH] WIP: measures process VI --- include/signal.h | 3 ++ include/widget.h | 2 ++ src/signal.c | 14 +++++++++ src/widget/measure/dispatch.c | 48 ++++++++++++++++++++++++----- src/widget/rules/selected/analyse.c | 3 +- 5 files changed, 61 insertions(+), 9 deletions(-) diff --git a/include/signal.h b/include/signal.h index 9b2effc..f84773d 100644 --- a/include/signal.h +++ b/include/signal.h @@ -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); + diff --git a/include/widget.h b/include/widget.h index 6577b7a..7e3575e 100644 --- a/include/widget.h +++ b/include/widget.h @@ -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(); diff --git a/src/signal.c b/src/signal.c index ef7a814..1443a4d 100644 --- a/src/signal.c +++ b/src/signal.c @@ -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())); +} + + diff --git a/src/widget/measure/dispatch.c b/src/widget/measure/dispatch.c index 9dca7e4..5e61908 100644 --- a/src/widget/measure/dispatch.c +++ b/src/widget/measure/dispatch.c @@ -38,8 +38,6 @@ /* M E A S U R E S */ /******************************************************************************/ -#define PARTITION_MEASURE 40 - static GtkBox *measure_page; static GtkBox *edit_a_new_measure_box; @@ -55,6 +53,11 @@ static GtkWidget *balance; static GtkWidget *btt_select_first_of_two; static GtkWidget *btt_select_second_of_two; +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 @@ -66,21 +69,54 @@ static GtkWidget *btt_select_second_of_two; // Is this measure to be correlated to some others ? -void *widget_measure_do_depends_on_a_single_event() + +void *widget_measure_single_event_occurences_nb() { - printf("measure depends on a single event\n"); - prefer_add_measure ("new measure from a single event"); + 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"); @@ -94,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; @@ -111,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; diff --git a/src/widget/rules/selected/analyse.c b/src/widget/rules/selected/analyse.c index 98b3a54..ab9ab6f 100644 --- a/src/widget/rules/selected/analyse.c +++ b/src/widget/rules/selected/analyse.c @@ -36,8 +36,7 @@ void *widget_get_rule_analyse() { return gtk_label_new (" ______________________\n RULE INVESTIGATION\n\ - tools\n '''''''''''''''''''''''''''''''''''''''\n\ -(camera, transparencies)"); + tools\n '''''''''''''''''''''''''''''''''''''''"); }