From 513fcaa17c7d90721857a7d53e12a383e3f106e7 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 7 Aug 2024 10:40:24 +0200 Subject: [PATCH] WIP: measures process III --- include/signal.h | 26 +++++++++++++++++--------- include/widget.h | 6 +++--- src/signal.c | 10 +++++----- src/widget/measure/dispatch.c | 7 ++++--- src/widget/topbar/dispatch.c | 18 +++++++++--------- src/widget/topbar/left.c | 2 +- src/widget/topbar/right.c | 8 ++++---- 7 files changed, 43 insertions(+), 34 deletions(-) diff --git a/include/signal.h b/include/signal.h index 99d5a58..52756ed 100644 --- a/include/signal.h +++ b/include/signal.h @@ -115,15 +115,6 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); -/******************************************************************************/ -/* M A I N W I N D O W T O P B A R */ -/******************************************************************************/ - -void on_clicked_home (GtkWidget *btt_reset, gpointer data); -void on_clicked_search (GtkWidget *btt_menu, gpointer list_box); -void on_clicked_measure (GtkWidget *btt_measure, gpointer data); -void on_clicked_new_measure (GtkWidget *btt_new_measure, gpointer data); - /******************************************************************************/ /* M A I N W I N D O W S T A T E P A G E (upper part) */ /******************************************************************************/ @@ -133,4 +124,21 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol void on_resetting_XYZ_in_state_page (); + + +/******************************************************************************/ +/* M A I N W I N D O W T O P B A R */ +/******************************************************************************/ + +void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data); +void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box); +void on_clicked_topbar_right_measure (GtkWidget *btt_measure, gpointer data); + + + +/******************************************************************************/ +/* M E A S U R E S */ +/******************************************************************************/ + +void on_start_new_measure (GtkWidget *btt_new_measure, gpointer data); void on_select_rules_first (GtkWidget *btt_new_measure, gpointer data); diff --git a/include/widget.h b/include/widget.h index 0d6c31d..53f4b16 100644 --- a/include/widget.h +++ b/include/widget.h @@ -90,8 +90,8 @@ void *widget_get_btt_data(); // {return btt_DATA;} // defined in widget / topbar / left.c // - widget / topbar / right.c -void window_design_header_bar_left (GtkWidget *header_bar); -void window_design_header_bar_right (GtkWidget *header_bar); +void window_design_topbar_left (GtkWidget *header_bar); +void window_design_topbar_right (GtkWidget *header_bar); // called in signal.c / fsm_get_state_rules_data() @@ -254,4 +254,4 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_ void *widget_measure_new(); void *widget_measure_do_select_rules_first(); -void *widget_do_xxx(); +void *widget_measure_do_xxx(); diff --git a/src/signal.c b/src/signal.c index 62e465a..23be041 100644 --- a/src/signal.c +++ b/src/signal.c @@ -310,14 +310,14 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) // ------------ M E N U / S E A R C H / H O M E / E T C ----------- // -void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) { +void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box) { // next line presents the text_window and works only once.\n // It should present a menu.\n"); // TODO gtk_window_present (GTK_WINDOW (widget_get_text_window())); } -void on_clicked_home (GtkWidget *btt_reset, gpointer data) +void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data) { printf ("signal.on_clicked_HOME() button presents the dialog_window\ ( :- ) but it works only once.\n"); // TODO @@ -364,13 +364,13 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol /* M E A S U R E S */ /******************************************************************************/ -void on_clicked_measure (GtkWidget *btt_measure, gpointer data) +void on_clicked_topbar_right_measure (GtkWidget *btt_measure, gpointer data) { gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), GTK_WIDGET (widget_get_measure_page())); } -void on_clicked_new_measure (GtkWidget *btt_new_measure, gpointer data) +void on_start_new_measure (GtkWidget *btt_new_measure, gpointer data) { gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), GTK_WIDGET (widget_measure_do_select_rules_first())); @@ -380,5 +380,5 @@ void on_select_rules_first (GtkWidget *btt_new_measure, gpointer data) { printf("on_select_rules_first()\n"); gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), - GTK_WIDGET (widget_do_xxx())); + GTK_WIDGET (widget_measure_do_xxx())); } diff --git a/src/widget/measure/dispatch.c b/src/widget/measure/dispatch.c index ceec2c5..ae6680a 100644 --- a/src/widget/measure/dispatch.c +++ b/src/widget/measure/dispatch.c @@ -50,9 +50,10 @@ static GtkBox *select_rules_first_box; static GtkWidget *pressure; static GtkWidget *btt_select_rules_first; -void *widget_do_xxx() +void *widget_measure_do_xxx() { - printf("on_clicked_measure() >> dispatch.c / widget_measure_do_select_rules_first() >> widget_do_xxx()\n"); + printf("on_clicked_measure() >> dispatch.c / widget_measure_do_select_rules_first()\ + >> widget_measure_do_xxx()\n"); return NULL; } @@ -84,7 +85,7 @@ void *widget_get_measure_page() ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure caliper icon.png"); btt_edit_a_new_measure = gtk_toggle_button_new_with_label ("edit a new measure"); g_signal_connect (btt_edit_a_new_measure, "toggled", - G_CALLBACK (on_clicked_new_measure), NULL); + G_CALLBACK (on_start_new_measure), NULL); gtk_box_append (edit_a_new_measure_box, GTK_WIDGET (caliper)); gtk_box_append (edit_a_new_measure_box, GTK_WIDGET (btt_edit_a_new_measure)); diff --git a/src/widget/topbar/dispatch.c b/src/widget/topbar/dispatch.c index 1bb1874..f72f466 100644 --- a/src/widget/topbar/dispatch.c +++ b/src/widget/topbar/dispatch.c @@ -38,13 +38,13 @@ /* M A I N W I N D O W T O P B A R ( C E N T E R ) */ /******************************************************************************/ -static GtkWidget *window_header_bar (GtkWindow *window); +static GtkWidget *window_topbar (GtkWindow *window); void widget_design_main_window (GtkWindow *main_window) { - GtkWidget *header_bar = window_header_bar (main_window); - window_design_header_bar_left (header_bar); - window_design_header_bar_right (header_bar); + GtkWidget *topbar = window_topbar (main_window); + window_design_topbar_left (topbar); + window_design_topbar_right (topbar); // use the next lineS to select the page that will be presented first // it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) @@ -60,13 +60,13 @@ void widget_design_main_window (GtkWindow *main_window) } -static GtkWidget *window_header_bar (GtkWindow *window) +static GtkWidget *window_topbar (GtkWindow *window) { char *title = "E coli (with permission from David S. Goodsell, 2009)"; - GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); - gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); - gtk_window_set_titlebar (window, header_bar); - return header_bar; + GtkWidget *topbar = GTK_WIDGET (gtk_header_bar_new ()); + gtk_header_bar_set_title_widget (GTK_HEADER_BAR (topbar), gtk_label_new (title)); + gtk_window_set_titlebar (window, topbar); + return topbar; } diff --git a/src/widget/topbar/left.c b/src/widget/topbar/left.c index 6c627d9..0cb81fa 100644 --- a/src/widget/topbar/left.c +++ b/src/widget/topbar/left.c @@ -44,7 +44,7 @@ void *widget_get_btt_state () {return btt_STATE;} void *widget_get_btt_rules () {return btt_RULES;} void *widget_get_btt_data () {return btt_DATA;} -void window_design_header_bar_left (GtkWidget *header_bar) +void window_design_topbar_left (GtkWidget *header_bar) { gpointer no_local_data = NULL; diff --git a/src/widget/topbar/right.c b/src/widget/topbar/right.c index 3c67806..3ed0fd5 100644 --- a/src/widget/topbar/right.c +++ b/src/widget/topbar/right.c @@ -39,24 +39,24 @@ static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); } -void window_design_header_bar_right (GtkWidget *header_bar) +void window_design_topbar_right (GtkWidget *header_bar) { gpointer no_local_data = NULL; GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ()); gtk_button_set_icon_name (btt_go_home, "go-home-symbolic"); // gtk_widget_error_bell (GTK_WIDGET (btt_go_home)); << TODO si c'est possible ? - g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data); + g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_topbar_right_home), no_local_data); gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home)); GtkButton *search = GTK_BUTTON (gtk_button_new ()); gtk_button_set_icon_name (search, "folder-saved-search-symbolic"); - g_signal_connect (search, "clicked", G_CALLBACK (on_clicked_search), no_local_data); + g_signal_connect (search, "clicked", G_CALLBACK (on_clicked_topbar_right_search), no_local_data); gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (search)); GtkButton *measure = GTK_BUTTON (gtk_button_new ()); gtk_button_set_icon_name (measure, "color-select-symbolic"); - g_signal_connect (measure, "clicked", G_CALLBACK (on_clicked_measure), no_local_data); + g_signal_connect (measure, "clicked", G_CALLBACK (on_clicked_topbar_right_measure), no_local_data); gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (measure));