diff --git a/automaton.c b/automaton.c index 8997ba6..73b4f73 100644 --- a/automaton.c +++ b/automaton.c @@ -8,13 +8,13 @@ /* S T A T E S */ /******************************************************************************/ -/* (exec / edit) - * X - * (state / rules / data) - * X - * (measure / analyse / interpret) - * X - * (read / write) +/* (exec / edit) + * X + * (state / rules / data) + * X + * (measure / analyse / interpret) + * X + * (read / write) */ static int status = INTER; // int get_status () {return status;} @@ -25,17 +25,17 @@ static int status = INTER; // int get_status () {return status;} void SWITCH_TO (int asked) { switch (asked) { - case (INTER) : // BEGIN_TO_EXEC_STOP - status = STATE; printf ("SWITCH_TO INTER\n"); + case (INTER) : + status = INTER; printf ("SWITCH_TO INTER\n"); break; - case (STATE) : // EXEC_STOP_TO_RUN - status = RULES; printf ("SWITCH_TO STATE\n"); + case (STATE) : // BEGIN_TO_EXEC_STOP + status = STATE; printf ("SWITCH_TO STATE\n"); break; - case (RULES) : // EXEC_RUN_TO_STOP - status = DATA; printf ("SWITCH_TO RULES\n"); + case (RULES) : // EXEC_STOP_TO_RUN + status = RULES; printf ("SWITCH_TO RULES\n"); break; - case (DATA) : // EXEC_TO_INTER - status = INTER; printf ("SWITCH_TO DATA\n"); + case (DATA) : // EXEC_RUN_TO_STOP + status = DATA; printf ("SWITCH_TO DATA\n"); break; default : ; } diff --git a/automaton.h b/automaton.h index b6e96a9..1377caa 100644 --- a/automaton.h +++ b/automaton.h @@ -5,5 +5,6 @@ void set_status (int prescribed); int get_status (); enum choice { INTER, STATE, RULES, DATA }; + // MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE }; void SWITCH_TO (int asked); diff --git a/callback.c b/callback.c index 38992af..d32e8fb 100644 --- a/callback.c +++ b/callback.c @@ -175,9 +175,9 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN } -void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {window_main_child (main_window, 0);} -void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {window_main_child (main_window, 1);} -void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {window_main_child (main_window, 2);} +void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {window_main_child (main_window, STATE); SWITCH_TO (STATE);} +void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {window_main_child (main_window, RULES); SWITCH_TO (RULES);} +void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {window_main_child (main_window, DATA); SWITCH_TO (DATA);} void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) { gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); diff --git a/contain.c b/contain.c index 785400f..e76466d 100644 --- a/contain.c +++ b/contain.c @@ -203,9 +203,11 @@ void window_header_bar (GtkWindow *window, char *title){ } void window_main_child (GtkWindow *main_window, int selected_page){ -// in_depth.c : enum { STATE, RULES, MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE }; +// in automaton.h : enum { INTER, STATE, RULES, DATA } switch (selected_page) { - case (0) : // STATE + case (INTER) : //SWITCH_TO (INTER); + break; + case (STATE) : GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS())); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); @@ -215,18 +217,24 @@ void window_main_child (GtkWindow *main_window, int selected_page){ // 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())); gtk_window_set_child (main_window, GTK_WIDGET (page_box)); + //SWITCH_TO (STATE); break; - case (1) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new())); break; - case (2) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new())); break; - case (3) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break; - case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break; - case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_help_page_new())); break; + case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new())); + //SWITCH_TO (RULES); + break; + case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new())); + //SWITCH_TO (DATA); + break; + case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break; + case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break; + case (6) : gtk_window_set_child (main_window, GTK_WIDGET (get_help_page_new())); break; default : gtk_window_set_child (main_window, GTK_WIDGET (get_SPACE_VIEW_box())); // + un "help message" } + // printf ("%d\n", get_status()); } void main_window_design (GtkWindow *main_window){ - window_main_child (main_window, 0); // 0 is the state page + window_main_child (main_window, STATE); window_header_bar (main_window, "E coli (with permission from David S. Goodsell, 2009)"); gtk_window_present (GTK_WINDOW (main_window));