Compare commits
2 Commits
008f67f745
...
fe047b5c2f
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | fe047b5c2f | |
Jean Sirmai | 9566672636 |
|
@ -38,8 +38,9 @@
|
|||
/******************************************************************************/
|
||||
// called by widgets through signal functions
|
||||
|
||||
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
|
||||
enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
|
||||
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
|
||||
|
||||
int fsm_get_exec_edit ();
|
||||
int fsm_get_state_rules_data ();
|
||||
|
@ -48,10 +49,7 @@ int fsm_get_situations_box_reset_value ();
|
|||
|
||||
void fsm_set_exec_edit (int value);
|
||||
void fsm_set_state_rules_data (int value);
|
||||
|
||||
void fsm_reset_all_objects_transparencies_at_value (int value);
|
||||
void fsm_store_all_objects_transparencies_current_values (int value);
|
||||
void fsm_restore_all_objects_transparencies_from_mem (int value);
|
||||
void fsm_set_store_restore_reset (int target, int value);
|
||||
|
||||
void fsm_reset_all_situations_transparencies_at_value (int value);
|
||||
|
||||
|
|
46
src/fsm.c
46
src/fsm.c
|
@ -4,9 +4,9 @@
|
|||
* *
|
||||
* State machine *
|
||||
* *
|
||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||
* 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. *
|
||||
* *
|
||||
|
@ -39,9 +39,10 @@
|
|||
|
||||
static int choice_EXEC_EDIT = EXEC;
|
||||
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_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_1 [] = { "STATE", "RULES", "DATA" };
|
||||
static char *tab_2 [] = { "STORE", "RESTORE", "RESET" };
|
||||
|
||||
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
|
||||
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_1 [choice_STATE_RULES_DATA],
|
||||
tab_0 [value],
|
||||
tab_1 [choice_STATE_RULES_DATA]);
|
||||
break;
|
||||
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
||||
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]);
|
||||
break;
|
||||
case (2) : printf("fsm_restore_all_objects_transparencies_from_mem\n"); break;
|
||||
case (3) : printf("fsm_store_all_objects_transparencies_current_values\n"); break;
|
||||
case (4) : printf("fsm_reset_all_objects_transparencies_at_value\n"); break;
|
||||
break;
|
||||
case (2) : printf("fsm_set_store_restore_reset <> target = %s\n",
|
||||
tab_2 [choice_STORE_RESTORE_RESET]);
|
||||
break;
|
||||
|
||||
case (5) : printf("fsm_set_situations_box_reset_value : %3d > %3d\n",
|
||||
fsm_get_situations_box_reset_value(), value);
|
||||
break;
|
||||
default : printf("default in automaton.debug_printing()\n");
|
||||
}
|
||||
default : printf("default in automaton.debug_printing()\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
43
src/signal.c
43
src/signal.c
|
@ -281,48 +281,25 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
|
|||
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
|
||||
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
|
||||
|
||||
if (! strcmp (toggled_button_name, "state")) {
|
||||
fsm_set_state_rules_data (STATE);
|
||||
}
|
||||
if ( ! strcmp (toggled_button_name, "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")) {
|
||||
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();
|
||||
}
|
||||
if (is_active) switch_state_rules_data();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------- O B J E C T S --------------------------- //
|
||||
|
||||
static void switch_store_restore_reset()
|
||||
{
|
||||
switch (fsm_get_objects_box_reset_value()) {
|
||||
case (-1) : break;
|
||||
case (-2) : break;
|
||||
case (-3) : break;
|
||||
default : printf("default in signal.switch_store_restore_reset()\n");
|
||||
}
|
||||
}
|
||||
|
||||
void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *reset_scrollbar)
|
||||
{
|
||||
const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source));
|
||||
GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar);
|
||||
int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (reset_scrollbar));
|
||||
|
||||
if ( ! strcmp (btt_name, "view-restore-symbolic")) // printf("restore\n");
|
||||
fsm_restore_all_objects_transparencies_from_mem (gtk_adjustment_get_value (adj_obj));
|
||||
if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) // printf("fullscreen\n");
|
||||
fsm_store_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj));
|
||||
if ( ! strcmp (btt_name, "view-refresh-symbolic")) // printf("refresh\n");
|
||||
fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj));
|
||||
if ( ! strcmp (btt_name, "view-restore-symbolic")) fsm_set_store_restore_reset (STORE, value);
|
||||
if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) fsm_set_store_restore_reset (RESTORE, value);
|
||||
if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_set_store_restore_reset (RESET, value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -333,13 +310,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 */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static void *get_objects_box()
|
|||
|
||||
|
||||
GtkBox *reset_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
||||
GtkCheckButton *group_transparencies = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||
// GtkCheckButton *group_transparencies = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||
|
||||
GtkWidget *btt_store = gtk_toggle_button_new ();
|
||||
const char *btt_store_tip = " store current transparencies values.\n\n\
|
||||
|
@ -69,7 +69,7 @@ static void *get_objects_box()
|
|||
sprintf(tooltip_text_for_btt_store, btt_store_tip);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (btt_store), btt_store_tip);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_store), "view-restore-symbolic");
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_store), group_transparencies);
|
||||
// gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_store), group_transparencies);
|
||||
g_signal_connect (btt_store, "toggled",
|
||||
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
||||
|
||||
|
@ -80,7 +80,7 @@ static void *get_objects_box()
|
|||
sprintf(tooltip_text_for_btt_restore, btt_restore_tip);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (btt_restore), btt_restore_tip);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_restore), "view-fullscreen-symbolic");
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_restore), group_transparencies);
|
||||
// gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_restore), group_transparencies);
|
||||
g_signal_connect (btt_restore, "toggled",
|
||||
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
||||
|
||||
|
@ -91,7 +91,7 @@ static void *get_objects_box()
|
|||
sprintf(tooltip_text_for_btt_reset, btt_reset_tip);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (btt_reset), btt_reset_tip);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_reset), group_transparencies);
|
||||
// gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_reset), group_transparencies);
|
||||
g_signal_connect (btt_reset, "toggled",
|
||||
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
||||
|
||||
|
@ -211,3 +211,4 @@ void *widget_get_graph_view_control()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue