From 4cd7a0215a85ac75de88f92e3cbc6840c0a9bd72 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 14 Jun 2024 07:20:01 +0200 Subject: [PATCH] TROIS BOUTONS: STATE, RULES et DATA --- callback.c | 22 +++------------------- callback.h | 6 ++++-- contain.c | 16 ++++++++++------ 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/callback.c b/callback.c index 89e58fd..a10dda6 100644 --- a/callback.c +++ b/callback.c @@ -175,25 +175,9 @@ void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_ } -void on_toggle_STATE_RULES (GtkWidget *btt_toggle_STATE_RULES, gpointer data) -{ - const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES)); - if (0) printf ("callback.c (line 191) - current_label = %s\n", current_label); - - if (! strcmp (current_label, "rules")) { - gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES), "state"); - window_main_child (main_window, 1); - } - else if (! strcmp (current_label, "state")) { - gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES), "rules"); - window_main_child (main_window, 0); - } -} - -void on_toggle_ANALYSIS (GtkWidget *btt_toggle_ANALYSIS, gpointer data) -{ - window_main_child (main_window, 2); -} +void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {window_main_child (main_window, 0);} +void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {window_main_child (main_window, 1);} +void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {window_main_child (main_window, 2);} void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); diff --git a/callback.h b/callback.h index 4b831ce..1523c7d 100644 --- a/callback.h +++ b/callback.h @@ -16,8 +16,10 @@ 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 (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data); -void on_toggle_ANALYSIS (GtkWidget *btt_toggle_ANALYSIS, gpointer data); + +void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data); +void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data); +void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data); void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); diff --git a/contain.c b/contain.c index aa72622..be3dfc1 100644 --- a/contain.c +++ b/contain.c @@ -177,17 +177,21 @@ void window_header_bar (GtkWindow *window, char *title){ GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new_with_label (" run ")); g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (on_toggle_model_exec), no_local_data); - GtkButton *btt_toggle_STATE_RULES = GTK_BUTTON (gtk_button_new_with_label ("rules")); - g_signal_connect (btt_toggle_STATE_RULES, "clicked", G_CALLBACK (on_toggle_STATE_RULES), no_local_data); + GtkButton *btt_open_STATE = GTK_BUTTON (gtk_button_new_with_label ("state")); + g_signal_connect (btt_open_STATE, "clicked", G_CALLBACK (on_open_STATE), no_local_data); - GtkButton *btt_toggle_ANALYSIS = GTK_BUTTON (gtk_button_new_with_label ("data analysis")); - g_signal_connect (btt_toggle_ANALYSIS, "clicked", G_CALLBACK (on_toggle_ANALYSIS), btt_toggle_STATE_RULES); + GtkButton *btt_open_RULES = GTK_BUTTON (gtk_button_new_with_label ("rules")); + g_signal_connect (btt_open_RULES, "clicked", G_CALLBACK (on_open_RULES), no_local_data); + + GtkButton *btt_open_DATA = GTK_BUTTON (gtk_button_new_with_label ("data analysis")); + g_signal_connect (btt_open_DATA, "clicked", G_CALLBACK (on_open_DATA), no_local_data); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (exec_xor_edit)); 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)); - gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_ANALYSIS)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA)); icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme }