WIP: creation des sub-automates: OBJECTS & SITUATIONS_box_RESET_VALUE
This commit is contained in:
parent
415238c5d1
commit
562365ec78
|
@ -58,9 +58,13 @@ enum choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
|
|||
|
||||
void set_EXEC_EDIT (int prescribed);
|
||||
void set_STATE_RULES_DATA (int prescribed);
|
||||
void set_OBJECTS_box_RESET_VALUE (int prescribed);
|
||||
void set_SITUATIONS_box_RESET_VALUE (int prescribed);
|
||||
|
||||
int get_EXEC_EDIT ();
|
||||
int get_STATE_RULES_DATA ();
|
||||
int get_OBJECTS_box_RESET_VALUE ();
|
||||
int get_SITUATIONS_box_RESET_VALUE ();
|
||||
|
||||
|
||||
|
||||
|
@ -112,7 +116,7 @@ static inline char *read_file(char *filename)
|
|||
char *contents;
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if(fd < 0) {
|
||||
if (fd < 0) {
|
||||
printf("Couldn't read file: %s\n",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,11 @@ void on_glarea_realize (GtkWidget *widget);
|
|||
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_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data);
|
||||
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data);
|
||||
|
||||
void on_reset_image (GtkWidget *btt_reset, gpointer data);
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data);
|
||||
void on_clicked_MENU (GtkWidget *btt_reset, gpointer data);
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ GtkWindow *get_text_window();
|
|||
|
||||
GtkButton *get_GtkButton (char *btt_name);
|
||||
|
||||
GtkWidget *widget_get_STATE_page();
|
||||
GtkWidget *widget_get_RULES_page();
|
||||
GtkWidget *widget_get_STOCK_page();
|
||||
GtkWidget *get_STATE_page();
|
||||
GtkWidget *get_RULES_page();
|
||||
GtkWidget *get_STOCK_page();
|
||||
|
||||
GtkWidget *widget_get_STOCK_text (gchar *text_name);
|
||||
GtkWidget *get_STOCK_text (gchar *text_name);
|
||||
|
||||
struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;};
|
||||
void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child);
|
||||
|
@ -59,10 +59,6 @@ struct TreeNode_t *create_user_tree_node (const gchar* text);
|
|||
void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
|
||||
GtkScrolledWindow *get_user_rules_tree ();
|
||||
|
||||
void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
GtkWidget *get_window_child_DATA_lab();
|
||||
void go_to_the_lab (GtkMenuButton* menu_button);
|
||||
|
||||
/******************************************************************************/
|
||||
/* I M A G E S */
|
||||
/******************************************************************************/
|
||||
|
@ -88,6 +84,15 @@ gchar *get_text_address_ANY ();
|
|||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* L A B O */
|
||||
/******************************************************************************/
|
||||
|
||||
void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
void go_to_the_lab (GtkMenuButton* menu_button);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,19 +5,21 @@
|
|||
* State machine *
|
||||
* *
|
||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||
* Copyright © 2023 Adrien Bourmault <neox@a-lec.org> *
|
||||
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||
* *
|
||||
* This file is part of Gem-graph. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Affero General Public License *
|
||||
* as publishedby the Free Software Foundation, *
|
||||
* either version 3 of the License, or (at your option) any later version. *
|
||||
* as published by the Free Software Foundation, *
|
||||
* either version 3 of the License, *
|
||||
* or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* but WITHOUT ANY WARRANTY; *
|
||||
* without even the implied warranty of MERCHANTABILITY *
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
|
@ -36,6 +38,9 @@
|
|||
static int choice_EXEC_EDIT = EXEC;
|
||||
static int choice_STATE_RULES_DATA = STATE;
|
||||
|
||||
static int choice_OBJECTS_box_RESET_VALUE = 0;
|
||||
static int choice_SITUATIONS_box_RESET_VALUE = 0;
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* T R A N S I T I O N S */
|
||||
|
@ -43,20 +48,38 @@ static int choice_STATE_RULES_DATA = STATE;
|
|||
|
||||
static void debug_printing (int prescribed, int sub_automaton);
|
||||
|
||||
void set_EXEC_EDIT (int prescribed) {
|
||||
void set_EXEC_EDIT (int prescribed)
|
||||
{
|
||||
if (choice_EXEC_EDIT != prescribed) {
|
||||
debug_printing (prescribed, 0); // EXEC_EDIT is sub_automaton 0
|
||||
choice_EXEC_EDIT = prescribed;
|
||||
}
|
||||
}
|
||||
|
||||
void set_STATE_RULES_DATA (int prescribed) {
|
||||
void set_STATE_RULES_DATA (int prescribed)
|
||||
{
|
||||
if (choice_STATE_RULES_DATA != prescribed) {
|
||||
debug_printing (prescribed, 1); // STATE_RULES_DATA is sub_automaton 1
|
||||
choice_STATE_RULES_DATA = prescribed;
|
||||
}
|
||||
}
|
||||
|
||||
void set_OBJECTS_box_RESET_VALUE (int prescribed)
|
||||
{
|
||||
if (choice_OBJECTS_box_RESET_VALUE != prescribed) {
|
||||
debug_printing (prescribed, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
|
||||
choice_OBJECTS_box_RESET_VALUE = prescribed;
|
||||
}
|
||||
}
|
||||
|
||||
void set_SITUATIONS_box_RESET_VALUE (int prescribed)
|
||||
{
|
||||
if (choice_SITUATIONS_box_RESET_VALUE != prescribed) {
|
||||
debug_printing (prescribed, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3
|
||||
choice_SITUATIONS_box_RESET_VALUE = prescribed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* G E T T E R S & D E B U G G E R S */
|
||||
|
@ -64,6 +87,8 @@ void set_STATE_RULES_DATA (int prescribed) {
|
|||
|
||||
int get_EXEC_EDIT () {return choice_EXEC_EDIT;}
|
||||
int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;}
|
||||
int get_OBJECTS_box_RESET_VALUE () {return choice_OBJECTS_box_RESET_VALUE;}
|
||||
int get_SITUATIONS_box_RESET_VALUE () {return choice_SITUATIONS_box_RESET_VALUE;}
|
||||
|
||||
static char *get_str_EXEC_EDIT (int value) {
|
||||
switch (value) {
|
||||
|
@ -97,6 +122,12 @@ static void debug_printing (int prescribed, int sub_automaton) {
|
|||
get_str_EXEC_EDIT (choice_EXEC_EDIT),
|
||||
get_str_STATE_RULES_DATA (prescribed));
|
||||
break;
|
||||
case (2) : printf("automat.set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
|
||||
get_OBJECTS_box_RESET_VALUE(), prescribed);
|
||||
break;
|
||||
case (3) : printf("automat.set_SITUATIONS_box_RESET_VALUE : %2d > %2d\n",
|
||||
get_SITUATIONS_box_RESET_VALUE(), prescribed);
|
||||
break;
|
||||
default : printf("default in automaton.debug_printing()\n");
|
||||
}
|
||||
}
|
||||
|
@ -105,4 +136,4 @@ static void debug_printing (int prescribed, 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 */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
// c'est quoi ça, déjà ?
|
||||
|
|
134
src/callbacks.c
134
src/callbacks.c
|
@ -31,8 +31,30 @@
|
|||
#include "../include/graph.h"
|
||||
|
||||
|
||||
static void on_auto_notification (const char *message)
|
||||
{
|
||||
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
|
||||
|
||||
if (window->toast_revealer == NULL) {
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->toast_text == NULL) {
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_label_set_label(window->toast_text, message);
|
||||
gtk_revealer_set_reveal_child(window->toast_revealer, true);
|
||||
*/
|
||||
g_printerr("%s\n", message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* W I N D O W S A C T I V A T I O N S */
|
||||
/* W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
void on_main_window_activation (GtkApplication *app,
|
||||
|
@ -61,26 +83,32 @@ void on_text_window_activation (GtkApplication *app,
|
|||
}
|
||||
|
||||
|
||||
static void on_auto_notification (const char *message)
|
||||
{
|
||||
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
|
||||
|
||||
if (window->toast_revealer == NULL) {
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->toast_text == NULL) {
|
||||
g_printerr("Can't find app->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_label_set_label(window->toast_text, message);
|
||||
gtk_revealer_set_reveal_child(window->toast_revealer, true);
|
||||
*/
|
||||
g_printerr("%s\n", message);
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data),
|
||||
TRUE);
|
||||
printf ("callback.c (line 286) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
||||
}
|
||||
|
||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_window_close (GTK_WINDOW (data));
|
||||
printf ("callback.c (line 292) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
|
||||
}
|
||||
|
||||
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_window_close (GTK_WINDOW (data));
|
||||
printf ("callback.c (line 300) - WRITE_CURRENT_MODEL\n");
|
||||
}
|
||||
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data) {
|
||||
printf ("callback.on_clicked_HOME() button presents the dialog_window ( :- ) but it works only once.\n");
|
||||
gtk_window_present (GTK_WINDOW (get_dialog_window())); // works once only !
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* T R E E */
|
||||
|
@ -222,28 +250,26 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
/* B U T T O N S */
|
||||
/* S T A T E */
|
||||
/******************************************************************************/
|
||||
|
||||
static void switch_STATE_RULES_DATA() {
|
||||
|
||||
static void switch_STATE_RULES_DATA()
|
||||
{
|
||||
switch (get_STATE_RULES_DATA()) {
|
||||
|
||||
case (STATE) :
|
||||
gtk_window_set_child (get_main_window(),
|
||||
GTK_WIDGET (widget_get_STATE_page()));
|
||||
GTK_WIDGET (get_STATE_page()));
|
||||
break;
|
||||
|
||||
case (RULES) :
|
||||
gtk_window_set_child (get_main_window(),
|
||||
GTK_WIDGET (widget_get_RULES_page()));
|
||||
GTK_WIDGET (get_RULES_page()));
|
||||
break;
|
||||
|
||||
case (DATA) :
|
||||
if (0) gtk_window_set_child (get_main_window(),
|
||||
GTK_WIDGET (get_window_child_DATA_lab ()));
|
||||
gtk_window_set_child (get_main_window(),
|
||||
GTK_WIDGET (widget_get_STOCK_page()));
|
||||
GTK_WIDGET (get_STOCK_page()));
|
||||
break;
|
||||
|
||||
default :
|
||||
|
@ -251,8 +277,8 @@ static void switch_STATE_RULES_DATA() {
|
|||
}
|
||||
}
|
||||
|
||||
void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) {
|
||||
|
||||
void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
|
||||
{
|
||||
if (get_EXEC_EDIT ()) {
|
||||
|
||||
gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
|
||||
|
@ -273,8 +299,8 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) {
|
|||
switch_STATE_RULES_DATA();
|
||||
}
|
||||
|
||||
void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data) {
|
||||
|
||||
void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data)
|
||||
{
|
||||
const char *toggled_button_name
|
||||
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
|
||||
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
|
||||
|
@ -296,30 +322,12 @@ void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data)
|
|||
}
|
||||
}
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data),
|
||||
TRUE);
|
||||
printf ("callback.c (line 286) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
||||
}
|
||||
|
||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_window_close (GTK_WINDOW (data));
|
||||
printf ("callback.c (line 292) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
|
||||
}
|
||||
|
||||
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL,
|
||||
gpointer data) {
|
||||
gtk_window_close (GTK_WINDOW (data));
|
||||
printf ("callback.c (line 300) - WRITE_CURRENT_MODEL\n");
|
||||
}
|
||||
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data) {
|
||||
printf ("callback.on_clicked_HOME() button presents the dialog_window ( :- ) but it works only once.\n");
|
||||
gtk_window_present (GTK_WINDOW (get_dialog_window())); // works once only !
|
||||
void on_OBJECTS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data)
|
||||
{
|
||||
printf ("callback.on_OBJECTS_box_DO_RESET()\n");
|
||||
}
|
||||
|
||||
void on_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data) {}
|
||||
|
||||
|
||||
|
||||
|
@ -333,10 +341,22 @@ void on_clicked_MENU (GtkWidget *btt_reset, gpointer menu_button) {go_to_the_lab
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void on_reset_image (GtkWidget *btt_reset, gpointer data) {
|
||||
printf ("callback.on_reset_image() <> Comment remettre tous les curseurs à zéro ?\n");
|
||||
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
|
||||
{
|
||||
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");
|
||||
set_OBJECTS_box_RESET_VALUE (1); // utiliser gpointer data pour transmettre la valeur choisie TODO
|
||||
}
|
||||
|
||||
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
|
||||
{
|
||||
set_SITUATIONS_box_RESET_VALUE (1);
|
||||
}
|
||||
|
||||
// GTK itself does not support event sounds, << A GREAT WAY TO DEBUG ! TODO
|
||||
// you have to use a loadable module like the one that comes with libcanberra.
|
||||
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ void widget_TEXT_WINDOW_design (GtkWindow *main_window, GtkWindow *text_window){
|
|||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
gtk_window_set_titlebar (text_window, header_bar);
|
||||
|
||||
GtkWidget *child = widget_get_STOCK_text (get_text_address_THEORY());
|
||||
child = widget_get_STOCK_text (get_text_address_ABOUT_COMMANDS());
|
||||
GtkWidget *child = get_STOCK_text (get_text_address_THEORY());
|
||||
child = get_STOCK_text (get_text_address_ABOUT_COMMANDS());
|
||||
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
|
||||
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ static GtkWidget *get_rules_tree_hpaned_new(){
|
|||
return GTK_WIDGET (H_tree_vs_comparison);
|
||||
}
|
||||
|
||||
GtkWidget *widget_get_RULES_page() {
|
||||
GtkWidget *get_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");
|
||||
|
|
|
@ -37,9 +37,18 @@
|
|||
#define UPPER_COMPARTMENT_PARTITION 600
|
||||
#define LOWER_COMPARTMENT_PARTITION 1300
|
||||
|
||||
GtkBox *get_XYZ_box(){
|
||||
/* L'image de l'état de l'espace (au centre) est entourée par trois panneaux:
|
||||
* - CONTROL ou EDIT en bas qui permet de contrôler / choisir un état et / ou de l'éditer
|
||||
* en mode EDIT, seuls les outils d'édition de l'état sont disponibles
|
||||
* en mode EXEC, seuls les outils de déplacement dans la séquence sont disponibles
|
||||
* - CAMERA à droite qui permet de choisir la position de la caméra
|
||||
* - CONTRAST en haut qui 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 */
|
||||
|
||||
GtkBox *get_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)); // spacing = 2q
|
||||
GtkBox *XYZ_scrollbar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2
|
||||
// GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
|
||||
// (double min, double max, double step, const char** icons)
|
||||
GtkAdjustment *X_adjust = gtk_adjustment_new (rand() % 100, 0, 380, 1, 0, 0);
|
||||
|
@ -48,21 +57,24 @@ GtkBox *get_XYZ_box(){
|
|||
GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust);
|
||||
GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust);
|
||||
GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 440);
|
||||
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 400);
|
||||
|
||||
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
|
||||
gtk_box_append (XYZ_scrollbar_box, scroll_X);
|
||||
gtk_box_append (XYZ_scrollbar_box, scroll_Y);
|
||||
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");
|
||||
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));
|
||||
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("")));
|
||||
return XYZ_labels_box;
|
||||
}
|
||||
|
||||
static GtkBox *get_ZOOM_box(){
|
||||
static GtkBox *get_ZOOM_box()
|
||||
{
|
||||
GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
|
||||
"\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\
|
||||
|
@ -73,53 +85,69 @@ static GtkBox *get_ZOOM_box(){
|
|||
}
|
||||
|
||||
|
||||
static GtkBox *get_OBJECTS_box(){
|
||||
static GtkBox *get_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_reset_image), NULL);
|
||||
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_OBJECTS_box_DO_RESET), NULL);
|
||||
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++) {
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
adjust [i] = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 0);
|
||||
}
|
||||
for (int i = 0; i < n; i++) {
|
||||
// adjust [i] = gtk_adjustment_new (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 (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_label_new (" "));
|
||||
gtk_box_append (objects_box, GTK_WIDGET (scrollbar_i));
|
||||
}
|
||||
return objects_box;
|
||||
}
|
||||
|
||||
static GtkBox *get_SITUATIONS_box(){
|
||||
static GtkBox *get_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_WIDGET (reset_scrollbar));
|
||||
GtkWidget *btt_reset = gtk_check_button_new_with_label ("reset");
|
||||
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_reset_image), NULL);
|
||||
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_SITUATIONS_box_DO_RESET), NULL);
|
||||
gtk_box_append (situations_box, btt_reset);
|
||||
GtkAdjustment *adjust = NULL;
|
||||
for (int i = 0; i < 128; i++) {
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
adjust = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 4);
|
||||
GtkScrollbar *scrollbar_i = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjust));
|
||||
char tooltip_text[8];
|
||||
sprintf(tooltip_text, "\n%d\n", i);
|
||||
if (0 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " transcription ");
|
||||
if (1 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " transport Na/K ");
|
||||
if (2 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " ubiquitination ");
|
||||
if (3 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " glycolyse aérobie ");
|
||||
if (4 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " cycle de Krebs ");
|
||||
if (5 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " shunt des pentoses ");
|
||||
if (6 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), " any situation name ");
|
||||
if (0 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "transcription");
|
||||
if (1 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "transport Na/K");
|
||||
if (2 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "ubiquitination");
|
||||
if (3 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "glycolyse aérobie");
|
||||
if (4 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "cycle de Krebs");
|
||||
if (5 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "shunt des pentoses");
|
||||
if (6 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), "any situation name");
|
||||
if (7 == i % 8) gtk_widget_set_tooltip_text (GTK_WIDGET (scrollbar_i), tooltip_text);
|
||||
gtk_box_append (situations_box, gtk_label_new (" "));
|
||||
gtk_box_append (situations_box, GTK_WIDGET (scrollbar_i));
|
||||
}
|
||||
return situations_box;
|
||||
|
@ -129,7 +157,8 @@ static GtkBox *get_SITUATIONS_box(){
|
|||
/* 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 *get_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);
|
||||
|
||||
|
@ -154,7 +183,8 @@ static GtkWidget *get_OBJECTS_and_SITUATIONS(){
|
|||
return objects_and_situations_horizontal_pane;
|
||||
}
|
||||
|
||||
GtkWidget *get_SPACE_VIEW_box() {
|
||||
GtkWidget *get_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 (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
|
@ -171,12 +201,14 @@ GtkWidget *get_SPACE_VIEW_box() {
|
|||
return GTK_WIDGET (central_box);
|
||||
}
|
||||
|
||||
static GtkWidget *get_SPACE_EDIT_CONTROL_box(){
|
||||
static GtkWidget *get_SPACE_EDIT_CONTROL_box()
|
||||
{
|
||||
return gtk_label_new
|
||||
("_____________\n SPACE EDIT\n controls\n'''''''''''''''''''''''");
|
||||
}
|
||||
|
||||
static GtkWidget *get_SEQUENCE_CONTROL_box() {
|
||||
static GtkWidget *get_SEQUENCE_CONTROL_box()
|
||||
{
|
||||
GtkBox *SEQUENCE_CONTROL_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||
|
||||
GtkBox *DO_UNDO_REDO_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
|
@ -202,7 +234,16 @@ static GtkWidget *get_SEQUENCE_CONTROL_box() {
|
|||
/* g e t S T A T E p a g e */
|
||||
/******************************************************************************/
|
||||
|
||||
GtkWidget *widget_get_STATE_page() {
|
||||
/* L'image de l'état de l'espace (au centre) est entourée par trois panneaux: (à renommer ?)
|
||||
* - CONTROL ou EDIT en bas qui permet de contrôler / choisir un état et / ou de l'éditer
|
||||
* en mode EDIT, seuls les outils d'édition de l'état sont disponibles
|
||||
* en mode EXEC, seuls les outils de déplacement dans la séquence sont disponibles
|
||||
* - CAMERA à droite qui permet de choisir la position de la caméra
|
||||
* - CONTRAST en haut qui 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 */
|
||||
|
||||
GtkWidget *get_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 (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "../../include/callbacks.h"
|
||||
#include "../../include/widgets.h"
|
||||
|
||||
GtkWidget *widget_get_STOCK_page () {
|
||||
GtkWidget *get_STOCK_page () {
|
||||
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
|
||||
|
||||
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
|
||||
|
@ -64,7 +64,7 @@ GtkWidget *widget_get_STOCK_page () {
|
|||
return GTK_WIDGET (data_box);
|
||||
}
|
||||
|
||||
GtkWidget *widget_get_STOCK_text (gchar *text_address) {
|
||||
GtkWidget *get_STOCK_text (gchar *text_address) {
|
||||
GtkWidget *view = gtk_text_view_new ();
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
|
||||
|
@ -78,6 +78,9 @@ GtkWidget *widget_get_STOCK_text (gchar *text_address) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* T E X T S */
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue