diff --git a/automaton.c b/automaton.c index 73b4f73..8893837 100644 --- a/automaton.c +++ b/automaton.c @@ -8,16 +8,23 @@ /* S T A T E S */ /******************************************************************************/ -/* (exec / edit) +/* (exec / edit) < MODE * X - * (state / rules / data) + * (state / rules / data) < STATUS * X * (measure / analyse / interpret) * X * (read / write) */ +static int mode = RUN; +void set_mode (int prescribed) {mode = prescribed;} +int get_mode () {return mode;} + static int status = INTER; // int get_status () {return status;} +void set_status (int prescribed) {status = prescribed;} +int get_status () {return status;} + /******************************************************************************/ /* T R A N S I T I O N S */ diff --git a/automaton.h b/automaton.h index 1377caa..da12b02 100644 --- a/automaton.h +++ b/automaton.h @@ -3,7 +3,10 @@ void set_status (int prescribed); int get_status (); +void set_mode (int prescribed); +int get_mode (); +enum mode { RUN, EDIT }; enum choice { INTER, STATE, RULES, DATA }; // MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE }; diff --git a/callback.c b/callback.c index d32e8fb..5bb61c7 100644 --- a/callback.c +++ b/callback.c @@ -166,12 +166,23 @@ 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){} +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 *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN_STOP) { + if (get_mode()) { gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "power-profile-balanced-rtl-symbolic"); - gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic"); - gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run "); + gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run "); gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), TRUE); + set_mode (0); + } else { + gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic"); + gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE); + set_mode (1); + } } diff --git a/contain.c b/contain.c index e76466d..61098dc 100644 --- a/contain.c +++ b/contain.c @@ -213,9 +213,9 @@ void window_main_child (GtkWindow *main_window, int selected_page){ 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))); - window_main_child_bottom (page_box); -// if (get_status ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box())); -// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box())); +// window_main_child_bottom (page_box); +// if (!get_mode ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box())); +// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box())); gtk_window_set_child (main_window, GTK_WIDGET (page_box)); //SWITCH_TO (STATE); break;