some comments in the 'include' files

This commit is contained in:
Jean Sirmai 2024-07-22 15:42:24 +02:00
parent 11bcd85d68
commit c30a50b089
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 83 additions and 183 deletions

View File

@ -14,6 +14,6 @@
#include <gtk-4.0/gtk/gtk.h>
void on_preferences_action(GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
GVariant *parameter,
gpointer user_data);

View File

@ -2,7 +2,7 @@
* *
* Gem-graph client *
* *
* Base header *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *

View File

@ -31,71 +31,103 @@
#pragma once
#include <gtk-4.0/gtk/gtk.h>
// on_windows_activation (app) is in 'init.c' (not 'signal.c') for simplicity
void on_windows_activation (GtkApplication *app, gpointer user_data);
// all other callbacks are in 'signal.c'
// void on_auto_notification (const char *message); (see "signal.c")
/******************************************************************************/
/* W I N D O W S */
/******************************************************************************/
/* "on_windows_activation (app)" is the only function called by "main.c" using :
* g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
* and the only signal function outside "signals.c".
* It is found in "init.c", where all the various windows are declared as static :
* (static GtkWindow *main_window, *dialog_window, *text_window;)
* and where are all the functions useful for initiating and designing these windows.
* It is called only once in "main.c" and nowhere else.
*
* It creates all the windows, using for each of them
* 1) the "gtk_application_window_new (app)" and
* 2) a specific "widget_design_name_of_the_window() function
* which is in "topbar.c" (last one) (see widget.h)
*/
void on_windows_activation (GtkApplication *app);
/******************************************************************************/
/* W I D G E T S */
/******************************************************************************/
/* All the callbacks except "on_windows_activation (app)" are in "signal.c" */
/* (see details below) */
/******************************************************************************/
/* F I N I T E S T A T E M A C H I N E (fsm) */
/******************************************************************************/
/* { EXEC xor EDIT } and { STATE xor RULES xor DATA } are states of the fsm */
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_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_rules (GtkWidget *btt_open_RULES, gpointer data);
//void on_open_data (GtkWidget *btt_open_DATA, gpointer data);
/******************************************************************************/
/* D I A L O G W I N D O W */
/******************************************************************************/
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_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data);
void on_setup_user_menu_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data);
void on_bind_user_menu_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data);
/******************************************************************************/
/* T R E E (in tree.c & rules.c) */
/******************************************************************************/
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data);
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data);
/******************************************************************************/
/* G L A R E A (see graphics) */
/******************************************************************************/
gboolean on_glarea_render (GtkGLArea *area, GdkGLContext *context);
void on_glarea_realize (GtkWidget *widget);
void on_glarea_unrealize (GtkWidget *widget);
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
/******************************************************************************/
/* M A I N W I N D O W T O P B A R */
/******************************************************************************/
void on_clicked_home (GtkWidget *btt_reset, gpointer data);
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box);
/******************************************************************************/
/* M A I N W I N D O W S T A T E P A G E (upper part) */
/******************************************************************************/
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_clicked_home (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_search (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

@ -2,7 +2,7 @@
* *
* Gem-graph client *
* *
* Widgets header *
* Widgets header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
@ -35,11 +35,9 @@
#define n_situations 128
/******************************************************************************/
/* W I N D O W S */
/* W I N D O W S (see "init.c") */
/******************************************************************************/
void widget_create_windows (GtkApplication *app);
void widget_design_main_window (GtkWindow *main_window);
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window);
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window);
@ -63,14 +61,6 @@ void widget_reset_all_situations_transparencies_to_value (int value);
void *widget_get_stock_text (gchar *text_name);
/******************************************************************************/
/* M E N U */
/******************************************************************************/
//struct MenuNode_t {gchar *text; struct MenuNode_t *child, *next;};
//struct MenuNode_t *widget_create_user_menu_node (const gchar* text);
/******************************************************************************/
/* T R E E */
@ -81,7 +71,7 @@ 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_get_user_rules_tree ();
void *widget_get_user_rules_tree (); // see "labo.c" for specification of the tree
/******************************************************************************/
@ -114,3 +104,8 @@ char *widget_get_text_address_any ();
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
/******************************************************************************/
/* M E N U */
/******************************************************************************/

View File

@ -329,133 +329,7 @@ void on_clicked_home (GtkWidget *btt_reset, gpointer data)
/******************************************************************************/
/* M E N U */
/******************************************************************************/
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);
// gpointer list_box = gtk_popover_get_child (GTK_POPOVER (pop));
/*
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);
else printf ("signal.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",\
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, 2)))));
// learning_how_to_create_a_menu (menu_button);
// https://docs.gtk.org/gtk4/class.ListBox.html
*/
}
/******************************************************************************/
/* M E N U (from TREE) */
/******************************************************************************/
static void on_user_menu_expander_toggled (GtkExpander *expander,
gpointer user_data)
{
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
gboolean is_expanded = gtk_tree_list_row_get_expanded (row);
gtk_tree_list_row_set_expanded (row, ! is_expanded);
const gchar *text = gtk_string_object_get_string (
GTK_STRING_OBJECT (gtk_tree_list_row_get_item (row)));
if (1) printf("[on_user_menu_expander_toggled] > %s\n", text);
}
void on_bind_user_menu_factory (GtkSignalListItemFactory *factory,
GObject* object,
gpointer user_data)
{
GtkListItem *list_item = GTK_LIST_ITEM (object);
assert (list_item);
GtkTreeListRow *row = gtk_list_item_get_item (list_item);
assert (row); // if (row != NULL) {...} do something ? TODO Check !
const gchar *text = gtk_string_object_get_string (
GTK_STRING_OBJECT (gtk_tree_list_row_get_item (row)));
GtkWidget *expander = gtk_list_item_get_child (list_item);
gtk_expander_set_label (GTK_EXPANDER (expander), text);
g_signal_handlers_disconnect_by_func (expander,
G_CALLBACK (on_user_menu_expander_toggled),
row);
g_signal_connect (expander,
"activate",
G_CALLBACK (on_user_menu_expander_toggled),
row);
gtk_widget_set_margin_start (expander,
gtk_tree_list_row_get_depth(row) * 20);
}
void on_setup_user_menu_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data){
GtkWidget* expander = gtk_expander_new (NULL);
gtk_list_item_set_child (GTK_LIST_ITEM (object), expander);
if (0) printf("[on_setup_user_menu_factory] here is an expander\n");
}

View File

@ -224,7 +224,6 @@ static void window_header_bar_right (GtkWidget *header_bar)
GSimpleAction *act_connect = g_simple_action_new("connect", NULL);
g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL);
g_signal_connect (open_menu, "activate", G_CALLBACK (on_clicked_menu_experiment), list_box);
// gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu);