From ba8ff7f65cdc2e39067c6d76b5933fc59a9fb6e8 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 13 Jun 2024 10:33:11 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20essai=20avec=20deux=20boutons=20=20>=20?= =?UTF-8?q?=20des=20erreurs=20mais=20am=C3=A9liorable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- callback.c | 37 ++++++++++++++++++++++++++++++++----- callback.h | 3 ++- contain.c | 5 ++++- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/callback.c b/callback.c index 5052045..03c50fd 100644 --- a/callback.c +++ b/callback.c @@ -175,21 +175,48 @@ void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_ } -void on_toggle_STATE_RULES_DATA (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data) +void on_toggle_STATE_RULES_DATA (GtkButton *btt_toggle_STATE_RULES_DATA, + GtkButton *btt_toggle_STATE_DATA_RULES) { const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA)); - if (0) printf ("callback.c (line 191) - current_label = %s\n", current_label); + if (0) printf ("callback.c (line 182) - current_label = %s\n", current_label); if (! strcmp (current_label, "analyse")) { - gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " state "); + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " state "); + gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), " state "); window_main_child (main_window, 0); } else if (! strcmp (current_label, " state ")) { - gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " rules "); + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " rules "); + gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), " rules "); window_main_child (main_window, 1); } else { - gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "analyse"); + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, "analyse"); + gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), "analyse"); + window_main_child (main_window, 2); + } +} + +void on_toggle_STATE_DATA_RULES (GtkButton *btt_toggle_STATE_RULES_DATA, + GtkButton *btt_toggle_STATE_DATA_RULES) +{ + const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA)); + if (0) printf ("callback.c (line 205) - current_label = %s\n", current_label); + + if (! strcmp (current_label, "analyse")) { + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " state "); + gtk_button_set_label (btt_toggle_STATE_DATA_RULES, " state "); + window_main_child (main_window, 0); + } + else if (! strcmp (current_label, " rules ")) { + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, "analyse"); + gtk_button_set_label (btt_toggle_STATE_DATA_RULES, "analyse"); + window_main_child (main_window, 1); + } + else { + gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " rules "); + gtk_button_set_label (btt_toggle_STATE_DATA_RULES, " rules "); window_main_child (main_window, 2); } } diff --git a/callback.h b/callback.h index b4a4b5b..f42093d 100644 --- a/callback.h +++ b/callback.h @@ -16,7 +16,8 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec); void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data); -void on_toggle_STATE_RULES_DATA (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data); +void on_toggle_STATE_RULES_DATA (GtkButton *btt_toggle_STATE_RULES_DATA, GtkButton *btt_toggle_STATE_DATA_RULES); +void on_toggle_STATE_DATA_RULES (GtkButton *btt_toggle_STATE_DATA_RULES, GtkButton *btt_toggle_STATE_RULES_DATA); void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); diff --git a/contain.c b/contain.c index 32d8756..6be987f 100644 --- a/contain.c +++ b/contain.c @@ -178,7 +178,9 @@ void window_header_bar (GtkWindow *window, char *title){ g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (on_toggle_model_exec), no_local_data); GtkButton *btt_toggle_STATE_RULES_DATA = GTK_BUTTON (gtk_button_new_with_label (" state ")); - g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data); + GtkButton *btt_toggle_STATE_DATA_RULES = GTK_BUTTON (gtk_button_new_with_label (" state ")); + g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_RULES_DATA), btt_toggle_STATE_DATA_RULES); + g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_DATA_RULES), btt_toggle_STATE_RULES_DATA); // GtkButton *observ_interpret = GTK_BUTTON (gtk_button_new_with_label ("data analysis")); // g_signal_connect (observ_interpret, "clicked", G_CALLBACK (on_toggle_observ_interpret), no_local_data); @@ -187,6 +189,7 @@ void window_header_bar (GtkWindow *window, char *title){ gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_STATE_RULES_DATA)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_STATE_DATA_RULES)); // gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (observ_interpret)); icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme