From eae714b2a30b070e24e74301c02fa699f604c6af Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Thu, 25 Jul 2024 19:59:29 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20beaucoup=20de=20nettoyage=20=C3=A0=20fai?= =?UTF-8?q?re=20mais=20la=20voie=20est=20libre...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/prefer.h | 2 +- include/widget.h | 4 +++- src/prefer.c | 5 ++++- src/signal.c | 10 +++++----- src/widget/state/top.c | 13 ++++++++++--- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/include/prefer.h b/include/prefer.h index fc91618..a1059c0 100644 --- a/include/prefer.h +++ b/include/prefer.h @@ -32,5 +32,5 @@ #pragma once #include -void pref_set_store_restore_reset (int choice, int value); +void pref_set_store_restore_reset (int choice, int value, GtkScrollbar *scrollbar); diff --git a/include/widget.h b/include/widget.h index 99863bc..047d1bd 100644 --- a/include/widget.h +++ b/include/widget.h @@ -73,8 +73,10 @@ void *widget_get_sequence_control(); // bottom // called in : src/widget/state/top.c -void widget_reset_all_objects_transparencies_to_value (int value); // top +//void widget_reset_all_objects_transparencies_to_value (int value); // top void widget_reset_all_situations_transparencies_to_value (int value); // top +GtkScrollbar *widget_get_object_32_transparency_scrollbar(); +void widget_reset_object_32_transparency_to_value (int value); /******************************************************************************/ diff --git a/src/prefer.c b/src/prefer.c index 22df1e3..a66aea4 100644 --- a/src/prefer.c +++ b/src/prefer.c @@ -45,11 +45,14 @@ static int choice_STORE_RESTORE_RESET = STORE; void pref_set_store_restore_reset (int choice, int value) { choice_STORE_RESTORE_RESET = choice; + GtkScrollbar *object_32 = widget_get_object_32_transparency_scrollbar(); switch (choice) { case (STORE) : printf("STORE current values in MEM [%d]\n", n_objects); break; case (RESTORE) : printf("RESTORE values from MEM [%d]\n", n_objects); break; - case (RESET) : printf("RESET current values from [%d]\n", value); break; + case (RESET) : widget_reset_object_32_transparency_to_value (value); + printf("RESET current value from [%d]\n", value); + break; default : printf("default in signal.switch_store_restore_reset()\n"); } } diff --git a/src/signal.c b/src/signal.c index 8fe80bf..a581c39 100644 --- a/src/signal.c +++ b/src/signal.c @@ -323,14 +323,14 @@ void on_clicked_home (GtkWidget *btt_reset, gpointer data) // ---------------------------- O B J E C T S --------------------------- // -void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *reset_scrollbar) +void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *scrollbar) { const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source)); - int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (reset_scrollbar)); + int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar)); - if ( ! strcmp (btt_name, "view-restore-symbolic")) pref_set_store_restore_reset (STORE, value); - if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) pref_set_store_restore_reset (RESTORE, value); - if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value); + if ( ! strcmp (btt_name, "view-restore-symbolic")) pref_set_store_restore_reset (STORE, value, scrollbar); + if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) pref_set_store_restore_reset (RESTORE, value, scrollbar); + if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value, scrollbar); } diff --git a/src/widget/state/top.c b/src/widget/state/top.c index adacec5..3f164ff 100644 --- a/src/widget/state/top.c +++ b/src/widget/state/top.c @@ -40,7 +40,12 @@ static GtkScrollbar *object_bar [n_objects]; static GtkAdjustment *object_adjust [n_objects]; -void widget_reset_all_objects_transparencies_to_value (int value) +GtkScrollbar *widget_get_object_32_transparency_scrollbar () {return object_bar [n_objects - 1];} + +void widget_reset_object_32_transparency_to_value (int value) + { gtk_adjustment_set_value (object_adjust [n_objects - 1], value); } + +static void widget_reset_all_objects_transparencies_to_value (int value) { for (int i = 0; i < n_objects; i++) if (value > -1) @@ -66,6 +71,7 @@ static void *get_objects_box() 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_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"); @@ -105,7 +111,7 @@ static void *get_objects_box() // GtkAdjustment *object_adjust [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size) for (int i = 0; i < n_objects; i++) { - object_adjust [i] = gtk_adjustment_new (0, 0, 127, 1, 0, 0); + object_adjust [i] = gtk_adjustment_new (64, 0, 127, 1, 0, 0); object_bar [i] = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, object_adjust [i])); char tooltip_text[8]; @@ -118,7 +124,8 @@ static void *get_objects_box() gtk_box_append (objects_box, GTK_WIDGET (object_bar [i])); } - widget_reset_all_objects_transparencies_to_value (-1); + if (0) widget_reset_all_objects_transparencies_to_value (-1); +// else widget_reset_object_32_transparency_to_value (0); return objects_box; }