WIP: cleaning... cleaning...

This commit is contained in:
Jean Sirmai 2024-07-24 14:14:05 +02:00
parent 008f67f745
commit 9566672636
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 53 additions and 43 deletions

View File

@ -38,8 +38,9 @@
/******************************************************************************/ /******************************************************************************/
// called by widgets through signal functions // called by widgets through signal functions
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor 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
int fsm_get_exec_edit (); int fsm_get_exec_edit ();
int fsm_get_state_rules_data (); int fsm_get_state_rules_data ();
@ -48,6 +49,7 @@ int fsm_get_situations_box_reset_value ();
void fsm_set_exec_edit (int value); void fsm_set_exec_edit (int value);
void fsm_set_state_rules_data (int value); void fsm_set_state_rules_data (int value);
void fsm_set_store_restore_reset (int target, int value);
void fsm_reset_all_objects_transparencies_at_value (int value); void fsm_reset_all_objects_transparencies_at_value (int value);
void fsm_store_all_objects_transparencies_current_values (int value); void fsm_store_all_objects_transparencies_current_values (int value);

View File

@ -4,9 +4,9 @@
* * * *
* State machine * * State machine *
* * * *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> * * Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> * * Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> * * Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* * * *
* This file is part of Gem-graph. * * This file is part of Gem-graph. *
* * * *
@ -39,9 +39,10 @@
static int choice_EXEC_EDIT = EXEC; static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = STATE; static int choice_STATE_RULES_DATA = STATE;
static int choice_STORE_RESTORE_RESET = STORE;
static int choice_OBJECTS_box_RESET_VALUE = -1; static int choice_OBJECTS_box_RESET_VALUE = -1;
static int choice_SITUATIONS_box_RESET_VALUE = 0; static int choice_SITUATIONS_box_RESET_VALUE = -1;
/******************************************************************************/ /******************************************************************************/
@ -66,6 +67,19 @@ void fsm_set_state_rules_data (int value)
} }
} }
void fsm_set_store_restore_reset (int target, int value)
{
printf("fsm_set_store_restore_reset(%d,%3d) > ", target, value);
switch (target) {
case (STORE) : printf("STORE\n"); break;
case (RESTORE) : printf("RESTORE\n"); break;
case (RESET) : printf("RESET\n"); break;
default : printf("default in signal.switch_store_restore_reset()\n");
}
// debug_printing (target, 2); // STORE_RESTORE_RESET is sub_automaton 2
// choice_STORE_RESTORE_RESET = value;
}
@ -136,32 +150,30 @@ int fsm_get_situations_box_reset_value () {return choice_SITUATIONS_box_RESET_V
static char *tab_0 [] = { "EXEC", "EDIT" }; 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 void debug_printing (int value, int sub_automaton) static void debug_printing (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 [value],
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 [value]);
break; break;
case (2) : printf("fsm_restore_all_objects_transparencies_from_mem\n"); break; case (2) : printf("fsm_set_store_restore_reset <> target = %s\n",
case (3) : printf("fsm_store_all_objects_transparencies_current_values\n"); break; tab_2 [choice_STORE_RESTORE_RESET]);
case (4) : printf("fsm_reset_all_objects_transparencies_at_value\n"); break; break;
case (5) : printf("fsm_set_situations_box_reset_value : %3d > %3d\n", default : printf("default in automaton.debug_printing()\n");
fsm_get_situations_box_reset_value(), value); }
break;
default : printf("default in automaton.debug_printing()\n");
}
} }

View File

@ -281,48 +281,41 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
= 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));
if (! strcmp (toggled_button_name, "state")) { if ( ! strcmp (toggled_button_name, "state")) fsm_set_state_rules_data (STATE);
fsm_set_state_rules_data (STATE); if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES);
} if ( ! strcmp (toggled_button_name, "data analysis")) fsm_set_state_rules_data (DATA);
if (! strcmp (toggled_button_name, "rules")) { if (is_active) switch_state_rules_data();
fsm_set_state_rules_data (RULES);
}
if (! strcmp (toggled_button_name, "data analysis")) {
fsm_set_state_rules_data (DATA);
}
if (is_active) {
switch_state_rules_data();
}
} }
// ---------------------------- O B J E C T S --------------------------- // // ---------------------------- O B J E C T S --------------------------- //
static void switch_store_restore_reset() /*static void switch_store_restore_reset(GtkScrollbar *reset_scrollbar)
{ {
GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar);
switch (fsm_get_objects_box_reset_value()) { switch (fsm_get_objects_box_reset_value()) {
case (-1) : break; case (STORE) : fsm_set_store_restore_reset (gtk_adjustment_get_value (adj_obj)); break;
case (-2) : break; case (RESTORE) : fsm_set_store_restore_reset (gtk_adjustment_get_value (adj_obj)); break;
case (-3) : break; case (RESET) : fsm_set_store_restore_reset (gtk_adjustment_get_value (adj_obj)); break;
default : printf("default in signal.switch_store_restore_reset()\n"); default : printf("default in signal.switch_store_restore_reset()\n");
} }
} }*/
void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *reset_scrollbar) void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *reset_scrollbar)
{ {
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));
GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar);
int value = gtk_adjustment_get_value (adj_obj);
if ( ! strcmp (btt_name, "view-restore-symbolic")) // printf("restore\n"); if ( ! strcmp (btt_name, "view-restore-symbolic")) // printf("restore\n");
fsm_restore_all_objects_transparencies_from_mem (gtk_adjustment_get_value (adj_obj)); fsm_set_store_restore_reset (STORE, value);
if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) // printf("fullscreen\n"); if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) // printf("fullscreen\n");
fsm_store_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj)); fsm_set_store_restore_reset (RESTORE, value);
if ( ! strcmp (btt_name, "view-refresh-symbolic")) // printf("refresh\n"); if ( ! strcmp (btt_name, "view-refresh-symbolic")) // printf("refresh\n");
fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj)); fsm_set_store_restore_reset (RESET, value);
} }
@ -333,13 +326,15 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
} }
/******************************************************************************/ /******************************************************************************/
/* M A I N W I N D O W H E A D E R W I D G E T S */ /* M A I N W I N D O W H E A D E R W I D G E T S */
/******************************************************************************/ /******************************************************************************/
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) { void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO // next line presents the text_window and works only once.\n
// 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()));
} }

View File

@ -211,3 +211,4 @@ void *widget_get_graph_view_control()
} }