Gtk-CRITICAL ** gtk_button_get_label: assertion 'GTK_IS_BUTTON (button)' failed
This commit is contained in:
parent
1d99bf35ce
commit
e797211e1e
20
callback.c
20
callback.c
|
@ -188,22 +188,36 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
|
||||||
void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data) {
|
void on_toggle_STATE_RULES_DATA (GtkToggleButton *source, gpointer user_data) {
|
||||||
// https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++
|
// 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");
|
// g_print ("Toggle button [%s] is active: %s\n", gtk_button_get_label (GTK_BUTTON (source)), gtk_toggle_button_get_active (source) ? "Yes" : "No");
|
||||||
|
printf("Callback on_toggle_STATE_RULES_DATA %d %s\n", get_status(), gtk_button_get_label (GTK_BUTTON (source)));
|
||||||
int choice = 0;
|
int choice = 0;
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
|
case (INTER): get_window_child_STATE (); break;
|
||||||
case (STATE): get_window_child_STATE (); break;
|
case (STATE): get_window_child_STATE (); break;
|
||||||
case (RULES): get_window_child_STATE (); break;
|
case (RULES): get_window_child_STATE (); break;
|
||||||
case (DATA): get_window_child_STATE (); break;
|
case (DATA): get_window_child_STATE (); break;
|
||||||
default : get_window_child_STATE ();
|
default : get_window_child_STATE ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GtkToggleButton *source
|
GtkToggleButton *source
|
||||||
g_print ("Toggle button "%s" is active: %s",
|
g_print ("Toggle button "%s" is active: %s",
|
||||||
gtk_button_get_label (GTK_BUTTON (source)),
|
gtk_button_get_label (GTK_BUTTON (source)),
|
||||||
gtk_toggle_button_get_active (source) ? "Yes" : "No");*/
|
gtk_toggle_button_get_active (source) ? "Yes" : "No");*/
|
||||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {get_window_child_STATE (main_window); SWITCH_TO (STATE);}
|
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {
|
||||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {get_window_child_STATE (main_window); SWITCH_TO (RULES);}
|
get_window_child_STATE (main_window);
|
||||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {get_window_child_STATE (main_window); SWITCH_TO (DATA);}
|
SWITCH_TO (STATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
||||||
|
get_window_child_RULES (main_window);
|
||||||
|
SWITCH_TO (RULES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
||||||
|
get_window_child_DATA (main_window);
|
||||||
|
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);
|
||||||
|
|
79
contain.c
79
contain.c
|
@ -179,14 +179,17 @@ 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"));
|
||||||
|
printf("GtkButton label > %s\n", gtk_button_get_label (GTK_BUTTON (btt_open_STATE)));
|
||||||
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);
|
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"));
|
||||||
|
printf("GtkButton label > %s\n", gtk_button_get_label (GTK_BUTTON (btt_open_RULES)));
|
||||||
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);
|
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"));
|
||||||
|
printf("GtkButton label > %s\n", gtk_button_get_label (GTK_BUTTON (btt_open_DATA)));
|
||||||
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);
|
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), NULL);
|
||||||
|
|
||||||
|
@ -222,40 +225,50 @@ GtkWidget *get_window_child_RULES (){
|
||||||
|
|
||||||
gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (get_rules_tree_hpaned_new()));
|
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_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_position (H_tree_vs_selected, 500); // WARNING : c'est une position "absolue"
|
||||||
gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE);
|
gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE);
|
||||||
// gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_selected), W, H); // inutile... ?
|
// gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_selected), W, H); // inutile... ?
|
||||||
return GTK_WIDGET (H_tree_vs_selected);
|
return GTK_WIDGET (H_tree_vs_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_window_child_DATA (){
|
GtkWidget *get_window_child_DATA (){
|
||||||
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16));
|
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 32));
|
||||||
|
|
||||||
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
|
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------");
|
||||||
gtk_frame_set_label_align (GTK_FRAME (frame_rule_effect), 0.5);
|
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));
|
GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
|
gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
|
||||||
|
|
||||||
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic");
|
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic\n----------");
|
||||||
gtk_frame_set_label_align (GTK_FRAME (frame_rule_topic), 0.5);
|
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));
|
GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
|
gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
|
||||||
|
|
||||||
GtkWidget* frame_data_type = gtk_frame_new ("data type");
|
GtkWidget* frame_data_type = gtk_frame_new ("data type\n----------");
|
||||||
gtk_frame_set_label_align (GTK_FRAME (frame_data_type), 0.5);
|
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));
|
GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
|
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
|
||||||
|
|
||||||
GtkWidget* frame_interpretations = gtk_frame_new ("interpretations");
|
GtkWidget* frame_interpretations = gtk_frame_new ("interpretation\n---------------");
|
||||||
gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5);
|
gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5);
|
||||||
GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
|
GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box));
|
gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box));
|
||||||
|
|
||||||
GtkWidget* frame_discussions = gtk_frame_new ("discussions");
|
GtkWidget* frame_discussions = gtk_frame_new ("discussion\n------------");
|
||||||
gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5);
|
gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5);
|
||||||
GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 4));
|
GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box));
|
gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box));
|
||||||
|
|
||||||
|
GtkWidget* frame_game = gtk_frame_new ("game\n------");
|
||||||
|
gtk_frame_set_label_align (GTK_FRAME (frame_game), 0.5);
|
||||||
|
GtkBox *game_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
|
gtk_frame_set_child (GTK_FRAME (frame_game), GTK_WIDGET (game_box));
|
||||||
|
|
||||||
|
GtkWidget* frame_help = gtk_frame_new ("help\n-----");
|
||||||
|
gtk_frame_set_label_align (GTK_FRAME (frame_help), 0.5);
|
||||||
|
GtkBox *help_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||||
|
gtk_frame_set_child (GTK_FRAME (frame_help), GTK_WIDGET (help_box));
|
||||||
|
|
||||||
//gtk_box_append (xxx_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
//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_effect));
|
||||||
|
@ -263,32 +276,62 @@ GtkWidget *get_window_child_DATA (){
|
||||||
gtk_box_append (data_box, GTK_WIDGET (frame_data_type));
|
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_interpretations));
|
||||||
gtk_box_append (data_box, GTK_WIDGET (frame_discussions));
|
gtk_box_append (data_box, GTK_WIDGET (frame_discussions));
|
||||||
|
gtk_box_append (data_box, GTK_WIDGET (frame_game));
|
||||||
|
gtk_box_append (data_box, GTK_WIDGET (frame_help));
|
||||||
|
|
||||||
gtk_box_append (rule_effect_box, gtk_label_new ("*"));
|
// 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 ("movement"));
|
||||||
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport"));
|
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_effect_box, gtk_button_new_with_label ("transformation"));
|
||||||
|
|
||||||
gtk_box_append (rule_topic_box, gtk_label_new ("*"));
|
// 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 ("objects"));
|
||||||
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
|
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
|
||||||
|
|
||||||
gtk_box_append (data_type_box, gtk_label_new ("*"));
|
gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (rule_topic_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("accuracy"));
|
||||||
|
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("pattern recognition"));
|
||||||
|
|
||||||
|
// 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 ("repartitions"));
|
||||||
gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions"));
|
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 (data_type_box, gtk_button_new_with_label ("correlations"));
|
||||||
|
|
||||||
gtk_box_append (interpretations_box, gtk_label_new ("*"));
|
// 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 ("stochastic"));
|
||||||
gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic"));
|
gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic"));
|
||||||
|
|
||||||
gtk_box_append (discussions_box, gtk_label_new ("*"));
|
gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
gtk_box_append (interpretations_box, gtk_button_new_with_label ("physical"));
|
||||||
|
gtk_box_append (interpretations_box, gtk_button_new_with_label ("chemical"));
|
||||||
|
gtk_box_append (interpretations_box, gtk_button_new_with_label ("biological"));
|
||||||
|
gtk_box_append (interpretations_box, gtk_button_new_with_label ("social"));
|
||||||
|
gtk_box_append (interpretations_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
|
||||||
|
// 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 ("context"));
|
||||||
gtk_box_append (discussions_box, gtk_button_new_with_label ("methodology"));
|
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 ("comparisons"));
|
||||||
gtk_box_append (discussions_box, gtk_button_new_with_label ("to improve"));
|
gtk_box_append (discussions_box, gtk_button_new_with_label ("to improve"));
|
||||||
gtk_box_append (discussions_box, gtk_button_new_with_label ("summary"));
|
gtk_box_append (discussions_box, gtk_button_new_with_label ("summary"));
|
||||||
|
|
||||||
|
// gtk_box_append (game_box, gtk_label_new ("*"));
|
||||||
|
gtk_box_append (game_box, gtk_button_new_with_label ("single player"));
|
||||||
|
gtk_box_append (game_box, gtk_button_new_with_label ("multiple players"));
|
||||||
|
gtk_box_append (game_box, gtk_button_new_with_label ("edition facilities"));
|
||||||
|
|
||||||
|
// gtk_box_append (help_box, gtk_label_new ("*"));
|
||||||
|
gtk_box_append (help_box, gtk_button_new_with_label ("modelization"));
|
||||||
|
gtk_box_append (help_box, gtk_button_new_with_label ("measurements"));
|
||||||
|
gtk_box_append (help_box, gtk_button_new_with_label ("results"));
|
||||||
|
gtk_box_append (help_box, gtk_button_new_with_label ("data analysis"));
|
||||||
|
|
||||||
|
gtk_box_append (help_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
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);
|
return GTK_WIDGET (data_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +339,8 @@ void main_window_design (GtkWindow *main_window){
|
||||||
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_set_child (main_window, get_window_child_STATE ());
|
||||||
|
gtk_window_set_child (main_window, get_window_child_RULES ());
|
||||||
|
gtk_window_set_child (main_window, get_window_child_DATA ());
|
||||||
gtk_window_present (GTK_WINDOW (main_window));
|
gtk_window_present (GTK_WINDOW (main_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue