WIP: cosmétique... mais le 'on_toggle_STATE_RULES_DATA()' callback (+ switch) reste à faire

This commit is contained in:
Jean Sirmai 2024-06-20 08:13:48 +02:00
parent 6f463326f9
commit 1d99bf35ce
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 92 additions and 10 deletions

View File

@ -185,8 +185,9 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
} }
} }
void on_STATE_RULES_DATA_selection (GtkToggleButton *source, gpointer user_data) { void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data) {
// g_print ("Toggle button [%s] is active: %s", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No"); // https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++
// g_print ("Toggle button [%s] is active: %s\n", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No");
int choice = 0; int choice = 0;
switch (choice) { switch (choice) {
case (STATE): get_window_child_STATE (); break; case (STATE): get_window_child_STATE (); break;

View File

@ -24,4 +24,4 @@ void on_open_DATA (GtkWidget *btt_open_DATA, gpointer 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);
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data); void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data);
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data); void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data);
void on_STATE_RULES_DATA_selection (GtkToggleButton *source, gpointer user_data); void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data);

View File

@ -179,27 +179,27 @@ void window_header_bar (GtkWindow *window, char *title) { // https://docs.gtk.or
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ()); GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_STATE_RULES_DATA_selection), NULL);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), NULL);
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules")); GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_STATE_RULES_DATA_selection), NULL);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), NULL);
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis")); GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_STATE_RULES_DATA_selection), NULL);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), NULL);
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP)); // gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA));
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme // icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
} }
GtkWidget *get_window_child_STATE () { GtkWidget *get_window_child_STATE () {
@ -214,10 +214,88 @@ GtkWidget *get_window_child_STATE () {
return GTK_WIDGET (page_box); 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, 600); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE);
// gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_selected), W, H); // inutile... ?
return GTK_WIDGET (H_tree_vs_selected);
}
GtkWidget *get_window_child_DATA (){
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16));
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
gtk_frame_set_label_align (GTK_FRAME (frame_rule_effect), 0.5);
GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic");
gtk_frame_set_label_align (GTK_FRAME (frame_rule_topic), 0.5);
GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
GtkWidget* frame_data_type = gtk_frame_new ("data type");
gtk_frame_set_label_align (GTK_FRAME (frame_data_type), 0.5);
GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
GtkWidget* frame_interpretations = gtk_frame_new ("interpretations");
gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5);
GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box));
GtkWidget* frame_discussions = gtk_frame_new ("discussions");
gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5);
GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box));
//gtk_box_append (xxx_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic));
gtk_box_append (data_box, GTK_WIDGET (frame_data_type));
gtk_box_append (data_box, GTK_WIDGET (frame_interpretations));
gtk_box_append (data_box, GTK_WIDGET (frame_discussions));
gtk_box_append (rule_effect_box, gtk_label_new ("*"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation"));
gtk_box_append (rule_topic_box, gtk_label_new ("*"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
gtk_box_append (data_type_box, gtk_label_new ("*"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions"));
gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations"));
gtk_box_append (interpretations_box, gtk_label_new ("*"));
gtk_box_append (interpretations_box, gtk_button_new_with_label ("stochastic"));
gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic"));
gtk_box_append (discussions_box, gtk_label_new ("*"));
gtk_box_append (discussions_box, gtk_button_new_with_label ("context"));
gtk_box_append (discussions_box, gtk_button_new_with_label ("methodology"));
gtk_box_append (discussions_box, gtk_button_new_with_label ("comparisons"));
gtk_box_append (discussions_box, gtk_button_new_with_label ("to improve"));
gtk_box_append (discussions_box, gtk_button_new_with_label ("summary"));
return GTK_WIDGET (data_box);
}
void main_window_design (GtkWindow *main_window){ void main_window_design (GtkWindow *main_window){
gtk_window_set_child (main_window, get_window_child_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_set_child (main_window, get_window_child_STATE ());
gtk_window_present (GTK_WINDOW (main_window)); gtk_window_present (GTK_WINDOW (main_window));
} }

View File

@ -37,3 +37,5 @@ GtkFrame *get_frame_with_label();
void window_main_child_bottom (GtkBox *page_box); 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);
GtkWidget *get_window_child_STATE (); GtkWidget *get_window_child_STATE ();
GtkWidget *get_window_child_RULES ();
GtkWidget *get_window_child_DATA ();

View File

@ -21,6 +21,7 @@ GtkWidget *get_image_PHENYLALANINE();
GtkWidget *get_image_DOPAMINE(); GtkWidget *get_image_DOPAMINE();
GtkWidget *get_image_ATP(); GtkWidget *get_image_ATP();
GtkWidget *get_image_AMP(); GtkWidget *get_image_AMP();
GtkWidget *get_rules_tree_hpaned_new();
GtkProgressBar *get_ELAPSED_TIME_ProgressBar(); GtkProgressBar *get_ELAPSED_TIME_ProgressBar();
GtkBox *get_RUN_STOP_box(); GtkBox *get_RUN_STOP_box();