From 61c04cf6a7c06bb0d20130700fff3dc04ee7b53c Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 23 Jul 2024 21:08:18 +0200 Subject: [PATCH] Officially introducing : ' P R E F E R E N C E S' ! (requires cleaning ++) --- src/fsm.c | 6 +++--- src/signal.c | 44 +++++++++++++++++++++++------------------- src/widget/state/top.c | 30 +++++++++++++++------------- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/fsm.c b/src/fsm.c index 6357aa2..a74c693 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -40,7 +40,7 @@ static int choice_EXEC_EDIT = EXEC; static int choice_STATE_RULES_DATA = STATE; -static int choice_OBJECTS_box_RESET_VALUE = 0; +static int choice_OBJECTS_box_RESET_VALUE = -1; static int choice_SITUATIONS_box_RESET_VALUE = 0; @@ -153,8 +153,8 @@ static void debug_printing (int value, int sub_automaton) tab_0 [choice_EXEC_EDIT], tab_1 [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 (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; case (5) : printf("fsm_set_situations_box_reset_value : %3d > %3d\n", fsm_get_situations_box_reset_value(), value); diff --git a/src/signal.c b/src/signal.c index e6b93bc..fe791fc 100644 --- a/src/signal.c +++ b/src/signal.c @@ -299,12 +299,35 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) } +static void switch_restore_store_reset() +{ + switch (fsm_get_objects_box_reset_value()) { + + case (-1) : + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_get_state_page())); + break; + + case (-2) : + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_get_rules_page())); + break; + + case (DATA) : + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_get_stock_page())); + break; + + default : + printf("default in signal.on_toggle_state_rule_data()\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); -// 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")) @@ -313,25 +336,6 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *re 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_store (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) -{ - GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); - fsm_store_all_objects_transparencies_current_values (gtk_adjustment_get_value (adj_obj)); -} - -void on_objects_box_do_restore (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) -{ - GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar); - 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 0b0a1f4..e3d6d5a 100644 --- a/src/widget/state/top.c +++ b/src/widget/state/top.c @@ -60,38 +60,42 @@ 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 ()); - GtkWidget *btt_store_this = gtk_toggle_button_new (); - const char *btt_store_this_tip = " store current transparencies values.\n\n\ + GtkWidget *btt_store = gtk_toggle_button_new (); + const char *btt_store_tip = " store current transparencies values.\n\n\ warning : this action will delete \n previous storage of these values"; 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"); - g_signal_connect (btt_store_this, "toggled", + 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); + g_signal_connect (btt_store, "toggled", G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar); GtkWidget *btt_restore = gtk_toggle_button_new (); - const char *btt_restore_this_tip = " restore transparencies\n\ + const char *btt_restore_tip = " restore transparencies\n\ from previous storage"; // from the last storage ? 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); + 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); g_signal_connect (btt_restore, "toggled", 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\ + const char *btt_reset_tip = "reset all transparencies to the value\n\ currently set by the left bar"; 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); + 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); g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar); - gtk_box_append (reset_box, btt_store_this); + gtk_box_append (reset_box, btt_store); gtk_box_append (reset_box, btt_restore); gtk_box_append (reset_box, btt_reset);