diff --git a/include/fsm.h b/include/fsm.h index 66b4bf6..7b2665f 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -50,8 +50,8 @@ 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_memorize_all_objects_transparencies_current_values (int value); -void fsm_reset_all_objects_transparencies_from_mem (int value); +void fsm_store_all_objects_transparencies_current_values (int value); +void fsm_restore_all_objects_transparencies_from_mem (int value); void fsm_reset_all_situations_transparencies_at_value (int value); diff --git a/include/prefer.h b/include/prefer.h new file mode 100644 index 0000000..81c204d --- /dev/null +++ b/include/prefer.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Main * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2024 Adrien Bourmault * +* Copyright © 2024 Jean Sirmai * +* * +* This file is part of Gem-graph. * +* * +* This program is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Affero General Public License * +* as published by the Free Software Foundation, * +* either version 3 of the License, * +* or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; * +* without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. * +* See the GNU Affero General Public License for more details. * +* * +* You should have received a copy of the GNU Affero General Public License * +* along with this program. If not, see . * +* * +* * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#pragma once +#include + +void print_sth(char *msg); diff --git a/include/signal.h b/include/signal.h index e387ac3..25fb5f6 100644 --- a/include/signal.h +++ b/include/signal.h @@ -127,10 +127,12 @@ void on_clicked_search (GtkWidget *btt_menu, gpointer list_box); /* M A I N W I N D O W S T A T E P A G E (upper part) */ /******************************************************************************/ +void on_updating_objects_transparencies (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); +/* void on_objects_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -void on_objects_box_do_memorize (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -void on_objects_box_do_reset_from_mem (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); - +void on_objects_box_do_store (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); +void on_objects_box_do_restore (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); +*/ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); diff --git a/src/fsm.c b/src/fsm.c index 89e81a6..6357aa2 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -29,6 +29,7 @@ #include "../include/fsm.h" +#include "../include/prefer.h" #include "../include/widget.h" @@ -76,48 +77,45 @@ void fsm_set_state_rules_data (int value) +void fsm_restore_all_objects_transparencies_from_mem (int value) +{ + print_sth("Officially introducing : ' P R E F E R E N C E S' !"); + debug_printing (value, 2); // OBJECTS_box_RESET_VALUES is sub_automaton 2 +} + +void fsm_store_all_objects_transparencies_current_values (int value) +{ + debug_printing (value, 3); // OBJECTS_box_STORE_VALUES is sub_automaton 3 +} + void fsm_reset_all_objects_transparencies_at_value (int value) { // if (choice_OBJECTS_box_RESET_VALUE != value) { << NON: Je veux pouvoir -// d'emblée tout remettre à zéro sans avoir à manipuler le curseur auparavant. +// d'emblée tout remettre à zéro sans avoir eu à manipuler le curseur auparavant. // Tant pis si cette fonction s'exécute parce qu'un reset inutile a été demandé. - debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2 + debug_printing (value, 4); // OBJECTS_box_RESET_VALUE is sub_automaton 2 choice_OBJECTS_box_RESET_VALUE = value; widget_reset_all_objects_transparencies_to_value (value); } -void fsm_memorize_all_objects_transparencies_current_values (int value) -{ - debug_printing (value, 3); // OBJECTS_box_RESET_VALUE is sub_automaton 2 - choice_OBJECTS_box_RESET_VALUE = value; - widget_reset_all_objects_transparencies_to_value (value); -} -void fsm_reset_all_objects_transparencies_from_mem (int value) -{ - debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2 - choice_OBJECTS_box_RESET_VALUE = value; - widget_reset_all_objects_transparencies_to_value (value); -} + + + + + + +// ---------------------- S I T U A T I O N S ---------------------------// + void fsm_reset_all_situations_transparencies_at_value (int value) { - debug_printing (value, 4); // SITUATIONS_box_RESET_VALUE is sub_automaton 5 + debug_printing (value, 5); // SITUATIONS_box_RESTORE_VALUES is sub_automaton 4 choice_SITUATIONS_box_RESET_VALUE = value; widget_reset_all_situations_transparencies_to_value (value); } - - - - - - - - - - void fsm_set_situations_box_reset_value (int value) { if (choice_SITUATIONS_box_RESET_VALUE != value) { @@ -155,15 +153,9 @@ static void debug_printing (int value, int sub_automaton) tab_0 [choice_EXEC_EDIT], tab_1 [value]); break; - case (2) : printf("fsm_set_objects_box_reset_value : %3d > %3d\n", - fsm_get_objects_box_reset_value(), value); - break; - case (3) : printf("fsm_set_objects_box_memorize : %3d > %3d\n", - fsm_get_objects_box_reset_value(), value); - break; - case (4) : printf("fsm_set_objects_box_restore : %3d > %3d\n", - fsm_get_objects_box_reset_value(), value); - break; + case (2) : printf("fsm_store_all_objects_transparencies_current_values\n"); break; + case (3) : printf("fsm_restore_all_objects_transparencies_from_mem\n"); break; + case (4) : printf("fsm_reset_all_objects_transparencies_at_value\n"); break; case (5) : printf("fsm_set_situations_box_reset_value : %3d > %3d\n", fsm_get_situations_box_reset_value(), value); break; diff --git a/src/prefer.c b/src/prefer.c new file mode 100644 index 0000000..a0fefdf --- /dev/null +++ b/src/prefer.c @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Main * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2024 Adrien Bourmault * +* Copyright © 2024 Jean Sirmai * +* * +* This file is part of Gem-graph. * +* * +* This program is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Affero General Public License * +* as published by the Free Software Foundation, * +* either version 3 of the License, * +* or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; * +* without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. * +* See the GNU Affero General Public License for more details. * +* * +* You should have received a copy of the GNU Affero General Public License * +* along with this program. If not, see . * +* * +* * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#include "../include/fsm.h" +#include "../include/signal.h" +#include "../include/widget.h" + +void print_sth(char *msg){printf("%s\n", msg);} diff --git a/src/signal.c b/src/signal.c index 46cfc3f..e6b93bc 100644 --- a/src/signal.c +++ b/src/signal.c @@ -32,6 +32,7 @@ #include "../include/fsm.h" #include "../include/signal.h" #include "../include/widget.h" +#include "../include/prefer.h" #include "../include/graphics.h" @@ -298,24 +299,39 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) } +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); +// print_sth (btt_name); + if (strcmp (btt_name, "view-restore-symbolic")) + fsm_restore_all_objects_transparencies_from_mem (gtk_adjustment_get_value (adj_obj)); + if (strcmp (btt_name, "view-fullscreen-symbolic")) + fsm_store_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj)); + if (strcmp (btt_name, "view-refresh-symbolic")) + fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj)); +} + +/* void on_objects_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) { GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); fsm_reset_all_objects_transparencies_at_value (gtk_adjustment_get_value (adj_obj)); } -void on_objects_box_do_memorize (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) +void on_objects_box_do_store (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) { GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); - fsm_memorize_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj)); + fsm_store_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj)); } -void on_objects_box_do_reset_from_mem (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) +void on_objects_box_do_restore (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) { GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); - fsm_reset_all_objects_transparencies_from_mem (gtk_adjustment_get_value (adj_obj)); + fsm_restore_all_objects_transparencies_from_mem (gtk_adjustment_get_value (adj_obj)); } +*/ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) { diff --git a/src/widget/state/top.c b/src/widget/state/top.c index 85b59bc..0b0a1f4 100644 --- a/src/widget/state/top.c +++ b/src/widget/state/top.c @@ -67,10 +67,9 @@ static void *get_objects_box() char tooltip_text_for_btt_store [140]; sprintf(tooltip_text_for_btt_store, btt_store_this_tip); gtk_widget_set_tooltip_text (GTK_WIDGET (btt_store_this), btt_store_this_tip); - gtk_button_set_icon_name (GTK_BUTTON (btt_store_this), - "view-restore-symbolic"); + gtk_button_set_icon_name (GTK_BUTTON (btt_store_this), "view-restore-symbolic"); g_signal_connect (btt_store_this, "toggled", - G_CALLBACK (on_objects_box_do_memorize), reset_scrollbar); + G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar); GtkWidget *btt_restore = gtk_toggle_button_new (); const char *btt_restore_this_tip = " restore transparencies\n\ @@ -78,10 +77,9 @@ static void *get_objects_box() char tooltip_text_for_btt_restore [140]; sprintf(tooltip_text_for_btt_restore, btt_restore_this_tip); gtk_widget_set_tooltip_text (GTK_WIDGET (btt_restore), btt_restore_this_tip); - gtk_button_set_icon_name (GTK_BUTTON (btt_restore), - "view-fullscreen-symbolic"); + gtk_button_set_icon_name (GTK_BUTTON (btt_restore), "view-fullscreen-symbolic"); g_signal_connect (btt_restore, "toggled", - G_CALLBACK (on_objects_box_do_reset_from_mem), reset_scrollbar); + G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar); GtkWidget *btt_reset = gtk_toggle_button_new (); const char *btt_reset_all = "reset all transparencies to the value\n\ @@ -89,10 +87,9 @@ static void *get_objects_box() char tooltip_text_for_btt_reset [140]; sprintf(tooltip_text_for_btt_reset, btt_reset_all); gtk_widget_set_tooltip_text (GTK_WIDGET (btt_reset), btt_reset_all); - gtk_button_set_icon_name (GTK_BUTTON (btt_reset), - "view-refresh-symbolic"); + gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic"); g_signal_connect (btt_reset, "toggled", - G_CALLBACK (on_objects_box_do_reset), reset_scrollbar); + G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar); gtk_box_append (reset_box, btt_store_this); gtk_box_append (reset_box, btt_restore);