A U T O M A T O N EXEC_EDIT x STATE_RULES_DATA is OK

This commit is contained in:
Jean Sirmai 2024-06-28 12:46:31 +02:00
parent 3cbbeb2c3a
commit 6a0f4f0a05
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 22 additions and 20 deletions

View File

@ -16,18 +16,18 @@ static int choice_STATE_RULES_DATA = STATE;
/* T R A N S I T I O N S */ /* 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) { void set_EXEC_EDIT (int prescribed) {
if (choice_EXEC_EDIT != prescribed) { if (choice_EXEC_EDIT != prescribed) {
debug_printing (prescribed, 0); debug_printing (prescribed, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = prescribed; choice_EXEC_EDIT = prescribed;
} }
} }
void set_STATE_RULES_DATA (int prescribed) { void set_STATE_RULES_DATA (int prescribed) {
if (choice_STATE_RULES_DATA != 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; 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_EXEC_EDIT () {return choice_EXEC_EDIT;}
int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;} 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) { switch (value) {
case (EXEC) : return "EXEC"; case (EXEC) : return "EXEC";
case (EDIT) : return "EDIT"; 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) { switch (value) {
case (STATE) : return "STATE"; case (STATE) : return "STATE";
case (RULES) : return "RULES"; case (RULES) : return "RULES";
@ -57,8 +57,9 @@ char *get_str_STATE_RULES_DATA (int value) {
} }
} }
void debug_printing (int prescribed, int sub_automaton) { static void debug_printing (int prescribed, int sub_automaton) {
switch (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", case (0) : printf("switch > %5s X %5s <> %5s X %5s\n",
get_str_EXEC_EDIT (choice_EXEC_EDIT), get_str_EXEC_EDIT (choice_EXEC_EDIT),
get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA), get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),

View File

@ -11,6 +11,6 @@ void set_STATE_RULES_DATA (int prescribed);
int get_EXEC_EDIT (); int get_EXEC_EDIT ();
int get_STATE_RULES_DATA (); int get_STATE_RULES_DATA ();
char *get_str_EXEC_EDIT (int value); // char *get_str_EXEC_EDIT (int value);
char *get_str_STATE_RULES_DATA (int value); // char *get_str_STATE_RULES_DATA (int value);

View File

@ -167,21 +167,21 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
/* B U T T O N S */ /* B U T T O N S */
/******************************************************************************/ /******************************************************************************/
/*void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data) { void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_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 if (get_EXEC_EDIT ()) {
(GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data) { gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "power-profile-balanced-rtl-symbolic");
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");
set_EXEC_EDIT (EXEC); set_EXEC_EDIT (EXEC);
} else { } else {
// gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "text-editor-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "text-editor-symbolic");
set_EXEC_EDIT (EDIT); 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) { void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data) {

View File

@ -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 (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box())); 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 (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); return GTK_WIDGET (page_box);
} }