WIP: les GTK_CHECK_BUTTON sont 'toggled' > la fenêtre est réaffichée (2 fois)

This commit is contained in:
Jean Sirmai 2024-06-15 23:29:17 +02:00
parent 0f0c21b299
commit bd252031c7
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 35 additions and 26 deletions

View File

@ -25,17 +25,17 @@ static int status = INTER; // int get_status () {return status;}
void SWITCH_TO (int asked) { void SWITCH_TO (int asked) {
switch (asked) { switch (asked) {
case (INTER) : // BEGIN_TO_EXEC_STOP case (INTER) :
status = STATE; printf ("SWITCH_TO INTER\n"); status = INTER; printf ("SWITCH_TO INTER\n");
break; break;
case (STATE) : // EXEC_STOP_TO_RUN case (STATE) : // BEGIN_TO_EXEC_STOP
status = RULES; printf ("SWITCH_TO STATE\n"); status = STATE; printf ("SWITCH_TO STATE\n");
break; break;
case (RULES) : // EXEC_RUN_TO_STOP case (RULES) : // EXEC_STOP_TO_RUN
status = DATA; printf ("SWITCH_TO RULES\n"); status = RULES; printf ("SWITCH_TO RULES\n");
break; break;
case (DATA) : // EXEC_TO_INTER case (DATA) : // EXEC_RUN_TO_STOP
status = INTER; printf ("SWITCH_TO DATA\n"); status = DATA; printf ("SWITCH_TO DATA\n");
break; break;
default : ; default : ;
} }

View File

@ -5,5 +5,6 @@ void set_status (int prescribed);
int get_status (); int get_status ();
enum choice { INTER, STATE, RULES, DATA }; enum choice { INTER, STATE, RULES, DATA };
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };
void SWITCH_TO (int asked); void SWITCH_TO (int asked);

View File

@ -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_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, 1);} 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, 2);} 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) { void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);

View File

@ -203,9 +203,11 @@ void window_header_bar (GtkWindow *window, char *title){
} }
void window_main_child (GtkWindow *main_window, int selected_page){ 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) { 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)); 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 (get_OBJECTS_and_SITUATIONS()));
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)));
@ -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())); // 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())); // else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
gtk_window_set_child (main_window, GTK_WIDGET (page_box)); gtk_window_set_child (main_window, GTK_WIDGET (page_box));
//SWITCH_TO (STATE);
break; break;
case (1) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new())); break; case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new()));
case (2) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new())); break; //SWITCH_TO (RULES);
case (3) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break; break;
case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break; case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new()));
case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_help_page_new())); break; //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" 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){ 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, window_header_bar (main_window,
"E coli (with permission from David S. Goodsell, 2009)"); "E coli (with permission from David S. Goodsell, 2009)");
gtk_window_present (GTK_WINDOW (main_window)); gtk_window_present (GTK_WINDOW (main_window));