WIP: using 'preferences' < first step

This commit is contained in:
Jean Sirmai 2024-07-24 23:07:14 +02:00
parent 01b59ee7ac
commit 89bde1d284
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 50 additions and 26 deletions

View File

@ -42,6 +42,12 @@ enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
#define n_objects 32
#define n_situations 128
int fsm_get_exec_edit ();
int fsm_get_state_rules_data ();
int fsm_get_store_restore_reset ();

View File

@ -33,3 +33,11 @@
#include <gtk-4.0/gtk/gtk.h>
void print_sth(char *msg);
struct preferences {
int id;
};
void pref_store_objects_transparencies_values ();
void pref_restore_previous_objects_transparencies_values ();
void pref_reset_objects_transparencies_values();

View File

@ -80,7 +80,7 @@ void on_toggle_state_rules_data (GtkWidget *btt_STATE_RULES_DATA, gpointer user_
/******************************************************************************/
/*************n_objects*****************************************************************/
/* D I A L O G W I N D O W */
/******************************************************************************/

View File

@ -31,9 +31,6 @@
#pragma once
#include <gtk-4.0/gtk/gtk.h>
#define n_objects 32
#define n_situations 128
/******************************************************************************/
/* W I N D O W S */
/******************************************************************************/

View File

@ -50,36 +50,37 @@ int fsm_get_store_restore_reset () {return choice_STORE_RESTORE_RESET;}
/* T R A N S I T I O N S */
/******************************************************************************/
static void debug_printing (int value, int sub_automaton);
static void debug_printing (int choice, int value, int sub_automaton);
void fsm_set_exec_edit (int value)
void fsm_set_exec_edit (int choice)
{
if (choice_EXEC_EDIT != value) {
debug_printing (value, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = value;
if (choice_EXEC_EDIT != choice) {
debug_printing (choice, 0, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = choice;
}
}
void fsm_set_state_rules_data (int value)
void fsm_set_state_rules_data (int choice)
{
if (choice_STATE_RULES_DATA != value) {
debug_printing (value, 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = value;
if (choice_STATE_RULES_DATA != choice) {
debug_printing (choice, 0, 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = choice;
}
}
void fsm_set_store_restore_reset (int target, int value)
void fsm_set_store_restore_reset (int choice, int value)
{
choice_STORE_RESTORE_RESET = target;
choice_STORE_RESTORE_RESET = choice;
switch (target) {
case (STORE) : break;
case (RESTORE) : break;
case (RESET) : break;
switch (choice) {
case (STORE) : printf("STORE current values in MEM ");
pref_store_objects_transparencies_values (); break;
case (RESTORE) : printf("RESTORE values from MEM "); break;
case (RESET) : printf("RESET current values from [value] "); break;
default : printf("default in signal.switch_store_restore_reset()\n");
}
debug_printing (target, 2); // STORE_RESTORE_RESET is sub_automaton 2
debug_printing (choice, value, 2); // STORE_RESTORE_RESET is sub_automaton 2
}
@ -90,7 +91,8 @@ static int choice_SITUATIONS_box_RESET_VALUE = -1;
void fsm_reset_all_situations_transparencies_at_value (int value)
{
debug_printing (value, 3); // SITUATIONS_box_RESTORE_VALUES is sub_automaton 4
debug_printing (choice_SITUATIONS_box_RESET_VALUE, value, 3);
// SITUATIONS_box_RESTORE_VALUES is sub_automaton 3
choice_SITUATIONS_box_RESET_VALUE = value;
widget_reset_all_situations_transparencies_to_value (value);
}
@ -104,23 +106,23 @@ static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "STATE", "RULES", "DATA" };
static char *tab_2 [] = { "STORE", "RESTORE", "RESET" };
static void debug_printing (int value, int sub_automaton)
static void debug_printing (int choice, int value, int sub_automaton)
{
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT],
tab_1 [choice_STATE_RULES_DATA],
tab_0 [value],
tab_0 [choice],
tab_1 [choice_STATE_RULES_DATA]);
break;
case (1) : printf("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 [value]);
tab_1 [choice]);
break;
case (2) : printf("fsm_set_store_restore_reset <> target = %s\n",
case (2) : printf("fsm_set_store_restore_reset <> choice = %s\n",
tab_2 [choice_STORE_RESTORE_RESET]);
break;
case (3) : printf("fsm_reset_all_situations_transparencies_at_value : %3d\n", value);

View File

@ -33,4 +33,15 @@
#include "../include/signal.h"
#include "../include/widget.h"
void print_sth(char *msg){printf("%s\n", msg);}
void print_sth(char *msg) {printf("%s\n", msg);}
struct preferences *pref;
void pref_store_objects_transparencies_values()
{
printf("pref_store_objects_transparencies_values n_objects = %d\n", n_objects);
}
void pref_restore_previous_objects_transparencies_values() {}
void pref_reset_objects_transparencies_values() {}