journal use INFO, SOURCE, TARGET ?

This commit is contained in:
Jean Sirmai 2024-09-19 07:14:05 +02:00
parent f3f76ef053
commit dc4820fe17
Signed by: jean
GPG Key ID: FB3115C340E057E3
11 changed files with 218 additions and 158 deletions

View File

@ -50,6 +50,7 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
/* J O U R N A L */ /* J O U R N A L */
/******************************************************************************/ /******************************************************************************/
enum severity {CRITICAL, ERROR, WARNING, INFO, MESSAGE, DEBUG, SPEW};
// ****************** - SEVERITY - ****************************************/ // ****************** - SEVERITY - ****************************************/
// //
// CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW (see: fsm.h) // CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW (see: fsm.h)
@ -94,29 +95,63 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
* This list is duplicated in both /fsm.h and /fsm/dispatch * * This list is duplicated in both /fsm.h and /fsm/dispatch *
* * * * * * * - F I L T E R S - * * * * * * */ * * * * * * * - F I L T E R S - * * * * * * */
/* * * * * - M E T A R U L E S J O U R N A L - * * * *
*
* Un seul fsm_journal_event() par fonction
* sauf si elle génère plusieurs autres fonctions d'intérêt (à surveiller)
*
* S'il y a deux fsm_journal_event() (begin / end) dans une fonction
* ils doivent avoir la même étiquette : MESSAGE, SOURCE, TARGET
*
* * * * * - M E T A R U L E S J O U R N A L - * * * */
enum source {
SOURCE, MAIN, APP, WIDGETS, MAIN_4, MAIN_5, MAIN_6, MAIN_7, MAIN_8, MAIN_9,
MAIN_WINDOW, DIALOG_WINDOW, MODAL_WINDOW, TEXT_WINDOW, AUTO_NOTIFICATION,
W_15, W_16, W_17, W_18, W_19,
TOPBAR, TOPBAR_LEFT, TOPBAR_RIGHT, TOPBAR_CENTER,
TB_24, TB_25, TB_26, TB_27, TB_28, TB_29,
SYNTH_PAGE, SY_31, SY_32, SY_33, SY_34, SY_35, SY_36, SY_37, SY_38, SY_39,
STATE_PAGE, ST_41, ST_42, ST_43, ST_44, ST_45, ST_46, ST_47, ST_48, ST_49,
RULES_PAGE, RL_51, RL_52, RL_53, RL_54, RL_55, RL_56, RL_57, RL_58, RL_59,
MEASURES_PAGE, MP_61, MP_62, MP_63, MP_64, MP_65, MP_66, MP_67, MP_68, MP_69,
RESULTS_PAGE, RS_71, RS_72, RS_73, RS_74, RS_75, RS_76, RS_77, RS_78, RS_79,
};
enum target {JOURNAL, FSM}; // INFO, SOURCE, TARGET
#define SOURCE 0
#define TARGET 0
#define JOURNAL 0
#define MAIN 0 #define MAIN 0
#define APP 0
#define WIDGETS 0
#define FSM 0
#define AUTO_NOTIFICATION 0
#define MAIN_WINDOW 10 #define MAIN_WINDOW 10
#define DIALOG_WINDOW 11 #define DIALOG_WINDOW 11
#define MODAL_WINDOW 12 #define MODAL_WINDOW 12
#define TEXT_WINDOW 13
#define TOPBAR 20 #define TOPBAR 20
#define TOPBAR_LEFT 21 #define TOPBAR_LEFT 21
#define TOPBAR_RIGHT 22 #define TOPBAR_RIGHT 22
#define TOPBAR_CENTER 23
#define SYNTH_PAGE 30 #define SYNTH_PAGE 50
#define STATE_PAGE 40 #define STATE_PAGE 60
#define RULES_PAGE 50 #define RULES_PAGE 70
#define MEASURES_PAGE 60 #define MEASURES_PAGE 80
#define RESULTS_PAGE 90
#define BUTTON 71 #define BUTTON 101
#define SCROLL 72 #define SCROLL 102
#define GLAREA 73 #define GLAREA 103
#define TEXT 74 #define TEXT 104
#define LABEL 75 #define LABEL 105
#define AUTO_NOTIFICATION 80
#define FSM 90
#define JOURNAL_DATE_MAX_LENGTH 255 #define JOURNAL_DATE_MAX_LENGTH 255
@ -145,7 +180,7 @@ void fsm_journal_test (char *message);
// ref: sudo cat /var/log/messages // ref: sudo cat /var/log/messages
// journal fsm_get_journal(); // def: fsm/dispatch call: fsm/prefer/fsm_store_restore_reset() // journal fsm_get_journal(); // def: fsm/dispatch call: fsm/prefer/fsm_store_restore_reset()
void fsm_journal_publication_request (); // def: fsm/dispatch call: main; void fsm_journal_publication_request (); // def: fsm/dispatch call: main;
void fsm_journal_event (char *message, int priority, int filter); void fsm_journal_event (char *message, int priority, int widget, int action);
// def: fsm/dispatch call: widget/dispatch; // def: fsm/dispatch call: widget/dispatch;
// --------------------------------------------------------------- WIP ------ // --------------------------------------------------------------- WIP ------

View File

@ -61,14 +61,15 @@ void fsm_journal_publication_request () {fsm_journal_publish (gg_logs);}
void fsm_journal_push (char *message) {fsm_journal_push_front (&gg_logs, message);} void fsm_journal_push (char *message) {fsm_journal_push_front (&gg_logs, message);}
#define CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____😄 0 #define CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____😄 0
void fsm_journal_event (char *message, int priority, int filter) void fsm_journal_event (char *message, int priority, int source, int target)
{ {
// CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 😄️ // CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 😄️
// 0 1 2 3 4 5 6 // 0 1 2 3 4 5 6
if (priority == 0 //<= DEBUG if (priority == 0 //<= DEBUG
/* * * * * * * - F I L T E R S - * * * * * * * #define MAIN___DIALOG___MODAL___TOPBAR___SYNTH___RULES___MEASURES___RESULTS___😄 0
/* * * * * * * - S O U R C E - * * * * * * *
* This list is duplicated in both /fsm.h and /fsm/dispatch * * This list is duplicated in both /fsm.h and /fsm/dispatch *
* * * *
* *
@ -90,17 +91,34 @@ void fsm_journal_event (char *message, int priority, int filter)
* MEASURES_PAGE _TOOLS _ACTIVITY _DISPLAY 60 61 62 63 * MEASURES_PAGE _TOOLS _ACTIVITY _DISPLAY 60 61 62 63
* TIME_DEP_RESULTS TIME_INDEP_RESULTS 64 65 * TIME_DEP_RESULTS TIME_INDEP_RESULTS 64 65
* *
* WIDGET BUTTON SCROLL GLAREA TEXT LABEL 70 71 72 73 74 75 * This list is duplicated in both /fsm.h and /fsm/dispatch *
* * * * * * * - S O U R C E - * * * * * * */
|| source == 16
/* * * * * * * - T A R G E T - * * * * * * *
* This list is duplicated in both /fsm.h and /fsm/dispatch *
*
* ANY 0
* WIDGET
* BUTTON
* SCROLL
* GLAREA
* TEXT
* LABEL
* TREE
* EXPANDER
* TOPBAR
* *
* AUTO_NOTIFICATION 80 * AUTO_NOTIFICATION 80
* *
* FSM 90 * FSM 90
* * * *
* This list is duplicated in both /fsm.h and /fsm/dispatch * * This list is duplicated in both /fsm.h and /fsm/dispatch *
* * * * * * * - F I L T E R S - * * * * * * */ * * * * * * * - T A R G E T - * * * * * * */
|| target == 41)
|| filter == 16
|| filter == 41)
fsm_journal_push (message); fsm_journal_push (message);
} }
#define _CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____👋 0 #define _CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____👋 0
@ -112,23 +130,23 @@ void fsm_journal_event (char *message, int priority, int filter)
void fsm_init (char *initial_message_from_main) void fsm_init (char *initial_message_from_main)
{ {
fsm_journal_init (&gg_logs); fsm_journal_init (&gg_logs);
fsm_journal_event (initial_message_from_main, 4, 0); fsm_journal_event (initial_message_from_main, MESSAGE, SOURCE, TARGET);
fsm_journal_event ("fsm/dispatch initialisation fsm has began", 4, 0); fsm_journal_event ("fsm/dispatch initialisation fsm has began", MESSAGE, SOURCE, TARGET);
fsm_measures_list_init(); fsm_measures_list_init();
fsm_journal_event ("fsm/dispatch measures list init()", 4, 0); fsm_journal_event ("fsm/dispatch measures list init()", MESSAGE, SOURCE, TARGET);
fsm_results_list_init(); fsm_results_list_init();
fsm_journal_event ("fsm/dispatch results list init()", 4, 0); fsm_journal_event ("fsm/dispatch results list init()", MESSAGE, SOURCE, TARGET);
fsm_displayable_list_init(); fsm_displayable_list_init();
fsm_journal_event ("fsm/dispatch displayable list init()", 4, 0); fsm_journal_event ("fsm/dispatch displayable list init()", MESSAGE, SOURCE, TARGET);
fsm_preferences_list_init(); fsm_preferences_list_init();
fsm_journal_event ("fsm/dispatch preferences list init()", 4, 0); fsm_journal_event ("fsm/dispatch preferences list init()", MESSAGE, SOURCE, TARGET);
fsm_journal_event ("fsm/dispatch initialisation fsm has ended", 4, 0); fsm_journal_event ("fsm/dispatch initialisation fsm has ended", MESSAGE, SOURCE, TARGET);
} }
@ -143,10 +161,10 @@ void fsm_set_preferences_modified (bool value)
{ {
char str1[140] = "fsm/dispatch preferences modified value = "; char str1[140] = "fsm/dispatch preferences modified value = ";
char str2[20]; sprintf(str2, " (%d)\n", value); strcat(str1, str2); char str2[20]; sprintf(str2, " (%d)\n", value); strcat(str1, str2);
fsm_journal_event (str1, 4, 90); fsm_journal_event (str1, INFO, SOURCE, TARGET);
fsm_journal_event ("fsm/dispatch preferences modified value = ?\n\ fsm_journal_event ("fsm/dispatch preferences modified value = ?\n\
> Je ne sais ni concatener les strings ni utiliser 'itoa'", 4, 90); > Je ne sais ni concatener les strings ni utiliser 'itoa'", INFO, SOURCE, TARGET);
preferences_have_been_modified = value; preferences_have_been_modified = value;
/* /*
if (value) fsm_journal_event ( if (value) fsm_journal_event (
@ -177,7 +195,7 @@ int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
void fsm_set_exec_edit (int choice) void fsm_set_exec_edit (int choice)
{ {
if (choice_EXEC_EDIT != choice) { if (choice_EXEC_EDIT != choice) {
fsm_journal_event ("fsm/dispatch set_exec_edit()", 4, 0); // TODO print choice fsm_journal_event ("fsm/dispatch set_exec_edit()", INFO, SOURCE, TARGET); // TODO print choice
choice_EXEC_EDIT = choice; choice_EXEC_EDIT = choice;
} }
} }
@ -185,7 +203,7 @@ void fsm_set_exec_edit (int choice)
void fsm_set_state_rules_data (int choice) void fsm_set_state_rules_data (int choice)
{ {
if (choice_STATE_RULES_DATA != choice) { if (choice_STATE_RULES_DATA != choice) {
fsm_journal_event ("fsm/dispatch set_state_rules_data()", 4, 0); // TODO print choice fsm_journal_event ("fsm/dispatch set_state_rules_data()", INFO, SOURCE, TARGET); // TODO print choice
choice_STATE_RULES_DATA = choice; choice_STATE_RULES_DATA = choice;
} }
} }
@ -204,7 +222,7 @@ void fsm_msg (int choice, int value, char *string, int sub_automaton)
// sub_automaton 1 is STATE_RULES_DATA // sub_automaton 1 is STATE_RULES_DATA
// sub_automaton 2 is MEASURE // sub_automaton 2 is MEASURE
case (0) : case (0) :
fsm_journal_event ("fsm/dispatch switch EXEC_EDIT (TODO)", 4, 0); // TODO print choice fsm_journal_event ("fsm/dispatch switch EXEC_EDIT (TODO)", INFO, SOURCE, TARGET); // TODO print choice
printf ("fsm/dispatch (message) |\ printf ("fsm/dispatch (message) |\
switch %5s x %5s > %5s x %5s\n", switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA], tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
@ -212,7 +230,7 @@ void fsm_msg (int choice, int value, char *string, int sub_automaton)
break; break;
case (1) : case (1) :
fsm_journal_event ("fsm/dispatch switch STATE_RULES_DATA (TODO)", 4, 0); // TODO print choice fsm_journal_event ("fsm/dispatch switch STATE_RULES_DATA (TODO)", INFO, SOURCE, TARGET); // TODO print choice
printf ("fsm/dispatch (message) |\ printf ("fsm/dispatch (message) |\
switch %5s x %5s > %5s x %5s\n", switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA], tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
@ -227,7 +245,7 @@ void fsm_msg (int choice, int value, char *string, int sub_automaton)
default : printf ("default in fsm/dispatch.fsm_msg()\n"); default : printf ("default in fsm/dispatch.fsm_msg()\n");
fsm_journal_event ("fsm/dispatch fsm_msg () default in switch (sub_automaton)", 4, 0); fsm_journal_event ("fsm/dispatch fsm_msg () default in switch (sub_automaton)", INFO, SOURCE, TARGET);
} }
} }

View File

@ -74,7 +74,7 @@ void fsm_store_restore_reset (int choice, int value)
switch (choice) { switch (choice) {
case (STORE) : case (STORE) :
fsm_journal_event ( fsm_journal_event (
"fsm/prefer store restore reset(): switch (STORE)", 5, 41); "fsm/prefer store restore reset(): switch (STORE)", MESSAGE, SOURCE, TARGET);
for (int i = 0; i < n_objects; i++) { for (int i = 0; i < n_objects; i++) {
p [i] = widget_get_object_transparency (i); p [i] = widget_get_object_transparency (i);
widget_set_object_transparency_to_value (i, p [i]); widget_set_object_transparency_to_value (i, p [i]);
@ -82,19 +82,19 @@ void fsm_store_restore_reset (int choice, int value)
break; break;
case (RESTORE) : case (RESTORE) :
fsm_journal_event ( fsm_journal_event (
"fsm/prefer store restore reset(): switch (RESTORE)", 5, 41); "fsm/prefer store restore reset(): switch (RESTORE)", MESSAGE, SOURCE, TARGET);
for (int i = 0; i < n_objects; i++) for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_to_value (i, p [i]); widget_set_object_transparency_to_value (i, p [i]);
break; break;
case (RESET) : case (RESET) :
fsm_journal_event ( fsm_journal_event (
"fsm/prefer store restore reset(): switch (RESET)", 5, 41); "fsm/prefer store restore reset(): switch (RESET)", MESSAGE, SOURCE, TARGET);
for (int i = 0; i < n_objects; i++) for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_to_value (i, value); // i * 4 // rand() % 127 widget_set_object_transparency_to_value (i, value); // i * 4 // rand() % 127
break; break;
default : default :
fsm_journal_event ( fsm_journal_event (
"fsm/prefer store restore reset(): switch (default)", 5, 41); "fsm/prefer store restore reset(): switch (default)", MESSAGE, SOURCE, TARGET);
} }
fsm_set_preferences_modified (TRUE); fsm_set_preferences_modified (TRUE);
@ -111,7 +111,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
{ {
char str1[140] = "fsm/prefer reset all situations transparencies at value"; char str1[140] = "fsm/prefer reset all situations transparencies at value";
char str2[10]; sprintf(str2, " (%d)", value); strcat(str1, str2); char str2[10]; sprintf(str2, " (%d)", value); strcat(str1, str2);
fsm_journal_event (str1, 5, 41); // TODO fsm_journal_event (str1, INFO, SOURCE, TARGET); // TODO
reset_situations_to_value = value; reset_situations_to_value = value;
widget_reset_all_situations_transparencies_to_value (value); widget_reset_all_situations_transparencies_to_value (value);
} }
@ -127,7 +127,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
void fsm_add_displayable (char *displayable_name) void fsm_add_displayable (char *displayable_name)
{ {
fsm_journal_event ( fsm_journal_event (
strcat("fsm/prefer add displayable() ", displayable_name), 5, 90); // TODO strcat("fsm/prefer add displayable() ", displayable_name), MESSAGE, SOURCE, TARGET); // TODO
} }
@ -136,11 +136,11 @@ void fsm_add_displayable (char *displayable_name)
/******************************************************************************/ /******************************************************************************/
void fsm_preferences_list_init () void fsm_preferences_list_init ()
{ {
fsm_journal_event ("fsm/prefer preferences list required()", 5, 0); fsm_journal_event ("fsm/prefer preferences list required()", MESSAGE, SOURCE, TARGET);
} }
void fsm_displayable_list_init () void fsm_displayable_list_init ()
{ {
fsm_journal_event ("fsm/prefer displayable list required()", 5, 0); fsm_journal_event ("fsm/prefer displayable list required()", MESSAGE, SOURCE, TARGET);
} }

View File

@ -135,11 +135,13 @@ int main (int argc, char **argv)
// def: src/fsm/dispatch fsm = finite state machine // def: src/fsm/dispatch fsm = finite state machine
fsm_init ("main first instruction in main() & first log"); fsm_init ("main first instruction in main() & first log");
fsm_journal_event ("main *app = gtk_application_new ()", 3, 0); fsm_journal_event (
"main *app = gtk_application_new ()", INFO, MAIN, APP);
GtkApplication *app = gtk_application_new ("org.gem-graph", GtkApplication *app = gtk_application_new ("org.gem-graph",
G_APPLICATION_DEFAULT_FLAGS); G_APPLICATION_DEFAULT_FLAGS);
fsm_journal_event ("main g signal connect (app <--> on_windows_startup)", 3, 0); fsm_journal_event ("main \
g signal connect (app <--> on_windows_startup)", INFO, MAIN, WIDGETS);
// ! WARNING ! 'on_windows_activation()' // ! WARNING ! 'on_windows_activation()'
// and 'on_windows_startup()' are in: src/widget/dispatch.c // and 'on_windows_startup()' are in: src/widget/dispatch.c
// NOT in: src/signal.c // NOT in: src/signal.c
@ -147,10 +149,10 @@ int main (int argc, char **argv)
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
int status = g_application_run (G_APPLICATION (app), argc, argv); int status = g_application_run (G_APPLICATION (app), argc, argv);
fsm_journal_event ("main g_object unref (app)", INFO, MAIN, APP);
g_object_unref (app); g_object_unref (app);
fsm_journal_event ("main g_object unref (app)", 3, 0);
fsm_journal_event ("main That'all folks ! 👋️😄️", 3, 0); fsm_journal_event ("main That'all folks ! 👋️😄️",INFO, MAIN, APP);
fsm_journal_publication_request(); fsm_journal_publication_request();
return status; return status;
@ -214,3 +216,4 @@ TODO (bottlenecks)
Il y a donc peu de problèmes à craindre du fait de la limite de la bande passante. Il y a donc peu de problèmes à craindre du fait de la limite de la bande passante.
*/ */

View File

@ -36,7 +36,8 @@
static void on_auto_notification (const char *message) static void on_auto_notification (const char *message)
{ {
fsm_journal_event ("signal auto notification() has began", DEBUG, 35); fsm_journal_event ("signal auto notification()",
DEBUG, SOURCE, AUTO_NOTIFICATION);
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily /* Ignored (2024-06-06) because I don't know how to get "main_window" easily
if (window->toast_revealer == NULL) { if (window->toast_revealer == NULL) {
@ -52,8 +53,7 @@ static void on_auto_notification (const char *message)
gtk_label_set_label(window->toast_text, message); gtk_label_set_label(window->toast_text, message);
gtk_revealer_set_reveal_child(window->toast_revealer, true); gtk_revealer_set_reveal_child(window->toast_revealer, true);
*/ */
g_printerr("%s\n", message); g_printerr("%s\n", message); // TODO use the journal to display the message (concat))
fsm_journal_event ("signal auto notification() has ended", DEBUG, 35);
} }
@ -62,13 +62,13 @@ static void on_auto_notification (const char *message)
/******************************************************************************/ /******************************************************************************/
static void on_user_tree_expander_toggled (GtkExpander *expander, static void on_user_tree_expander_toggled (GtkExpander *expander,
gpointer user_data) gpointer user_data)
{ {
fsm_journal_event ("signal user tree expander toggled() has began", DEBUG, 23); fsm_journal_event ("signal user tree expander toggled()",
DEBUG, SOURCE, TARGET);
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data); GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
gboolean is_expanded = gtk_tree_list_row_get_expanded (row); gboolean is_expanded = gtk_tree_list_row_get_expanded (row);
gtk_tree_list_row_set_expanded (row, ! is_expanded); gtk_tree_list_row_set_expanded (row, ! is_expanded);
fsm_journal_event ("signal user tree expander toggled() has ended", DEBUG, 23);
} }
@ -76,7 +76,8 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object, GObject* object,
gpointer user_data) gpointer user_data)
{ {
fsm_journal_event ("signal bind user tree factory() has began", SPEW, 23); fsm_journal_event ("signal bind user tree factory()",
SPEW, SOURCE, TARGET);
GtkListItem *list_item = GTK_LIST_ITEM (object); GtkListItem *list_item = GTK_LIST_ITEM (object);
assert (list_item); assert (list_item);
@ -96,15 +97,14 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
row); row);
gtk_widget_set_margin_start (expander, gtk_widget_set_margin_start (expander,
gtk_tree_list_row_get_depth(row) * 20); gtk_tree_list_row_get_depth(row) * 20);
fsm_journal_event ("signal bind user tree factory() has ended", SPEW, 23);
} }
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory, void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data){ GObject* object, gpointer user_data){
fsm_journal_event ("signal setup user tree factory() has began", SPEW, 23); fsm_journal_event ("signal setup user tree factory()",
SPEW, SOURCE, TARGET);
GtkWidget* expander = gtk_expander_new (NULL); GtkWidget* expander = gtk_expander_new (NULL);
gtk_list_item_set_child (GTK_LIST_ITEM (object), expander); gtk_list_item_set_child (GTK_LIST_ITEM (object), expander);
fsm_journal_event ("signal setup user tree factory() has ended", SPEW, 23);
} }
@ -115,7 +115,7 @@ void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
gboolean on_glarea_render (GtkGLArea *area, gboolean on_glarea_render (GtkGLArea *area,
GdkGLContext *context) GdkGLContext *context)
{ {
fsm_journal_event ("signal glarea render() has began", DEBUG, 32); fsm_journal_event ("signal glarea render()", DEBUG, SOURCE, TARGET);
// Check if the widget is a glarea // Check if the widget is a glarea
if(gtk_gl_area_get_error(area) != NULL) { if(gtk_gl_area_get_error(area) != NULL) {
on_auto_notification("An OpenGL error occured !"); on_auto_notification("An OpenGL error occured !");
@ -127,7 +127,6 @@ gboolean on_glarea_render (GtkGLArea *area,
return false; return false;
} }
fsm_journal_event ("signal glarea render() has ended", DEBUG, 32);
return true; return true;
} }
@ -135,7 +134,7 @@ gboolean on_glarea_render (GtkGLArea *area,
/* We need to set up our state when we realize the GtkGLArea widget */ /* We need to set up our state when we realize the GtkGLArea widget */
void on_glarea_realize (GtkWidget *widget) void on_glarea_realize (GtkWidget *widget)
{ {
fsm_journal_event ("signal glarea realize() has began", DEBUG, 32); fsm_journal_event ("signal glarea realize()", DEBUG, SOURCE, TARGET);
GError *internal_error = NULL; GError *internal_error = NULL;
// Make the GL context current to be able to call the GL API // Make the GL context current to be able to call the GL API
@ -156,13 +155,12 @@ void on_glarea_realize (GtkWidget *widget)
} }
gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true); gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true);
fsm_journal_event ("signal glarea realize() has ended", DEBUG, 32);
} }
/* We should tear down the state when unrealizing */ /* We should tear down the state when unrealizing */
void on_glarea_unrealize (GtkWidget *widget) void on_glarea_unrealize (GtkWidget *widget)
{ {
fsm_journal_event ("signal glarea unrealize() has began", DEBUG, 32); fsm_journal_event ("signal glarea unrealize()", DEBUG, SOURCE, TARGET);
GError *internal_error = NULL; GError *internal_error = NULL;
// Make the GL context current to be able to call the GL API // Make the GL context current to be able to call the GL API
@ -171,7 +169,6 @@ void on_glarea_unrealize (GtkWidget *widget)
// Check if the widget is a glarea // Check if the widget is a glarea
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) { if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
on_auto_notification("An OpenGL error occured !"); on_auto_notification("An OpenGL error occured !");
fsm_journal_event ("signal glarea unrealize() has ended", DEBUG, 32);
return; return;
} }
@ -180,15 +177,13 @@ void on_glarea_unrealize (GtkWidget *widget)
internal_error) == false) { internal_error) == false) {
on_auto_notification( on_auto_notification(
"Failed to shutdown the graphic stack !"); "Failed to shutdown the graphic stack !");
fsm_journal_event ("signal glarea unrealize() has ended", DEBUG, 32);
return; return;
} }
fsm_journal_event ("signal glarea unrealize() has ended", DEBUG, 32);
} }
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data) void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
{ {
fsm_journal_event ("signal axis value change() has began", DEBUG, 32); fsm_journal_event ("signal axis value change() has began", SPEW, SOURCE, TARGET);
GtkWidget *slider = gtk_widget_get_parent(GTK_WIDGET(data)); GtkWidget *slider = gtk_widget_get_parent(GTK_WIDGET(data));
GtkWidget *container_widget = gtk_widget_get_parent(GTK_WIDGET(slider)); GtkWidget *container_widget = gtk_widget_get_parent(GTK_WIDGET(slider));
@ -206,7 +201,6 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
gtk_adjustment_get_value(adjustment)); gtk_adjustment_get_value(adjustment));
/* Update the contents of the GL drawing area */ /* Update the contents of the GL drawing area */
fsm_journal_event ("signal axis value change() has ENDED", DEBUG, 32);
} }
@ -217,25 +211,25 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
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)
{ {
fsm_journal_event ("signal save current model before editing() has began", INFO, 2); fsm_journal_event ("signal save current model before editing()",
INFO, SOURCE, TARGET);
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
fsm_journal_event ("signal save current model before editing() has ended", INFO, 2);
} }
void on_discard_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL, void on_discard_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL,
gpointer data) gpointer data)
{ {
fsm_journal_event ("signal discard current model before editing() has began", INFO, 2); fsm_journal_event ("signal discard current model before editing()",
INFO, SOURCE, TARGET);
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
fsm_journal_event ("signal discard current model before editing() has ended", INFO, 2);
} }
void on_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL, void on_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL,
gpointer data) gpointer data)
{ {
fsm_journal_event ("signal write current model() has began", INFO, 2); fsm_journal_event ("signal write current model()",
INFO, SOURCE, TARGET);
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
fsm_journal_event ("signal write current model() has ended", INFO, 2);
} }
@ -250,7 +244,7 @@ static void switch_state_rules_data();
void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data) void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
{ {
fsm_journal_event ("signal toggle exec edit() has began", INFO, 5); fsm_journal_event ("signal toggle exec edit()", INFO, SOURCE, TARGET);
if (fsm_get_exec_edit ()) { // TODO (or NOT ?) et si je ne suis pas sur la page SYNTH if (fsm_get_exec_edit ()) { // TODO (or NOT ?) et si je ne suis pas sur la page SYNTH
gtk_button_set_icon_name (GTK_BUTTON (toggled_button), gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
@ -264,14 +258,14 @@ 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_get_dialog_window()));
// // works once only A window should be created each time
fsm_set_exec_edit (EDIT); fsm_set_exec_edit (EDIT);
// TODO set_btt_SYNTH_active (FALSE) // TODO set_btt_SYNTH_active (FALSE)
} }
switch_state_rules_data(); switch_state_rules_data();
fsm_journal_event ("signal toggle exec edit() has ended", INFO, 5);
} }
@ -280,7 +274,8 @@ void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
static void switch_state_rules_data() static void switch_state_rules_data()
{ {
fsm_journal_event ("signal switch state rules data() has began", INFO, 5); fsm_journal_event ("signal switch state rules data() has began",
INFO, SOURCE, TARGET);
switch (fsm_get_state_rules_data()) { switch (fsm_get_state_rules_data()) {
case (SYNTH) : case (SYNTH) :
@ -324,9 +319,11 @@ static void switch_state_rules_data()
default : default :
printf("default in signal.on_toggle_state_rule_data()\n"); printf("default in signal.on_toggle_state_rule_data()\n");
fsm_journal_event ("signal default in : switch state rules data() > has ended", INFO, 5); fsm_journal_event ("signal default in : switch state rules data()",
INFO, SOURCE, TARGET);
} }
fsm_journal_event ("signal switch state rules data() has ended", INFO, 5); fsm_journal_event ("signal switch state rules data() has ended",
INFO, SOURCE, TARGET);
} }
// TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!! // TODO Il doit y avoir plus élégant,... ET SURTOUT MOINS DANGEREUX !!!
@ -334,7 +331,8 @@ static void switch_state_rules_data()
// Les noms d'icônes sont utilisés pour deux fonctions distinctes... // Les noms d'icônes sont utilisés pour deux fonctions distinctes...
void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
{ {
fsm_journal_event ("signal toggle state rules data() has began", INFO, 5); fsm_journal_event ("signal toggle state rules data() has began",
INFO, SOURCE, TARGET);
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));
@ -344,7 +342,9 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES); if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES);
if ( ! strcmp (toggled_button_name, "results")) fsm_set_state_rules_data (DATA); if ( ! strcmp (toggled_button_name, "results")) fsm_set_state_rules_data (DATA);
fsm_journal_event ("signal toggle state rules data() has ended", INFO, 5); fsm_journal_event ("signal toggle state rules data() has ended",
INFO, SOURCE, TARGET);
if (is_active) switch_state_rules_data(); if (is_active) switch_state_rules_data();
} }
@ -352,20 +352,22 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
// ------------ M E N U / S E A R C H / H O M E / E T C ----------- // // ------------ M E N U / S E A R C H / H O M E / E T C ----------- //
void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box) { void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box)
fsm_journal_event ("signal clicked topbar right search() has began", DEBUG, 6); {
fsm_journal_event ("signal clicked topbar right search()",
DEBUG, SOURCE, TARGET);
// next line presents the text_window and works only once.\n // next line presents the text_window and works only once.\n
// It should present a menu.\n"); // TODO // It should present a menu.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_get_text_window())); gtk_window_present (GTK_WINDOW (widget_get_text_window()));
fsm_journal_event ("signal clicked topbar right search() has ended", DEBUG, 6);
} }
void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data) void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data)
{ {
fsm_journal_event ("signal clicked topbar right home() has began", DEBUG, 6); fsm_journal_event ("signal clicked topbar right home()",
// gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); // NB works only once. < TODO DEBUG, SOURCE, TARGET);
fsm_journal_event ("signal clicked topbar right home() has ended", DEBUG, 6); // gtk_window_present (GTK_WINDOW (widget_get_dialog_window()));
// NB works only once. < TODO
} }
@ -379,7 +381,8 @@ void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data)
void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *scrollbar) void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *scrollbar)
{ {
fsm_journal_event ("signal updating objects transparencies() has began", DEBUG, 16); fsm_journal_event ("signal updating objects transparencies()",
DEBUG, SOURCE, TARGET);
const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source)); const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source));
int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar)); int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar));
@ -387,25 +390,24 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
if ( ! strcmp (btt_name, "edit-undo-symbolic")) fsm_store_restore_reset (RESTORE, value); if ( ! strcmp (btt_name, "edit-undo-symbolic")) fsm_store_restore_reset (RESTORE, value);
if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_store_restore_reset (RESET, value); if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_store_restore_reset (RESET, value);
fsm_journal_event ("signal updating objects transparencies() has ended", DEBUG, 16);
fsm_set_preferences_modified (TRUE); // << à détailler TODO fsm_set_preferences_modified (TRUE); // << à détailler TODO
} }
void on_resetting_XYZ_in_state_page () void on_resetting_XYZ_in_state_page ()
{ {
fsm_journal_event ("signal resetting XYZ in state page() has began", DEBUG, 16); fsm_journal_event ("signal resetting XYZ in state page()",
DEBUG, SOURCE, TARGET);
widget_state_XYZ_reset_all(); widget_state_XYZ_reset_all();
fsm_journal_event ("signal resetting XYZ in state page() has ended", DEBUG, 16);
} }
// -------------------------- S I T U A T I O N S ----------------------- // // -------------------------- S I T U A T I O N S ----------------------- //
void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{ {
fsm_journal_event ("signal on_situations_box_do_reset() has began", DEBUG, 16); fsm_journal_event ("signal on_situations_box_do_reset() has began",
DEBUG, SOURCE, TARGET);
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));
fsm_journal_event ("signal on_situations_box_do_reset() has ended", DEBUG, 16);
} }
@ -416,123 +418,108 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data) void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal clicked topbar right measure() has began", DEBUG, 26); fsm_journal_event ("signal clicked topbar right measure()", DEBUG, SOURCE, TARGET);
// fsm_measures_sorted_list_do something (); // fsm_measures_sorted_list_do something ();
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_measure_page())); GTK_WIDGET (widget_get_measure_page()));
fsm_journal_event ("signal clicked topbar right measure() has ended", DEBUG, 26);
} }
void on_start_new_measure (GtkWidget *btt, gpointer data) void on_start_new_measure (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal start new measure() has began", DEBUG, 26); fsm_journal_event ("signal start new measure()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_select_rules_first())); GTK_WIDGET (widget_measure_do_select_rules_first()));
fsm_journal_event ("signal start new measure() has ended", DEBUG, 26);
} }
void on_select_rules_first (GtkWidget *btt, gpointer data) void on_select_rules_first (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal select rules first() has began", DEBUG, 26); fsm_journal_event ("signal select rules first()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_depends_on_one_or_two_events())); GTK_WIDGET (widget_measure_do_depends_on_one_or_two_events()));
fsm_journal_event ("signal select rules first() has ended", DEBUG, 26);
} }
void on_measure_depends_on_a_single_event (GtkWidget *btt, gpointer data) void on_measure_depends_on_a_single_event (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure depends on a single event() has began", DEBUG, 26); fsm_journal_event ("signal measure depends on a single event()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_depends_on_a_single_event())); GTK_WIDGET (widget_measure_do_depends_on_a_single_event()));
fsm_journal_event ("signal measure depends on a single event() has ended", DEBUG, 26);
} }
void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data) void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure depends on two events() has began", DEBUG, 26); fsm_journal_event ("signal measure depends on two events()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_select_a_second_rules_set())); GTK_WIDGET (widget_measure_do_select_a_second_rules_set()));
fsm_journal_event ("signal measure depends on two events() has ended", DEBUG, 26);
} }
void on_select_a_second_rules_set (GtkWidget *btt, gpointer data) void on_select_a_second_rules_set (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal select a second rules set() has began", DEBUG, 26); fsm_journal_event ("signal select a second rules set()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_choose_an_event_type())); GTK_WIDGET (widget_measure_do_choose_an_event_type()));
fsm_journal_event ("signal select a second rules set() has ended", DEBUG, 26);
} }
void on_select_a_second_measurement (GtkWidget *btt, gpointer data) void on_select_a_second_measurement (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal select a second measurement() has began", DEBUG, 26); fsm_journal_event ("signal select a second measurement()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_correlate())); GTK_WIDGET (widget_measure_do_correlate()));
fsm_journal_event ("signal select a second measurement() has ended", DEBUG, 26);
} }
void on_skip_this_step (GtkWidget *btt, gpointer data) void on_skip_this_step (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal skip this step() has began", DEBUG, 26); fsm_journal_event ("signal skip this step()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_insert_in_measurements_list ())); GTK_WIDGET (widget_measure_do_insert_in_measurements_list ()));
fsm_journal_event ("signal skip this step() has ended", DEBUG, 26);
} }
void on_something_else (GtkWidget *btt, gpointer data) void on_something_else (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal something else() has began", DEBUG, 26); fsm_journal_event ("signal something else()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process())); GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process()));
fsm_journal_event ("signal something else() has ended", DEBUG, 26);
} }
void on_closing_page (GtkWidget *btt, gpointer data) void on_closing_page (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal closing page() has began", DEBUG, 26); fsm_journal_event ("signal closing page()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_synth_page())); GTK_WIDGET (widget_get_synth_page()));
fsm_journal_event ("signal closing page() has ended", DEBUG, 26);
} }
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data) void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure single event occurences nb() has began", DEBUG, 26); fsm_journal_event ("signal measure single event occurences nb()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_nb())); GTK_WIDGET (widget_measure_event_occurences_nb()));
fsm_journal_event ("signal measure single event occurences nb() has ended", DEBUG, 26);
} }
void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data) void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure single event occurences dates() has began", DEBUG, 26); fsm_journal_event ("signal measure single event occurences dates()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_dates())); GTK_WIDGET (widget_measure_event_occurences_dates()));
fsm_journal_event ("signal measure single event occurences dates() has ended", DEBUG, 26);
} }
void on_measure_single_event_occurences_situations (GtkWidget *btt, gpointer data) void on_measure_single_event_occurences_situations (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure single event occurences situations() has began", DEBUG, 26); fsm_journal_event ("signal measure single event occurences situations()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_situations())); GTK_WIDGET (widget_measure_event_occurences_situations()));
fsm_journal_event ("signal measure single event occurences situations() has ended", DEBUG, 26);
} }
void on_measure_time_elapsed_between_two_events (GtkWidget *btt, gpointer data) void on_measure_time_elapsed_between_two_events (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure time elapsed between two events() has began", DEBUG, 26); fsm_journal_event ("signal measure time elapsed between two events()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_time_elapsed_between_two_events())); GTK_WIDGET (widget_measure_time_elapsed_between_two_events()));
fsm_journal_event ("signal measure time elapsed between two events() has ended", DEBUG, 26);
} }
void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data) void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal measure third event occurences in between() has began", DEBUG, 26); fsm_journal_event ("signal measure third event occurences in between()", DEBUG, SOURCE, TARGET);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_third_event_occurences_in_between())); GTK_WIDGET (widget_measure_third_event_occurences_in_between()));
fsm_journal_event ("signal measure third event occurences in between() has ended", DEBUG, 26);
} }
@ -542,11 +529,13 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
void on_entry_name_insert_after (GtkWidget *entry, gpointer data) void on_entry_name_insert_after (GtkWidget *entry, gpointer data)
{ {
fsm_journal_event ("signal entry name insert after() has began", DEBUG, 25); fsm_journal_event ("signal entry name insert after() has began",
DEBUG, SOURCE, TARGET);
} }
void on_entry_name_delete_after (GtkWidget *entry, gpointer data) void on_entry_name_delete_after (GtkWidget *entry, gpointer data)
{ {
fsm_journal_event ("signal entry name delete after() has began", DEBUG, 25); fsm_journal_event ("signal entry name delete after() has began",
DEBUG, SOURCE, TARGET);
} }

View File

@ -61,12 +61,13 @@ void *widget_get_text_window() { return text_window; }
void on_windows_startup (GtkApplication *app) // WIP 2024-09 void on_windows_startup (GtkApplication *app) // WIP 2024-09
{ {
// NB on_windows_startup() is in: widget/dispatch NOT in: src/signal // NB on_windows_startup() is in: widget/dispatch NOT in: src/signal
fsm_journal_event ("widget/dispatch windows startup()", INFO, 0); fsm_journal_event ("widget/dispatch windows startup()", MESSAGE, SOURCE, TARGET);
} }
void on_windows_activation (GtkApplication *app) void on_windows_activation (GtkApplication *app)
{ {
fsm_journal_event ("widget/dispatch windows activation() has began", INFO, 0); fsm_journal_event ("widget/dispatch windows activation() has began",
INFO, WIDGETS, WIDGETS);
// on_windows_activation() is in: widget/dispatch NOT in: src/signal // on_windows_activation() is in: widget/dispatch NOT in: src/signal
// g_application_activate (G_APPLICATION (app)); < how ? > in main is // g_application_activate (G_APPLICATION (app)); < how ? > in main is
@ -102,7 +103,8 @@ void on_windows_activation (GtkApplication *app)
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_b)); g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_b));
g_signal_connect (act_b, "activate", G_CALLBACK (action_b), app2);*/ g_signal_connect (act_b, "activate", G_CALLBACK (action_b), app2);*/
fsm_journal_event ("widget/dispatch windows activation() has ended", INFO, 0); fsm_journal_event ("widget/dispatch windows activation() has ended",
INFO, WIDGETS, WIDGETS);
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -27,6 +27,7 @@
#include "../../../include/base.h" #include "../../../include/base.h"
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
#include "../../../include/fsm.h"
/******************************************************************************/ /******************************************************************************/
@ -35,36 +36,37 @@
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window) void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
{ {
char *title = " Save the current model before modifying it? "; fsm_journal_event ("modal window design", INFO, WIDGETS, MODAL_WINDOW);
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); char *title = " Save the current model before modifying it? ";
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_window_set_titlebar (dialog_window, header_bar); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
gtk_window_set_titlebar (dialog_window, header_bar);
GtkWidget *dialog_window_grid = gtk_grid_new (); GtkWidget *dialog_window_grid = gtk_grid_new ();
const char *txt = " SAVE CURRENT MODEL "; const char *txt = " SAVE CURRENT MODEL ";
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_before_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) ;
gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ; gtk_grid_attach (GTK_GRID (dialog_window_grid), GTK_WIDGET (action_save_current_model), 0, 2, 2, 1) ;
gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid)); gtk_window_set_child (GTK_WINDOW (dialog_window), GTK_WIDGET (dialog_window_grid));
gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window)); gtk_window_set_transient_for (GTK_WINDOW (dialog_window), GTK_WINDOW (main_window));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog_window), TRUE);
gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE gtk_window_set_deletable (GTK_WINDOW (dialog_window), FALSE); // FALSE
gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE); gtk_window_set_modal (GTK_WINDOW (dialog_window), TRUE);
} }

View File

@ -39,6 +39,8 @@ static GtkWidget *window_topbar (GtkWindow *window);
void widget_design_main_window (GtkWindow *main_window, GtkApplication *app) void widget_design_main_window (GtkWindow *main_window, GtkApplication *app)
{ {
fsm_journal_event ("main_window *topbar = window_topbar (main_window)",
INFO, WIDGETS, TOPBAR);
GtkWidget *topbar = window_topbar (main_window); GtkWidget *topbar = window_topbar (main_window);
window_design_topbar_left (topbar); window_design_topbar_left (topbar);
window_design_topbar_right (topbar, app); window_design_topbar_right (topbar, app);
@ -49,6 +51,8 @@ void widget_design_main_window (GtkWindow *main_window, GtkApplication *app)
static GtkWidget *window_topbar (GtkWindow *window) static GtkWidget *window_topbar (GtkWindow *window)
{ {
fsm_journal_event ("topbar *topbar = gtk_header_bar_new ()",
INFO, TOPBAR, TOPBAR_CENTER);
char *title = "E coli (with permission from David S. Goodsell, 2009)"; char *title = "E coli (with permission from David S. Goodsell, 2009)";
GtkWidget *topbar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *topbar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (topbar), gtk_label_new (title)); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (topbar), gtk_label_new (title));

View File

@ -27,6 +27,7 @@
#include "../../../include/base.h" #include "../../../include/base.h"
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
#include "../../../include/fsm.h"
/******************************************************************************/ /******************************************************************************/
@ -42,6 +43,8 @@ void *widget_get_btt_data () {return btt_DATA;}
void window_design_topbar_left (GtkWidget *header_bar) void window_design_topbar_left (GtkWidget *header_bar)
{ {
fsm_journal_event ("topbar left g_signal_connect (EXEC / EDIT) + select a page",
INFO, TOPBAR, TOPBAR_LEFT);
gpointer no_local_data = NULL; gpointer no_local_data = NULL;
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ()); GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());

View File

@ -35,19 +35,20 @@
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window) void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
{ {
char *title = " Learn more about Gem Graph. "; fsm_journal_event ("text window design", INFO, WIDGETS, TEXT_WINDOW);
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); char *title = " Learn more about Gem Graph. ";
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_window_set_titlebar (text_window, header_bar); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
gtk_window_set_titlebar (text_window, header_bar);
GtkWidget *child = widget_get_text_from_address (widget_get_text_address_theory()); GtkWidget *child = widget_get_text_from_address (widget_get_text_address_theory());
child = widget_get_text_from_address (widget_get_text_address_practice()); child = widget_get_text_from_address (widget_get_text_address_practice());
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);
// gtk_window_set_resizable (GTK_WINDOW (text_window), TRUE); // gtk_window_set_resizable (GTK_WINDOW (text_window), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (text_window), GTK_WINDOW (main_window)); gtk_window_set_transient_for (GTK_WINDOW (text_window), GTK_WINDOW (main_window));
gtk_window_set_destroy_with_parent (GTK_WINDOW (text_window), TRUE); gtk_window_set_destroy_with_parent (GTK_WINDOW (text_window), TRUE);
} }

View File

@ -27,6 +27,7 @@
#include "../../../include/base.h" #include "../../../include/base.h"
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
#include "../../../include/fsm.h"
/******************************************************************************/ /******************************************************************************/
@ -92,6 +93,8 @@ static void connect(GApplication *app, gpointer *data) { puts("Connect menu item
void window_design_topbar_right (GtkWidget *header_bar, GtkApplication *app) void window_design_topbar_right (GtkWidget *header_bar, GtkApplication *app)
{ {
fsm_journal_event ("topbar right display_widgets (buttons, menus)",
INFO, TOPBAR, TOPBAR_RIGHT);
display_widgets_at_the_right_side (header_bar); display_widgets_at_the_right_side (header_bar);
GSimpleActionGroup *ga = g_simple_action_group_new (); GSimpleActionGroup *ga = g_simple_action_group_new ();