Compare commits

..

No commits in common. "11bcd85d686d82b5efead9f234a4a48efc8ee75a" and "9d1298ca7afc6cbd73bb4d2917d20aec296dde01" have entirely different histories.

13 changed files with 211 additions and 179 deletions

View File

@ -37,16 +37,16 @@
/* S T A T E M A C H I N E */ /* S T A T E M A C H I N E */
/******************************************************************************/ /******************************************************************************/
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor enum choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor enum choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
int fsm_get_exec_edit (); int fsm_get_EXEC_EDIT ();
int fsm_get_state_rules_data (); int fsm_get_STATE_RULES_DATA ();
int fsm_get_objects_box_reset_value (); int fsm_get_OBJECTS_box_RESET_VALUE ();
int fsm_get_situations_box_reset_value (); int fsm_get_SITUATIONS_box_RESET_VALUE ();
void fsm_set_exec_edit (int value); void fsm_set_EXEC_EDIT (int value);
void fsm_set_state_rules_data (int value); void fsm_set_STATE_RULES_DATA (int value);
void fsm_reset_all_objects_transparencies_at_value (int value); void fsm_reset_all_objects_transparencies_at_value (int value);
void fsm_reset_all_situations_transparencies_at_value (int value); void fsm_reset_all_situations_transparencies_at_value (int value);

View File

@ -2,7 +2,7 @@
* * * *
* Gem-graph client * * Gem-graph client *
* * * *
* Signals header * * Callbacks header *
* * * *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> * * Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> * * Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
@ -31,21 +31,21 @@
#pragma once #pragma once
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
// on_windows_activation (app) is in 'init.c' (not 'signal.c') for simplicity // void on_auto_notification (const char *message);
void on_windows_activation (GtkApplication *app, gpointer user_data); void on_windows_activation (GtkApplication *app, gpointer user_data);
// all other callbacks are in 'signal.c'
void on_toggle_exec_edit (GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data); void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data);
void on_toggle_state_rules_data (GtkWidget *btt_STATE_RULES_DATA, gpointer user_data); void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data);
//void on_toggle_model_run_stop (GtkWidget *btt_MODEL_RUN_STOP, gpointer data); void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data);
//void on_open_state (GtkWidget *btt_open_STATE, gpointer data); void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data);
//void on_open_rules (GtkWidget *btt_open_RULES, gpointer data); void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data);
//void on_open_data (GtkWidget *btt_open_DATA, gpointer data); 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_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_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data);
void on_setup_user_menu_factory (GtkSignalListItemFactory *factory, void on_setup_user_menu_factory (GtkSignalListItemFactory *factory,
@ -66,17 +66,15 @@ void on_glarea_unrealize (GtkWidget *widget);
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data); void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
void on_objects_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar);
void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar);
void on_clicked_home (GtkWidget *btt_reset, gpointer data); void on_clicked_HOME (GtkWidget *btt_reset, gpointer data);
//void on_clicked_MENU_list_box (GtkWidget *btt_reset, gpointer data); //void on_clicked_MENU_list_box (GtkWidget *btt_reset, gpointer data);
//void on_clicked_MENU_pop (GtkWidget *btt_reset, gpointer data); //void on_clicked_MENU_pop (GtkWidget *btt_reset, gpointer data);
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box); void on_clicked_search (GtkWidget *btt_menu, gpointer list_box);
void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box); void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box);
// void on_auto_notification (const char *message);

View File

@ -40,36 +40,43 @@
void widget_create_windows (GtkApplication *app); void widget_create_windows (GtkApplication *app);
void widget_design_main_window (GtkWindow *main_window); void widget_create_main_window (GtkApplication *app);
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window); void widget_create_dialog_window (GtkApplication *app);
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window); void widget_create_text_window (GtkApplication *app);
void *widget_get_main_window(); void widget_topbar_design_main_window (GtkWindow *main_window);
void *widget_get_dialog_window(); void widget_topbar_design_dialog_window (GtkWindow *main_window,
void *widget_get_text_window(); GtkWindow *dialog_window);
void widget_topbar_design_text_window (GtkWindow *main_window,
GtkWindow *text_window);
void *widget_topbar_get_main_window();
void *widget_topbar_get_dialog_window();
void *widget_topbar_get_text_window();
/******************************************************************************/ /******************************************************************************/
/* W I D G E T S */ /* W I D G E T S */
/******************************************************************************/ /******************************************************************************/
void *widget_get_state_page(); GtkWidget *widget_rec_state_page();
void *widget_get_rules_page(); GtkWidget *widget_rec_rules_page();
void *widget_get_stock_page(); GtkWidget *widget_rec_stock_page();
void widget_reset_all_objects_transparencies_to_value (int value); void reset_all_objects_transparencies_to_value (int value);
void widget_reset_all_situations_transparencies_to_value (int value); void reset_all_situations_transparencies_to_value (int value);
void *widget_get_stock_text (gchar *text_name); GtkWidget *widget_rec_stock_text (gchar *text_name);
/******************************************************************************/ /******************************************************************************/
/* M E N U */ /* M E N U */
/******************************************************************************/ /******************************************************************************/
//struct MenuNode_t {gchar *text; struct MenuNode_t *child, *next;}; struct MenuNode_t {gchar *text; struct MenuNode_t *child, *next;};
//struct MenuNode_t *widget_create_user_menu_node (const gchar* text); struct MenuNode_t *widget_create_user_menu_node (const gchar* text);
GtkWidget *widget_rec_menu_anchor();
/******************************************************************************/ /******************************************************************************/
@ -80,37 +87,37 @@ struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;};
struct TreeNode_t *widget_create_user_tree_node (const gchar* text); struct TreeNode_t *widget_create_user_tree_node (const gchar* text);
void widget_add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child); void widget_add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child);
void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
void *widget_get_user_rules_tree (); GtkScrolledWindow *widget_rec_user_rules_tree ();
/******************************************************************************/ /******************************************************************************/
/* I M A G E S */ /* I M A G E S */
/******************************************************************************/ /******************************************************************************/
// images are in : data / image / // images are in : data / image /
// functions are in : widget / stock.c
void *widget_get_image_E_coli(); GtkWidget *widget_rec_image_E_coli();
void *widget_get_image_glutamate(); GtkWidget *widget_rec_image_GLUTAMATE();
void *widget_get_image_glutamine(); GtkWidget *widget_rec_image_GLUTAMINE();
void *widget_get_image_ATP(); GtkWidget *widget_rec_image_ATP();
void *widget_get_image_AMP(); GtkWidget *widget_rec_image_AMP();
/******************************************************************************/ /******************************************************************************/
/* T E X T S */ /* T E X T S */
/******************************************************************************/ /******************************************************************************/
// texts are in : data / text / // texts are in : data / text /
// functions are in : widget / stock.c
char *widget_get_text_address_theory (); gchar *widget_rec_text_address_theory ();
char *widget_get_text_address_about_commands (); gchar *widget_rec_text_address_about_commands ();
char *widget_get_text_address_any (); gchar *widget_rec_text_address_any ();
/******************************************************************************/ /******************************************************************************/
/* L A B O */ /* L A B O */
/******************************************************************************/ /******************************************************************************/
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root); void learning_how_to_create_a_menu (GtkMenuButton* menu_button);
void labo_create_a_simple_gtk_string_list ();

View File

@ -49,7 +49,7 @@ static int choice_SITUATIONS_box_RESET_VALUE = 0;
static void debug_printing (int value, int sub_automaton); static void debug_printing (int value, int sub_automaton);
void fsm_set_exec_edit (int value) void fsm_set_EXEC_EDIT (int value)
{ {
if (choice_EXEC_EDIT != value) { if (choice_EXEC_EDIT != value) {
debug_printing (value, 0); // EXEC_EDIT is sub_automaton 0 debug_printing (value, 0); // EXEC_EDIT is sub_automaton 0
@ -57,7 +57,7 @@ void fsm_set_exec_edit (int value)
} }
} }
void fsm_set_state_rules_data (int value) void fsm_set_STATE_RULES_DATA (int value)
{ {
if (choice_STATE_RULES_DATA != value) { if (choice_STATE_RULES_DATA != value) {
debug_printing (value, 1); // STATE_RULES_DATA is sub_automaton 1 debug_printing (value, 1); // STATE_RULES_DATA is sub_automaton 1
@ -73,7 +73,7 @@ void fsm_reset_all_objects_transparencies_at_value (int value)
debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2 debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
choice_OBJECTS_box_RESET_VALUE = value; choice_OBJECTS_box_RESET_VALUE = value;
widget_reset_all_objects_transparencies_to_value (value); reset_all_objects_transparencies_to_value (value);
} }
void fsm_reset_all_situations_transparencies_at_value (int value) void fsm_reset_all_situations_transparencies_at_value (int value)
@ -84,10 +84,10 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
debug_printing (value, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3 debug_printing (value, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3
choice_SITUATIONS_box_RESET_VALUE = value; choice_SITUATIONS_box_RESET_VALUE = value;
widget_reset_all_situations_transparencies_to_value (value); reset_all_situations_transparencies_to_value (value);
} }
void fsm_set_situations_box_reset_value (int value) void fsm_set_SITUATIONS_box_RESET_VALUE (int value)
{ {
if (choice_SITUATIONS_box_RESET_VALUE != value) { if (choice_SITUATIONS_box_RESET_VALUE != value) {
debug_printing (value, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3 debug_printing (value, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3
@ -95,10 +95,10 @@ void fsm_set_situations_box_reset_value (int value)
} }
} }
int fsm_get_exec_edit () {return choice_EXEC_EDIT;} int fsm_get_EXEC_EDIT () {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;} int fsm_get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;}
int fsm_get_objects_box_reset_value () {return choice_OBJECTS_box_RESET_VALUE;} int fsm_get_OBJECTS_box_RESET_VALUE () {return choice_OBJECTS_box_RESET_VALUE;}
int fsm_get_situations_box_reset_value () {return choice_SITUATIONS_box_RESET_VALUE;} int fsm_get_SITUATIONS_box_RESET_VALUE () {return choice_SITUATIONS_box_RESET_VALUE;}
/******************************************************************************/ /******************************************************************************/
@ -124,11 +124,11 @@ static void debug_printing (int value, int sub_automaton)
tab_0 [choice_EXEC_EDIT], tab_0 [choice_EXEC_EDIT],
tab_1 [value]); tab_1 [value]);
break; break;
case (2) : printf("fsm_set_objects_box_reset_value : %3d > %3d\n", case (2) : printf("fsm_set_OBJECTS_box_RESET_VALUE : %3d > %3d\n",
fsm_get_objects_box_reset_value(), value); fsm_get_OBJECTS_box_RESET_VALUE(), value);
break; break;
case (3) : printf("fsm_set_situations_box_reset_value : %3d > %3d\n", case (3) : printf("fsm_set_SITUATIONS_box_RESET_VALUE : %3d > %3d\n",
fsm_get_situations_box_reset_value(), value); fsm_get_SITUATIONS_box_RESET_VALUE(), value);
break; break;
default : printf("default in automaton.debug_printing()\n"); default : printf("default in automaton.debug_printing()\n");
} }

View File

@ -146,6 +146,7 @@ int main (int argc, char **argv)
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
if (0) widget_create_windows (app); // < Erreur de segmentation
status = g_application_run (G_APPLICATION (app), argc, argv); status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app); g_object_unref (app);

View File

@ -2,7 +2,7 @@
* * * *
* Gem-graph client * * Gem-graph client *
* * * *
* Signals * * Callbacks header *
* * * *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> * * Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> * * Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
@ -56,6 +56,23 @@ static void on_auto_notification (const char *message)
} }
void on_windows_activation (GtkApplication *app,
gpointer no_user_data)
{
widget_create_main_window (app);
widget_topbar_design_main_window (GTK_WINDOW (widget_topbar_get_main_window ()));
widget_create_dialog_window (app);
widget_topbar_design_dialog_window (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WINDOW (widget_topbar_get_dialog_window()));
widget_create_text_window (app);
widget_topbar_design_text_window (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WINDOW (widget_topbar_get_text_window()));
}
/******************************************************************************/ /******************************************************************************/
/* T R E E */ /* T R E E */
/******************************************************************************/ /******************************************************************************/
@ -199,26 +216,26 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
/* D I A L O G W I D G E T S */ /* D I A L O G W I D G E T S */
/******************************************************************************/ /******************************************************************************/
void on_save_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL, void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
gpointer data) gpointer data)
{ {
gtk_widget_set_sensitive (GTK_WIDGET (data), gtk_widget_set_sensitive (GTK_WIDGET (data),
TRUE); TRUE);
printf ("signal.c - SAVE_CURRENT_MODEL_BEFORE_EDITING\n"); printf ("callback.c - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
} }
void on_discard_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL, void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
gpointer data) gpointer data)
{ {
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
printf ("signal.c - DISCARD_CURRENT_MODEL_AND_START_EDITING\n"); printf ("callback.c - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
} }
void on_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL, void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL,
gpointer data) gpointer data)
{ {
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
printf ("signal.c - WRITE_CURRENT_MODEL\n"); printf ("callback.c - WRITE_CURRENT_MODEL\n");
} }
@ -227,37 +244,37 @@ void on_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL,
/* S T A T E W I D G E T */ /* S T A T E W I D G E T */
/******************************************************************************/ /******************************************************************************/
static void switch_state_rules_data() static void switch_STATE_RULES_DATA()
{ {
switch (fsm_get_state_rules_data()) { switch (fsm_get_STATE_RULES_DATA()) {
case (STATE) : case (STATE) :
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WIDGET (widget_get_state_page())); GTK_WIDGET (widget_rec_state_page()));
break; break;
case (RULES) : case (RULES) :
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WIDGET (widget_get_rules_page())); GTK_WIDGET (widget_rec_rules_page()));
break; break;
case (DATA) : case (DATA) :
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WIDGET (widget_get_stock_page())); GTK_WIDGET (widget_rec_stock_page()));
break; break;
default : default :
printf("default in signal.on_toggle_state_rule_data()\n"); printf("default in callback.on_toggle_STATE_RULES_DATA()\n");
} }
} }
void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data) void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
{ {
if (fsm_get_exec_edit ()) { if (fsm_get_EXEC_EDIT ()) {
gtk_button_set_icon_name (GTK_BUTTON (toggled_button), gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
"power-profile-balanced-rtl-symbolic"); "power-profile-balanced-rtl-symbolic");
fsm_set_exec_edit (EXEC); fsm_set_EXEC_EDIT (EXEC);
} else { } else {
@ -265,45 +282,44 @@ void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
"text-editor-symbolic"); "text-editor-symbolic");
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30 // https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
// gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); // works once only ! // gtk_window_present (GTK_WINDOW (widget_topbar_get_dialog_window())); // works once only !
fsm_set_exec_edit (EDIT); fsm_set_EXEC_EDIT (EDIT);
} }
switch_state_rules_data(); switch_STATE_RULES_DATA();
} }
// TODO Il doit y avoir plus élégant,... void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data)
void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
{ {
const char *toggled_button_name const char *toggled_button_name
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button)); = gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button)); int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
if (! strcmp (toggled_button_name, "state")) { if (! strcmp (toggled_button_name, "state")) {
fsm_set_state_rules_data (STATE); fsm_set_STATE_RULES_DATA (STATE);
} }
if (! strcmp (toggled_button_name, "rules")) { if (! strcmp (toggled_button_name, "rules")) {
fsm_set_state_rules_data (RULES); fsm_set_STATE_RULES_DATA (RULES);
} }
if (! strcmp (toggled_button_name, "data analysis")) { if (! strcmp (toggled_button_name, "data analysis")) {
fsm_set_state_rules_data (DATA); fsm_set_STATE_RULES_DATA (DATA);
} }
if (is_active) { if (is_active) {
switch_state_rules_data(); switch_STATE_RULES_DATA();
} }
} }
void on_objects_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{ {
GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar);
fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj)); fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj));
} }
void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{ {
GtkAdjustment *adj_situ = gtk_scrollbar_get_adjustment (reset_scrollbar); GtkAdjustment *adj_situ = gtk_scrollbar_get_adjustment (reset_scrollbar);
fsm_reset_all_situations_transparencies_at_value (gtk_adjustment_get_value (adj_situ)); fsm_reset_all_situations_transparencies_at_value (gtk_adjustment_get_value (adj_situ));
@ -317,14 +333,14 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) { void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO // next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_get_text_window())); gtk_window_present (GTK_WINDOW (widget_topbar_get_text_window()));
} }
void on_clicked_home (GtkWidget *btt_reset, gpointer data) void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
{ {
printf ("signal.on_clicked_HOME() button presents the dialog_window\ printf ("callback.on_clicked_HOME() button presents the dialog_window\
( :- ) but it works only once.\n"); // TODO ( :- ) but it works only once.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); gtk_window_present (GTK_WINDOW (widget_topbar_get_dialog_window()));
} }
@ -356,14 +372,14 @@ void on_clicked_home (GtkWidget *btt_reset, gpointer data)
/******************************************************************************/ /******************************************************************************/
void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box) { void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box) {
printf ("signal.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box); printf ("callback.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box);
// gpointer list_box = gtk_popover_get_child (GTK_POPOVER (pop)); // gpointer list_box = gtk_popover_get_child (GTK_POPOVER (pop));
/* /*
if (gtk_list_box_get_row_at_index (list_box, 3)) if (gtk_list_box_get_row_at_index (list_box, 3))
printf ("signal.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box); printf ("callback.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box);
else printf ("signal.on_clicked_MENU() button > in list_box are the three buttons : %s, %s, %s\n\ else printf ("callback.on_clicked_MENU() button > in list_box are the three buttons : %s, %s, %s\n\
and now : how to display these three buttons (and make use of them) ? 2024-07-13 (20h)\n",\ and now : how to display these three buttons (and make use of them) ? 2024-07-13 (20h)\n",\
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 0)))), gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 0)))),
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 1)))), gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 1)))),

View File

@ -38,21 +38,28 @@
static GtkWindow *main_window, *dialog_window, *text_window; static GtkWindow *main_window, *dialog_window, *text_window;
void *widget_get_main_window() { return main_window; } void *widget_topbar_get_main_window() { return main_window; }
void *widget_get_dialog_window() { return dialog_window; } void *widget_topbar_get_dialog_window() { return dialog_window; }
void *widget_get_text_window() { return text_window; } void *widget_topbar_get_text_window() { return text_window; }
void on_windows_activation (GtkApplication *app) void widget_create_windows (GtkApplication *app)
{ {
// g_application_activate (G_APPLICATION (app)); < how ? > in main.c is
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
main_window = GTK_WINDOW (gtk_application_window_new (app)); main_window = GTK_WINDOW (gtk_application_window_new (app));
dialog_window = GTK_WINDOW (gtk_application_window_new (app)); dialog_window = GTK_WINDOW (gtk_application_window_new (app));
text_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app));
widget_design_main_window (main_window); widget_topbar_design_main_window (main_window);
widget_design_dialog_window (main_window, dialog_window); widget_topbar_design_dialog_window (main_window, dialog_window);
widget_design_text_window (main_window, text_window); widget_topbar_design_text_window (main_window, text_window);
} }
void widget_create_main_window (GtkApplication *app)
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_create_dialog_window (GtkApplication *app)
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_create_text_window (GtkApplication *app)
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }

View File

@ -68,11 +68,20 @@
/* C O N T A I N E R S */ /* C O N T A I N E R S */
/******************************************************************************/ /******************************************************************************/
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
// https://iconduck.com/sets/adwaita-icon-theme
// https://iconduck.com/sets/carbon-icons
// https://docs.gtk.org/gtk4/section-text-widget.html
// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
// https://docs.gtk.org/gtk4/class.TextView.html
// https://docs.gtk.org/gtk4/class.TextBuffer.html
// https://docs.gtk.org/gtk3/method.TextIter.get_text.html
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL // GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) { void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
struct TreeNode_t *a = widget_create_user_tree_node("We, the people");widget_add_child_node(tree_root, a); struct TreeNode_t *a = widget_create_user_tree_node("We, the people");widget_add_child_node(tree_root, a);
struct TreeNode_t *b = widget_create_user_tree_node("in Order to"); widget_add_child_node(tree_root, b); struct TreeNode_t *b = widget_create_user_tree_node("in Order to"); widget_add_child_node(tree_root, b);
struct TreeNode_t *c = widget_create_user_tree_node("do establish"); widget_add_child_node(tree_root, c); struct TreeNode_t *c = widget_create_user_tree_node("do establish"); widget_add_child_node(tree_root, c);
@ -104,6 +113,14 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
struct TreeNode_t *cc = widget_create_user_tree_node("access"); widget_add_child_node(c, cc); struct TreeNode_t *cc = widget_create_user_tree_node("access"); widget_add_child_node(c, cc);
} }
void labo_create_a_simple_gtk_string_list () {
char *array[] = {"one", "two", "three", "four", NULL};
GtkStringList *list = gtk_string_list_new ((const char * const *) array);
for (int i = 0; i < 4; i++)
printf ("in labo.a_simple_gtk_string_list() > list [%d + 1] = %s\n",\
i,
gtk_string_list_get_string (list, i));
}
/* /*
"rule effect" "rule effect"
@ -145,16 +162,6 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
*/ */
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
// https://iconduck.com/sets/adwaita-icon-theme
// https://iconduck.com/sets/carbon-icons
// https://docs.gtk.org/gtk4/section-text-widget.html
// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
// https://docs.gtk.org/gtk4/class.TextView.html
// https://docs.gtk.org/gtk4/class.TextBuffer.html
// https://docs.gtk.org/gtk3/method.TextIter.get_text.html
/* https://iconduck.com/sets/adwaita-icon-theme /* https://iconduck.com/sets/adwaita-icon-theme
https://iconduck.com/sets/carbon-icons < pas mal ... https://iconduck.com/sets/carbon-icons < pas mal ...

View File

@ -40,14 +40,14 @@ static GtkWidget *rec_selected_rules_vpaned_new() {
gtk_paned_set_shrink_end_child (EXEC_CONTROLS_pane, FALSE); gtk_paned_set_shrink_end_child (EXEC_CONTROLS_pane, FALSE);
GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (up_box, GTK_WIDGET (widget_get_image_glutamate())); gtk_box_append (up_box, GTK_WIDGET (widget_rec_image_GLUTAMATE()));
gtk_box_append (up_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (up_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (up_box, GTK_WIDGET (widget_get_image_glutamine())); gtk_box_append (up_box, GTK_WIDGET (widget_rec_image_GLUTAMINE()));
GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (bottom_box, GTK_WIDGET (widget_get_image_ATP())); gtk_box_append (bottom_box, GTK_WIDGET (widget_rec_image_ATP()));
gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (bottom_box, GTK_WIDGET (widget_get_image_AMP())); gtk_box_append (bottom_box, GTK_WIDGET (widget_rec_image_AMP()));
gtk_paned_set_start_child (EXEC_CONTROLS_pane, GTK_WIDGET (up_box)); gtk_paned_set_start_child (EXEC_CONTROLS_pane, GTK_WIDGET (up_box));
gtk_paned_set_end_child (EXEC_CONTROLS_pane, GTK_WIDGET (bottom_box)); gtk_paned_set_end_child (EXEC_CONTROLS_pane, GTK_WIDGET (bottom_box));
@ -58,13 +58,13 @@ static GtkWidget *rec_selected_rules_vpaned_new() {
static GtkBox *rec_rules_comparator_new(){ static GtkBox *rec_rules_comparator_new(){
GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_widget_set_size_request (GTK_WIDGET (comparator), W_IMAGE_LOCAL, H_IMAGE_LOCAL); gtk_widget_set_size_request (GTK_WIDGET (comparator), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
gtk_box_append (comparator, GTK_WIDGET (widget_get_image_ATP())); gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_ATP()));
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (comparator, GTK_WIDGET (widget_get_image_AMP())); gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_AMP()));
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (comparator, GTK_WIDGET (widget_get_image_glutamate())); gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_GLUTAMATE()));
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (comparator, GTK_WIDGET (widget_get_image_glutamine())); gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_GLUTAMINE()));
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (comparator, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png"))); gtk_box_append (comparator, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png")));
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
@ -80,8 +80,8 @@ static GtkWidget *rec_rules_tree_hpaned_new(){
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre"); // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection"); // GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
// GTK_SCROLLED_WINDOW
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_get_user_rules_tree())); gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_rec_user_rules_tree()));
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (rec_rules_comparator_new())); gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (rec_rules_comparator_new()));
gtk_paned_set_position (H_tree_vs_comparison, 300); gtk_paned_set_position (H_tree_vs_comparison, 300);
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE); gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE);
@ -91,7 +91,7 @@ static GtkWidget *rec_rules_tree_hpaned_new(){
return GTK_WIDGET (H_tree_vs_comparison); return GTK_WIDGET (H_tree_vs_comparison);
} }
void *widget_get_rules_page() { GtkWidget *widget_rec_rules_page() {
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); 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 *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"); // GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");

View File

@ -67,8 +67,7 @@ static GtkBox *rec_XYZ_box()
gtk_box_append (XYZ_scrollbar_box, scroll_Z); gtk_box_append (XYZ_scrollbar_box, scroll_Z);
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
GtkWidget *btt_reset = gtk_toggle_button_new (); GtkWidget *btt_reset = gtk_toggle_button_new_with_label ("reset");
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset));
@ -91,7 +90,7 @@ static GtkBox *rec_ZOOM_box()
static GtkScrollbar *object_bar [n_objects]; static GtkScrollbar *object_bar [n_objects];
static GtkAdjustment *object_adjust [n_objects]; static GtkAdjustment *object_adjust [n_objects];
void widget_reset_all_objects_transparencies_to_value (int value) void reset_all_objects_transparencies_to_value (int value)
{ {
for (int i = 0; i < n_objects; i++) for (int i = 0; i < n_objects; i++)
if (value > -1) if (value > -1)
@ -108,7 +107,7 @@ static GtkBox *rec_OBJECTS_box()
gtk_box_append (objects_box, GTK_WIDGET (reset_scrollbar)); gtk_box_append (objects_box, GTK_WIDGET (reset_scrollbar));
GtkWidget *btt_reset = gtk_toggle_button_new (); GtkWidget *btt_reset = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_objects_box_do_reset), reset_scrollbar); g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_OBJECTS_box_DO_RESET), reset_scrollbar);
gtk_box_append (objects_box, btt_reset); gtk_box_append (objects_box, btt_reset);
// GtkAdjustment *object_adjust [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size) // GtkAdjustment *object_adjust [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size)
@ -127,7 +126,7 @@ static GtkBox *rec_OBJECTS_box()
gtk_box_append (objects_box, GTK_WIDGET (object_bar [i])); gtk_box_append (objects_box, GTK_WIDGET (object_bar [i]));
} }
widget_reset_all_objects_transparencies_to_value (-1); reset_all_objects_transparencies_to_value (-1);
return objects_box; return objects_box;
} }
@ -135,7 +134,7 @@ static GtkBox *rec_OBJECTS_box()
static GtkScrollbar *situation_bar [n_situations]; static GtkScrollbar *situation_bar [n_situations];
static GtkAdjustment *situation_adjust [n_situations]; static GtkAdjustment *situation_adjust [n_situations];
void widget_reset_all_situations_transparencies_to_value (int value) void reset_all_situations_transparencies_to_value (int value)
{ {
for (int i = 0; i < n_situations; i++) for (int i = 0; i < n_situations; i++)
if (value > -1) if (value > -1)
@ -152,7 +151,7 @@ static GtkBox *rec_SITUATIONS_box()
gtk_box_append (situations_box, GTK_WIDGET (reset_scrollbar)); gtk_box_append (situations_box, GTK_WIDGET (reset_scrollbar));
GtkWidget *btt_reset = gtk_toggle_button_new (); GtkWidget *btt_reset = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_situations_box_do_reset), reset_scrollbar); g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_SITUATIONS_box_DO_RESET), reset_scrollbar);
gtk_box_append (situations_box, btt_reset); gtk_box_append (situations_box, btt_reset);
for (int i = 0; i < n_situations; i++) for (int i = 0; i < n_situations; i++)
@ -173,7 +172,7 @@ static GtkBox *rec_SITUATIONS_box()
gtk_box_append (situations_box, GTK_WIDGET (situation_bar [i])); gtk_box_append (situations_box, GTK_WIDGET (situation_bar [i]));
} }
widget_reset_all_situations_transparencies_to_value (-1); reset_all_situations_transparencies_to_value (-1);
return situations_box; return situations_box;
} }
@ -219,7 +218,7 @@ static GtkWidget *rec_SPACE_VIEW_box()
GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
// TODO // TODO
gtk_box_append (central_box, GTK_WIDGET (widget_get_image_E_coli())); gtk_box_append (central_box, GTK_WIDGET (widget_rec_image_E_coli()));
// ui_setup_glarea (0, GTK_WIDGET (central_box)); // ui_setup_glarea (0, GTK_WIDGET (central_box));
gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
@ -270,14 +269,14 @@ static GtkWidget *rec_SEQUENCE_CONTROL_box()
* - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations * - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations
* afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */ * afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */
void *widget_get_state_page() GtkWidget *widget_rec_state_page()
{ {
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 (rec_OBJECTS_and_SITUATIONS())); gtk_box_append (page_box, GTK_WIDGET (rec_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)));
gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_VIEW_box())); gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_VIEW_box()));
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)));
if (fsm_get_exec_edit ()) gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_EDIT_CONTROL_box())); if (fsm_get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_EDIT_CONTROL_box()));
else gtk_box_append (page_box, GTK_WIDGET (rec_SEQUENCE_CONTROL_box())); else gtk_box_append (page_box, GTK_WIDGET (rec_SEQUENCE_CONTROL_box()));
return GTK_WIDGET (page_box); return GTK_WIDGET (page_box);
} }

View File

@ -31,7 +31,7 @@
#include "../../include/signal.h" #include "../../include/signal.h"
#include "../../include/widget.h" #include "../../include/widget.h"
void *widget_get_stock_page () { GtkWidget *widget_rec_stock_page () {
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32)); GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect"); GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
@ -64,7 +64,7 @@ void *widget_get_stock_page () {
return GTK_WIDGET (data_box); return GTK_WIDGET (data_box);
} }
void *widget_get_stock_text (gchar *text_address) { GtkWidget *widget_rec_stock_text (gchar *text_address) {
GtkWidget *view = gtk_text_view_new (); GtkWidget *view = gtk_text_view_new ();
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, read_file (text_address), -1); gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
@ -85,15 +85,15 @@ void *widget_get_stock_text (gchar *text_address) {
/* T E X T S */ /* T E X T S */
/******************************************************************************/ /******************************************************************************/
char *widget_get_text_address_theory () { gchar *widget_rec_text_address_theory () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt"; return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
} }
char *widget_get_text_address_about_commands () { gchar *widget_rec_text_address_about_commands () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt"; return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
} }
char *widget_get_text_address_any () { gchar *widget_rec_text_address_any () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt"; return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
} }
@ -103,31 +103,31 @@ char *widget_get_text_address_any () {
/* I M A G E S */ /* I M A G E S */
/******************************************************************************/ /******************************************************************************/
void *widget_get_image_E_coli(){ GtkWidget *widget_rec_image_E_coli(){
GtkWidget *image = gtk_picture_new_for_filename GtkWidget *image = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png");
return image; return image;
} }
void *widget_get_image_glutamate(){ GtkWidget *widget_rec_image_GLUTAMATE(){
GtkWidget *image = gtk_picture_new_for_filename GtkWidget *image = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png");
return image; return image;
} }
void *widget_get_image_glutamine(){ GtkWidget *widget_rec_image_GLUTAMINE(){
GtkWidget *image = gtk_picture_new_for_filename GtkWidget *image = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png");
return image; return image;
} }
void *widget_get_image_ATP(){ GtkWidget *widget_rec_image_ATP(){
GtkWidget *image = gtk_picture_new_for_filename GtkWidget *image = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png");
return image; return image;
} }
void *widget_get_image_AMP(){ GtkWidget *widget_rec_image_AMP(){
GtkWidget *image = gtk_picture_new_for_filename GtkWidget *image = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png");
return image; return image;

View File

@ -43,15 +43,15 @@ static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
/* T E X T W I N D O W */ /* T E X T W I N D O W */
/******************************************************************************/ /******************************************************************************/
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window) void widget_topbar_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
{ {
char *title = " Learn more about Gem Graph. "; char *title = " Learn more about Gem Graph. ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); 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_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
gtk_window_set_titlebar (text_window, header_bar); gtk_window_set_titlebar (text_window, header_bar);
GtkWidget *child = widget_get_stock_text (widget_get_text_address_theory()); GtkWidget *child = widget_rec_stock_text (widget_rec_text_address_theory());
child = widget_get_stock_text (widget_get_text_address_about_commands()); child = widget_rec_stock_text (widget_rec_text_address_about_commands());
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child)); gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW); gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
@ -66,7 +66,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
/* D I A L O G W I N D O W */ /* D I A L O G W I N D O W */
/******************************************************************************/ /******************************************************************************/
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window) void widget_topbar_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
{ {
char *title = " Save the current model before modifying it? "; char *title = " Save the current model before modifying it? ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
@ -79,15 +79,15 @@ void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_wind
GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt)); GtkButton *action_save_current_model = GTK_BUTTON (gtk_button_new_with_label (txt));
gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (action_save_current_model), FALSE);
g_signal_connect (action_save_current_model, "clicked", g_signal_connect (action_save_current_model, "clicked",
G_CALLBACK (on_write_current_model), dialog_window); G_CALLBACK (on_WRITE_CURRENT_MODEL), dialog_window);
GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES")); GtkButton *click_yes = GTK_BUTTON (gtk_button_new_with_label ("YES"));
g_signal_connect (click_yes, "clicked", g_signal_connect (click_yes, "clicked",
G_CALLBACK (on_save_current_model_before_editing), action_save_current_model); G_CALLBACK (on_SAVE_CURRENT_MODEL_BEFORE_EDITING), action_save_current_model);
GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO")); GtkButton *click_no = GTK_BUTTON (gtk_button_new_with_label ("NO"));
g_signal_connect (click_no, "clicked", g_signal_connect (click_no, "clicked",
G_CALLBACK (on_discard_current_model_before_editing), dialog_window); G_CALLBACK (on_DISCARD_CURRENT_MODEL_AND_START_EDITING), dialog_window);
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ; gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_yes), 0, 0, 1, 1) ;
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ; gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (click_no), 1, 0, 1, 1) ;
@ -110,18 +110,16 @@ static GtkWidget *window_header_bar (GtkWindow *window);
static void window_header_bar_left (GtkWidget *header_bar); static void window_header_bar_left (GtkWidget *header_bar);
static void window_header_bar_right (GtkWidget *header_bar); static void window_header_bar_right (GtkWidget *header_bar);
void widget_topbar_design_main_window (GtkWindow *main_window)
void widget_design_main_window (GtkWindow *main_window)
{ {
GtkWidget *header_bar = window_header_bar (main_window); GtkWidget *header_bar = window_header_bar (main_window);
window_header_bar_left (header_bar); window_header_bar_left (header_bar);
window_header_bar_right (header_bar); window_header_bar_right (header_bar);
// next line <=> calls.on_toggle_state_rule_data (btt_STATE) // next line <=> calls.on_toggle_STATE_RULES_DATA (btt_STATE)
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE); gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_STATE), TRUE);
gtk_window_present (GTK_WINDOW (main_window)); gtk_window_present (GTK_WINDOW (main_window));
} }
static GtkWidget *window_header_bar (GtkWindow *window) static GtkWidget *window_header_bar (GtkWindow *window)
{ {
char *title = "E coli (with permission from David S. Goodsell, 2009)"; char *title = "E coli (with permission from David S. Goodsell, 2009)";
@ -144,23 +142,23 @@ static void window_header_bar_left (GtkWidget *header_bar)
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ()); 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");
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-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), no_local_data); g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), no_local_data);
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | ")); GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
GtkCheckButton *group_state_rules_data = GTK_CHECK_BUTTON (gtk_check_button_new ()); GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_state_rules_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_STATE_RULES_DATA);
btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules")); btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_state_rules_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_STATE_RULES_DATA);
btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis")); btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_state_rules_data); gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_STATE_RULES_DATA);
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 (any_Label)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
@ -184,7 +182,7 @@ static void window_header_bar_right (GtkWidget *header_bar)
GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ()); GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (btt_go_home, "go-home-symbolic"); gtk_button_set_icon_name (btt_go_home, "go-home-symbolic");
g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data); g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home)); gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home));
GtkButton *search = GTK_BUTTON (gtk_button_new ()); GtkButton *search = GTK_BUTTON (gtk_button_new ());
@ -289,4 +287,3 @@ static void window_header_bar_right (GtkWidget *header_bar)
// gtk_button_set_icon_name (search, "preferences-desktop-appearance-symbolic"); // gtk_button_set_icon_name (search, "preferences-desktop-appearance-symbolic");
// gtk_button_set_icon_name (search, "applications-utilities-symbolic"); // gtk_button_set_icon_name (search, "applications-utilities-symbolic");

View File

@ -83,10 +83,10 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
return get_user_tree_model_child (cur); return get_user_tree_model_child (cur);
} }
void *widget_get_user_rules_tree () GtkScrolledWindow *widget_rec_user_rules_tree ()
{ {
struct TreeNode_t *tree_root = widget_create_user_tree_node("root"); struct TreeNode_t *tree_root = widget_create_user_tree_node("root");
widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); labo_let_us_create_a_complex_useless_and_expensive_tree (tree_root);
GtkStringList *model = gtk_string_list_new(NULL); GtkStringList *model = gtk_string_list_new(NULL);
gtk_string_list_append (model, tree_root->text); gtk_string_list_append (model, tree_root->text);