diff --git a/callback.c b/callback.c index 04b4d24..3128135 100644 --- a/callback.c +++ b/callback.c @@ -197,17 +197,20 @@ void on_open_STATE (GtkWidget *btt_open_STATE, gpointer user_data) { gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)), gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA))); - if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state")))) window_main_child (main_window, STATE); -}// SWITCH_TO (STATE);} + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state")))) + gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); // window_main_child (main_window, STATE); +} // SWITCH_TO (STATE);} void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) { if (0) printf("on_open_RULES status = %d\n", get_status ()); - if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules")))) window_main_child (main_window, RULES); + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules")))) + gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES())); // window_main_child (main_window, RULES); }// SWITCH_TO (RULES);} void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) { if (0) printf("on_open_DATA status = %d\n", get_status ()); - if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))) window_main_child (main_window, DATA); + if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))) + gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA())); // window_main_child (main_window, DATA); }// SWITCH_TO (DATA);} diff --git a/contain.c b/contain.c index ac29708..7f41663 100644 --- a/contain.c +++ b/contain.c @@ -244,44 +244,10 @@ void window_header_bar (GtkWindow *window, char *title){ // ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix... } -void window_main_child (GtkWindow *main_window, int selected_page){ -// in automaton.h : enum { INTER, STATE, RULES, DATA } - if (0) printf ("window_main_child() selected_page = %d\n", selected_page); - - switch (selected_page) { - case (INTER) : //SWITCH_TO (INTER); - break; - case (STATE) : - // printf ("SWITCH_TO STATE\n"); - 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))); - 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_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; - case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new())); - // printf ("SWITCH_TO RULES\n"); - break; - case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA())); - // printf ("SWITCH_TO DATA\n"); - 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_header_bar (main_window, "E coli (with permission from David S. Goodsell, 2009)"); - window_main_child (main_window, STATE); + gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); // window_main_child (main_window, STATE); // set_check_button_active (GTK_BUTTON (btt_open_STATE), 1); gtk_window_present (GTK_WINDOW (main_window)); } @@ -368,6 +334,30 @@ static void icons_for_fun (GtkHeaderBar *header_bar) gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low)); } +GtkWidget *get_window_child_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))); + gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box())); + gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + 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())); + //SWITCH_TO (STATE); + return GTK_WIDGET (page_box); +} + +GtkWidget *get_window_child_RULES(){ + GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); +// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); +// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection"); + gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (get_rules_tree_hpaned_new())); + gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (get_selected_rules_vpaned_new())); + gtk_paned_set_position (H_tree_vs_selected, 400); // WARNING : c'est une position "absolue" + gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE); + //SWITCH_TO (RULES); + return GTK_WIDGET (H_tree_vs_selected); +} + GtkWidget *get_window_child_DATA (){ GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32)); @@ -463,6 +453,7 @@ GtkWidget *get_window_child_DATA (){ gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (help_box, gtk_button_new_with_label ("preferences")); - return GTK_WIDGET (data_box); + //SWITCH_TO (DATA); + return GTK_WIDGET (data_box); } diff --git a/contain.h b/contain.h index a0e382c..64fb6df 100644 --- a/contain.h +++ b/contain.h @@ -35,7 +35,9 @@ void two_notebooks_in_two_panes (GtkWindow *window); GtkWidget *get_selected_rules_vpaned_new(); GtkFrame *get_frame_with_label(); void window_main_child_bottom (GtkBox *page_box); -void window_main_child (GtkWindow *main_window, int selected_page); +//void window_main_child (GtkWindow *main_window, int selected_page); void set_check_button_active (GtkButton *button, int active); GtkButton *get_GtkButton (char *btt_name); +GtkWidget *get_window_child_STATE(); +GtkWidget *get_window_child_RULES(); GtkWidget *get_window_child_DATA(); diff --git a/display.h b/display.h index 90cf07a..157190b 100644 --- a/display.h +++ b/display.h @@ -21,6 +21,7 @@ GtkWidget *get_image_PHENYLALANINE(); GtkWidget *get_image_DOPAMINE(); GtkWidget *get_image_ATP(); GtkWidget *get_image_AMP(); +GtkWidget *get_rules_tree_hpaned_new(); GtkProgressBar *get_ELAPSED_TIME_ProgressBar(); GtkBox *get_RUN_STOP_box();