WIP: using 'preferences' < first step
This commit is contained in:
parent
01b59ee7ac
commit
89bde1d284
|
@ -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_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
|
||||||
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // 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_exec_edit ();
|
||||||
int fsm_get_state_rules_data ();
|
int fsm_get_state_rules_data ();
|
||||||
int fsm_get_store_restore_reset ();
|
int fsm_get_store_restore_reset ();
|
||||||
|
|
|
@ -33,3 +33,11 @@
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
void print_sth(char *msg);
|
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();
|
||||||
|
|
|
@ -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 */
|
/* D I A L O G W I N D O W */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
#define n_objects 32
|
|
||||||
#define n_situations 128
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* W I N D O W S */
|
/* W I N D O W S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
44
src/fsm.c
44
src/fsm.c
|
@ -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 */
|
/* 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) {
|
if (choice_EXEC_EDIT != choice) {
|
||||||
debug_printing (value, 0); // EXEC_EDIT is sub_automaton 0
|
debug_printing (choice, 0, 0); // EXEC_EDIT is sub_automaton 0
|
||||||
choice_EXEC_EDIT = value;
|
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) {
|
if (choice_STATE_RULES_DATA != choice) {
|
||||||
debug_printing (value, 1); // STATE_RULES_DATA is sub_automaton 1
|
debug_printing (choice, 0, 1); // STATE_RULES_DATA is sub_automaton 1
|
||||||
choice_STATE_RULES_DATA = value;
|
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) {
|
switch (choice) {
|
||||||
case (STORE) : break;
|
case (STORE) : printf("STORE current values in MEM ");
|
||||||
case (RESTORE) : break;
|
pref_store_objects_transparencies_values (); break;
|
||||||
case (RESET) : 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");
|
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)
|
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;
|
choice_SITUATIONS_box_RESET_VALUE = value;
|
||||||
widget_reset_all_situations_transparencies_to_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_1 [] = { "STATE", "RULES", "DATA" };
|
||||||
static char *tab_2 [] = { "STORE", "RESTORE", "RESET" };
|
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
|
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
|
||||||
// sub_automaton 1 is STATE_RULES_DATA
|
// sub_automaton 1 is STATE_RULES_DATA
|
||||||
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
|
||||||
tab_0 [choice_EXEC_EDIT],
|
tab_0 [choice_EXEC_EDIT],
|
||||||
tab_1 [choice_STATE_RULES_DATA],
|
tab_1 [choice_STATE_RULES_DATA],
|
||||||
tab_0 [value],
|
tab_0 [choice],
|
||||||
tab_1 [choice_STATE_RULES_DATA]);
|
tab_1 [choice_STATE_RULES_DATA]);
|
||||||
break;
|
break;
|
||||||
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
||||||
tab_0 [choice_EXEC_EDIT],
|
tab_0 [choice_EXEC_EDIT],
|
||||||
tab_1 [choice_STATE_RULES_DATA],
|
tab_1 [choice_STATE_RULES_DATA],
|
||||||
tab_0 [choice_EXEC_EDIT],
|
tab_0 [choice_EXEC_EDIT],
|
||||||
tab_1 [value]);
|
tab_1 [choice]);
|
||||||
break;
|
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]);
|
tab_2 [choice_STORE_RESTORE_RESET]);
|
||||||
break;
|
break;
|
||||||
case (3) : printf("fsm_reset_all_situations_transparencies_at_value : %3d\n", value);
|
case (3) : printf("fsm_reset_all_situations_transparencies_at_value : %3d\n", value);
|
||||||
|
|
13
src/prefer.c
13
src/prefer.c
|
@ -33,4 +33,15 @@
|
||||||
#include "../include/signal.h"
|
#include "../include/signal.h"
|
||||||
#include "../include/widget.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() {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue