journal introduction of : 'REPEATED' (applied to conditions' list and tree)

This commit is contained in:
Jean Sirmai 2024-09-22 15:30:00 +02:00
parent 8d510d84be
commit 0d312b7d31
Signed by: jean
GPG Key ID: FB3115C340E057E3
9 changed files with 43 additions and 30 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, SPEW}; enum severity {CRITICAL, ERROR, WARNING, INFO, MESSAGE, DEBUG, REPEATED, SPEW};
enum source { enum source {
SOURCE, TARGET, JOURNAL, FSM, PREFER, SOURCE, TARGET, JOURNAL, FSM, PREFER,
@ -72,7 +72,9 @@ enum source {
SYNTH_PAGE, STATE_PAGE, RULES_PAGE, MEASURES_PAGE, RESULTS_PAGE, SYNTH_PAGE, STATE_PAGE, RULES_PAGE, MEASURES_PAGE, RESULTS_PAGE,
SYNTH_GLAREA, SYNTH_ALL_RESULTS, SYNTH_TIME_DEP_RESULTS, SYNTH_TIME_INDEP_RESULTS, SYNTH_GLAREA, SYNTH_ALL_RESULTS, SYNTH_TIME_DEP_RESULTS, SYNTH_TIME_INDEP_RESULTS,
STATE_TOP, STATE_BOTTOM, STATE_GLAREA, STATE_CAMERA, STATE_TOP, STATE_BOTTOM, STATE_GLAREA, STATE_CAMERA,
RULE_GLAREA, RULE_CAMERA, RULES_TREE, RULES_COMPARE, RULES_USE, RULE_GEOMETRY, RULE_GLAREA, RULE_CAMERA,
RULE_ALGEBRA, RULE_CONDITION, RULE_ASSIGN, RULE_ID,
RULES_TREE, RULES_COMPARE, RULES_USE,
MEASURES_TOOLS, MEASURES__ACTIVITY, MEASURES__DISPLAY, MEASURES_TOOLS, MEASURES__ACTIVITY, MEASURES__DISPLAY,
TIME_DEP_RESULTS, TIME_INDEP_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,

View File

@ -154,8 +154,8 @@ void *widget_get_sequence_control(); // bottom
// call: prefer.c // call: prefer.c
// def: widget / state / top.c // def: widget / state / top.c
void widget_reset_all_situations_transparencies_to_value (int value); // top void widget_reset_all_situations_transparencies_at_value (int value); // top
void widget_set_object_transparency_to_value (int rank, int value); // top void widget_set_object_transparency_at_value (int rank, int value); // top
int widget_get_object_transparency (int i); // top int widget_get_object_transparency (int i); // top

View File

@ -68,15 +68,15 @@ void fsm_journal_push (char *message, const char *string_value)
fsm_journal_push_front (&gg_logs, concat (message, " ", string_value, NULL)); fsm_journal_push_front (&gg_logs, concat (message, " ", string_value, NULL));
} }
// CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 😄️ // CRITICAL ERROR WARNING INFO MESSAGE DEBUG qq SPEW 😄️
// 0 1 2 3 4 5 6 // 0 1 2 3 4 5 6 7
#define CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____😄 0 #define CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___REPEATED___SPEW____😄 0
void fsm_journal_event (char *message, int severity, int source, const char *value) void fsm_journal_event (char *message, int severity, int source, const char *value)
{ {
if if
( (
severity <= DEBUG severity != REPEATED
&& source != TREE // && source != TREE
/* && ( /* && (
source == MAIN source == MAIN
|| source == FSM || source == FSM

View File

@ -77,20 +77,20 @@ void fsm_store_restore_reset (int choice, int value)
"fsm/prefer store restore reset(): switch (STORE)", MESSAGE, PREFER, ""); "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_to_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 (
"fsm/prefer store restore reset(): switch (RESTORE)", MESSAGE, PREFER, ""); "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_to_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 (
"fsm/prefer store restore reset(): switch (RESET)", MESSAGE, PREFER, ""); "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_to_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 (
@ -113,7 +113,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
char string_value [12]; sprintf(string_value, " (%d)", value); strcat(str1, string_value); char string_value [12]; sprintf(string_value, " (%d)", value); strcat(str1, string_value);
fsm_journal_event (str1, INFO, PREFER, string_value); // TODO fsm_journal_event (str1, INFO, PREFER, string_value); // TODO
reset_situations_to_value = value; reset_situations_to_value = value;
widget_reset_all_situations_transparencies_to_value (value); widget_reset_all_situations_transparencies_at_value (value);
} }

View File

@ -141,7 +141,7 @@ int main (int argc, char **argv)
G_APPLICATION_DEFAULT_FLAGS); G_APPLICATION_DEFAULT_FLAGS);
fsm_journal_event ("main \ fsm_journal_event ("main \
g signal connect (app <--> on_windows_startup)", INFO, MAIN, ""); g signal connect (app <--> on_windows_startup & activate)", INFO, MAIN, "\n");
// ! 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

View File

@ -74,7 +74,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 ("signal setup user tree factory()",
SPEW, EXPANDER, ""); 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);
} }
@ -104,7 +104,7 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
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 ("signal (tree) bind user tree factory()",
DEBUG, TREE, text); REPEATED, TREE, text);
} }
@ -204,11 +204,11 @@ 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 ("signal (axis) X value changed()",
SPEW, SLIDER_X, string_value); break; REPEATED, SLIDER_X, string_value); break;
case 1 : fsm_journal_event ("signal (axis) Y value changed()", case 1 : fsm_journal_event ("signal (axis) Y value changed()",
SPEW, SLIDER_Y, string_value); break; REPEATED, SLIDER_Y, string_value); break;
case 2 : fsm_journal_event ("signal (axis) Z value changed()", case 2 : fsm_journal_event ("signal (axis) Z value changed()",
SPEW, SLIDER_Z, string_value); break; REPEATED, SLIDER_Z, string_value); break;
} }
} }

View File

@ -104,7 +104,7 @@ void on_windows_activation (GtkApplication *app)
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 ("widget/dispatch windows activation() has ended",
INFO, WIDGETS, ""); INFO, WIDGETS, "\n");
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -25,6 +25,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../../include/util.h"
#include "../../../../include/fsm.h" #include "../../../../include/fsm.h"
#include "../../../../include/widget.h" #include "../../../../include/widget.h"
#include "../../../../include/signal.h" #include "../../../../include/signal.h"
@ -39,15 +40,23 @@ 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
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];
sprintf(str_nb, "%d", conditions_nb);
char *str_journal;
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
char str1[40]; strcpy(str1, "if ( value ("); char str1[] = "if ( value (";
char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2); char str2[5]; sprintf(str2, "%d, ", rand() % 10);
char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3); char str3[5]; sprintf(str3, "%d, ", rand() % 10);
char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4); char str4[5]; sprintf(str4, "%d, ", rand() % 10);
char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5); char str5[8]; sprintf(str5, "%d) == ", rand() % 10);
char str6[5]; sprintf(str6, "%d)", rand() % 10); strcat(str1, str6); char str6[4]; sprintf(str6, "%d)", rand() % 10);
widget_set_item_text (list_box, str1, TRUE); str_journal = concat (str1, str2, str3, str4, str5, str6, NULL);
widget_set_item_text (list_box, str_journal, TRUE);
fsm_journal_event ("conditions_list ", REPEATED, RULE_CONDITION, str_journal);
} }
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);
@ -60,6 +69,8 @@ void *widget_get_btt_conditions_list()
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));
fsm_journal_event ("conditions_list ", DEBUG, RULE_CONDITION,
concat ("clicked [", str_journal, "] = last of: ", str_nb, NULL));
return conditions; return conditions;
} }

View File

@ -41,7 +41,7 @@ int widget_get_object_transparency (int rank)
return gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (object_bar [rank])); return gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (object_bar [rank]));
} }
void widget_set_object_transparency_to_value (int rank, int value) void widget_set_object_transparency_at_value (int rank, int value)
{ {
gtk_adjustment_set_value (object_adjust [rank], value); gtk_adjustment_set_value (object_adjust [rank], value);
} }
@ -131,7 +131,7 @@ static void *get_objects_box()
static GtkScrollbar *situation_bar [n_situations]; static GtkScrollbar *situation_bar [n_situations];
static GtkAdjustment *situation_adjust [n_situations]; static GtkAdjustment *situation_adjust [n_situations];
void widget_reset_all_situations_transparencies_to_value (int value) void widget_reset_all_situations_transparencies_at_value (int value)
{ {
for (int i = 0; i < n_situations; i++) for (int i = 0; i < n_situations; i++)
if (value > -1) if (value > -1)
@ -169,7 +169,7 @@ static void *get_situations_box()
gtk_box_append (situations_box, GTK_WIDGET (situation_bar [i])); gtk_box_append (situations_box, GTK_WIDGET (situation_bar [i]));
} }
widget_reset_all_situations_transparencies_to_value (-1); widget_reset_all_situations_transparencies_at_value (-1);
return situations_box; return situations_box;
} }