From 6a0f4f0a0504220f381e6fca96f95df05db47228 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 28 Jun 2024 12:46:31 +0200 Subject: [PATCH] A U T O M A T O N EXEC_EDIT x STATE_RULES_DATA is OK --- automaton.c | 15 ++++++++------- automaton.h | 4 ++-- callback.c | 20 ++++++++++---------- contain.c | 3 ++- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/automaton.c b/automaton.c index 3de81f4..4f4f6fa 100644 --- a/automaton.c +++ b/automaton.c @@ -16,18 +16,18 @@ static int choice_STATE_RULES_DATA = STATE; /* T R A N S I T I O N S */ /******************************************************************************/ -void debug_printing (int prescribed, int sub_automaton); +static void debug_printing (int prescribed, int sub_automaton); void set_EXEC_EDIT (int prescribed) { if (choice_EXEC_EDIT != prescribed) { - debug_printing (prescribed, 0); + debug_printing (prescribed, 0); // EXEC_EDIT is sub_automaton 0 choice_EXEC_EDIT = prescribed; } } void set_STATE_RULES_DATA (int prescribed) { if (choice_STATE_RULES_DATA != prescribed) { - debug_printing (prescribed, 1); + debug_printing (prescribed, 1); // STATE_RULES_DATA is sub_automaton 1 choice_STATE_RULES_DATA = prescribed; } } @@ -40,7 +40,7 @@ void set_STATE_RULES_DATA (int prescribed) { int get_EXEC_EDIT () {return choice_EXEC_EDIT;} int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;} -char *get_str_EXEC_EDIT (int value) { +static char *get_str_EXEC_EDIT (int value) { switch (value) { case (EXEC) : return "EXEC"; case (EDIT) : return "EDIT"; @@ -48,7 +48,7 @@ char *get_str_EXEC_EDIT (int value) { } } -char *get_str_STATE_RULES_DATA (int value) { +static char *get_str_STATE_RULES_DATA (int value) { switch (value) { case (STATE) : return "STATE"; case (RULES) : return "RULES"; @@ -57,8 +57,9 @@ char *get_str_STATE_RULES_DATA (int value) { } } -void debug_printing (int prescribed, int sub_automaton) { - switch (sub_automaton) { +static void debug_printing (int prescribed, int sub_automaton) { + switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and + // sub_automaton 1 is STATE_RULES_DATA case (0) : printf("switch > %5s X %5s <> %5s X %5s\n", get_str_EXEC_EDIT (choice_EXEC_EDIT), get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA), diff --git a/automaton.h b/automaton.h index 8126494..48e5517 100644 --- a/automaton.h +++ b/automaton.h @@ -11,6 +11,6 @@ void set_STATE_RULES_DATA (int prescribed); int get_EXEC_EDIT (); int get_STATE_RULES_DATA (); -char *get_str_EXEC_EDIT (int value); -char *get_str_STATE_RULES_DATA (int value); +// char *get_str_EXEC_EDIT (int value); +// char *get_str_STATE_RULES_DATA (int value); diff --git a/callback.c b/callback.c index e164bc6..f42cd4a 100644 --- a/callback.c +++ b/callback.c @@ -167,21 +167,21 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data) /* B U T T O N S */ /******************************************************************************/ -/*void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data) { - if (strcmp (gtk_button_get_label (GTK_BUTTON (btt_MODEL_RUN_STOP)), " run ")) - gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run "); - else gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " stop ");}*/ +void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) { -void on_toggle_EXEC_EDIT -(GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data) { - if (get_EXEC_EDIT ()) {// (strcmp (get_str_EXEC_EDIT(0), "EXEC")) { - gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "power-profile-balanced-rtl-symbolic"); + if (get_EXEC_EDIT ()) { + gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "power-profile-balanced-rtl-symbolic"); set_EXEC_EDIT (EXEC); } else { - // gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic"); - gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "text-editor-symbolic"); + gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "text-editor-symbolic"); set_EXEC_EDIT (EDIT); } + switch (get_STATE_RULES_DATA()) { + case (STATE) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); break; + case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES())); break; + case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA())); break; + default : printf("default in callback.on_toggle_STATE_RULES_DATA()\n"); + } } void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data) { diff --git a/contain.c b/contain.c index 7d722e8..3f0a463 100644 --- a/contain.c +++ b/contain.c @@ -236,7 +236,8 @@ GtkWidget *get_window_child_STATE() { gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box())); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box())); + if (get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box())); + else gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box())); return GTK_WIDGET (page_box); }