WIP: demo en cliquant sur store et reset; reste à mettre en mémoire un état choisi
This commit is contained in:
parent
eae714b2a3
commit
4a271bc2d5
|
@ -33,4 +33,4 @@
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
void pref_set_store_restore_reset (int choice, int value, GtkScrollbar *scrollbar);
|
void pref_set_store_restore_reset (int choice, int value, GtkScrollbar *scrollbar);
|
||||||
|
int *pref_get_all_objects_transparencies();
|
||||||
|
|
|
@ -73,10 +73,9 @@ 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_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_objects_transparency_to_values (int *value); // top
|
||||||
void widget_reset_object_32_transparency_to_value (int value);
|
void *widget_get_objects_transparencies(); // top
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
14
src/fsm.c
14
src/fsm.c
|
@ -40,13 +40,14 @@
|
||||||
|
|
||||||
static int choice_EXEC_EDIT = EXEC;
|
static int choice_EXEC_EDIT = EXEC;
|
||||||
static int choice_STATE_RULES_DATA = STATE;
|
static int choice_STATE_RULES_DATA = STATE;
|
||||||
static int preferences = TRUE;
|
static int preferences_have_been_modified = FALSE;
|
||||||
|
|
||||||
int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
|
int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
|
||||||
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
|
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
|
||||||
|
|
||||||
bool fsm_get_preferences_state () {return preferences;}
|
void fsm_set_preferences_state (bool value) {preferences_have_been_modified = value;}
|
||||||
void fsm_set_preferences_state (bool value) {preferences = value;}
|
bool fsm_get_preferences_state () {return preferences_have_been_modified;}
|
||||||
|
// preferences_have_been_modified and should be stored before closing the current session. TODO
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -79,14 +80,15 @@ void fsm_set_state_rules_data (int choice)
|
||||||
|
|
||||||
// ---------------------- S I T U A T I O N S ---------------------------//
|
// ---------------------- S I T U A T I O N S ---------------------------//
|
||||||
|
|
||||||
static int choice_SITUATIONS_box_RESET_VALUE = -1;
|
static int reset_situations_to_value = -1;
|
||||||
|
|
||||||
void fsm_reset_all_situations_transparencies_at_value (int value)
|
void fsm_reset_all_situations_transparencies_at_value (int value)
|
||||||
{
|
{
|
||||||
debug_printing (choice_SITUATIONS_box_RESET_VALUE, value, 3);
|
debug_printing (reset_situations_to_value, value, 3);
|
||||||
// SITUATIONS_box_RESTORE_VALUES is sub_automaton 3
|
// SITUATIONS_box_RESTORE_VALUES is sub_automaton 3
|
||||||
choice_SITUATIONS_box_RESET_VALUE = value;
|
reset_situations_to_value = value;
|
||||||
widget_reset_all_situations_transparencies_to_value (value);
|
widget_reset_all_situations_transparencies_to_value (value);
|
||||||
|
preferences_have_been_modified = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
46
src/prefer.c
46
src/prefer.c
|
@ -33,25 +33,55 @@
|
||||||
#include "../include/signal.h"
|
#include "../include/signal.h"
|
||||||
#include "../include/widget.h"
|
#include "../include/widget.h"
|
||||||
|
|
||||||
// static struct preferences *pref = NULL;
|
|
||||||
// size_t pref_size = 0;
|
|
||||||
|
|
||||||
struct preferences {
|
struct preferences {
|
||||||
int id [n_objects];
|
int transparency [n_objects]; // may become a long, long list...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int choice_STORE_RESTORE_RESET = STORE;
|
static int choice_STORE_RESTORE_RESET = STORE;
|
||||||
|
|
||||||
|
static int p [n_objects];
|
||||||
|
|
||||||
|
void pref_set_all_objects_transparencies (int *q)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n_objects; i++) p [i] = q [i];
|
||||||
|
}
|
||||||
|
|
||||||
|
int *pref_get_all_objects_transparencies () { return p; }
|
||||||
|
|
||||||
|
|
||||||
|
static void print_p (int *abc) {
|
||||||
|
for (int i = 0; i < n_objects; i++) printf("%3d ", abc [i]); printf("\n");}
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
int ppp [n_objects];
|
||||||
|
|
||||||
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);
|
||||||
case (RESTORE) : printf("RESTORE values from MEM [%d]\n", n_objects); break;
|
// GtkScrollbar *reset_scrollbar =
|
||||||
case (RESET) : widget_reset_object_32_transparency_to_value (value);
|
// GTK_SCROLLBAR (widget_get_objects_transparencies ());
|
||||||
printf("RESET current value from [%d]\n", value);
|
for (int i = 0; i < n_objects; i++) ppp [i] = i * 4;
|
||||||
|
// widget_get_object_transparency_scrollbar (i);
|
||||||
|
pref_set_all_objects_transparencies (ppp); // print_p (ppp);
|
||||||
|
widget_reset_objects_transparency_to_values (ppp);
|
||||||
|
fsm_set_preferences_state (TRUE);
|
||||||
|
break;
|
||||||
|
case (RESTORE) : printf("RESTORE values from MEM [%d]\n", n_objects);
|
||||||
|
for (int i = 0; i < n_objects; i++) ppp [i] = i * 4;
|
||||||
|
pref_set_all_objects_transparencies (ppp); // print_p (ppp);
|
||||||
|
widget_reset_objects_transparency_to_values (ppp);
|
||||||
|
fsm_set_preferences_state (TRUE);
|
||||||
|
break;
|
||||||
|
case (RESET) : printf("RESET \n");
|
||||||
|
for (int i = 0; i < n_objects; i++) ppp [i] = rand() % 127;
|
||||||
|
pref_set_all_objects_transparencies (ppp); // print_p (ppp);
|
||||||
|
widget_reset_objects_transparency_to_values (ppp);
|
||||||
|
fsm_set_preferences_state (TRUE);
|
||||||
break;
|
break;
|
||||||
default : printf("default in signal.switch_store_restore_reset()\n");
|
default : printf("default in signal.switch_store_restore_reset()\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,8 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
|
||||||
if ( ! strcmp (btt_name, "view-restore-symbolic")) pref_set_store_restore_reset (STORE, value, scrollbar);
|
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-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);
|
if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value, scrollbar);
|
||||||
|
|
||||||
|
fsm_set_preferences_state (TRUE); // << à détailler TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,17 +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];
|
||||||
|
|
||||||
GtkScrollbar *widget_get_object_32_transparency_scrollbar () {return object_bar [n_objects - 1];}
|
void *widget_get_objects_transparencies () {return object_bar;}
|
||||||
|
|
||||||
void widget_reset_object_32_transparency_to_value (int value)
|
void widget_reset_objects_transparency_to_values (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)
|
gtk_adjustment_set_value (object_adjust [i], value [i]);
|
||||||
gtk_adjustment_set_value (object_adjust [i], value);
|
|
||||||
else gtk_adjustment_set_value (object_adjust [i], rand() % 127);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *get_objects_box()
|
static void *get_objects_box()
|
||||||
|
@ -67,7 +62,7 @@ static void *get_objects_box()
|
||||||
GtkBox *reset_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
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 ();
|
GtkWidget *btt_store = gtk_toggle_button_new (); // _with_label ("store");
|
||||||
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];
|
||||||
|
@ -79,7 +74,7 @@ static void *get_objects_box()
|
||||||
g_signal_connect (btt_store, "toggled",
|
g_signal_connect (btt_store, "toggled",
|
||||||
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
||||||
|
|
||||||
GtkWidget *btt_restore = gtk_toggle_button_new ();
|
GtkWidget *btt_restore = gtk_toggle_button_new (); // _with_label ("restore");
|
||||||
const char *btt_restore_tip = " restore transparencies\n\
|
const char *btt_restore_tip = " restore transparencies\n\
|
||||||
from previous storage"; // from the last storage ?
|
from previous storage"; // from the last storage ?
|
||||||
char tooltip_text_for_btt_restore [140];
|
char tooltip_text_for_btt_restore [140];
|
||||||
|
@ -90,7 +85,7 @@ static void *get_objects_box()
|
||||||
g_signal_connect (btt_restore, "toggled",
|
g_signal_connect (btt_restore, "toggled",
|
||||||
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
G_CALLBACK (on_updating_objects_transparencies), reset_scrollbar);
|
||||||
|
|
||||||
GtkWidget *btt_reset = gtk_toggle_button_new ();
|
GtkWidget *btt_reset = gtk_toggle_button_new (); // _with_label ("reset");
|
||||||
const char *btt_reset_tip = "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";
|
currently set by the left bar";
|
||||||
char tooltip_text_for_btt_reset [140];
|
char tooltip_text_for_btt_reset [140];
|
||||||
|
@ -124,8 +119,6 @@ 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]));
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue