From a7e83aee300bffcee9d06678823b5609e3be0f45 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 5 Jul 2024 10:23:19 +0200 Subject: [PATCH] WIP: cleaning (stock, labo) --- include/base.h | 11 -- include/widgets.h | 45 ++++----- src/widget.c/labo.c | 232 +++++++++++-------------------------------- src/widget.c/rules.c | 20 ---- src/widget.c/state.c | 6 +- src/widget.c/stock.c | 52 ++++++++-- 6 files changed, 125 insertions(+), 241 deletions(-) diff --git a/include/base.h b/include/base.h index dad7186..866e2fe 100644 --- a/include/base.h +++ b/include/base.h @@ -131,14 +131,3 @@ static inline char *read_file(char *filename) return contents; } - -/******************************************************************************/ -/* T E X T S */ -/******************************************************************************/ -// texts will be in : data / text / -// (previously in : widget / stock) - -gchar *get_text_address_THEORY (); -gchar *get_text_address_ABOUT_COMMANDS (); -gchar *get_text_address_ANY (); - diff --git a/include/widgets.h b/include/widgets.h index c9e6260..4933386 100644 --- a/include/widgets.h +++ b/include/widgets.h @@ -62,31 +62,26 @@ GtkScrolledWindow *get_user_rules_tree (); void icons_for_fun (GtkHeaderBar *header_bar); GtkWidget *get_window_child_DATA_lab(); - - - - - - - - - - - - - - - - - - - - - - - - - +/******************************************************************************/ +/* I M A G E S */ +/******************************************************************************/ +// images are in : data / image / + +GtkWidget *get_image_E_coli(); +GtkWidget *get_image_GLUTAMATE(); +GtkWidget *get_image_GLUTAMINE(); +GtkWidget *get_image_ATP(); +GtkWidget *get_image_AMP(); + + +/******************************************************************************/ +/* T E X T S */ +/******************************************************************************/ +// texts are in : data / text / + +gchar *get_text_address_THEORY (); +gchar *get_text_address_ABOUT_COMMANDS (); +gchar *get_text_address_ANY (); diff --git a/src/widget.c/labo.c b/src/widget.c/labo.c index fc11e29..dd80258 100644 --- a/src/widget.c/labo.c +++ b/src/widget.c/labo.c @@ -92,182 +92,68 @@ void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree } - -GtkWidget *get_window_child_DATA_lab () { - if (0) printf("widgets.get_window_child_DATA (line 279)\n"); - 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")); - - return GTK_WIDGET (data_box); -} +/* +"rule effect" +"rule topic" +"data type" +"interpretation" +"discussion" +"game" +"help" +"movement" +"transport" +"transformation" +"objects" +"situations" +"accuracy" +"pattern recognition" +"repartitions" +"evolutions" +"correlations" +"stochastic" +"deterministic" +"physical" +"chemical" +"biological" +"social" +"context" +"methodology" +"comparisons" +"to improve" +"summary" +"single player" +"multiple players" +"edition facilities" +"modelization" +"measurements" +"results" +"data analysis" +"preferences" +*/ -void icons_for_fun (GtkHeaderBar *header_bar) // https://iconduck.com/sets/adwaita-icon-theme -// https://iconduck.com/sets/carbon-icons < pas mal ... -// https://thenounproject.com/icon/train-134324/ -// ma préférée : Transport Steam Engine Icon mais : [ process icon ] semble un bon choix... -{ - GtkButton *go_home = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (go_home, "go-home-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (go_home)); +/* https://iconduck.com/sets/adwaita-icon-theme + https://iconduck.com/sets/carbon-icons < pas mal ... + https://thenounproject.com/icon/train-134324/ +// ma préférée : Transport Steam Engine Icon - GtkButton *user_trash = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (user_trash, "user-trash-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (user_trash)); - - GtkButton *help_biblio = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_biblio, "accessories-dictionary-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_biblio)); - - GtkButton *help_doc = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_doc, "emblem-documents-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_doc)); - - GtkButton *help_about = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_about, "help-about-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_about)); - - GtkButton *help_faq = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (help_faq, "help-faq-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (help_faq)); - - GtkButton *terminal = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (terminal, "utilities-terminal-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (terminal)); - - GtkButton *search = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (search, "folder-saved-search-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (search)); - - GtkButton *preferences_desktop_appearance = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (preferences_desktop_appearance, "preferences-desktop-appearance-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_desktop_appearance)); - - GtkButton *preferences_system = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (preferences_system, "preferences-system-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (preferences_system)); - - GtkButton *document_properties = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (document_properties, "document-properties-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (document_properties)); - - GtkButton *text_edit = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (text_edit, "text-editor-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (text_edit)); - - GtkButton *applications_utilities = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (applications_utilities, "applications-utilities-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (applications_utilities)); - - GtkButton *open_menu = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (open_menu, "open-menu-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (open_menu)); - - GtkButton *power_max = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_max, "power-profile-performance-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_max)); - - GtkButton *power_middle = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_middle, "power-profile-balanced-rtl-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_middle)); - - GtkButton *power_low = GTK_BUTTON (gtk_button_new ()); - gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic"); - gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low)); - -// gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "process-stop-symbolic"); -} + gtk_button_set_icon_name (any, "go-home-symbolic"); + gtk_button_set_icon_name (any, "accessories-dictionary-symbolic"); + gtk_button_set_icon_name (any, "emblem-documents-symbolic"); + gtk_button_set_icon_name (any, "help-about-symbolic"); + gtk_button_set_icon_name (any, "help-faq-symbolic"); + gtk_button_set_icon_name (any, "utilities-terminal-symbolic"); + gtk_button_set_icon_name (any, "folder-saved-search-symbolic"); + gtk_button_set_icon_name (any, "preferences-desktop-appearance-symbolic"); + gtk_button_set_icon_name (any, "preferences-system-symbolic"); + gtk_button_set_icon_name (any, "document-properties-symbolic"); + gtk_button_set_icon_name (any, "text-editor-symbolic"); + gtk_button_set_icon_name (any, "applications-utilities-symbolic"); + gtk_button_set_icon_name (any, "open-menu-symbolic"); + gtk_button_set_icon_name (any, "power-profile-performance-symbolic"); + gtk_button_set_icon_name (any, "power-profile-balanced-rtl-symbolic"); + gtk_button_set_icon_name (any, "power-profile-power-saver-symbolic"); +*/ diff --git a/src/widget.c/rules.c b/src/widget.c/rules.c index 978e800..61eea7b 100644 --- a/src/widget.c/rules.c +++ b/src/widget.c/rules.c @@ -34,26 +34,6 @@ #define W_IMAGE_LOCAL W / 64 #define H_IMAGE_LOCAL H / 64 -static GtkWidget *get_image_GLUTAMATE(){ - GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png"); - return image; -} - -static GtkWidget *get_image_GLUTAMINE(){ - GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png"); - return image; -} - -static GtkWidget *get_image_ATP(){ - GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png"); - return image; -} - -static GtkWidget *get_image_AMP(){ - GtkWidget *image = gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"); - return image; -} - static GtkWidget *get_selected_rules_vpaned_new() { GtkPaned *EXEC_CONTROLS_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); gtk_widget_set_size_request (GTK_WIDGET (EXEC_CONTROLS_pane), W_IMAGE_LOCAL, H_IMAGE_LOCAL); diff --git a/src/widget.c/state.c b/src/widget.c/state.c index 4ba2cfe..84682b9 100644 --- a/src/widget.c/state.c +++ b/src/widget.c/state.c @@ -28,8 +28,8 @@ #include "../../include/base.h" +#include "../../include/widgets.h" #include "../../include/callbacks.h" -//#include "../../include/widgets.h" < usefulness ?? #define W 1920 // TODO 2024-06-30 (Ad hoc pour mon écran) #define H 960 @@ -158,9 +158,7 @@ GtkWidget *get_SPACE_VIEW_box() { GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // TODO - GtkWidget *image = gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"); - gtk_box_append (central_box, GTK_WIDGET (image)); + gtk_box_append (central_box, GTK_WIDGET (get_image_E_coli())); // ui_setup_glarea (0, GTK_WIDGET (central_box)); gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); diff --git a/src/widget.c/stock.c b/src/widget.c/stock.c index badf0ce..a42a4df 100644 --- a/src/widget.c/stock.c +++ b/src/widget.c/stock.c @@ -77,20 +77,56 @@ GtkWidget *widget_get_STOCK_text (gchar *text_address) { return GTK_WIDGET (scrolled_window); } -gchar *get_text_address_THEORY () {return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";} -gchar *get_text_address_ABOUT_COMMANDS () {return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";} -gchar *get_text_address_ANY () {return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";} - - - - - + +/******************************************************************************/ +/* T E X T S */ +/******************************************************************************/ + +gchar *get_text_address_THEORY () { + return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt"; +} + +gchar *get_text_address_ABOUT_COMMANDS () { + return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt"; +} + +gchar *get_text_address_ANY () { + return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt"; +} +/******************************************************************************/ +/* I M A G E S */ +/******************************************************************************/ +GtkWidget *get_image_E_coli(){ + GtkWidget *image = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png"); + return image; +} +GtkWidget *get_image_GLUTAMATE(){ + GtkWidget *image = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png"); + return image; +} +GtkWidget *get_image_GLUTAMINE(){ + GtkWidget *image = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png"); + return image; +} +GtkWidget *get_image_ATP(){ + GtkWidget *image = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png"); + return image; +} +GtkWidget *get_image_AMP(){ + GtkWidget *image = gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"); + return image; +}