WIP: essai avec deux boutons > des erreurs mais améliorable

This commit is contained in:
Jean Sirmai 2024-06-13 10:33:11 +02:00
parent 00f88d1c36
commit ba8ff7f65c
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 38 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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