Compare commits

..

No commits in common. "07cbfe9fcb174b8580f13d954d534c34e5de68a6" and "dfc623a15160811570f7089654a6eb4e260d3434" have entirely different histories.

36 changed files with 338 additions and 1632 deletions

View File

@ -76,3 +76,43 @@ struct arrow_t { uint load; uint site; uint x; uint y; uint z; };
#define SOUTH 4 // + z blue #define SOUTH 4 // + z blue
#define NORTH 5 // - z yellow #define NORTH 5 // - z yellow
/******************************************************************************/
/* U T I L I T I E S */
/******************************************************************************/
/*
* char *read_file(char *filename)
* reads a file from filename into a provided buffer
*
* @param filename, file name
* contents, target ptr
*
* @return void
*/
static inline char *read_file(char *filename)
{
int fd;
int filesize;
char *contents;
fd = open(filename, O_RDONLY);
if (fd < 0) {
printf("Couldn't read file: %s\n",filename);
return NULL;
}
filesize = lseek(fd, 0, SEEK_END) + 1 ;
contents = g_malloc(filesize * sizeof(char));
assert (contents);
lseek(fd, 0, SEEK_SET);
read(fd,contents,filesize);
contents[filesize-1] = '\0';
close(fd);
return contents;
}

View File

@ -30,81 +30,33 @@
#pragma once #pragma once
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <gtk-4.0/gtk/gtk.h>
/******************************************************************************/ /******************************************************************************/
/* S T A T E M A C H I N E */ /* S T A T E M A C H I N E */
/******************************************************************************/ /******************************************************************************/
// called by widgets through signal functions // called by widgets through signal functions
enum fsm_select_EXEC_EDIT { EXEC, EDIT }; enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum fsm_select_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; // xor
enum fsm_select_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
enum fsm_measure_type {DATE_RULE_EXEC, RULE_EXEC_NB, OBJECT_NB, ELAPSED_TIME };
#define n_rules 128 // arbitrary #define n_rules 128 // arbitrary
#define n_objects 32 // arbitrary too, #define n_objects 32 // arbitrary too,
#define n_situations 128 // and so on... #define n_situations 128 // and so on...
typedef struct tool_list {int value; struct tool_list *suiv;} tool_list ;
typedef struct flow_list {int value; struct flow_list *suiv;} flow_list ;
typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
void fsm_init(); // def: fsm/dispatch; call: main;
void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch;
void fsm_measures_list_init(); // def: fsm/measure/manage.c; call: fsm/dispatch;
void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch;
void fsm_displayable_list_init(); // def: fsm/prefer; call: fsm/dispatch;
int fsm_get_exec_edit(); // def: fsm/dispatch; call: signal;
// widget/state/dispatch;
// widget/rules/selected/dispatch;
int fsm_get_state_rules_data(); // def: fsm/dispatch; call: signal;
void fsm_set_exec_edit (int value);// def: fsm/dispatch; call: signal;
void fsm_set_state_rules_data (int value); // def: fsm/dispatch; call: signal;
void fsm_store_restore_reset (int choice, int value);// def: prefer; call: signal;
bool fsm_get_preferences_state(); // def: fsm/dispatch; call: - - -
void fsm_set_preferences_state (bool value); // def: fsm/dispatch; call: signal;
// fsm/prefer;
void fsm_add_measure (char *measure_name); // def: fsm/measure/manage.c;
// call: widget/measure/dispatch;
void fsm_add_result (char *result_name); // def: fsm/result; call: - - -
void fsm_add_displayable (char *displayable_name);// def: fsm/prefer; call: fsm/prefer;
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
// def: fsm/prefer; call: signal;
void fsm_msg (int choice, int value, char *string, int sub_automaton); int fsm_get_exec_edit ();
// def: fsm/dispatch; call: fsm/dispatch; int fsm_get_state_rules_data ();
// fsm/measure; int fsm_get_store_restore_reset ();
// fsm/result;
// --------------------------------------------------------------- WIP ------ void fsm_set_exec_edit (int value);
// def: measure/tool_list call: measure/tool_list (about the following functions...) void fsm_set_state_rules_data (int value);
void fsm_tools_sort_list_insert (tool_list **tl, int value); void fsm_set_store_restore_reset (int target, int value);
int fsm_tools_sort_list_pop (tool_list **tl);
int fsm_tools_sort_list_length (tool_list *tl);
void fsm_tools_sort_list_clear (tool_list **tl);
void fsm_tools_sort_list_view (tool_list *tl);
void fsm_tools_sort_list_test(); // def: measure/manage; call: measure/manage;
// def: fsm/measure/manage/; call: rule exec
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id);
// --------------------------------------------------------------- WIP ------ bool fsm_get_preferences_state ();
typedef struct journal {int value; struct journal *prev;} journal; // structure d'un élément void fsm_set_preferences_state (bool value);
int fsm_journal_push (journal **jj, int v_value);
int fsm_journal_pop (journal **jj);
void fsm_journal_clear (journal **jj);
int fsm_journal_length (journal *jj);
void fsm_journal_view (journal *jj);
void fsm_journal_seek (journal *jj, int v_value);

View File

@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Gem-graph client * * Gem-graph client *
* * * *
* State machine / Measures * * Main *
* * * *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> * * Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> * * Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
@ -27,18 +27,14 @@
* * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/ #pragma once
/* An editable list of displayed results is defined and maintained here */ #include <gtk-4.0/gtk/gtk.h>
/* (see : fsm/measure/manage.c) */
/* - - - */
/* NB some data may be displayed simultaneously in different pages */
/* ex : pages SYNTH & RESULTS */
/******************************************************************************/
void pref_set_store_restore_reset (int choice, int value);
const char get_button_icon_name (int n);
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
void *prefer_add_measure (char *measure_name);

View File

@ -156,8 +156,6 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
// correlate ? // correlate ?
void on_select_a_second_measurement (GtkWidget *btt, gpointer data); void on_select_a_second_measurement (GtkWidget *btt, gpointer data);
void on_skip_this_step (GtkWidget *btt, gpointer data); void on_not_yet_defined (GtkWidget *btt, gpointer data);
void on_something_else (GtkWidget *btt, gpointer data); void on_something_else (GtkWidget *btt, gpointer data);
void on_closing_page (GtkWidget *btt, gpointer data);

View File

@ -1,90 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <gtk-4.0/gtk/gtk.h>
#include "../include/fsm.h"
char *util_read_file (char *filename);
//------------------------------------------------------------------------------
// https://chgi.developpez.com/liste/ < ^c^v
// Copyright © 2016 CGi.
// Aucune reproduction, même partielle, ne peut être faite de ce site
// ni de l'ensemble de son contenu : textes, documents, images, etc.
// sans l'autorisation expresse de l'auteur.
// Sinon vous encourez selon la loi jusqu'à trois ans de prison
// et jusqu'à 300 000 € de dommages et intérêts.
// Le piratage est illégal,
// de même que sont interdits: cracks, warez, sérials (sauf évaluation), etc.
// Est bien sûr autorisé tout ce qui concerne les logiciels gratuits, freewares et évaluation.
//------------------------------------------------------------------------------
typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément
void util_pile_clear (pile **); // vide toute la pile
void util_pile_view (pile *); // affiche la pile en commençant par le sommet
int util_pile_push (pile **, int); // ajoute une valeur sur la pile
int util_pile_pop (pile **); // retire la dernière valeur empilée
int util_pile_length (pile *p); // renvoie le nombre d'éléments de la pile
//------------------------------------------------------------------------------
typedef struct elem {int value; struct elem *prev; struct elem *next;} elem;
typedef struct {elem *first; elem *last;} dblist; // structure d'accès à la liste
void util_list_2x2_init (dblist *l); // initialisation
void util_list_2x2_clear (dblist *l); // vide toute la liste
void util_list_2x2_view (dblist l); // affiche les valeurs de toute la liste
int util_list_2x2_push_back (dblist *l, int val); // ajoute une valeur en fin de liste
int util_list_2x2_push_front (dblist *l, int val); // ajoute une valeur en début de liste
int util_list_2x2_pop_back (dblist *l); // retire une valeur en fin de liste
int util_list_2x2_pop_front (dblist *l); // retire une valeur en début de liste
int util_list_2x2_length (dblist l); // renvoie le nombre d'éléments de la liste
//------------------------------------------------------------------------------
typedef struct slist {int value; struct slist *suiv;} slist ;
void util_sorted_list_clear (slist **sl); // vide toute la liste
void util_sorted_list_view (slist *sl); // affiche toute la liste
int util_sorted_list_insert (slist **sl, int val); // insertion d'un élément selon son rang
int util_sorted_list_pop (slist **sl); // retire la dernière valeur de la liste
int util_sorted_list_length (slist *sl); // renvoie le nombre d'éléments de la liste
//------------------------------------------------------------------------------
void util_trigger_test(); // def: util/tests.c calls: ...
void util_pile_test(); // called in fsm/measure.c
void util_double_list_test(); // " "
void util_sorted_list_test(); // " "

View File

@ -65,9 +65,8 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window
/******************************************************************************/ /******************************************************************************/
#define W_TREE 160 #define W_TREE 160
#define W_DO_UNDO_REDO_BOX 1300 #define W_DO_UNDO_REDO_BOX 1300
#define W_XYZ_BOX 62
#define H_XYZ_BOX 200 #define H_XYZ_BOX 200
#define H_E_COLI 760 #define H_E_COLI 790
#define H_OBJECTS_SITUATIONS 130 #define H_OBJECTS_SITUATIONS 130
#define W_COMPARATOR 64 #define W_COMPARATOR 64
#define W_RULES_USE 90 #define W_RULES_USE 90
@ -76,7 +75,6 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window
#define W_IMAGE_100 100 #define W_IMAGE_100 100
/******************************************************************************/ /******************************************************************************/
/* T O P B A R */ /* T O P B A R */
/******************************************************************************/ /******************************************************************************/
@ -118,9 +116,6 @@ void *widget_get_measure_page();// in : widget / measure / dispatch.c
// repartitions.c WIP // repartitions.c WIP
// correlations.c WIP // correlations.c WIP
#define H_PARTITION_SYNTH 1600
#define W_PARTITION_SYNTH 400
void *widget_get_time_dependent_results_and_time_controls(); void *widget_get_time_dependent_results_and_time_controls();
// *widget_get_space_vs_non_time_dependent_analysis(); WIP // *widget_get_space_vs_non_time_dependent_analysis(); WIP
// *widget_get_non_time_dependent_analysis_elements(); WIP // *widget_get_non_time_dependent_analysis_elements(); WIP
@ -133,14 +128,8 @@ void *widget_get_time_dependent_results_and_time_controls();
// defined in : widget / state / middle // defined in : widget / state / middle
// defined in : widget / state / bottom // defined in : widget / state / bottom
#define PARTITION_STATE_TOP 600 void *widget_get_space_view(); // middle
#define PARTITION_SPACE_VS_CONTROLS_1 920 void *widget_get_graph_view_control(); // middle
#define PARTITION_SPACE_VS_CONTROLS_2 800
#define PARTITION_SPACE_VS_CAMERA_IN_STATE 1850
#define PARTITION_SPACE_VS_CAMERA_IN_SYNTH 1560
void *widget_get_space_view (int partition_space_vs_camera); // middle
void *widget_get_graph_view_control(); // middle
void *widget_get_space_edit_control(); // bottom void *widget_get_space_edit_control(); // bottom
void *widget_get_sequence_control(); // bottom void *widget_get_sequence_control(); // bottom
@ -201,15 +190,14 @@ void *widget_get_selected_rule_images();
/******************************************************************************/ /******************************************************************************/
/* D A T A */ /* D A T A */
/******************************************************************************/ /******************************************************************************/
// called by : widget / results / dispatch / widget_get_data_page() // called by : widget / data / dispatch / widget_get_data_page()
// defined in : widget / results / organize.c // defined in : widget / data / measures.c
// display.c // operations.c
// results.c
#define H_PARTITION_RESULTS 140 void *widget_get_measures_page();
void *widget_get_results_page();
void *widget_get_organize_results_box(); void *widget_get_operations_on_results_page();
void *widget_get_display_results_box();
void *widget_get_time_results_box ();
/******************************************************************************/ /******************************************************************************/
@ -265,21 +253,16 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
// defined in : widget / measure / dispatch.c // defined in : widget / measure / dispatch.c
void *widget_measure_new(); void *widget_measure_new();
// La séquence logique à suivre pour créer une nouvelle mesure
void *widget_measure_do_select_rules_first(); void *widget_measure_do_select_rules_first();
void *widget_measure_do_depends_on_one_or_two_events(); void *widget_measure_do_depends_on_one_or_two_events();
void *widget_measure_do_depends_on_a_single_event(); void *widget_measure_do_depends_on_a_single_event();
void *widget_measure_do_depends_on_two_events(); void *widget_measure_do_depends_on_two_events();
void *widget_measure_do_select_a_second_rules_set(); void *widget_measure_do_select_a_second_rules_set();
void *widget_measure_do_choose_an_event_type(); void *widget_measure_do_choose_an_event_type();
void *widget_measure_do_correlate();
void *widget_measure_do_insert_in_measurements_list();
void *widget_measure_do_end_creation_of_measurement_process();
// Les cinq types de mesures possibles
void *widget_measure_event_occurences_nb(); void *widget_measure_event_occurences_nb();
void *widget_measure_event_occurences_dates(); void *widget_measure_event_occurences_dates();
void *widget_measure_event_occurences_situations(); void *widget_measure_event_occurences_situations();
void *widget_measure_time_elapsed_between_two_events(); void *widget_measure_time_elapsed_between_two_events();
void *widget_measure_third_event_occurences_in_between(); void *widget_measure_third_event_occurences_in_between();
void *widget_measure_do_we_select_another_measurement();
void *widget_not_yet_defined();

101
journal.c
View File

@ -1,101 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* A journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/******************************************************************************/
int fsm_journal_push (journal **jj, int vv)
{
journal *element = malloc (sizeof(journal));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = vv;
element->prev = *jj;
*jj = element; // Le pointeur pointe sur le dernier élément.
return vv;
}
int fsm_journal_pop (journal **jj)
{
int vv;
journal *tmp;
if (!*jj) return -1; // Retourne -1 si le journal est vide.
tmp = (*jj)->prev;
vv = (*jj)->value;
free (*jj);
*jj = tmp; // Le pointeur pointe sur le dernier élément.
return vv; // retourne la value retirée du journal.
}
void fsm_journal_clear (journal **jj)
{
journal *tmp;
while (*jj)
{
tmp = (*jj)->prev;
free (*jj);
*jj = tmp;
}
}
int fsm_journal_length (journal *jj)
{
int n=0;
while (jj)
{
n++;
jj = jj->prev;
}
return n;
}
void fsm_journal_view (journal *jj)
{
printf ("view journal (n = %d)\n", fsm_journal_length (jj));
while (jj)
{
printf ("> %d\n", jj->value);
jj = jj->prev;
}
puts ("------");
}
void fsm_journal_seek (journal *jj, int value)
{
}

View File

@ -29,75 +29,39 @@
#include <stdbool.h> #include <stdbool.h>
#include "../../include/fsm.h" #include "../include/fsm.h"
#include "../include/prefer.h"
#include "../include/widget.h"
/******************************************************************************/
/* */
/* OOOOOOOOOOO OOOOO OOO OOO */
/* OO OO OO OOOO OOOO */
/* OO OO OO OO OO OO */
/* OOOOOO OO OO OO OO OO */
/* OO OO OO OOO OO */
/* OO OO OO OO */
/* OO OO OOO OO OO */
/* OO OOOOOO OO OO */
/* */
/******************************************************************************/
/******************************************************************************/
/* Each state of the finite state machine (fsm) must be */
/* - saved at the end of a work session and */
/* - reread (available) at the start of a new session. */
/* */
/* No state of the fsm should be defined in another module. */
/* No fsm transition needs to be executed in another module. */
/******************************************************************************/
/******************************************************************************/
/* F S M I N I T */
/******************************************************************************/
void fsm_init()
{
fsm_measures_list_init();
fsm_results_list_init();
fsm_displayable_list_init();
fsm_preferences_init();
}
/******************************************************************************/ /******************************************************************************/
/* S T A T E S */ /* S T A T E S */
/******************************************************************************/ /******************************************************************************/
static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = STATE;
static int preferences_have_been_modified = FALSE; static int preferences_have_been_modified = FALSE;
int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
void fsm_set_preferences_state (bool value) {preferences_have_been_modified = value;} void fsm_set_preferences_state (bool value) {preferences_have_been_modified = value;}
bool fsm_get_preferences_state() {return preferences_have_been_modified;} bool fsm_get_preferences_state () {return preferences_have_been_modified;}
// preferences_have_been_modified // preferences_have_been_modified
// and should be stored before closing the current session. TODO // and should be stored before closing the current session. TODO
static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = SYNTH; // THE FIRST PAGE TO BE PRESENTED
// SEE ALSO fsm/dispatch.c window_design_topbar_left() (the end)
int fsm_get_exec_edit() {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
/******************************************************************************/ /******************************************************************************/
/* T R A N S I T I O N S */ /* T R A N S I T I O N S */
/******************************************************************************/ /******************************************************************************/
static void debug_printing (int choice, int value, int sub_automaton);
void fsm_set_exec_edit (int choice) void fsm_set_exec_edit (int choice)
{ {
if (choice_EXEC_EDIT != choice) { if (choice_EXEC_EDIT != choice) {
fsm_msg (choice, 0, "", 0); // EXEC_EDIT is sub_automaton 0 debug_printing (choice, 0, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = choice; choice_EXEC_EDIT = choice;
} }
} }
@ -105,42 +69,59 @@ void fsm_set_exec_edit (int choice)
void fsm_set_state_rules_data (int choice) void fsm_set_state_rules_data (int choice)
{ {
if (choice_STATE_RULES_DATA != choice) { if (choice_STATE_RULES_DATA != choice) {
fsm_msg (choice, 0, "", 1); // STATE_RULES_DATA is sub_automaton 1 debug_printing (choice, 0, 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = choice; choice_STATE_RULES_DATA = choice;
} }
} }
/******************************************************************************/ /******************************************************************************/
/* D E B U G G I N G */ /* D E B U G G E R S */
/******************************************************************************/ /******************************************************************************/
static char *tab_0 [] = { "EXEC", "EDIT" }; static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" }; static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
void fsm_msg (int choice, int value, char *string, int sub_automaton) static void debug_printing (int choice, int value, int sub_automaton)
{ {
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA // sub_automaton 1 is STATE_RULES_DATA
// sub_automaton 2 is MEASURE case (0) : printf("switch %5s x %5s > %5s x %5s\n",
case (0) : printf ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\n", tab_0 [choice_EXEC_EDIT],
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA], tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice], tab_1 [choice_STATE_RULES_DATA]); tab_0 [choice],
tab_1 [choice_STATE_RULES_DATA]);
break; break;
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
case (1) : printf ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\n", tab_0 [choice_EXEC_EDIT],
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA], tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice_EXEC_EDIT], tab_1 [choice]); tab_0 [choice_EXEC_EDIT],
tab_1 [choice]);
break; break;
case (2) : break;
case (3) : break;
case (2) : printf ("fsm/dispatch.message | %s\n", string); default : printf("default in automaton.debug_printing()\n");
break;
case (3) : printf ("fsm/dispatch.message | %2d\n", choice);
break;
default : printf ("default in fsm/dispatch.fsm_msg()\n");
} }
} }
/******************************************************************************/
/* N O N E X C L U S I V E S E L E C T I O N S */
/******************************************************************************/
// ?
/******************************************************************************/
/* M E A S U R E S */
/******************************************************************************/
// list of measurements requested by the user
// this list is editable (see widget / measure)
// the results of each measurement can be displayed in diagrams (charts,...)
// liste des diagrammes

View File

@ -1,101 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine / Journal *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../include/fsm.h"
/******************************************************************************/
/* A journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/******************************************************************************/
int fsm_journal_push (journal **jj, int vv)
{
journal *element = malloc (sizeof(journal));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = vv;
element->prev = *jj;
*jj = element; // Le pointeur pointe sur le dernier élément.
return vv;
}
int fsm_journal_pop (journal **jj)
{
int vv;
journal *tmp;
if (!*jj) return -1; // Retourne -1 si le journal est vide.
tmp = (*jj)->prev;
vv = (*jj)->value;
free (*jj);
*jj = tmp; // Le pointeur pointe sur le dernier élément.
return vv; // retourne la value retirée du journal.
}
void fsm_journal_clear (journal **jj)
{
journal *tmp;
while (*jj)
{
tmp = (*jj)->prev;
free (*jj);
*jj = tmp;
}
}
int fsm_journal_length (journal *jj)
{
int n=0;
while (jj)
{
n++;
jj = jj->prev;
}
return n;
}
void fsm_journal_view (journal *jj)
{
printf ("view journal (n = %d)\n", fsm_journal_length (jj));
while (jj)
{
printf ("> %d\n", jj->value);
jj = jj->prev;
}
puts ("------");
}
void fsm_journal_seek (journal *jj, int value)
{
}

View File

@ -1,49 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
// data_list or flow_list
// ?
// when does a stream of numbers become data
// ?
/******************************************************************************/
/* An editable list of results is defined and maintained here */
/* and some operations can be performed on them. */
/* (see : fsm/measure/manage.c) */
/* - - - */
/* ex : filter, concat, inverse, scale, correlate, etc. */
/******************************************************************************/

View File

@ -1,87 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* F R O M M E A S U R E M E N T S T O P R E S E N T A T I O N S */
/* */
/* How should the sequence */
/* from measurements to results presentation */
/* be organized */
/* ? */
/* */
/* (1) create/edit some mesurement tools and/or activate existing ones */
/* (2) apply a mesurement tool to a situation to create a new data flow */
/* and possibly carry out any operations on these results */
/* (3) display (plot) the results and adjust the appearance of the tables */
/* - - - */
/* */
/* As a consequence, three lists at least */
/* must be created and maintained : */
/* */
/* (1) a mesurement tools list (see : fsm/measure/tool_list.c) */
/* which should mention if the tool is 'active' or 'inactive' */
/* NB each rule ou rules-tree edition may change some items of that list */
/* */
/* (2) a data flows list (see : fsm/measure/flow_list.c) */
/* (it could either be named : fsm/measure/data_list.c) */
/* on which some operations could be performed : */
/* ex : filter, concat, inverse, scale, correlate, etc. */
/* NB each data flow should be available in a 'displayable form' */
/* */
/* (3) a displayed data list (see : fsm/measure/disp_list.c) */
/* NB some data may be displayed simultaneously in different pages */
/* ex : SYNTH & RESULTS */
/* */
/* NB these three lists should be stored in the XML model */
/* and restored at the beginning of a new session */
/* - - - */
/* */
/* (4) a journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/* - - - */
/* */
/* When a rule is adequately tagged, it triggers a measure : */
/* fsm_rule_trig_measure (rule_id, object_id, measure_id) {...} */
/* */
/* The measurement is then taken and the result stored. */
/* */
/******************************************************************************/
void fsm_add_measure (char *measure_name) {fsm_msg (2, 0, measure_name, 2);}
void fsm_measures_list_init() {if (0) fsm_tools_sort_list_test();}
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id) {}

View File

@ -1,199 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* An editable list of measurements is defined and maintained here */
/* (see : fsm/measure/manage.c) */
/* - - - */
/* Each possible measurement can be activated or silenced */
/* - - - */
/* The measures relate to */
/* - the number of occurrences of a rule or group of rules, */
/* - the number of objects or situations before/after the rule was applied, */
/* - the time (date) of the event, */
/* - the time elapsed between two events, */
/* - the occurrence of events C between events A and B, */
/* NB This list is non limitative. ex : pattern recognition tools */
/******************************************************************************/
//------------------------------------------------------------------------------
// structure de données : chaque "item" doit comporter :
//
// - identifiant (clé) (+/- pointeur vers : date de création, auteur,...)
//
// - type de mesure
// les 6 items suivants peuvent documenter l'ensemble de toutes les valeurs
// à recueillir pour documenter tous les types de mesure possibles;
// tous ces items ne doivent pas être simultanément complétés
// mais, si un tableau etait utilisé, il y aurait peu de place perdue;
//
// - pointeur vers le premier groupe de règles (une au moins)
// - pointeur vers un second groupe de règles (une au moins)
// - pointeur vers des objets ou situations (un au moins)
// - pointeur vers un ensemble d'évènements intercurrents
// - date de l'évènement
// - durée entre deux évènements
//
// - mesure active ? + / -
// - pointeur vers une liste de mesures similaires
// - pointeur vers des données, des représentations de données ?
//------------------------------------------------------------------------------
void fsm_tools_sort_list_insert (tool_list **ml, int value)
{
tool_list *tmp = NULL;
tool_list *cml = *ml;
tool_list *elem = malloc (sizeof (tool_list));
if (!elem) exit (EXIT_FAILURE);
elem->value = value;
while (cml && cml->value < value)
{
tmp = cml;
cml = cml->suiv;
}
elem->suiv = cml;
if (tmp) tmp->suiv = elem;
else *ml = elem;
}
int fsm_tools_sort_list_pop (tool_list **ml)
{
int value;
tool_list *tmp;
if (! *ml) return -1;
tmp = (*ml)->suiv;
value = (*ml)->value;
printf("value = %d < removed from the measures list\n", (*ml)->value);
free (*ml);
*ml = tmp;
return value;
}
int fsm_tools_sort_list_length (tool_list *ml)
{
int n = 0;
while (ml)
{
n++;
ml = ml->suiv;
}
return n;
}
void fsm_tools_sort_list_clear (tool_list **ml)
{
tool_list *tmp;
while (*ml)
{
tmp = (*ml)->suiv;
free (*ml);
*ml = tmp;
}
}
void fsm_tools_sort_list_view (tool_list *ml)
{
printf ("-------- view measures list (n = %d)\n",
fsm_tools_sort_list_length (ml));
while(ml)
{
printf("%d\n", ml->value);
ml = ml->suiv;
}
puts ("--------------");
}
void fsm_tools_sort_list_test()
{
tool_list *ex_tool = NULL;
puts("\ncréation d'une liste de 10 elements :");
fsm_tools_sort_list_insert (&ex_tool,9);
fsm_tools_sort_list_insert (&ex_tool,-8);
fsm_tools_sort_list_insert (&ex_tool,3);
fsm_tools_sort_list_insert (&ex_tool,5);
fsm_tools_sort_list_insert (&ex_tool,-1);
fsm_tools_sort_list_insert (&ex_tool,4);
fsm_tools_sort_list_insert (&ex_tool,-6);
fsm_tools_sort_list_insert (&ex_tool,2);
fsm_tools_sort_list_insert (&ex_tool,0);
fsm_tools_sort_list_insert (&ex_tool,7);
fsm_tools_sort_list_view (ex_tool);
puts("retrait des 3 premiers elements :");
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_view (ex_tool);
puts("ajout des 3 elements (8, 1, 6) :");
fsm_tools_sort_list_insert (&ex_tool,8);
fsm_tools_sort_list_insert (&ex_tool,1);
fsm_tools_sort_list_insert (&ex_tool,6);
fsm_tools_sort_list_view (ex_tool);
fsm_tools_sort_list_clear (&ex_tool);
printf("clear()\n> nombre d'éléments restant = %d\n\n",
fsm_tools_sort_list_length(ex_tool));
}

View File

@ -1,79 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include "../../include/fsm.h"
#include "../../include/widget.h"
/******************************************************************************/
/* Each state of the finite state machine (fsm) must be */
/* - saved at the end of a work session and */
/* - reread (available) at the start of a new session. */
/* */
/* No state of the fsm should be defined in another module. */
/* No fsm transition needs to be executed in another module. */
/******************************************************************************/
/******************************************************************************/
/* R E S U L T S */
/******************************************************************************/
// An editable list of displayable results is maintained. (add, remove, display)
// A preferred presentation should be available for each result.
// NB : "graph", "chart", "plot" and "diagram" are ambiguous terms.
// The list of results currently displayed is defined in : prefer.c
// structure de données : tableau ?
// - identifiant (clé) (+/- pointeur vers : date de création, auteur,...)
// - type de données 1
// - type de données 2
// - ... ?
// - pointeur vers le premier groupe de données
// - pointeur vers le second groupe de données
// - ... ?
// - pointeur vers une liste de données similaires
// - concat ?
static void *list_results;
void fsm_add_result (char *result_name)
{
printf("fsm_add_result %p <<< %s (see fsm.c)\n", list_results, result_name);
}
void fsm_results_list_init ()
{
fsm_msg (0,0, "src/fsm/result.c fsm_results_list_init()", 2); // sub_automaton 2
}

View File

@ -28,8 +28,6 @@
#include "../../include/graphics.h" #include "../../include/graphics.h"
#include "../../include/parse.h" #include "../../include/parse.h"
#include "../../include/util.h"
#define TEST 0 #define TEST 0
@ -382,7 +380,7 @@ bool graphics_init_shaders(const int stack_id)
GLuint p = 0; GLuint p = 0;
// Load vertex shader file // Load vertex shader file
vertex_shader = util_read_file(VERTEX_SHADER_FILE); vertex_shader = read_file(VERTEX_SHADER_FILE);
if (vertex_shader == NULL) if (vertex_shader == NULL)
return false; return false;
vertex = graphics_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader); vertex = graphics_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
@ -394,7 +392,7 @@ bool graphics_init_shaders(const int stack_id)
} }
// Load fragment shader file // Load fragment shader file
fragment_shader = util_read_file(FRAG_SHADER_FILE); fragment_shader = read_file(FRAG_SHADER_FILE);
if (fragment_shader == NULL) if (fragment_shader == NULL)
return false; return false;
fragment = graphics_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader); fragment = graphics_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);

View File

@ -45,7 +45,7 @@
* model_get_dim_value() * model_get_dim_value()
* *
* Le fichier 'state.c' est devenu un dossier contenant * Le fichier 'state.c' est devenu un dossier contenant
* les fichiers 'top.c', 'middle.c', 'bottom.c' et 'distrib.c' (2024-08) * les fichiers 'top.c', 'middle.c', 'bottom.c' et 'distrib.c'
* *
* 'middle.c' deviendra, s'il est trop volumineux, un dossier 'middle' * 'middle.c' deviendra, s'il est trop volumineux, un dossier 'middle'
* contenant, par exemple, les fichiers 'camera.c' ou 'contrasts.c' et d'autres * contenant, par exemple, les fichiers 'camera.c' ou 'contrasts.c' et d'autres
@ -92,8 +92,7 @@
* 2) Les structures transversales. * 2) Les structures transversales.
* -------------------------------- * --------------------------------
* *
* Les fonctions 'transversales' comme celles de 'graphics', 'parse', 'fsm', 'prefer', * Les fonctions 'transversales' comme celles de 'graphics', 'parse', 'fsm', 'prefer'
* et peut-être des structures communes à tous les arbres, listes, etc.
* doivent pouvoir être accédées directement * doivent pouvoir être accédées directement
* sans avoir à passer par la hiérarchie des widgets et/ou callbacks. * sans avoir à passer par la hiérarchie des widgets et/ou callbacks.
* Elles restent à la racine: 'src/ * Elles restent à la racine: 'src/
@ -133,17 +132,16 @@
* *
******************************************************************************* *******************************************************************************
* L I S T E D E S F O N C T I O N S A P P E L É E S * * L I S T E D E S F O N C T I O N S A P P E L É E S *
******************************************************************************* * *****************************************************************************
* *
******************************************************************************* *******************************************************************************
* L I S T E D E S A P P E L S D E F O N C T I O N S * * L I S T E D E S A P P E L S D E F O N C T I O N S *
******************************************************************************* * *****************************************************************************
*/ */
#include "../include/widget.h" #include "../include/widget.h"
#include "../include/signal.h" #include "../include/signal.h"
#include "../include/fsm.h"
int main (int argc, char **argv) int main (int argc, char **argv)
@ -153,10 +151,7 @@ int main (int argc, char **argv)
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
fsm_init (); // fsm = finite state machine (see : src/fsm/dispatch.c)
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
// on_windows_activation <> see : src/widget/dispatch
status = g_application_run (G_APPLICATION (app), argc, argv); status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app); g_object_unref (app);

View File

@ -29,9 +29,9 @@
#include "../../include/fsm.h" #include "../include/fsm.h"
#include "../../include/signal.h" #include "../include/signal.h"
#include "../../include/widget.h" #include "../include/widget.h"
// TODO Les noms d'icônes sont utilisés pour deux fonctions distinctes : // TODO Les noms d'icônes sont utilisés pour deux fonctions distinctes :
@ -39,7 +39,7 @@
// 2) dans signal.c on_updating_objects_transparencies() // 2) dans signal.c on_updating_objects_transparencies()
// où ils servent à identifier le bouton source (activé) // où ils servent à identifier le bouton source (activé)
// Cette identification va déterminer le choix du switch // Cette identification va déterminer le choix du switch
// de la fonction : fsm_store_restore_reset() // de la fonction : pref_set_store_restore_reset ()
// ! WARNING ! Cette méthode d'identification est dangereuse: // ! WARNING ! Cette méthode d'identification est dangereuse:
// Si un utilisateur modifie l'apparence d'un bouton (parce que préférence...) // Si un utilisateur modifie l'apparence d'un bouton (parce que préférence...)
@ -50,20 +50,13 @@
// Les "symbolics" (les noms) des icônes devraient être déclarées une seule fois (ici)) // Les "symbolics" (les noms) des icônes devraient être déclarées une seule fois (ici))
// de façon à ce qu'une seule variable soit utilisée pour les deux fonctions. // de façon à ce qu'une seule variable soit utilisée pour les deux fonctions.
/* use this ?
static const char *icon_name [3] = { static const char *icon_name [3] = {
"document-revert-rtl-symbolic", "document-revert-rtl-symbolic",
"edit-undo-symbolic", "edit-undo-symbolic",
"view-refresh-symbolic" "view-refresh-symbolic"
}; };
// transtypage vers un pointeur depuis un entier de taille différente vvv TODO
const char *fsm_get_button_icon_name (int n) {return (const char*) icon_name [n];} const char *get_button_icon_name (int n) {return (const char*) icon_name [n];}
*/
/******************************************************************************/
/* S T A T E A P P E A R A N C E */
/******************************************************************************/
// ------------------------- O B J E C T S ------------------------------// // ------------------------- O B J E C T S ------------------------------//
@ -73,7 +66,7 @@ struct preferences *pref_jean = NULL; // TODO (voir graphics_init(...))
// en attendant: // en attendant:
static int p[n_objects] = {}; static int p[n_objects] = {};
void fsm_store_restore_reset (int choice, int value) void pref_set_store_restore_reset (int choice, int value)
{ {
switch (choice) { switch (choice) {
case (STORE) : case (STORE) :
@ -116,21 +109,13 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
/******************************************************************************/ /******************************************************************************/
/* D I S P L A Y E D R E S U L T S */ /* M E A S U R E S */
/******************************************************************************/ /******************************************************************************/
static void *list_displayables; static void *list_measures;
void fsm_add_displayable (char *displayable_name) void *prefer_add_measure (char *measure_name)
{ {
printf("fsm_add_displayable %p <<< %s (see prefer.c)\n", printf("prefer_add_measure %p <<< %s (see prefer.c)\n", list_measures, measure_name);
list_displayables, displayable_name); return NULL;
} }
/******************************************************************************/
/* P R E F E R E N C E S */
/******************************************************************************/
void fsm_preferences_init () {fsm_displayable_list_init ();}
void fsm_displayable_list_init () { printf("src/fsm/prefer.c fsm_displayable_list_init()\n");}

View File

@ -32,6 +32,7 @@
#include "../include/fsm.h" #include "../include/fsm.h"
#include "../include/signal.h" #include "../include/signal.h"
#include "../include/widget.h" #include "../include/widget.h"
#include "../include/prefer.h"
#include "../include/graphics.h" #include "../include/graphics.h"
@ -337,9 +338,9 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
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 (scrollbar)); int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar));
if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) fsm_store_restore_reset (STORE, value); if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) pref_set_store_restore_reset (STORE, value);
if ( ! strcmp (btt_name, "edit-undo-symbolic")) fsm_store_restore_reset (RESTORE, value); if ( ! strcmp (btt_name, "edit-undo-symbolic")) pref_set_store_restore_reset (RESTORE, value);
if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_store_restore_reset (RESET, value); if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value);
fsm_set_preferences_state (TRUE); // << à détailler TODO fsm_set_preferences_state (TRUE); // << à détailler TODO
} }
@ -349,7 +350,7 @@ void on_resetting_XYZ_in_state_page ()
widget_state_XYZ_reset_all(); widget_state_XYZ_reset_all();
} }
// -------------------------- S I T U A T I O N S ----------------------- // // -------------------------- S IT U A T I O N S ------------------------ //
void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{ {
@ -365,7 +366,6 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data) void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
{ {
// fsm_measures_sorted_list_do something ();
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_measure_page())); GTK_WIDGET (widget_get_measure_page()));
} }
@ -394,34 +394,33 @@ void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data)
GTK_WIDGET (widget_measure_do_select_a_second_rules_set())); GTK_WIDGET (widget_measure_do_select_a_second_rules_set()));
} }
void on_select_a_second_rules_set (GtkWidget *btt, gpointer data) void on_select_a_second_rules_set (GtkWidget *btt, gpointer data)
{ {
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_choose_an_event_type())); GTK_WIDGET (widget_measure_do_choose_an_event_type()));
} }
void on_select_a_second_measurement (GtkWidget *btt, gpointer data) void on_select_a_second_measurement (GtkWidget *btt, gpointer data)
{ {
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_correlate())); GTK_WIDGET (widget_measure_do_we_select_another_measurement()));
} }
void on_skip_this_step (GtkWidget *btt, gpointer data) void on_not_yet_defined (GtkWidget *btt, gpointer data)
{ {
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_insert_in_measurements_list ())); GTK_WIDGET (widget_not_yet_defined ()));
} }
void on_something_else (GtkWidget *btt, gpointer data) void on_something_else (GtkWidget *btt, gpointer data)
{ {
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), printf("insert in measurements list (this print comes from signal.c)\n");
GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process()));
}
void on_closing_page (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_synth_page()));
} }
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data) void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data)

View File

@ -1,130 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_list_2x2_init (dblist *l)
{
l->first = NULL;
l->last = NULL;
}
int util_list_2x2_push_back (dblist *l, int val)
{
elem *nouv = malloc (sizeof(elem));
if (! nouv) exit (EXIT_FAILURE);
nouv->value = val;
nouv->prev = l->last;
nouv->next = NULL;
if (l->last) l->last->next = nouv;
else l->first = nouv;
l->last = nouv;
return val;
}
int util_list_2x2_push_front (dblist *l, int val)
{
elem *nouv = malloc(sizeof(elem));
if (! nouv) exit (EXIT_FAILURE);
nouv->value = val;
nouv->next = l->first;
nouv->prev = NULL;
if (l->first) l->first->prev = nouv;
else l->last = nouv;
l->first = nouv;
return val;
}
int util_list_2x2_pop_back (dblist *l)
{
int val;
elem *tmp = l->last;
if (! tmp) return -1;
val = tmp->value;
l->last = tmp->prev;
if (l->last) l->last->next = NULL;
else l->first = NULL;
free (tmp);
return val;
}
int util_list_2x2_pop_front (dblist *l)
{
int val;
elem *tmp = l->first;
if (! tmp) return -1;
val = tmp->value;
l->first = tmp->next;
if (l->first)l->first->prev = NULL;
else l->last = NULL;
free (tmp);
return val;
}
void util_list_2x2_clear (dblist *l)
{
elem *tmp;
elem *pelem = l->first;
while(pelem)
{
tmp = pelem;
pelem = pelem->next;
free(tmp);
}
l->first = NULL;
l->last = NULL;
}
int util_list_2x2_length (dblist l)
{
elem *pelem = l.first;
int cpt = 0;
while (pelem)
{
cpt ++;
pelem = pelem->next;
}
return cpt;
}
void util_list_2x2_view (dblist l)
{
printf ("-------- view liste (n = %d)\n", util_list_2x2_length (l));
elem *pelem = l.first;
while (pelem)
{
printf ("> %d <\n", pelem->value);
pelem = pelem->next;
}
puts ("--------------");
}

View File

@ -1,97 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_sorted_list_clear (slist **sl)
{
slist *tmp;
while (*sl)
{
tmp = (*sl)->suiv;
free (*sl);
*sl = tmp;
}
}
void util_sorted_list_view (slist *sl)
{
printf ("-------- view liste (n = %d)\n", util_sorted_list_length (sl));
while(sl)
{
printf("%d\n",sl->value);
sl = sl->suiv;
}
puts ("--------------");
}
int util_sorted_list_insert (slist **sl, int value)
{
slist *tmp = NULL;
slist *csl = *sl;
slist *elem = malloc (sizeof (slist));
if (!elem) exit (EXIT_FAILURE);
elem->value = value;
while (csl && csl->value < value)
{
tmp = csl;
csl = csl->suiv;
}
elem->suiv = csl;
if(tmp) tmp->suiv = elem;
else *sl = elem;
return 0;
}
int util_sorted_list_pop (slist **sl)
{
int value;
slist *tmp;
if (! *sl) return -1;
tmp = (*sl)->suiv;
value = (*sl)->value;
printf("value = %d <> removed from the list by pop()\n", (*sl)->value);
free (*sl);
*sl = tmp;
return value;
}
int util_sorted_list_length (slist *sl)
{
int n = 0;
while (sl)
{
n++;
sl = sl->suiv;
}
return n;
}

View File

@ -1,126 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_trigger_test ()
{
if (0) util_pile_test();
if (0) util_double_list_test();
if (0) util_sorted_list_test();
}
void util_pile_test()
{
pile *exemple = NULL; // doit être initialisée à NULL
puts ("------");
printf ("push > %d\n", util_pile_push (&exemple, 1));
printf ("push > %d\n", util_pile_push (&exemple, 2));
printf ("push > %d\n", util_pile_push (&exemple, 3));
printf ("push > %d\n", util_pile_push (&exemple, 4));
util_pile_view (exemple);
printf ("pop > %d\n", util_pile_pop (&exemple));
printf ("pop > %d\n", util_pile_pop (&exemple));
util_pile_view (exemple);
printf ("clear pile\n"); util_pile_clear (&exemple);
util_pile_view (exemple);
}
void util_double_list_test()
{
dblist exemple;
util_list_2x2_init (&exemple);
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 10));
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 100));
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 1000));
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 1));
util_list_2x2_view (exemple);
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_push_back (&exemple, 2));
util_list_2x2_view (exemple);
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 3));
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 0));
util_list_2x2_view (exemple);
printf ("clear list\n"); util_list_2x2_clear (&exemple);
util_list_2x2_view (exemple);
}
void util_sorted_list_test()
{
slist *Mysl = NULL;
puts("\ncréation d'une liste de 10 elements :");
util_sorted_list_insert (&Mysl,9);
util_sorted_list_insert (&Mysl,-8);
util_sorted_list_insert (&Mysl,3);
util_sorted_list_insert (&Mysl,5);
util_sorted_list_insert (&Mysl,-1);
util_sorted_list_insert (&Mysl,4);
util_sorted_list_insert (&Mysl,-6);
util_sorted_list_insert (&Mysl,2);
util_sorted_list_insert (&Mysl,0);
util_sorted_list_insert (&Mysl,7);
util_sorted_list_view (Mysl);
puts("retrait des 3 premiers elements :");
util_sorted_list_pop (&Mysl);
util_sorted_list_pop (&Mysl);
util_sorted_list_pop (&Mysl);
util_sorted_list_view (Mysl);
puts("ajout des 3 elements (8, 1, 6) :");
util_sorted_list_insert (&Mysl,8);
util_sorted_list_insert (&Mysl,1);
util_sorted_list_insert (&Mysl,6);
util_sorted_list_view (Mysl);
util_sorted_list_clear (&Mysl);
printf("clear()\n> nombre d'éléments restant = %d\n\n",
util_sorted_list_length(Mysl));
}

View File

@ -34,14 +34,15 @@
// "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably. // "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably.
// https://www.mathsisfun.com/data/data-graph.php // https://www.mathsisfun.com/data/data-graph.php
#define PARTITION_700 700
void *widget_get_data_page() void *widget_get_data_page()
{ {
GtkWidget *measures_and_results = gtk_paned_new (GTK_ORIENTATION_VERTICAL); GtkWidget *measures_and_results = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_set_start_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_organize_results_box())); gtk_paned_set_start_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_measures_page()));
gtk_paned_set_end_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_display_results_box())); gtk_paned_set_end_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_results_page()));
gtk_paned_set_position (GTK_PANED (measures_and_results), H_PARTITION_RESULTS); gtk_paned_set_position (GTK_PANED (measures_and_results), PARTITION_700);
gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE);

View File

@ -1,11 +1,10 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Gem-graph client * * Gem-graph client *
* * * *
* Finite State Machine (fsm) header * * Stock *
* * * *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> * * Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> * * Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* * * *
* This file is part of Gem-graph. * * This file is part of Gem-graph. *
@ -28,63 +27,40 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h" #include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_measures_page ()
int util_pile_push (pile **p, int Val)
{ {
pile *element = malloc (sizeof(pile)); GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = Val;
element->prev = *p;
*p = element; // Le pointeur pointe sur le dernier élément.
return Val;
}
int util_pile_pop (pile **p) GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
{ GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
int Val; gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
pile *tmp;
if (!*p) return -1; // Retourne -1 si la pile est vide. GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic");
tmp = (*p)->prev; GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
Val = (*p)->value; gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
free (*p);
*p = tmp; // Le pointeur pointe sur le dernier élément. gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement"));
return Val; // Retourne la value soutirée de la pile. gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport"));
} gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects"));
void util_pile_clear (pile **p) gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
{
pile *tmp; GtkWidget *btt_B = gtk_toggle_button_new ();
while (*p) gtk_button_set_icon_name (GTK_BUTTON (btt_B), "folder-saved-search-symbolic");
{
tmp = (*p)->prev; gtk_box_append (data_box, GTK_WIDGET (btt_B));
free (*p); gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect));
*p = tmp; gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic));
}
} GtkWidget* frame_measures = gtk_frame_new ("measures");
gtk_frame_set_child (GTK_FRAME (frame_measures), GTK_WIDGET (data_box));
int util_pile_length (pile *p)
{ return GTK_WIDGET (frame_measures);
int n=0;
while (p)
{
n++;
p = p->prev;
}
return n;
}
void util_pile_view (pile *p)
{
printf ("view pile (n = %d)\n", util_pile_length (p));
while (p)
{
printf ("> %d\n", p->value);
p = p->prev;
}
puts ("------");
} }

View File

@ -1,11 +1,10 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Gem-graph client * * Gem-graph client *
* * * *
* Base header * * Stock *
* * * *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> * * Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> * * Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* * * *
* This file is part of Gem-graph. * * This file is part of Gem-graph. *
@ -28,55 +27,24 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
#include <assert.h> void *widget_get_operations_on_results_page () {
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h> // Defines NULL.
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include "../../include/util.h" GtkWidget *btt_A = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_A), "view-refresh-symbolic");
// GtkWidget *data_chart = GTK_WIDGET (gtk_picture_new_for_filename
// ("/home/jean/Gem-Graph/gem-graph-client/data/image/data charts.png"));
/* GtkWidget* frame_analysis = gtk_frame_new ("analysis");
* char *read_file(char *filename) // GtkBox *analysis_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
* reads a file from filename into a provided buffer gtk_frame_set_child (GTK_FRAME (frame_analysis), GTK_WIDGET (btt_A));
* // gtk_frame_set_child (GTK_FRAME (frame_analysis), GTK_WIDGET (data_chart));
* @param filename, file name
* contents, target ptr
*
* @return void
*/
char *util_read_file(char *filename)
{
int fd;
int filesize;
char *contents;
fd = open(filename, O_RDONLY); return GTK_WIDGET (frame_analysis);
if (fd < 0) {
printf("Couldn't read file: %s\n",filename);
return NULL;
}
filesize = lseek(fd, 0, SEEK_END) + 1 ;
contents = g_malloc(filesize * sizeof(char));
assert (contents);
lseek(fd, 0, SEEK_SET);
read(fd,contents,filesize);
contents[filesize-1] = '\0';
close(fd);
return contents;
} }

View File

@ -31,37 +31,28 @@
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
void *widget_get_time_results_box () { void *widget_get_results_page () {
GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (time_box, GTK_WIDGET (gtk_button_new_with_label ("\n a widget\n\
intended to\n modulate\n the look of\n the various\n represented\n flows\n")));
gtk_box_append (time_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
return GTK_WIDGET (time_box);
}
void *widget_get_display_results_box () {
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (data_box, gtk_button_new_with_label ("repartitions (1D, 2D)")); GtkWidget* frame_data_type = gtk_frame_new ("about the fsm / about the model");
gtk_box_append (data_box, GTK_WIDGET (gtk_picture_new_for_filename GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
gtk_box_append (data_box, GTK_WIDGET (frame_data_type));
gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions"));
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions (1D, 2D)"));
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png"))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png")));
gtk_box_append (data_box, gtk_button_new_with_label ("correlations")); gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations"));
gtk_box_append (data_box, GTK_WIDGET (gtk_picture_new_for_filename gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data correlations (4, horizontal).png"))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/data correlations (4, horizontal).png")));
gtk_box_append (data_box, gtk_button_new_with_label ("evolutions")); gtk_widget_set_size_request (GTK_WIDGET (data_box), 1800, 700); // provisoire TODO
GtkBox *scroll_bar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (scroll_bar_box, GTK_WIDGET(gtk_label_new ("\
a scroll bar allowing to detail the data along the time elapsed during the simulation")));
gtk_box_append (scroll_bar_box, GTK_WIDGET (gtk_progress_bar_new ()));
GtkAdjustment *adjust = gtk_adjustment_new (30, 0, 100, 1, 0, 0);
gtk_box_append (data_box, GTK_WIDGET (widget_get_time_results_box ()));
gtk_box_append (scroll_bar_box,
GTK_WIDGET (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjust)));
gtk_box_append (data_box, GTK_WIDGET (scroll_bar_box));
return GTK_WIDGET (data_box); return GTK_WIDGET (data_box);
} }
@ -75,9 +66,7 @@ void *widget_get_display_results_box () {
/******************************************************************************/ /******************************************************************************/
/* names /*
(propositions)
"rule effect" "rule effect"
"rule topic" "rule topic"
"data type" "data type"

View File

@ -32,20 +32,6 @@
#include "../../include/widget.h" #include "../../include/widget.h"
/******************************************************************************/
/* */
/* ## ## ### ##### ###### ######## ######## */
/* # # # # ## ## ## # # */
/* # # # # ## ## # # */
/* # # # # ## ## #### # */
/* # # # # # # # # # # */
/* # # # # # # ## ## #### # # */
/* ## ## # # ## ## ## # # */
/* ## ## ### ###### ####### ######## # */
/* */
/******************************************************************************/
/******************************************************************************/ /******************************************************************************/
/* W I N D O W S */ /* W I N D O W S */
/******************************************************************************/ /******************************************************************************/
@ -65,11 +51,8 @@ void on_windows_activation (GtkApplication *app)
dialog_window = GTK_WINDOW (gtk_application_window_new (app)); dialog_window = GTK_WINDOW (gtk_application_window_new (app));
text_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app));
widget_design_main_window (main_window); // def: widget/topbar/dispatch widget_design_main_window (main_window);
widget_design_dialog_window (main_window, dialog_window); widget_design_dialog_window (main_window, dialog_window);
widget_design_text_window (main_window, text_window); widget_design_text_window (main_window, text_window);
} }
/******************************************************************************/
/* M A I N W I N D O W <> see T O P B A R */
/******************************************************************************/

View File

@ -31,57 +31,15 @@
#include "../../../include/base.h" #include "../../../include/base.h"
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
#include "../../../include/fsm.h" #include "../../../include/prefer.h"
/******************************************************************************/ /******************************************************************************/
/* M E A S U R E S */ /* M E A S U R E S */
/******************************************************************************/ /******************************************************************************/
// Measure concerns
// - nb of occurences of the rule
// - nb of objects / situations before / after > select target
// - time (date) of event
// - time elapsed between two events
// - occurence of events C between events A and B
// Then, add this new measure to the list of measures
// When a list is established, it is possible to evaluate
// if the results of this measure are correlated with some other results.
static GtkBox *measure_page; static GtkBox *measure_page;
void *widget_measure_event_occurences_nb()
{
fsm_add_measure ("new measure count one event occurences");
return measure_page;
}
void *widget_measure_event_occurences_dates()
{
fsm_add_measure ("new measure one event occurences dates");
return measure_page;
}
void *widget_measure_event_occurences_situations()
{
fsm_add_measure ("new measure one event occurences situations");
return measure_page;
}
void *widget_measure_time_elapsed_between_two_events()
{
fsm_add_measure ("new measure time elapsed between two events");
return measure_page;
}
void *widget_measure_third_event_occurences_in_between()
{
fsm_add_measure ("new measure of the frequency of a third event\
occurring between two other events");
return measure_page;
}
static GtkBox *edit_a_new_measure_box; static GtkBox *edit_a_new_measure_box;
static GtkWidget *caliper; static GtkWidget *caliper;
static GtkWidget *btt_edit_a_new_measure; static GtkWidget *btt_edit_a_new_measure;
@ -110,38 +68,30 @@ static GtkWidget *bridge;
static GtkWidget *btt_time_elapsed; static GtkWidget *btt_time_elapsed;
static GtkWidget *btt_event_in_between; static GtkWidget *btt_event_in_between;
static GtkBox *correlation_measures_box; static GtkBox *correlation_measures_box; //TODO
static GtkWidget *correl; static GtkWidget *correl;
static GtkWidget *btt_skip_this_step; static GtkWidget *btt_select_another_measurement_question;
static GtkBox *insertion_in_list_measurements_box; static GtkBox *insertion_in_list_measurements_box; //TODO
static GtkWidget *insert; static GtkWidget *insert;
static GtkWidget *btt_insert_in_measurements_list; static GtkWidget *btt_insert_in_measurements_list;
static GtkBox *last_one;
static GtkWidget *clean;
static GtkWidget *btt_end;
void *widget_measure_do_end_creation_of_measurement_process() // Measure concerns
{ // - nb of occurences of the rule
last_one = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // - nb of objects / situations before / after > select target
clean = gtk_picture_new_for_filename // - time (date) of event
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/clean.png"); // - time elapsed between two events
btt_end = gtk_toggle_button_new_with_label // - occurence of events C between events A and B
("click to end the creation of a new measurement process");
// g_signal_connect (btt_end, "toggled", G_CALLBACK (on_closing_page), NULL); // Then, add this new measure to the list of measures
gtk_box_append (last_one, GTK_WIDGET (clean)); // Is this measure to be correlated to some others ?
gtk_box_append (last_one, GTK_WIDGET (btt_end));
gtk_box_append (last_one, GTK_WIDGET (gtk_label_new
(" < triggers redirection to the 'SYNTY' page"))); void *widget_not_yet_defined()
gtk_box_append (measure_page, GTK_WIDGET (last_one));
return measure_page;
}
void *widget_measure_do_insert_in_measurements_list()
{ {
// printf("insert in measurements list\n");
insertion_in_list_measurements_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); insertion_in_list_measurements_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
insert = gtk_picture_new_for_filename insert = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/data collection.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/data collection.png");
@ -150,34 +100,68 @@ void *widget_measure_do_insert_in_measurements_list()
g_signal_connect (btt_insert_in_measurements_list, "toggled", g_signal_connect (btt_insert_in_measurements_list, "toggled",
G_CALLBACK (on_something_else), NULL); G_CALLBACK (on_something_else), NULL);
gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (insert)); gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (insert));
gtk_box_append (insertion_in_list_measurements_box,
GTK_WIDGET (gtk_label_new
("Specify the frequency with which this measurement must be carried out and ")));
gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (btt_insert_in_measurements_list)); gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (btt_insert_in_measurements_list));
gtk_box_append (measure_page, GTK_WIDGET (insertion_in_list_measurements_box)); gtk_box_append (measure_page, GTK_WIDGET (insertion_in_list_measurements_box));
return measure_page; return measure_page;
} }
void *widget_measure_do_correlate() void *widget_measure_do_we_select_another_measurement()
{ {
// printf("Could this measurement be related to another one ?\n");
correlation_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); correlation_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
correl = gtk_picture_new_for_filename correl = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/harbor.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/buoy.png");
btt_skip_this_step = btt_select_another_measurement_question =
gtk_toggle_button_new_with_label ("next"); gtk_toggle_button_new_with_label ("select another measurement to correlate with ?");
// g_signal_connect (btt_skip_this_step, "toggled", G_CALLBACK (on_skip_this_step), NULL); g_signal_connect (btt_select_another_measurement_question, "toggled",
G_CALLBACK (on_not_yet_defined), NULL);
gtk_box_append (correlation_measures_box, GTK_WIDGET (correl)); gtk_box_append (correlation_measures_box, GTK_WIDGET (correl));
gtk_box_append (correlation_measures_box, gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_select_another_measurement_question));
GTK_WIDGET (gtk_label_new
("The current measurement will be inserted in the list of available measures.\n\
Two measurements or more can be selected there to study potential correlations.")));
gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_skip_this_step));
gtk_box_append (measure_page, GTK_WIDGET (correlation_measures_box)); gtk_box_append (measure_page, GTK_WIDGET (correlation_measures_box));
return measure_page; return measure_page;
} }
void *widget_measure_event_occurences_nb()
{
// printf("measure event_occurences_nb\n");
prefer_add_measure ("new measure count one event occurences");
return measure_page;
}
void *widget_measure_event_occurences_dates()
{
// printf("measure event_occurences_dates\n");
prefer_add_measure ("new measure one event occurences dates");
return measure_page;
}
void *widget_measure_event_occurences_situations()
{
// printf("measure event_occurences_situations\n");
prefer_add_measure ("new measure one event occurences situations");
return measure_page;
}
void *widget_measure_time_elapsed_between_two_events()
{
// printf("measure time_elapsed_between_two_events\n");
prefer_add_measure ("new measure time elapsed between two events");
return measure_page;
}
void *widget_measure_third_event_occurences_in_between()
{
// printf("measure third_event_occurences_in_between\n");
prefer_add_measure ("new measure of the frequency of a third event\
occurring between two other events");
return measure_page;
}
void *widget_measure_do_depends_on_a_single_event() void *widget_measure_do_depends_on_a_single_event()
{ {
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_second_of_two)); gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_second_of_two));
@ -203,7 +187,6 @@ void *widget_measure_do_depends_on_a_single_event()
G_CALLBACK (on_select_a_second_measurement), NULL); G_CALLBACK (on_select_a_second_measurement), NULL);
gtk_box_append (one_rule_measures_box, GTK_WIDGET (scale)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (scale));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (gtk_label_new (" select one > ")));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_nb)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_nb));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_date)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_date));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_situation)); gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_situation));
@ -230,9 +213,9 @@ void *widget_measure_do_select_a_second_rules_set()
void *widget_measure_do_choose_an_event_type() void *widget_measure_do_choose_an_event_type()
{ {
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two)); gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two));
// ici, il faudrait inactiver le btt_select_second_of_two // ici, il faut inactiver le btt_select_second_of_two
gtk_box_append (select_second_rules_set_box, gtk_box_append (select_second_rules_set_box,
gtk_label_new (" < done. A second set of rules was selected")); gtk_toggle_button_new_with_label ("< done > a second set of rules was selected"));
two_rules_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); two_rules_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
bridge = gtk_picture_new_for_filename bridge = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure temperature icon.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure temperature icon.png");
@ -249,7 +232,6 @@ void *widget_measure_do_choose_an_event_type()
G_CALLBACK (on_select_a_second_measurement), NULL); G_CALLBACK (on_select_a_second_measurement), NULL);
gtk_box_append (two_rules_measures_box, GTK_WIDGET (bridge)); gtk_box_append (two_rules_measures_box, GTK_WIDGET (bridge));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (gtk_label_new (" select one > ")));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_time_elapsed)); gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_time_elapsed));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_event_in_between)); gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_event_in_between));
gtk_box_append (measure_page, GTK_WIDGET (two_rules_measures_box)); gtk_box_append (measure_page, GTK_WIDGET (two_rules_measures_box));
@ -259,8 +241,8 @@ void *widget_measure_do_choose_an_event_type()
void *widget_measure_do_depends_on_one_or_two_events() void *widget_measure_do_depends_on_one_or_two_events()
{ {
gtk_box_append (select_rules_first_box, gtk_box_append (select_rules_first_box,
gtk_label_new ("< done. A set of rules was selected")); gtk_toggle_button_new_with_label ("< done > a set of rules was selected"));
// ici, il faudrait inactiver le btt_select_rules_first // ici, il faut inactiver le btt_select_rules_first
select_one_or_two_rules_events_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); select_one_or_two_rules_events_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
balance = gtk_picture_new_for_filename balance = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/balance icon.png"); ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/balance icon.png");

View File

@ -1,62 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Stock *
* *
* Copyright © 2021 Libre en Communs <contact@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 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. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_organize_results_box ()
{
GtkBox *all_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkBox *ad_hoc_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (ad_hoc_box, gtk_button_new_with_label ("\n\n\n\n\n\n \
\
"));
GtkBox *front_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (front_box, gtk_button_new_with_label ("\n how should \n\
the sequence \n from measurements\n to results presentation \n\
be organized\n ?"));
GtkBox *access_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (access_box, gtk_button_new_with_label ("measurements\
activate or create mesurement tools \
"));
gtk_box_append (access_box, gtk_button_new_with_label ("measures\
apply a mesurement tool to a situation to create a data flow\
"));
gtk_box_append (access_box, gtk_button_new_with_label ("results\
get some results and operate on them (filter, concat, analyze, transform, etc.)"));
gtk_box_append (access_box, gtk_button_new_with_label ("presentation\
display (plot) results and tune the chart (graph, diagram) appearance\
"));
gtk_box_append (all_box, GTK_WIDGET (ad_hoc_box));
gtk_box_append (all_box, GTK_WIDGET (front_box));
gtk_box_append (all_box, GTK_WIDGET (access_box));
return GTK_WIDGET (all_box);
}

View File

@ -171,8 +171,7 @@ void *widget_get_an_impression_of_what_a_rules_comparator_could_be(){
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png"))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png")));
printf(" ---------\ printf(" --------- \n");//%d\n", *stack_b->arr[0]);
widget/rules/tree_tools/compare.c widget_get_an_impression_of_...()\n");//%d\n", *stack_b->arr[0]);
// peek(&stack_b); // peek(&stack_b);
// gtk_box_append (compare_left, peek(&stack_b)); // gtk_box_append (compare_left, peek(&stack_b));
@ -210,12 +209,12 @@ static GtkWidget *do_rtfd (Stack stack) // TODO
// it works !!! >>> GIcon *hello_dream = G_ICON (image_insuline); // it works !!! >>> GIcon *hello_dream = G_ICON (image_insuline);
// //
GtkWidget *widget_insuline = GTK_WIDGET (image_insuline); GtkWidget *widget_insuline = GTK_WIDGET (image_insuline);
if (0 && image_insuline_storage_type == GTK_IMAGE_ICON_NAME) if (image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
printf("src/widget/rules/tree_tools/compare.c do_rtfd() insuline image now at : %p storage_type : %s\n", printf("insuline image now at : %p storage_type : %s\n",
&image_insuline, "GTK_IMAGE_ICON_NAME"); &image_insuline, "GTK_IMAGE_ICON_NAME");
push_images_onto_stack (stack); // totalement inutile ici push_images_onto_stack (stack); // totalement inutile ici
// peek (NULL); // idem + Erreur de segmentation // peek (NULL); // idem + Erreur de segmentation
// free_intlist (NULL); // idem // free_intlist (NULL); // idem
// add_to_mylist (0); // idem // add_to_mylist (0); // idem

View File

@ -52,12 +52,15 @@
/******************************************************************************/ /******************************************************************************/
#define PARTITION_SPACE_VS_CONTROLS_1 920
#define PARTITION_SPACE_VS_CONTROLS_2 800
void *widget_get_state_page() void *widget_get_state_page()
{ {
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (page_box, GTK_WIDGET (widget_get_graph_view_control())); gtk_box_append (page_box, GTK_WIDGET (widget_get_graph_view_control()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view(PARTITION_SPACE_VS_CAMERA_IN_STATE))); gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL); GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL);

View File

@ -57,7 +57,7 @@ static void *get_XYZ_box()
GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust); GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust);
GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust); GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust);
GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust); GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust);
gtk_widget_set_size_request (GTK_WIDGET (XYZ_scrollbar_box), W_XYZ_BOX, H_XYZ_BOX); // (provisoire) TODO gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, H_XYZ_BOX); // (provisoire) TODO
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") 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_X);
@ -73,23 +73,23 @@ static void *get_XYZ_box()
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); 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 (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); 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; return XYZ_labels_box;
} }
static void *get_ZOOM_box() static void *get_ZOOM_box()
{ {
GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new ( GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
"\n TOOLS\n\ "\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\
---\n zoom\n\ ---\n arrows\n struct.\n ---\n orient\n state\n in space\n"));
---\n space\n struct.\n\
---\n arrows\n struct.\n\
---\n orient\n state\n in\n space\n"));
gtk_box_append (ZOOM_box, ZOOM_Label); gtk_box_append (ZOOM_box, ZOOM_Label);
return ZOOM_box; return ZOOM_box;
} }
void *widget_get_space_view(int partition_space_vs_camera) #define PARTITION_SPACE_VS_CAMERA 1860
void *widget_get_space_view()
{ {
GtkBox *E_coli = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkBox *E_coli = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (GTK_BOX (E_coli), GTK_WIDGET (gtk_picture_new_for_filename gtk_box_append (GTK_BOX (E_coli), GTK_WIDGET (gtk_picture_new_for_filename
@ -108,11 +108,15 @@ void *widget_get_space_view(int partition_space_vs_camera)
gtk_paned_set_end_child (GTK_PANED (view_space_vs_camera), GTK_WIDGET (camera)); gtk_paned_set_end_child (GTK_PANED (view_space_vs_camera), GTK_WIDGET (camera));
gtk_paned_set_shrink_start_child (GTK_PANED (view_space_vs_camera), FALSE); gtk_paned_set_shrink_start_child (GTK_PANED (view_space_vs_camera), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (view_space_vs_camera), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (view_space_vs_camera), FALSE);
gtk_paned_set_position (GTK_PANED (view_space_vs_camera), partition_space_vs_camera); gtk_paned_set_position (GTK_PANED (view_space_vs_camera), PARTITION_SPACE_VS_CAMERA);
/* GtkBox *un_essai = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6));
gtk_box_append (GTK_BOX (un_essai), GTK_WIDGET (E_coli));
gtk_box_append (GTK_BOX (un_essai), GTK_WIDGET (camera));
return GTK_WIDGET (un_essai); <<< Ça devrait suffire ? */
return GTK_WIDGET (view_space_vs_camera); return GTK_WIDGET (view_space_vs_camera);
} }

View File

@ -182,6 +182,7 @@ static void *get_situations_box()
/* S T A T E p a g e > t o p l e v e l b o x */ /* S T A T E p a g e > t o p l e v e l b o x */
/******************************************************************************/ /******************************************************************************/
#define PARTITION_STATE_TOP 600
void *widget_get_graph_view_control() void *widget_get_graph_view_control()
{ {

View File

@ -47,15 +47,16 @@ static void *widget_get_non_time_dependent_analysis_elements() // for fun !
return results_box; return results_box;
} }
#define PARTITION_SYNTH 1540
static void *widget_get_space_vs_non_time_dependent_analysis() static void *widget_get_space_vs_non_time_dependent_analysis()
{ {
GtkWidget *space_vs_non_time_dependent_analysis = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); GtkWidget *space_vs_non_time_dependent_analysis = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_set_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), gtk_paned_set_start_child (GTK_PANED (space_vs_non_time_dependent_analysis),
GTK_WIDGET (widget_get_space_view(PARTITION_SPACE_VS_CAMERA_IN_SYNTH))); GTK_WIDGET (widget_get_space_view()));
gtk_paned_set_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), gtk_paned_set_end_child (GTK_PANED (space_vs_non_time_dependent_analysis),
GTK_WIDGET (widget_get_non_time_dependent_analysis_elements())); GTK_WIDGET (widget_get_non_time_dependent_analysis_elements()));
gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), H_PARTITION_SYNTH); gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), PARTITION_SYNTH);
gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); // TRUE gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); // TRUE
@ -69,7 +70,7 @@ void *widget_get_synth_page()
GTK_WIDGET (widget_get_space_vs_non_time_dependent_analysis())); GTK_WIDGET (widget_get_space_vs_non_time_dependent_analysis()));
gtk_paned_set_end_child (GTK_PANED (space_and_analysis_vs_history), gtk_paned_set_end_child (GTK_PANED (space_and_analysis_vs_history),
GTK_WIDGET (widget_get_time_dependent_results_and_time_controls())); GTK_WIDGET (widget_get_time_dependent_results_and_time_controls()));
gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), W_PARTITION_SYNTH); gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), PARTITION_SYNTH);
gtk_paned_set_shrink_start_child (GTK_PANED (space_and_analysis_vs_history), FALSE); gtk_paned_set_shrink_start_child (GTK_PANED (space_and_analysis_vs_history), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (space_and_analysis_vs_history), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (space_and_analysis_vs_history), FALSE);
gtk_widget_set_size_request (space_and_analysis_vs_history, 0, H_MY_SCREEN); // OK (required)) gtk_widget_set_size_request (space_and_analysis_vs_history, 0, H_MY_SCREEN); // OK (required))
@ -125,4 +126,3 @@ src/widget/synth/dispatch.c: gtk_paned_set_shrink_end_child (GTK_
*/ */

View File

@ -35,7 +35,8 @@ void *widget_get_time_dependent_results_and_time_controls()
{ {
GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (time_box, GTK_WIDGET(widget_get_sequence_control())); gtk_box_append (time_box, GTK_WIDGET(widget_get_sequence_control()));
gtk_box_append (time_box, GTK_WIDGET (widget_get_time_results_box ())); gtk_box_append (time_box, GTK_WIDGET(gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
return time_box; return time_box;
} }

View File

@ -46,6 +46,16 @@ void widget_design_main_window (GtkWindow *main_window)
window_design_topbar_left (topbar); window_design_topbar_left (topbar);
window_design_topbar_right (topbar); window_design_topbar_right (topbar);
// use the next lineS to select the page that will be presented first
// it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME)
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
// THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...)
gtk_window_present (GTK_WINDOW (main_window)); gtk_window_present (GTK_WINDOW (main_window));
} }

View File

@ -81,23 +81,6 @@ void window_design_topbar_left (GtkWidget *header_bar)
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA));
/******************************************************************************/
/* use the next lineS to select the page that will be presented first */
/* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */
/* and remember: */
/* the last one is the winner (and the winner takes it all !...) */
/* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */
/******************************************************************************/
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
} }

View File

@ -28,7 +28,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/util.h" #include "../../../include/base.h"
#include "../../../include/signal.h" #include "../../../include/signal.h"
#include "../../../include/widget.h" #include "../../../include/widget.h"
@ -59,7 +59,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
void *widget_get_text_from_address (gchar *text_address) { void *widget_get_text_from_address (gchar *text_address) {
GtkWidget *view = gtk_text_view_new (); GtkWidget *view = gtk_text_view_new ();
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, util_read_file (text_address), -1); gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
gtk_text_buffer_set_modified (buffer, FALSE); gtk_text_buffer_set_modified (buffer, FALSE);
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new());