reset_all_objects_transparency_to_value < a starting point

This commit is contained in:
Jean Sirmai 2024-07-19 23:02:27 +02:00
parent 27be86da76
commit 46915ed62f
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 68 additions and 63 deletions

View File

@ -66,7 +66,7 @@ void on_glarea_unrealize (GtkWidget *widget);
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
void on_OBJECTS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data);
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, gpointer data);
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar);
void on_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data);
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data);

View File

@ -58,6 +58,8 @@ GtkWidget *widget_rec_STATE_page();
GtkWidget *widget_rec_RULES_page();
GtkWidget *widget_rec_STOCK_page();
void *reset_all_objects_transparency_to_value (GtkScrollbar *object_bar, int value);
GtkWidget *widget_rec_STOCK_text (gchar *text_name);

View File

@ -29,6 +29,7 @@
#include "../include/fsm.h"
#include "../include/widget.h"
/******************************************************************************/
@ -69,6 +70,7 @@ void fsm_set_OBJECTS_box_RESET_VALUE (int value)
if (choice_OBJECTS_box_RESET_VALUE != value) {
debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
choice_OBJECTS_box_RESET_VALUE = value;
reset_all_objects_transparency_to_value (NULL, value);
}
}
@ -109,10 +111,10 @@ static void debug_printing (int value, int sub_automaton)
tab_0 [choice_EXEC_EDIT],
tab_1 [value]);
break;
case (2) : printf("automat.fsm_set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
case (2) : printf("fsm_set_OBJECTS_box_RESET_VALUE : %3d > %3d\n",
fsm_get_OBJECTS_box_RESET_VALUE(), value);
break;
case (3) : printf("automat.fsm_set_SITUATIONS_box_RESET_VALUE : %2d > %2d\n",
case (3) : printf("fsm_set_SITUATIONS_box_RESET_VALUE : %3d > %3d\n",
fsm_get_SITUATIONS_box_RESET_VALUE(), value);
break;
default : printf("default in automaton.debug_printing()\n");
@ -124,5 +126,4 @@ static void debug_printing (int value, int sub_automaton)
/******************************************************************************/
/* N O N E X C L U S I V E S E L E C T I O N S */
/******************************************************************************/
// ?

View File

@ -325,20 +325,17 @@ void on_OBJECTS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data)
void on_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data) {}
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{
printf ("callback.on_OBJECTS_box_DO_RESET()\
<> Comment remettre tous les curseurs à une même valeur ?\n\
NB Cette valeur sera la valeur choisie au moyen du curseur situé à gauche du bouton 'RESET'\n\
et elle sera lue par l'un des sous-automates qui déterminent l'état de la page 'ÉTAT'\n\
et reportée dans le module 'automat'.\n");
// utiliser gpointer data pour transmettre la valeur choisie TODO
fsm_set_OBJECTS_box_RESET_VALUE (1);
GtkAdjustment *adj_obj = gtk_scrollbar_get_adjustment (reset_scrollbar);
double db = gtk_adjustment_get_value (adj_obj);
puts("on_OBJECTS_box_DO_RESET");
fsm_set_OBJECTS_box_RESET_VALUE (db);
}
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
{
puts("on_SITUATIONS_box_DO_RESET");
fsm_set_SITUATIONS_box_RESET_VALUE (1);
}
@ -491,3 +488,4 @@ void on_setup_user_menu_factory (GtkSignalListItemFactory *factory,
if (0) printf("[on_setup_user_menu_factory] here is an expander\n");
}

View File

@ -32,7 +32,7 @@
#define W_IMAGE_LOCAL 1920 / 64 // 1920 x 960 ad hoc (pour mon écran)
#define H_IMAGE_LOCAL 960 / 64
static GtkWidget *get_selected_rules_vpaned_new() {
static GtkWidget *rec_selected_rules_vpaned_new() {
GtkPaned *EXEC_CONTROLS_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
gtk_widget_set_size_request (GTK_WIDGET (EXEC_CONTROLS_pane), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
// if mode EDIT set_shrink FALSE < TODO
@ -55,7 +55,7 @@ static GtkWidget *get_selected_rules_vpaned_new() {
return GTK_WIDGET (EXEC_CONTROLS_pane);
}
static GtkBox *get_rules_comparator_new(){
static GtkBox *rec_rules_comparator_new(){
GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_widget_set_size_request (GTK_WIDGET (comparator), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_ATP()));
@ -75,14 +75,14 @@ static GtkBox *get_rules_comparator_new(){
return comparator;
}
static GtkWidget *get_rules_tree_hpaned_new(){
static GtkWidget *rec_rules_tree_hpaned_new(){
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_rec_user_rules_tree()));
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (get_rules_comparator_new()));
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (rec_rules_comparator_new()));
gtk_paned_set_position (H_tree_vs_comparison, 300);
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE);
gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_comparison), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
@ -95,8 +95,8 @@ GtkWidget *widget_rec_RULES_page() {
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");
gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (get_rules_tree_hpaned_new()));
gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (get_selected_rules_vpaned_new()));
gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (rec_rules_tree_hpaned_new()));
gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (rec_selected_rules_vpaned_new()));
gtk_paned_set_position (H_tree_vs_selected, 400); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE);
gtk_paned_set_shrink_start_child (H_tree_vs_selected, FALSE);

View File

@ -44,7 +44,7 @@
* - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations
* afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */
static GtkBox *get_XYZ_box()
static GtkBox *rec_XYZ_box()
{
GtkBox *XYZ_labels_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
GtkBox *XYZ_scrollbar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
@ -64,7 +64,7 @@ static GtkBox *get_XYZ_box()
gtk_box_append (XYZ_scrollbar_box, scroll_Z);
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset");
GtkWidget *btt_reset = gtk_toggle_button_new_with_label ("reset");
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset));
@ -72,7 +72,7 @@ static GtkBox *get_XYZ_box()
return XYZ_labels_box;
}
static GtkBox *get_ZOOM_box()
static GtkBox *rec_ZOOM_box()
{
GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
@ -83,54 +83,48 @@ static GtkBox *get_ZOOM_box()
return ZOOM_box;
}
#define n_objects 32
static GtkScrollbar *object_bar [n_objects];
static GtkAdjustment *adjust_bar [n_objects];
static GtkBox *get_OBJECTS_box()
void *reset_all_objects_transparency_to_value (GtkScrollbar *object_bar, int value)
{
for (int i = 0; i < n_objects; i++) {
adjust_bar [i] = gtk_adjustment_new (value, 0, 127, 1, 0, 0);
// gtk_scrollbar_set_adjustment (object_bar [i], adjust_bar [i]);
}
}
static GtkBox *rec_OBJECTS_box()
{
GtkBox *objects_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkAdjustment *reset_value = gtk_adjustment_new (0, 0, 127, 1, 0, 0);
GtkScrollbar *reset_scrollbar = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, reset_value));
/* printf("\nin state.get_OBJECTS_box() g_signal_connect (reset_scrollbar,...) déclenche:\n\
Gtk-CRITICAL **:... assertion 'GTK_IS_SIGNAL_ACTION (self)' failed (Quel est le nom de ce signal ?)\n\
GLib-GObject-CRITICAL **:... g_signal_connect_data: assertion 'detailed_signal != NULL' failed\n");
g_signal_connect (reset_scrollbar,
gtk_signal_action_get_signal_name (GTK_SIGNAL_ACTION (reset_scrollbar)),
G_CALLBACK (on_OBJECTS_box_RESET_VALUE), NULL);*/
gtk_box_append (objects_box, gtk_label_new (" ")); // AD HOC (pour "centrer")
gtk_box_append (objects_box, GTK_WIDGET (reset_scrollbar));
GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset");
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_OBJECTS_box_DO_RESET), NULL);
GtkWidget *btt_reset = gtk_toggle_button_new_with_label ("r\ne\ns\ne\nt");
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_OBJECTS_box_DO_RESET), reset_scrollbar);
gtk_box_append (objects_box, btt_reset);
// Je veux pouvoir remettre tous les curseurs à ZÉRO ou à UN. TODO
// À ZÉRO ou à UN ou à n'importe quelle valeur intermédiaire (la même pour tous)
// de façon à pouvoir mieux observer, par contraste, les structures qui m'intéressent
int n = 32;
GtkAdjustment *adjust [n]; // (value, lower, upper, step_increment, page_increment, page_size)
for (int i = 0; i < n; i++)
// GtkAdjustment *adjust_bar [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size)
for (int i = 0; i < n_objects; i++)
{
adjust [i] = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 0);
GtkScrollbar *scrollbar_i = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust [i]));
char tooltip_text[8];
sprintf(tooltip_text, "\n%d\n", i);
if (0 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "membrane");
if (1 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "co-enzyme A");
if (2 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "ATP synthase");
if (3 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "any object name");
if (4 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), tooltip_text);
gtk_box_append (objects_box, GTK_WIDGET (scrollbar_i));
adjust_bar [i] = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 0);
object_bar [i] = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust_bar [i]));
gtk_box_append (objects_box, GTK_WIDGET (object_bar [i]));
}
// for (int i = 0; i < n_objects; i++) reset_all_objects_transparency_to_value (*object_bar, 100);
return objects_box;
}
static GtkBox *get_SITUATIONS_box()
static GtkBox *rec_SITUATIONS_box()
{
GtkBox *situations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkAdjustment *reset_value = gtk_adjustment_new (0, 0, 127, 1, 0, 0);
GtkScrollbar *reset_scrollbar = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, reset_value));
gtk_box_append (situations_box, gtk_label_new ("<>"));
gtk_box_append (situations_box, gtk_label_new (" "));
gtk_box_append (situations_box, GTK_WIDGET (reset_scrollbar));
GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset");
GtkWidget *btt_reset = gtk_toggle_button_new_with_label ("r\ne\ns\ne\nt");
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_SITUATIONS_box_DO_RESET), NULL);
gtk_box_append (situations_box, btt_reset);
GtkAdjustment *adjust = NULL;
@ -153,23 +147,33 @@ static GtkBox *get_SITUATIONS_box()
return situations_box;
}
/*
char tooltip_text[8];
sprintf(tooltip_text, "\n%d\n", i);
if (0 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (object_bar [i]), "membrane");
if (1 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (object_bar [i]), "co-enzyme A");
if (2 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (object_bar [i]), "ATP synthase");
if (3 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (object_bar [i]), "any object name");
if (4 == i % 5) gtk_widget_set_tooltip_text (GTK_WIDGET (object_bar [i]), tooltip_text);
*/
/******************************************************************************/
/* S T A T E p a g e > t h r e e t o p l e v e l b o x e s */
/******************************************************************************/
static GtkWidget *get_OBJECTS_and_SITUATIONS()
static GtkWidget *rec_OBJECTS_and_SITUATIONS()
{
GtkWidget *scroll_objects = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_objects), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
GtkWidget *frame_objects = gtk_frame_new (" Objects"); // defines each class of object transparency
gtk_frame_set_child (GTK_FRAME (frame_objects), GTK_WIDGET (get_OBJECTS_box()));
gtk_frame_set_child (GTK_FRAME (frame_objects), GTK_WIDGET (rec_OBJECTS_box()));
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_objects), frame_objects);
GtkWidget *scroll_situations = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_situations), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
GtkWidget *frame_situations = gtk_frame_new (" Situations"); // facilitates each situation identification
gtk_frame_set_child (GTK_FRAME (frame_situations), GTK_WIDGET (get_SITUATIONS_box()));
gtk_frame_set_child (GTK_FRAME (frame_situations), GTK_WIDGET (rec_SITUATIONS_box()));
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_situations), frame_situations);
GtkWidget *objects_and_situations_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
@ -183,12 +187,12 @@ static GtkWidget *get_OBJECTS_and_SITUATIONS()
return objects_and_situations_horizontal_pane;
}
static GtkWidget *get_SPACE_VIEW_box()
static GtkWidget *rec_SPACE_VIEW_box()
{
GtkBox *right_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (right_box, GTK_WIDGET (get_XYZ_box()));
gtk_box_append (right_box, GTK_WIDGET (rec_XYZ_box()));
gtk_box_append (right_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (right_box, GTK_WIDGET (get_ZOOM_box()));
gtk_box_append (right_box, GTK_WIDGET (rec_ZOOM_box()));
GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
@ -201,13 +205,13 @@ static GtkWidget *get_SPACE_VIEW_box()
return GTK_WIDGET (central_box);
}
static GtkWidget *get_SPACE_EDIT_CONTROL_box()
static GtkWidget *rec_SPACE_EDIT_CONTROL_box()
{
return gtk_label_new
("_____________\n SPACE EDIT\n controls\n'''''''''''''''''''''''");
}
static GtkWidget *get_SEQUENCE_CONTROL_box()
static GtkWidget *rec_SEQUENCE_CONTROL_box()
{
GtkBox *SEQUENCE_CONTROL_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
@ -247,12 +251,12 @@ static GtkWidget *get_SEQUENCE_CONTROL_box()
GtkWidget *widget_rec_STATE_page()
{
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
gtk_box_append (page_box, GTK_WIDGET (rec_OBJECTS_and_SITUATIONS()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_VIEW_box()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
if (fsm_get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_CONTROL_box()));
else gtk_box_append (page_box, GTK_WIDGET (get_SEQUENCE_CONTROL_box()));
if (fsm_get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (rec_SPACE_EDIT_CONTROL_box()));
else gtk_box_append (page_box, GTK_WIDGET (rec_SEQUENCE_CONTROL_box()));
return GTK_WIDGET (page_box);
}