From 49d78fdfd255b0c8f37c5e0ba686861b552ebef9 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 11 Jun 2024 22:01:44 +0200 Subject: [PATCH] WIP: et faisons fonctionner ces boutons --- in_depth.c => automaton.c | 0 in_depth.h => automaton.h | 0 callback.c | 10 +++++++--- callback.h | 1 + contain.c | 2 +- dialog.c | 14 +++++++++++--- 6 files changed, 20 insertions(+), 7 deletions(-) rename in_depth.c => automaton.c (100%) rename in_depth.h => automaton.h (100%) diff --git a/in_depth.c b/automaton.c similarity index 100% rename from in_depth.c rename to automaton.c diff --git a/in_depth.h b/automaton.h similarity index 100% rename from in_depth.h rename to automaton.h diff --git a/callback.c b/callback.c index 61d8030..c58d11f 100644 --- a/callback.c +++ b/callback.c @@ -6,7 +6,7 @@ #include "contain.h" #include "dialog.h" #include "texts.h" -#include "in_depth.h" +#include "automaton.h" #include "parsing.h" #include "graph_area.h" @@ -197,9 +197,13 @@ void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointe } void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { - printf("SAVE_CURRENT_MODEL_BEFORE_EDITING (callback.c - line 200)\n"); + printf("callback.c (line 200) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n"); } void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { - printf("DISCARD_CURRENT_MODEL_AND_START_EDITING (callback.c - line 204)\n"); + printf("callback.c (line 204) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n"); +} + +void on_WRITE_THE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data) { + printf("callback.c (line 208) - WRITE_THE_CURRENT_MODEL\n"); } diff --git a/callback.h b/callback.h index 9621957..72f86f1 100644 --- a/callback.h +++ b/callback.h @@ -20,6 +20,7 @@ void on_toggle_state_rules (GtkWidget *btt_toggle_state_rules, gpointer 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); void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); +void on_WRITE_THE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data); diff --git a/contain.c b/contain.c index 3710dfc..bac54c2 100644 --- a/contain.c +++ b/contain.c @@ -2,7 +2,7 @@ #include #include "callback.h" -#include "in_depth.h" +#include "automaton.h" #include "display.h" #include "tree.h" #include "texts.h" diff --git a/dialog.c b/dialog.c index 3352c47..53a3c2b 100644 --- a/dialog.c +++ b/dialog.c @@ -2,12 +2,13 @@ #include #include "callback.h" -#include "in_depth.h" +#include "automaton.h" #include "display.h" #include "tree.h" #include "texts.h" // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery +// GTK_ORIENTATION_HORIZONTAL GTK_ORIENTATION_VERTICAL /* doc : see > on_dialog_window_activation (...) in callback.c */ @@ -26,11 +27,18 @@ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){ g_signal_connect (click_yes, "clicked", G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), NULL); gtk_box_append (YES_NO_box, GTK_WIDGET (click_yes)); -// gtk_box_append (YES_NO_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO")); g_signal_connect (click_no, "clicked", G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), NULL); gtk_box_append (YES_NO_box, GTK_WIDGET (click_no)); - gtk_window_set_child (dialog_window, GTK_WIDGET (YES_NO_box)); + + GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label ("SAVE THE CURRENT MODEL")); + g_signal_connect (click_no, "clicked", G_CALLBACK (on_WRITE_THE_CURRENT_MODEL), NULL); + + GtkBox *WINDOW_CHILD_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); + gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (YES_NO_box)); + gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (WINDOW_CHILD_box, GTK_WIDGET (action_save_current_model)); + gtk_window_set_child (dialog_window, GTK_WIDGET (WINDOW_CHILD_box)); gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window)); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);