WIP: beaucoup de nettoyage à faire mais la voie est libre...

This commit is contained in:
Jean Sirmai 2024-07-25 19:59:29 +02:00
parent 40857dd683
commit eae714b2a3
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 23 additions and 11 deletions

View File

@ -32,5 +32,5 @@
#pragma once #pragma once
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
void pref_set_store_restore_reset (int choice, int value); void pref_set_store_restore_reset (int choice, int value, GtkScrollbar *scrollbar);

View File

@ -73,8 +73,10 @@ void *widget_get_sequence_control(); // bottom
// called in : src/widget/state/top.c // 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 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);
/******************************************************************************/ /******************************************************************************/

View File

@ -45,11 +45,14 @@ static int choice_STORE_RESTORE_RESET = STORE;
void pref_set_store_restore_reset (int choice, int value) void pref_set_store_restore_reset (int choice, int value)
{ {
choice_STORE_RESTORE_RESET = choice; choice_STORE_RESTORE_RESET = choice;
GtkScrollbar *object_32 = widget_get_object_32_transparency_scrollbar();
switch (choice) { switch (choice) {
case (STORE) : printf("STORE current values in MEM [%d]\n", n_objects); break; 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 (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"); default : printf("default in signal.switch_store_restore_reset()\n");
} }
} }

View File

@ -323,14 +323,14 @@ void on_clicked_home (GtkWidget *btt_reset, gpointer data)
// ---------------------------- O B J E C T S --------------------------- // // ---------------------------- 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)); 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-restore-symbolic")) pref_set_store_restore_reset (STORE, value, scrollbar);
if ( ! strcmp (btt_name, "view-fullscreen-symbolic")) pref_set_store_restore_reset (RESTORE, value); 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); if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value, scrollbar);
} }

View File

@ -40,7 +40,12 @@
static GtkScrollbar *object_bar [n_objects]; static GtkScrollbar *object_bar [n_objects];
static GtkAdjustment *object_adjust [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++) for (int i = 0; i < n_objects; i++)
if (value > -1) if (value > -1)
@ -66,6 +71,7 @@ static void *get_objects_box()
const char *btt_store_tip = " store current transparencies values.\n\n\ const char *btt_store_tip = " store current transparencies values.\n\n\
warning : this action will delete \n previous storage of these values"; warning : this action will delete \n previous storage of these values";
char tooltip_text_for_btt_store [140]; char tooltip_text_for_btt_store [140];
sprintf(tooltip_text_for_btt_store, btt_store_tip); sprintf(tooltip_text_for_btt_store, btt_store_tip);
gtk_widget_set_tooltip_text (GTK_WIDGET (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_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) // GtkAdjustment *object_adjust [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size)
for (int i = 0; i < n_objects; i++) 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_bar [i] = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
object_adjust [i])); object_adjust [i]));
char tooltip_text[8]; char tooltip_text[8];
@ -118,7 +124,8 @@ static void *get_objects_box()
gtk_box_append (objects_box, GTK_WIDGET (object_bar [i])); 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; return objects_box;
} }