Compare commits

..

2 Commits

18 changed files with 240 additions and 338 deletions

View File

@ -62,7 +62,7 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
* * * * * - J O U R N A L M E T A R U L E S - * * * */ * * * * * - J O U R N A L M E T A R U L E S - * * * */
enum severity {CRITICAL, ERROR, WARNING, INFO, MESSAGE, DEBUG, REPEATED, SPEW}; enum severity {CRITICAL, ERROR, WARNING, INFO, MESSAGE, DEBUG, REPETITIVE, SPEW};
enum source { enum source {
SOURCE, TARGET, JOURNAL, FSM, PREFER, SOURCE, TARGET, JOURNAL, FSM, PREFER,
@ -76,7 +76,7 @@ enum source {
RULE_ALGEBRA, RULE_CONDITION, RULE_ASSIGN, RULE_ID, RULE_ALGEBRA, RULE_CONDITION, RULE_ASSIGN, RULE_ID,
RULES_TREE, RULES_COMPARE, RULES_USE, RULES_TREE, RULES_COMPARE, RULES_USE,
MEASURES_TOOLS, MEASURES__ACTIVITY, MEASURES__DISPLAY, MEASURES_TOOLS, MEASURES__ACTIVITY, MEASURES__DISPLAY,
TIME_DEP_RESULTS, TIME_INDEP_RESULTS, RESULTS, TIME_DEP_RESULTS, TIME_INDEP_RESULTS,
WIDGET, BUTTON, SCROLL, GLAREA, TEXT, LABEL, TREE, SLIDER, EXPANDER, ENTRY, WIDGET, BUTTON, SCROLL, GLAREA, TEXT, LABEL, TREE, SLIDER, EXPANDER, ENTRY,
SWITCH_STATE_RULES_DATA, SWITCH_STATE_RULES_DATA,
SLIDER_X, SLIDER_Y, SLIDER_Z, SLIDER_X, SLIDER_Y, SLIDER_Z,
@ -89,33 +89,47 @@ enum value {VALUE}; // to use or not to use ... (plutôt non)
typedef struct unit {long yy_dd_mm; typedef struct unit {long yy_dd_mm;
long usec; long usec;
char *message; const char *file_source;
const char *function_source;
const char *string_value;
struct unit *prev; struct unit *prev;
struct unit *next;} unit; // journal unit structure struct unit *next;} unit; // journal unit structure
typedef struct {unit *first; unit *last;} journal; // journal unit access structure typedef struct {unit *first; unit *last;} journal; // journal unit access structure
void fsm_journal_init (journal *jj); // init from main void fsm_journal_init (journal *jj); // init from main
void fsm_journal_push (char *message, void fsm_journal_push_front (journal *jj, // add an évènement at the journal front
const char *string_value); // def: fsm/dispatch const char *file_source, // def: fsm/dispatch
// call: any call that does not have const char *function_source, // call: any call that does not have
// the log address const char *string_value); // the log address
void fsm_journal_clear (journal *jj, char *message); // empty the journal void fsm_journal_clear (journal *jj,
void fsm_journal_push_front (journal *jj, char *message); // add an évènement at the journal front const char *file_source,
long fsm_journal_pop_back (journal *jj, char *message); // remove an évènement at the journal end const char *function_source,
const char *string_value); // empty the journal
long fsm_journal_pop_back (journal *jj, // removes an évènement
const char *file_source, // at the journal end
const char *function_source,
const char *string_value);
int fsm_journal_length (journal jj); // journal length int fsm_journal_length (journal jj); // journal length
void fsm_journal_seek (journal jj, long usec, char *message); // seek for an évènement in the journal void fsm_journal_seek (journal jj, // seek for an évènement
long usec, // in the journal
const char *file_source,
const char *function_source,
const char *string_value);
void fsm_journal_publish (journal jj); // display the journal void fsm_journal_publish (journal jj); // display the journal
void fsm_journal_test (char *message);
// --------------------------------------------------------------- WIP ------ // -----------------------------------------------------------------------------
// 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 severity, int source, const char *value); void fsm_journal_event (int severity,
int source,
const char *file_source,
const char *function_source,
const char *string_value);
// def: fsm/dispatch call: widget/dispatch; // def: fsm/dispatch call: widget/dispatch;
// --------------------------------------------------------------- WIP ------ // -----------------------------------------------------------------------------
@ -148,12 +162,6 @@ void fsm_add_displayable (char *displayable_name);// def: fsm/prefer; call: fs
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
// def: fsm/prefer; call: signal; // def: fsm/prefer; call: signal;
void fsm_msg (int choice, int value, char *string, int sub_automaton);
// def: fsm/dispatch; call: fsm/dispatch;
// fsm/measure;
// fsm/result;
// --------------------------------------------------------------- WIP ------ // --------------------------------------------------------------- WIP ------
// def: measure/tool_list call: measure/tool_list (about the following functions...) // def: measure/tool_list call: measure/tool_list (about the following functions...)
void fsm_tools_list_insert (tool_list **tl, int value); void fsm_tools_list_insert (tool_list **tl, int value);

View File

@ -30,6 +30,8 @@
#include "../include/fsm.h" #include "../include/fsm.h"
char *util_read_file (char *filename); char *util_read_file (char *filename);
// Programmers using the strcat function can easily be recognized as lazy and reckless.
// (quoted from: The GNU C Library (glibc) manual - 5.5 Concatenating Strings)
char *concat (const char *str, ...); char *concat (const char *str, ...);
typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément

103
journal.c
View File

@ -1,103 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* A journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/* */
/* A session starts when the main window opens and ends when it closes. */
/******************************************************************************/
int fsm_journal_push (journal **jj, int vv)
{
journal *element = malloc (sizeof(journal));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = vv;
element->prev = *jj;
*jj = element; // Le pointeur pointe sur le dernier élément.
return vv;
}
int fsm_journal_pop (journal **jj)
{
int vv;
journal *tmp;
if (!*jj) return -1; // Retourne -1 si le journal est vide.
tmp = (*jj)->prev;
vv = (*jj)->value;
free (*jj);
*jj = tmp; // Le pointeur pointe sur le dernier élément.
return vv; // retourne la value retirée du journal.
}
void fsm_journal_clear (journal **jj)
{
journal *tmp;
while (*jj)
{
tmp = (*jj)->prev;
free (*jj);
*jj = tmp;
}
}
int fsm_journal_length (journal *jj)
{
int n=0;
while (jj)
{
n++;
jj = jj->prev;
}
return n;
}
void fsm_journal_view (journal *jj)
{
printf ("view journal (n = %d)\n", fsm_journal_length (jj));
while (jj)
{
printf ("> %d\n", jj->value);
jj = jj->prev;
}
puts ("------");
}
void fsm_journal_seek (journal *jj, int value)
{
}

View File

@ -60,41 +60,26 @@ static journal gg_logs;
void fsm_journal_publication_request () {fsm_journal_publish (gg_logs);} void fsm_journal_publication_request () {fsm_journal_publish (gg_logs);}
void fsm_journal_push (char *message, const char *string_value) // CRITICAL ERROR WARNING INFO MESSAGE DEBUG REPETITIVE SPEW
{
// Programmers using the strcat function can easily be recognized as lazy and reckless.
// (quoted from: The GNU C Library (glibc) manual - 5.5 Concatenating Strings)
fsm_journal_push_front (&gg_logs, concat (message, " ", string_value, NULL));
}
// CRITICAL ERROR WARNING INFO MESSAGE DEBUG qq SPEW 😄️
// 0 1 2 3 4 5 6 7 // 0 1 2 3 4 5 6 7
#define CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___REPEATED___SPEW____😄 0 void fsm_journal_event (int severity,
void fsm_journal_event (char *message, int severity, int source, const char *value) int source,
const char *file_source,
const char *function_source,
const char *string_value)
{ {
if if ( TRUE // just to find easily the line beginning the filter conditions 😄️
(
severity != REPEATED
// && source != TREE
/* && (
source == MAIN
|| source == FSM
|| source == TOPBAR
|| source == DIALOG_WINDOW
|| source == MODAL_WINDOW
|| source == TEXT_WINDOW
|| source == TOPBAR_LEFT
|| source == TOPBAR_RIGHT
|| source == PREFER
)
// && strcmp (value, "")
&& source != SIGNAL */
)
fsm_journal_push (message, value); // TODO push (message + value) && severity != REPETITIVE
// source != TREE
// source == FSM
// strcmp (value, "")
&& TRUE) // just to find easily the line ending the filter conditions 😄️
// in case there are many ...
fsm_journal_push_front (&gg_logs, file_source, function_source, string_value);
} }
#define MAIN___DIALOG___MODAL___TOPBAR___SYNTH___RULES___MEASURES___RESULTS___😄 0
/******************************************************************************/ /******************************************************************************/
@ -103,23 +88,23 @@ void fsm_journal_event (char *message, int severity, int source, const char *val
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, MESSAGE, MAIN, ""); fsm_journal_event (MESSAGE, MAIN, "main", initial_message_from_main, "");
fsm_journal_event ("fsm/dispatch fsm initialisation has began", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation", "has began");
fsm_journal_event ("fsm/dispatch measures list init()", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "measures list init()", "");
fsm_measures_list_init(); fsm_measures_list_init();
fsm_journal_event ("fsm/dispatch results list init()", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "results list init()", "");
fsm_results_list_init(); fsm_results_list_init();
fsm_journal_event ("fsm/dispatch displayable list init()", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "displayable list init()", "");
fsm_displayable_list_init(); fsm_displayable_list_init();
fsm_journal_event ("fsm/dispatch preferences list init()", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "preferences list init()", "");
fsm_preferences_list_init(); fsm_preferences_list_init();
fsm_journal_event ("fsm/dispatch fsm initialisation has ended", MESSAGE, FSM, ""); fsm_journal_event (MESSAGE, FSM, "fsm/dispatch", "fsm initialisation", "has ended");
} }
@ -132,22 +117,27 @@ static int preferences_have_been_modified = FALSE;
void fsm_set_preferences_modified (bool value) void fsm_set_preferences_modified (bool value)
{ {
char str1[] = "fsm/dispatch preferences modified: value = "; const char *str_value;
char str2[] = "TRUE or FALSE (TODO)"; //sprintf(str2, "%d", value); TODO if (value) str_value = "FALSE"; else str_value = "TRUE";
fsm_journal_event (str1, INFO, FSM, str2); fsm_journal_event (INFO, FSM,
"fsm/dispatch",
"preferences modified: value = ",
str_value);
preferences_have_been_modified = value; preferences_have_been_modified = value;
} }
bool fsm_get_preferences_state() {return preferences_have_been_modified;}
// preferences_have_been_modified // preferences_have_been_modified
// and should be stored before closing the current session. TODO // and should be stored before closing the current session. TODO
bool fsm_get_preferences_state() {return preferences_have_been_modified;}
static int choice_EXEC_EDIT = EXEC; static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = SYNTH; // THE FIRST PAGE TO BE PRESENTED static int choice_STATE_RULES_DATA = SYNTH; // THE FIRST PAGE TO BE PRESENTED
// SEE ALSO fsm/dispatch.c window_design_topbar_left() (the end) // SEE ALSO fsm/dispatch.c window_design_topbar_left() (the end)
int fsm_get_exec_edit() {return choice_EXEC_EDIT;} int fsm_get_exec_edit() {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;} int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
@ -157,61 +147,26 @@ int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
/* T R A N S I T I O N S */ /* T R A N S I T I O N S */
/******************************************************************************/ /******************************************************************************/
static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "SYNTH", "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()", INFO, FSM, ""); // TODO print choice {
fsm_journal_event (INFO, FSM, "fsm/dispatch", "set_exec_edit()",
concat (tab_0 [choice_EXEC_EDIT], " > ", tab_0 [choice], NULL));
choice_EXEC_EDIT = choice; choice_EXEC_EDIT = 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()", INFO, FSM, ""); // TODO print choice {
fsm_journal_event (INFO, FSM, "fsm/dispatch", "set_state_rules_data()",
concat (tab_1 [choice_STATE_RULES_DATA], " > ", tab_1 [choice], NULL));
choice_STATE_RULES_DATA = choice; choice_STATE_RULES_DATA = choice;
} }
} }
/******************************************************************************/
/* D E B U G G I N G */
/******************************************************************************/
static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
void fsm_msg (int choice, int value, char *string, int sub_automaton)
{
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA
// sub_automaton 2 is MEASURE
case (0) :
fsm_journal_event ("fsm/dispatch switch EXEC_EDIT (TODO)", INFO, FSM, ""); // TODO print choice
printf ("fsm/dispatch (message) |\
switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice], tab_1 [choice_STATE_RULES_DATA]);
break;
case (1) :
fsm_journal_event ("fsm/dispatch switch STATE_RULES_DATA (TODO)", INFO, FSM, ""); // TODO print choice
printf ("fsm/dispatch (message) |\
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]);
break;
case (2) : // printf ("fsm/dispatch (message) | %s\n", string);
break;
case (3) : // printf ("fsm/dispatch (message) | %2d\n", choice);
break;
default : printf ("default in fsm/dispatch.fsm_msg()\n");
fsm_journal_event ("fsm/dispatch fsm_msg () default in switch (sub_automaton)", INFO, FSM, "");
}
}

View File

@ -23,7 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * along with this program. If not, see <http://www.gnu.org/licenses/>. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h> //#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
@ -32,10 +32,19 @@
#include "../../include/fsm.h" #include "../../include/fsm.h"
/******************************************************************************/ /******************************************************************************/
/* A journal stores chronologically the fsm events */ /* A journal stores chronologically the events */
/* during a session run (rules exec, mainly) */ /* during a session run (rules exec, mainly) */
/******************************************************************************/ /******************************************************************************/
/* 2024-09-22
* What types of events should be reported ? (fsm, widgets, ... )
* For what purpose ?
* What information must be collected and transmitted ?
* How do you name and classify this information ?
* How do you present it ?
*
* date clé (rank) fichier source fonction source +/- valeur */
/* /*
time_t current_time = time(NULL); time_t current_time = time(NULL);
@ -52,7 +61,10 @@ void fsm_journal_init (journal *jj)
jj->last = NULL; jj->last = NULL;
} }
void fsm_journal_clear (journal *jj, char *message) void fsm_journal_clear (journal *jj,
const char *file_source,
const char *function_source,
const char *string_value)
{ {
unit *tmp; unit *tmp;
unit *a_unit = jj->first; unit *a_unit = jj->first;
@ -66,15 +78,22 @@ void fsm_journal_clear (journal *jj, char *message)
jj->last = NULL; jj->last = NULL;
} }
void fsm_journal_push_front (journal *jj, char *message) void fsm_journal_push_front (journal *jj,
const char *file_source,
const char *function_source,
const char *string_value)
{ {
struct timeval tv; struct timeval tv;
gettimeofday (&tv, NULL); gettimeofday (&tv, NULL);
unit *new_unit = malloc (sizeof(unit)); unit *new_unit = malloc (sizeof(unit));
if (! new_unit) exit (EXIT_FAILURE); if (! new_unit) exit (EXIT_FAILURE);
new_unit->yy_dd_mm = tv.tv_sec; new_unit->yy_dd_mm = tv.tv_sec;
new_unit->usec = tv.tv_usec; new_unit->usec = tv.tv_usec;
new_unit->message = message; new_unit->file_source = file_source;
new_unit->function_source = function_source;
new_unit->string_value = string_value;
new_unit->next = jj->first; new_unit->next = jj->first;
new_unit->prev = NULL; new_unit->prev = NULL;
if (jj->first) jj->first->prev = new_unit; if (jj->first) jj->first->prev = new_unit;
@ -82,7 +101,10 @@ void fsm_journal_push_front (journal *jj, char *message)
jj->first = new_unit; jj->first = new_unit;
} }
long fsm_journal_pop_back (journal *jj, char *message) long fsm_journal_pop_back (journal *jj,
const char *file_source,
const char *function_source,
const char *string_value)
{ {
long usec; long usec;
unit *tmp = jj->last; unit *tmp = jj->last;
@ -108,7 +130,10 @@ int fsm_journal_length (journal jj)
return nb; return nb;
} }
void fsm_journal_seek (journal jj, long usec, char *message) void fsm_journal_seek (journal jj, long usec,
const char *file_source,
const char *function_source,
const char *string_value)
{ {
unit *a_unit = jj.first; unit *a_unit = jj.first;
int nb = 0; int nb = 0;
@ -123,6 +148,7 @@ void fsm_journal_seek (journal jj, long usec, char *message)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// ref: sudo cat /var/log/messages
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz" "%Y-%m-%d %H:%M:%S" // Format time, "ddd yyyy-mm-dd hh:mm:ss zzz" "%Y-%m-%d %H:%M:%S"
// https://www.man7.org/linux/man-pages/man3/strftime.3.html // https://www.man7.org/linux/man-pages/man3/strftime.3.html
// https://en.cppreference.com/w/c/io/fprintf // https://en.cppreference.com/w/c/io/fprintf
@ -139,7 +165,13 @@ void fsm_journal_publish (journal jj)
while (a_unit) while (a_unit)
{ {
strftime(buf, sizeof(buf), "%D %T", localtime(&a_unit->yy_dd_mm)); strftime(buf, sizeof(buf), "%D %T", localtime(&a_unit->yy_dd_mm));
g_message ("%s + %6ld %6d %s", buf, a_unit->usec, nb, a_unit->message); g_message ("%s + %-6ld %6d %-32s %-36s %-50s",
buf,
a_unit->usec,
nb,
a_unit->file_source,
a_unit->function_source,
a_unit->string_value);
a_unit = a_unit->prev; a_unit = a_unit->prev;
nb ++; nb ++;
} }

View File

@ -87,8 +87,17 @@
void fsm_add_measure (char *measure_name) {fsm_msg (2, 0, measure_name, 2);} void fsm_add_measure (char *measure_name)
{
fsm_journal_event (DEBUG,
MEASURES_TOOLS,
"fsm/measure/manage/",
"fsm_add_measure()",
measure_name);
}
void fsm_measures_list_init() {if (0) fsm_tools_list_test();} void fsm_measures_list_init() {if (0) fsm_tools_list_test();}
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id) {} void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id) {}

View File

@ -73,28 +73,24 @@ void fsm_store_restore_reset (int choice, int value)
{ {
switch (choice) { switch (choice) {
case (STORE) : case (STORE) :
fsm_journal_event ( fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "store restore reset(): switch (STORE)", "");
"fsm/prefer store restore reset(): switch (STORE)", MESSAGE, PREFER, "");
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_at_value (i, p [i]); widget_set_object_transparency_at_value (i, p [i]);
} }
break; break;
case (RESTORE) : case (RESTORE) :
fsm_journal_event ( fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "store restore reset(): switch (RESTORE)", "");
"fsm/prefer store restore reset(): switch (RESTORE)", MESSAGE, PREFER, "");
for (int i = 0; i < n_objects; i++) for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_at_value (i, p [i]); widget_set_object_transparency_at_value (i, p [i]);
break; break;
case (RESET) : case (RESET) :
fsm_journal_event ( fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "store restore reset(): switch (RESET)", "");
"fsm/prefer store restore reset(): switch (RESET)", MESSAGE, PREFER, "");
for (int i = 0; i < n_objects; i++) for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_at_value (i, value); // i * 4 // rand() % 127 widget_set_object_transparency_at_value (i, value); // i * 4 // rand() % 127
break; break;
default : default :
fsm_journal_event ( fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "store restore reset(): switch (default)", "");
"fsm/prefer store restore reset(): switch (default)", MESSAGE, PREFER, "");
} }
fsm_set_preferences_modified (TRUE); fsm_set_preferences_modified (TRUE);
@ -109,9 +105,8 @@ static int reset_situations_to_value = -1;
void fsm_reset_all_situations_transparencies_at_value (int value) void fsm_reset_all_situations_transparencies_at_value (int value)
{ {
char str1[140] = "fsm/prefer reset all situations transparencies at value"; char string_value [12]; sprintf(string_value, "(%d)", value);
char string_value [12]; sprintf(string_value, " (%d)", value); strcat(str1, string_value); fsm_journal_event (INFO, PREFER, "fsm/prefer", "reset all situations transparencies at value", string_value);
fsm_journal_event (str1, INFO, PREFER, string_value); // TODO
reset_situations_to_value = value; reset_situations_to_value = value;
widget_reset_all_situations_transparencies_at_value (value); widget_reset_all_situations_transparencies_at_value (value);
} }
@ -126,8 +121,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 (MESSAGE, PREFER, "fsm/prefer", "add displayable()", displayable_name);
strcat("fsm/prefer add displayable() ", displayable_name), MESSAGE, PREFER, ""); // TODO
} }
@ -136,11 +130,11 @@ void fsm_add_displayable (char *displayable_name)
/******************************************************************************/ /******************************************************************************/
void fsm_preferences_list_init () void fsm_preferences_list_init ()
{ {
fsm_journal_event ("fsm/prefer setting up preferences list", MESSAGE, PREFER, ""); fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "preferences list init()", "");
} }
void fsm_displayable_list_init () void fsm_displayable_list_init ()
{ {
fsm_journal_event ("fsm/prefer setting up displayable list", MESSAGE, PREFER, ""); fsm_journal_event (MESSAGE, PREFER, "fsm/prefer", "displayables list init()", "");
} }

View File

@ -70,6 +70,10 @@ void fsm_add_result (char *result_name)
void fsm_results_list_init () void fsm_results_list_init ()
{ {
fsm_msg (0,0, "src/fsm/result.c fsm_results_list_init()", 2); // sub_automaton 2 fsm_journal_event (DEBUG,
RESULTS,
"fsm/",
"fsm_results_list_init()",
"");
} }

View File

@ -133,15 +133,13 @@
int main (int argc, char **argv) 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 ("first instruction / first log");
fsm_journal_event (INFO, MAIN, "main", "*app = gtk_application_new ()", "");
fsm_journal_event (
"main *app = gtk_application_new ()", INFO, MAIN, "");
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 \ fsm_journal_event (INFO, MAIN, "main",
g signal connect (app <--> on_windows_startup & activate)", INFO, MAIN, "\n"); "g signal connect", "(app <--> on_windows_startup & activate)");
// ! 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
@ -149,10 +147,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, ""); fsm_journal_event (INFO, MAIN, "main", "g_object unref (app)", "");
g_object_unref (app); g_object_unref (app);
fsm_journal_event ("main That'all folks ! 👋️😄️",INFO, MAIN, ""); fsm_journal_event (INFO, MAIN, "main", "That'all folks ! 👋️😄️", "");
fsm_journal_publication_request(); fsm_journal_publication_request();
return status; return status;

View File

@ -37,7 +37,7 @@
static void on_auto_notification (char *message) static void on_auto_notification (char *message)
{ {
// message = "-(any auto notification)-"; // test // message = "-(any auto notification)-"; // test
fsm_journal_event ("signal (notif.) ", DEBUG, AUTO_NOTIFICATION, message); fsm_journal_event (DEBUG, AUTO_NOTIFICATION, "signal", "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) {
@ -64,8 +64,7 @@ static void on_auto_notification (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()", fsm_journal_event (SPEW, EXPANDER, "signal", "user tree expander toggled()", "");
SPEW, EXPANDER, "");
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);
@ -73,8 +72,7 @@ static void on_user_tree_expander_toggled (GtkExpander *expander,
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()", fsm_journal_event (REPETITIVE, EXPANDER, "signal", "setup user tree factory()", "");
REPEATED, EXPANDER, "");
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);
} }
@ -103,8 +101,7 @@ 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 (tree) bind user tree factory()", fsm_journal_event (REPETITIVE, TREE, "signal", "(tree) bind user tree factory()", text);
REPEATED, TREE, text);
} }
@ -115,7 +112,7 @@ void on_bind_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) glarea render()", DEBUG, GLAREA, "(context TODO)"); fsm_journal_event (DEBUG, GLAREA, "signal", "glarea render()", "(context TODO)");
// 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 !");
@ -134,7 +131,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) glarea realize()", DEBUG, GLAREA, ""); fsm_journal_event (DEBUG, GLAREA, "signal", "glarea realize()", "");
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
@ -160,7 +157,7 @@ void on_glarea_realize (GtkWidget *widget)
/* 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) glarea unrealize()", DEBUG, GLAREA, ""); fsm_journal_event (DEBUG, GLAREA, "signal", "glarea unrealize()", "");
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
@ -203,12 +200,15 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
char string_value [10]; sprintf(string_value, " (%d)", axis_value); char string_value [10]; sprintf(string_value, " (%d)", axis_value);
switch (axis) { switch (axis) {
case 0 : fsm_journal_event ("signal (axis) X value changed()", case 0 : fsm_journal_event (REPETITIVE, SLIDER_X,
REPEATED, SLIDER_X, string_value); break; "signal", "X value changed()", string_value);
case 1 : fsm_journal_event ("signal (axis) Y value changed()", break;
REPEATED, SLIDER_Y, string_value); break; case 1 : fsm_journal_event (REPETITIVE, SLIDER_Y,
case 2 : fsm_journal_event ("signal (axis) Z value changed()", "signal", "Y value changed()", string_value);
REPEATED, SLIDER_Z, string_value); break; break;
case 2 : fsm_journal_event (REPETITIVE, SLIDER_Z,
"signal", "Z value changed()", string_value);
break;
} }
} }
@ -220,7 +220,7 @@ 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 (dialog) save current model()", INFO, BUTTON, ""); fsm_journal_event (INFO, BUTTON, "signal", "(dialog) save current model()", "");
on_auto_notification ("save_current_model_before_editing !"); on_auto_notification ("save_current_model_before_editing !");
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
} }
@ -228,7 +228,7 @@ void on_save_current_model_before_editing (GtkWidget *btt_save_current_model,
void on_discard_current_model_before_editing (GtkWidget *btt_discard_current_model, void on_discard_current_model_before_editing (GtkWidget *btt_discard_current_model,
gpointer data) gpointer data)
{ {
fsm_journal_event ("signal (dialog) discard current model()", INFO, BUTTON, ""); fsm_journal_event (INFO, BUTTON, "signal", "(dialog) discard current model()", "");
on_auto_notification ("discard_current_model_before_editing ?"); on_auto_notification ("discard_current_model_before_editing ?");
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
} }
@ -236,7 +236,7 @@ void on_discard_current_model_before_editing (GtkWidget *btt_discard_current_mod
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 (dialog) write current model()", INFO, BUTTON, ""); fsm_journal_event (INFO, BUTTON, "signal", "(dialog) write current model()", "");
on_auto_notification ("writing current_model_before_editing 😄️"); on_auto_notification ("writing current_model_before_editing 😄️");
gtk_window_close (GTK_WINDOW (data)); gtk_window_close (GTK_WINDOW (data));
} }
@ -253,7 +253,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 (Xec/Ed) toggle exec edit()", INFO, BUTTON, ""); fsm_journal_event (INFO, BUTTON, "signal", "(Xec/Ed) toggle exec edit()", "");
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),
@ -284,9 +284,12 @@ void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
static void switch_state_rules_data() static void switch_state_rules_data()
{ {
int value = fsm_get_state_rules_data(); int value = fsm_get_state_rules_data();
/*
* pas sûr que ça ait un intérêt... en tout cas, pas comme ça !
*
char string_value [12]; sprintf(string_value, "%d", value); char string_value [12]; sprintf(string_value, "%d", value);
fsm_journal_event ("signal (switch) value = ", fsm_journal_event (DEBUG, SWITCH_STATE_RULES_DATA, "signal", "(switch) value = ", string_value);
DEBUG, SWITCH_STATE_RULES_DATA, string_value); */
switch (value) { switch (value) {
case (SYNTH) : case (SYNTH) :
@ -330,8 +333,8 @@ 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 (switch) default in : switch state rules data()", fsm_journal_event (INFO, SWITCH_STATE_RULES_DATA,
INFO, SWITCH_STATE_RULES_DATA, ""); "signal", "(switch) default in : switch state rules data()", "");
} }
} }
@ -342,8 +345,8 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
{ {
const char *toggled_button_name const char *toggled_button_name
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button)); = gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
fsm_journal_event ("signal (toggle) <-->", fsm_journal_event (DEBUG, BUTTON,
INFO, BUTTON, toggled_button_name); "signal", "(toggle)", concat ("[ ", toggled_button_name, " ]", NULL));
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button)); int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
if ( ! strcmp (toggled_button_name, "synth")) fsm_set_state_rules_data (SYNTH); if ( ! strcmp (toggled_button_name, "synth")) fsm_set_state_rules_data (SYNTH);
@ -360,9 +363,7 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
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 (topbar R) search()", fsm_journal_event (DEBUG, BUTTON, "signal", "(topbar right) search()", "");
// fsm_journal_event ("signal clicked topbar right search()",
DEBUG, BUTTON, "");
// 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()));
@ -371,9 +372,7 @@ void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box)
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 (topbar R) home()", fsm_journal_event (DEBUG, BUTTON, "signal", "(topbar right) home()", "");
// fsm_journal_event ("signal clicked topbar right home()",
DEBUG, BUTTON, "");
gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); gtk_window_present (GTK_WINDOW (widget_get_dialog_window()));
// NB works only once. < TODO // NB works only once. < TODO
} }
@ -389,8 +388,7 @@ 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()", fsm_journal_event (DEBUG, BUTTON, "signal", "updating objects transparencies()", "");
DEBUG, BUTTON, "");
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));
@ -403,8 +401,7 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
void on_resetting_XYZ_in_state_page () void on_resetting_XYZ_in_state_page ()
{ {
fsm_journal_event ("signal resetting XYZ in state page()", fsm_journal_event (DEBUG, BUTTON, "signal", "resetting XYZ in state page()", "");
DEBUG, BUTTON, "");
widget_state_XYZ_reset_all(); widget_state_XYZ_reset_all();
} }
@ -412,8 +409,7 @@ void on_resetting_XYZ_in_state_page ()
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 situations box do reset()", fsm_journal_event (DEBUG, BUTTON, "signal", "situations box do reset()", "");
DEBUG, BUTTON, "");
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));
} }
@ -426,7 +422,7 @@ 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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "clicked topbar right measure()", "");
// 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()));
@ -434,98 +430,98 @@ void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "start new measure()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "select rules first()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure depends on a single event()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure depends on two events()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "select a second rules set()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "select a second measurement()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "skip this step()", "");
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 ()));
} }
void on_something_else (GtkWidget *btt, gpointer data) void on_something_else (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal something else()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "something else()", "");
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()));
} }
void on_closing_page (GtkWidget *btt, gpointer data) void on_closing_page (GtkWidget *btt, gpointer data)
{ {
fsm_journal_event ("signal closing page()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "closing page()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure single event occurences nb()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure single event occurences dates()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure single event occurences situations()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure time elapsed between two events()", "");
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()));
} }
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()", DEBUG, BUTTON, ""); fsm_journal_event (DEBUG, BUTTON, "signal", "measure third event occurences in between()", "");
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()));
} }
@ -537,13 +533,11 @@ 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()", fsm_journal_event (DEBUG, ENTRY, "signal", "entry name insert after()", "");
DEBUG, ENTRY, "");
} }
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()", fsm_journal_event (DEBUG, ENTRY, "signal", "entry name delete after()", "");
DEBUG, ENTRY, "");
} }

View File

@ -61,13 +61,12 @@ 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()", MESSAGE, WIDGETS, ""); fsm_journal_event (MESSAGE, WIDGETS, "widget/dispatch", "windows startup()", "");
} }
void on_windows_activation (GtkApplication *app) void on_windows_activation (GtkApplication *app)
{ {
fsm_journal_event ("widget/dispatch windows activation() has began", fsm_journal_event (INFO, WIDGETS, "widget/dispatch", "windows activation()", "has began");
INFO, 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
@ -103,8 +102,7 @@ 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", fsm_journal_event (INFO, WIDGETS, "widget/dispatch", "windows activation()", "has ended");
INFO, WIDGETS, "\n");
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -40,11 +40,11 @@ void *widget_get_btt_conditions_list()
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box);
gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H); gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H);
int conditions_nb = 32, // arbitrary TODO int conditions_nb = 32, // arbitrary TODO link to the XML model
nb_of_digits_used_to_write_the_conditions_nb_plus_one = 3; nb_of_digits_used_to_write_the_conditions_nb_plus_one = 3;
char str_nb [nb_of_digits_used_to_write_the_conditions_nb_plus_one]; char str_nb [nb_of_digits_used_to_write_the_conditions_nb_plus_one];
sprintf(str_nb, "%d", conditions_nb); sprintf(str_nb, "%d", conditions_nb);
char *str_journal; char *one_condition;
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
@ -54,9 +54,13 @@ void *widget_get_btt_conditions_list()
char str4[5]; sprintf(str4, "%d, ", rand() % 10); char str4[5]; sprintf(str4, "%d, ", rand() % 10);
char str5[8]; sprintf(str5, "%d) == ", rand() % 10); char str5[8]; sprintf(str5, "%d) == ", rand() % 10);
char str6[4]; sprintf(str6, "%d)", rand() % 10); char str6[4]; sprintf(str6, "%d)", rand() % 10);
str_journal = concat (str1, str2, str3, str4, str5, str6, NULL); one_condition = concat (str1, str2, str3, str4, str5, str6, NULL);
widget_set_item_text (list_box, str_journal, TRUE); widget_set_item_text (list_box, one_condition, TRUE);
fsm_journal_event ("conditions_list ", REPEATED, RULE_CONDITION, str_journal); fsm_journal_event (REPETITIVE,
RULE_CONDITION,
"one_rule/algebra/conditions",
"conditions list ",
one_condition);
} }
GtkWidget *pop = gtk_popover_new (); GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box); gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box);
@ -68,9 +72,14 @@ void *widget_get_btt_conditions_list()
gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions"); gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions");
gtk_menu_button_set_always_show_arrow (conditions, TRUE); gtk_menu_button_set_always_show_arrow (conditions, TRUE);
gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop)); gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop));
// clicked (conditions, NULL);
fsm_journal_event (DEBUG,
RULE_CONDITION,
"one_rule/algebra/conditions",
concat ("list; last of ", str_nb, " conditions: ", NULL),
concat ("[", one_condition, "]", NULL));
fsm_journal_event ("conditions_list ", DEBUG, RULE_CONDITION,
concat ("clicked [", str_journal, "] = last of: ", str_nb, NULL));
return conditions; return conditions;
} }

View File

@ -36,7 +36,7 @@
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window) void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
{ {
fsm_journal_event ("modal window design", INFO, MODAL_WINDOW, ""); fsm_journal_event (INFO, MODAL_WINDOW, "widget/topbar/dialog", "modal window design", "");
char *title = " Save the current model before modifying it? "; char *title = " Save the current model before modifying it? ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));

View File

@ -39,8 +39,7 @@ 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)", fsm_journal_event (INFO, TOPBAR, "widget/topbar/dispatch", "design (main window topbar)", "");
INFO, 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);
@ -51,8 +50,7 @@ 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 ()", fsm_journal_event (INFO, TOPBAR_CENTER, "widget/topbar/dispatch", "topbar = gtk_header_bar_new()", "");
INFO, 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

@ -43,8 +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", fsm_journal_event (INFO, TOPBAR_LEFT, "widget/topbar/left", "design",
INFO, TOPBAR_LEFT, ""); "(EXEC / EDIT) and (SYNTH / STATE / RULES / DATA)");
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,7 +35,7 @@
void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window) void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
{ {
fsm_journal_event ("text window design", INFO, TEXT_WINDOW, ""); fsm_journal_event (INFO, TEXT_WINDOW, "widget/topbar/modal", "text window design", "");
char *title = " Learn more about Gem Graph. "; char *title = " Learn more about Gem Graph. ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));

View File

@ -93,8 +93,7 @@ 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)", fsm_journal_event (INFO, TOPBAR_RIGHT, "widget/topbar/right", "design (buttons, menus)", "");
INFO, 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 ();

View File

@ -24,6 +24,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/fsm.h"
#include "../../include/signal.h" #include "../../include/signal.h"
#include "../../include/widget.h" #include "../../include/widget.h"
@ -76,6 +77,8 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
// ! WARNING ! TODO CUR EST L'ENFANT, MAINTENANT // ! WARNING ! TODO CUR EST L'ENFANT, MAINTENANT
// DONC, SI CUR EST UNE FEUILLE, JE N'ATTEINDRAI PAS SON ENFANT // DONC, SI CUR EST UNE FEUILLE, JE N'ATTEINDRAI PAS SON ENFANT
// TODO: link the tree to the XML model
return get_user_tree_model_child (cur); return get_user_tree_model_child (cur);
} }
@ -84,6 +87,8 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
void *widget_get_user_rules_tree () void *widget_get_user_rules_tree ()
{ {
fsm_journal_event (DEBUG, RULES_TREE, "widget/tree", "get user rules tree", "[We, the people,]...");
struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,"); struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,");
widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root);