Compare commits
9 Commits
e6871816a4
...
141f3564e6
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | 141f3564e6 | |
Jean Sirmai | b05510e482 | |
Jean Sirmai | ccb5f5177b | |
Jean Sirmai | 8790b3addf | |
Jean Sirmai | 48e8884ab1 | |
Jean Sirmai | 9a334090c9 | |
Jean Sirmai | 533d1ad387 | |
Jean Sirmai | 80bde12a84 | |
Jean Sirmai | 5071f152e4 |
21
callback.c
21
callback.c
|
@ -180,15 +180,30 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
|
|||
set_mode (0);
|
||||
} else {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic");
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "emblem-ok-symbolic"); // Transport Steam Engine !!
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE);
|
||||
set_mode (1);
|
||||
}
|
||||
}
|
||||
|
||||
void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data) {
|
||||
// https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++
|
||||
|
||||
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);}
|
||||
const char *btt_name = gtk_check_button_get_label (GTK_CHECK_BUTTON (btt));
|
||||
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (btt));
|
||||
|
||||
int is_state_active = ! strcmp (btt_name, "state");
|
||||
int is_rules_active = ! strcmp (btt_name, "rules");
|
||||
int is_data_active = ! strcmp (btt_name, "data analysis");
|
||||
if (0 && is_active) printf ("> [%d] %d, %d, %d %14s\n",
|
||||
is_active, is_state_active, is_rules_active, is_data_active, btt_name);
|
||||
|
||||
if (is_active) {
|
||||
if (is_state_active) gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE()));
|
||||
else if (is_rules_active) gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES()));
|
||||
else if (is_data_active) gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA()));
|
||||
}
|
||||
}
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
||||
|
|
|
@ -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_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_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data);
|
||||
|
|
208
contain.c
208
contain.c
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
#include "graph_area.h"
|
||||
#include "callback.h"
|
||||
#include "automaton.h"
|
||||
#include "display.h"
|
||||
|
@ -133,8 +134,9 @@ GtkWidget *get_SPACE_VIEW_box(){
|
|||
gtk_box_append (right_box, GTK_WIDGET (get_ZOOM_box()));
|
||||
|
||||
GtkBox *middle_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||
gtk_box_append (middle_box, GTK_WIDGET (get_image_ALL_SPACE()));
|
||||
////////////////////////// gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
|
||||
// gtk_box_append (middle_box, GTK_WIDGET (get_image_ALL_SPACE()));
|
||||
ui_setup_glarea (0, GTK_WIDGET (middle_box));
|
||||
|
||||
gtk_box_append (middle_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||
gtk_box_append (middle_box, GTK_WIDGET (right_box));
|
||||
return GTK_WIDGET (middle_box);
|
||||
|
@ -154,89 +156,73 @@ void window_main_child_bottom (GtkBox *page_box){
|
|||
|
||||
static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
|
||||
static GtkButton *btt_open_STATE;
|
||||
static GtkButton *btt_open_RULES;
|
||||
static GtkButton *btt_open_DATA;
|
||||
|
||||
GtkButton *get_GtkButton (char *btt_name) {
|
||||
if (strcmp (btt_name, "state")) return btt_open_STATE;
|
||||
if (strcmp (btt_name, "rules")) return btt_open_RULES;
|
||||
if (strcmp (btt_name, "data analysis")) return btt_open_DATA;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void set_check_button_active (GtkButton *button, int active){
|
||||
const char *lab = gtk_button_get_label (button);
|
||||
if (strcmp (lab, "state")) printf("set_check_button_active > %s\n", lab);
|
||||
}
|
||||
|
||||
|
||||
void window_header_bar (GtkWindow *window, char *title){
|
||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
gtk_window_set_titlebar (window, header_bar);
|
||||
|
||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
GtkButton *btt_MODEL_RUN_STOP = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
||||
g_signal_connect (btt_MODEL_RUN_STOP, "clicked", G_CALLBACK (on_toggle_MODEL_RUN_STOP), no_local_data);
|
||||
|
||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic"); // https://thenounproject.com/icon/train-134324/
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "process-stop-symbolic");
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), btt_MODEL_RUN_STOP);
|
||||
|
||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_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"));
|
||||
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
||||
btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
||||
|
||||
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||
btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
||||
|
||||
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||
btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
||||
|
||||
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_MODEL_RUN_STOP));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP)); // << pas ici ! TODO
|
||||
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_RULES));
|
||||
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
|
||||
}
|
||||
|
||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||
// in automaton.h : enum { INTER, STATE, RULES, DATA }
|
||||
switch (selected_page) {
|
||||
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)));
|
||||
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()));
|
||||
//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());
|
||||
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||
// https://iconduck.com/sets/carbon-icons < pas mal ...
|
||||
// ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix...
|
||||
}
|
||||
|
||||
void main_window_design (GtkWindow *main_window){
|
||||
window_main_child (main_window, STATE);
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE()));
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
|
@ -321,3 +307,127 @@ static void icons_for_fun (GtkHeaderBar *header_bar)
|
|||
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
||||
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));
|
||||
|
||||
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect\n-----------");
|
||||
gtk_frame_set_label_align (GTK_FRAME (frame_rule_effect), 0.5);
|
||||
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));
|
||||
|
||||
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic\n----------");
|
||||
gtk_frame_set_label_align (GTK_FRAME (frame_rule_topic), 0.5);
|
||||
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));
|
||||
|
||||
GtkWidget* frame_data_type = gtk_frame_new ("data type\n----------");
|
||||
gtk_frame_set_label_align (GTK_FRAME (frame_data_type), 0.5);
|
||||
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));
|
||||
|
||||
GtkWidget* frame_interpretations = gtk_frame_new ("interpretation\n---------------");
|
||||
gtk_frame_set_label_align (GTK_FRAME (frame_interpretations), 0.5);
|
||||
GtkBox *interpretations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||
gtk_frame_set_child (GTK_FRAME (frame_interpretations), GTK_WIDGET (interpretations_box));
|
||||
|
||||
GtkWidget* frame_discussions = gtk_frame_new ("discussion\n------------");
|
||||
gtk_frame_set_label_align (GTK_FRAME (frame_discussions), 0.5);
|
||||
GtkBox *discussions_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
|
||||
gtk_frame_set_child (GTK_FRAME (frame_discussions), GTK_WIDGET (discussions_box));
|
||||
|
||||
GtkWidget* frame_separator = gtk_frame_new ("\n");
|
||||
|
||||
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 (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 (data_box, GTK_WIDGET (frame_separator));
|
||||
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_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_button_new_with_label ("objects"));
|
||||
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
|
||||
|
||||
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_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_button_new_with_label ("stochastic"));
|
||||
gtk_box_append (interpretations_box, gtk_button_new_with_label ("deterministic"));
|
||||
|
||||
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_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"));
|
||||
|
||||
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_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"));
|
||||
|
||||
//SWITCH_TO (DATA);
|
||||
return GTK_WIDGET (data_box);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,5 +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();
|
||||
|
|
|
@ -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();
|
||||
|
|
28
graph_area.c
28
graph_area.c
|
@ -84,19 +84,19 @@ long ui_is_graphic_stack_ready(void *container_widget)
|
|||
*/
|
||||
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer)
|
||||
{
|
||||
//g_printerr("[debug] ui_init_graphic_stack()\n");
|
||||
g_printerr("[debug] ui_init_graphic_stack()\n");
|
||||
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : target is %p\n", container_widget);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : target is %p\n", container_widget);
|
||||
|
||||
// look for stack_index entry
|
||||
for (int i = 0; i < stack_index_size; i++) {
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : i is %d\n", i);
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n",
|
||||
//stack_index[i].container_widget);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : i is %d\n", i);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n",
|
||||
stack_index[i].container_widget);
|
||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||
stack_index[i].stack_id = graphics_init(&error_buffer);
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : stack_id is %d\n",
|
||||
//stack_index[i].stack_id);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : stack_id is %ld\n",
|
||||
stack_index[i].stack_id);
|
||||
if (stack_index[i].stack_id >= 0)
|
||||
return true;
|
||||
else
|
||||
|
@ -254,11 +254,11 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
|
|||
{
|
||||
GtkWidget *gl_area;
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea()\n");
|
||||
g_printerr("[debug] ui_setup_glarea()\n");
|
||||
|
||||
assert(target_widget);
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : target is %p\n", target_widget);
|
||||
g_printerr("[debug] ui_setup_glarea() : target is %p\n", target_widget);
|
||||
|
||||
if (stack_index == NULL) {
|
||||
stack_index = g_malloc(sizeof(struct stack_index_t));
|
||||
|
@ -296,13 +296,13 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
|
|||
|
||||
stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : set target to %p\n", target_widget);
|
||||
g_printerr("[debug] ui_setup_glarea() : set target to %p\n", target_widget);
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
||||
//stack_index,
|
||||
//stack_index_size);
|
||||
g_printerr("[debug] ui_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
||||
stack_index,
|
||||
stack_index_size);
|
||||
|
||||
gtk_box_append(GTK_BOX(target_widget), gl_area);
|
||||
gtk_box_append (GTK_BOX (target_widget), gl_area);
|
||||
gtk_widget_set_visible (GTK_WIDGET (gl_area), TRUE);
|
||||
|
||||
// Create sliders
|
||||
|
|
|
@ -34,8 +34,10 @@
|
|||
#include "base.h"
|
||||
//#include "draw.c"
|
||||
|
||||
#define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
||||
// #define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
||||
// #define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
||||
#define VERTEX_SHADER_FILE "shader.vert"
|
||||
#define FRAG_SHADER_FILE "shader.frag"
|
||||
#define GL_TARGET_MAJOR_VERSION 0
|
||||
#define GL_TARGET_MINOR_VERSION 4
|
||||
|
||||
|
@ -77,6 +79,8 @@ struct graphic_stack_t {
|
|||
long buffer_plans_0_arrow;
|
||||
};
|
||||
|
||||
bool ui_setup_glarea(int target_mode, GtkWidget *target_widget);
|
||||
|
||||
/*
|
||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||
*/
|
||||
|
|
|
@ -111,12 +111,12 @@ int graphics_init(void *error_buffer)
|
|||
int cur_id = 0;
|
||||
struct graphic_stack_t *stack;
|
||||
|
||||
/* g_printerr("[debug] graphics_init()\n"); */
|
||||
g_printerr("[debug] graphics_init()\n");
|
||||
|
||||
if (graphic_stack == NULL) {
|
||||
graphic_stack = g_malloc0(sizeof(struct graphic_stack_t));
|
||||
graphic_stack_size = 1;
|
||||
/* g_printerr("[debug] graphics_init(): init graphic_stack @ %p\n", graphic_stack); */
|
||||
g_printerr("[debug] graphics_init(): init graphic_stack @ %p\n", graphic_stack);
|
||||
} else {
|
||||
// Check if there are free slots
|
||||
if (free_stack_slot_size) {
|
||||
|
@ -136,9 +136,9 @@ int graphics_init(void *error_buffer)
|
|||
|
||||
memset(&graphic_stack[cur_id], 0, sizeof(struct graphic_stack_t));
|
||||
|
||||
/* g_printerr("[debug] graphics_init() : graphic_stack (@0x%p) has %ld elements\n", */
|
||||
/* graphic_stack, */
|
||||
/* graphic_stack_size); */
|
||||
g_printerr("[debug] graphics_init() : graphic_stack (@0x%p) has %ld elements\n",
|
||||
graphic_stack,
|
||||
graphic_stack_size);
|
||||
|
||||
stack = &graphic_stack[cur_id];
|
||||
stack->id = cur_id;
|
||||
|
@ -147,11 +147,11 @@ int graphics_init(void *error_buffer)
|
|||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
||||
////////////////////////// if (!graphics_init_shaders(cur_id)) return -1;
|
||||
if (!graphics_init_shaders(cur_id)) return -1;
|
||||
|
||||
//print_stack(cur_id);
|
||||
print_stack(cur_id);
|
||||
|
||||
////////////////////////// graphics_init_buffers(cur_id);
|
||||
graphics_init_buffers(cur_id);
|
||||
|
||||
glDebugMessageCallback(graphics_debug_callback, NULL);
|
||||
|
||||
|
|
20
init.c
20
init.c
|
@ -119,12 +119,28 @@ bool graphics_init_shaders(const int stack_id)
|
|||
|
||||
// Link shaders to program
|
||||
program = glCreateProgram();
|
||||
printf("\n------------------------------------------------------------------------------------------\n");
|
||||
printf("[debug] graphics_init_shaders() : program = %d, vertex = %d, fragment = %d\n\
|
||||
exec > ** (myprogram:-----): WARNING ** : --:--:--:---: Linking failure: (address)\n",
|
||||
program, vertex, fragment);
|
||||
|
||||
/* (myprogram:11732): WARNING **: 10:37:34.233: v plusieurs 'run' successifs
|
||||
* (myprogram:11883): WARNING **: 10:38:22.979: glLinkProgram(program); < commenté
|
||||
* (myprogram:11953): WARNING **: 10:38:46.170:
|
||||
* (myprogram:12034): WARNING **: 10:39:14.709:
|
||||
* (myprogram:12182): WARNING **: 10:40:49.788:
|
||||
* > probablement la même adresse dans la librairie 'mesa' d'OpenGL (?) */
|
||||
|
||||
glAttachShader(program, vertex);
|
||||
glAttachShader(program, fragment);
|
||||
|
||||
glLinkProgram(program);
|
||||
printf("Failed to link the graphic stack to widgets ! <> see init.c graphics_init_shaders()\n");
|
||||
printf("the error in not : vertex shader lacks `main' but : failed to link... (comment line 140)\n");
|
||||
// https://registry.khronos.org/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml
|
||||
// glLinkProgram(program); // Linking failure: (address)
|
||||
printf("------------------------------------------------------------------------------------------\n");
|
||||
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &status);
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &status); // Linking failure: (address)
|
||||
|
||||
if(status == GL_FALSE) {
|
||||
int log_len;
|
||||
|
|
Loading…
Reference in New Issue