diff --git a/(notes) b/(notes) index 8693532..1b6c86f 100644 --- a/(notes) +++ b/(notes) @@ -8,6 +8,7 @@ https://docs.gtk.org/gtk4/section-text-widget.html texts https://docs.gtk.org/gtk4/drag-and-drop.html drag-and-drop https://docs.gtk.org/gtk4/class.GestureZoom.html GtkGestureZoom https://docs.gtk.org/gtk4/class.ListView.html +https://blog.gtk.org/2020/09/08/on-list-models/ < TODO -------------------------------------------------------------------------------- @@ -113,6 +114,10 @@ GtkScrolledWindow *get_scrolled_gl_area(){ +//typedef anytype = {(int)(*fnct) {printf("typedef {(int)(*fnct) {printf("");}");} GtkModelFnct; + + + diff --git a/callback.h b/callback.h index 729a1a2..3b19d68 100644 --- a/callback.h +++ b/callback.h @@ -1,18 +1,30 @@ #include + void ui_main_window (GtkApplication *app, gpointer user_data); -void ui_enable_action (const char *name); -void ui_disable_action (const char *name); +void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data); +void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data); + +void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data); +void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data); + + + + + +/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + S I M P L I F I O N S ! + + +//void ui_enable_action (const char *name); +//void ui_disable_action (const char *name); // https://docs.gtk.org/gio/method.ActionMap.add_action_entries.html // A function for creating multiple GSimpleAction instances and adding them to a GActionMap. // @see application . gem_graph_client_application_init (GemGraphClientApplication *self) { // g_action_map_add_action_entries (G_ACTION_MAP(self), app_actions, G_N_ELEMENTS(app_actions), self); ... -void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data); -void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data); - void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data); void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data); void on_preferences_action (GSimpleAction *action, GVariant *parameter, gpointer user_data); @@ -45,6 +57,4 @@ static const GActionEntry app_actions[] = { { "savefile", on_savefile_action, NULL, NULL, NULL }, { "toastclose", on_toast_close_action, NULL, NULL, NULL }, }; - -void on_user_tree_expander_toggled(GtkExpander *expander, gpointer user_data); -void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data); +*/ diff --git a/contain.c b/contain.c index ee0244a..4e4a193 100644 --- a/contain.c +++ b/contain.c @@ -11,11 +11,7 @@ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery -//typedef anytype = {(int)(*fnct) {printf("typedef {(int)(*fnct) {printf("");}");} GtkModelFnct; - - - -GtkFrame *get_frame_with_label(){ // EN ATTENDANT DE SAVOIR UTILISER : GtkTextTagTable et GtkTextBuffer +GtkFrame *get_frame_with_label(){ // EN ATTENDANT DE SAVOIR UTILISER : GtkTextTagTable , GtkTextBuffer GtkFrame *space_specif = GTK_FRAME(gtk_frame_new ("Space (run / edit) specifications")); GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (get_space_run_edit_specif())); gtk_frame_set_child (GTK_FRAME (space_specif), GTK_WIDGET (any_Label)); @@ -88,10 +84,6 @@ GtkWidget *get_run_help_page_new(){ return run_help_grid; } -/* -GtkWidget *get_run_rules_page_new(){ @see hot.c 2024-05-11 } (line 166) -*/ - GtkWidget *get_edit_space_page_new(){ GtkWidget *space_grid = gtk_grid_new(); gtk_grid_attach (GTK_GRID(space_grid), get_image_ALL_SPACE(), 0, 0, 1, 3); @@ -100,8 +92,6 @@ GtkWidget *get_edit_space_page_new(){ gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET (get_ZOOM_box()), 1, 2, 1, 2); gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET (get_edit_TOOL_box()), 1, 3, 1, 2); gtk_widget_set_size_request (space_grid, W, H); -// How to use gtk_separators ? -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)), 1, 1, 1, 1); return space_grid; } @@ -110,19 +100,11 @@ GtkWidget *get_edit_space_page_new(){ GtkWidget *get_selected_rules_vpaned_new(){ GtkPaned *V_selected_1_vs_2 = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); -// GtkWidget *règle_sélectionnée_n_1 = gtk_frame_new ("(1)"); -// GtkWidget *règle_sélectionnée_n_2 = gtk_frame_new ("(2)"); - GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); gtk_box_append (up_box, GTK_WIDGET (get_image_GLUTAMATE())); gtk_box_append (up_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (up_box, GTK_WIDGET (get_image_GLUTAMINE())); -/* - GtkBox *bottom_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); - gtk_box_append (bottom_box, GTK_WIDGET (get_image_PHENYLALANINE())); - gtk_box_append (bottom_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (bottom_box, GTK_WIDGET (get_image_DOPAMINE())); -*/ + GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); gtk_box_append (bottom_box, GTK_WIDGET (get_image_ATP())); gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); @@ -131,16 +113,6 @@ GtkWidget *get_selected_rules_vpaned_new(){ gtk_paned_set_start_child (V_selected_1_vs_2, GTK_WIDGET (up_box)); gtk_paned_set_end_child (V_selected_1_vs_2, GTK_WIDGET (bottom_box)); -// gtk_paned_set_start_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_1)); -// gtk_paned_set_end_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_2)); - - - -// LES DEUX 'Gtk-CRITICAL **: 12:56:16.886: gtk_box_append: assertion 'GTK_IS_BOX (box)' failed' VIENNENT DES DEUX LIGNES SUIVANTES (2024-06-02) -// gtk_box_append ( GTK_BOX (règle_sélectionnée_n_1), GTK_WIDGET (up_box));//, GTK_WIDGET (get_image_GLUTAMATE())); -// gtk_box_append ( GTK_BOX (règle_sélectionnée_n_2), GTK_WIDGET (bottom_box));//, GTK_WIDGET (get_image_GLUTAMATE())); - - return GTK_WIDGET (V_selected_1_vs_2); } @@ -167,31 +139,6 @@ GtkWidget *get_SPACE_VIEW_box(){ return GTK_WIDGET (middle_box); } -/* -GtkWidget *get_run_space_left_box(){ - GtkBox *left_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_box_append (left_box, GTK_WIDGET (get_image_ALL_SPACE())); - gtk_box_append (left_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS())); - return GTK_WIDGET (left_box); -} - -GtkWidget *get_run_space_right_box(){ - GtkBox *right_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_box_append (right_box, GTK_WIDGET (get_XYZ_box())); - gtk_box_append (right_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (right_box, GTK_WIDGET (get_ZOOM_box())); - return GTK_WIDGET (right_box); -} - -GtkWidget *get_run_space_bottom_box(){ - GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); - gtk_box_append (bottom_box, GTK_WIDGET (get_run_space_left_box())); - gtk_box_append (bottom_box, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (bottom_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") - gtk_box_append (bottom_box, GTK_WIDGET (get_run_space_right_box())); - return GTK_WIDGET (bottom_box); -} -*/ GtkWidget *get_run_space_page_new(){ GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS())); @@ -274,8 +221,8 @@ static void icons_for_fun (GtkHeaderBar *header_bar) } void window_header_bar (GtkWindow *window, char *title){ - GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new()); - gtk_window_set_titlebar (window, header_bar); + GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); + gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); // 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); @@ -297,6 +244,7 @@ void window_header_bar (GtkWindow *window, char *title){ gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (exec_xor_edit)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec)); gtk_window_set_titlebar (window, header_bar); + icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme } diff --git a/display.h b/display.h index 0a31695..a02d358 100644 --- a/display.h +++ b/display.h @@ -8,9 +8,9 @@ /******************************************************************************/ GtkWidget *get_text_view(); -GtkFrame *get_frame_with_label(); +GtkFrame *get_frame_with_label(); GtkWidget *get_run_rules_page_new(); -GtkBox *get_rules_user_tree_new(); +GtkBox *get_rules_user_tree_new(); GtkWidget *get_image_ALL_SPACE(); GtkWidget *get_image_GLUTAMATE(); diff --git a/in_depth.c b/in_depth.c index 84e54a0..649d1b0 100644 --- a/in_depth.c +++ b/in_depth.c @@ -2,22 +2,27 @@ #include #include "callback.h" -enum { EXEC_MODE, EDIT_MODE, N_MODE }; + +/******************************************************************************/ +/* EXEC / EDIT */ +/******************************************************************************/ + +enum { EXEC_MODE, EDIT_MODE}; static int run_edit_mode_val = EXEC_MODE; +int get_exec_edit_mode () {return run_edit_mode_val;} +void set_exec_edit_mode (int prescribed_mode) {run_edit_mode_val = prescribed_mode;} + + + +/******************************************************************************/ +/* RUN / STOP */ +/******************************************************************************/ + enum { STOP, RUN }; static int run_stop_val = STOP; - -// --- EXEC / EDIT --------------------------------------------------------- - -int get_exec_edit_mode () {return run_edit_mode_val;} -void set_exec_edit_mode (int prescribed_mode) {run_edit_mode_val = prescribed_mode;} - // if (prescribed_mode == EDIT_MODE && run_stop_val == RUN) run_stop_val = STOP; - // serait redondant car déjà fait dans le callback ui_toggle_exec_edit() - -// --- RUN / STOP ---------------------------------------------------------- - int get_run_xor_stop_exec () {return run_stop_val;} void set_run_xor_stop_exec (int prescribed_state) {run_stop_val = prescribed_state;} - + +