130 lines
3.1 KiB
C
130 lines
3.1 KiB
C
#include <gtk-4.0/gtk/gtk.h>
|
|
#include <assert.h>
|
|
#include "callback.h"
|
|
#include "automaton.h"
|
|
|
|
|
|
/******************************************************************************/
|
|
/* S T A T E S */
|
|
/******************************************************************************/
|
|
|
|
/* (exec / edit) < MODE
|
|
* X
|
|
* (state / rules / data) < VIEW
|
|
* X
|
|
* (measure / analyse / interpret)
|
|
* X
|
|
* (read / write)
|
|
*/
|
|
|
|
static int mode = RUN;
|
|
void set_mode (int prescribed) {mode = prescribed;}
|
|
int get_mode () {return mode;}
|
|
|
|
static int view = INTER; // int get_view () {return view;}
|
|
void set_view (int prescribed) {view = prescribed;}
|
|
int get_view () {return view;}
|
|
|
|
|
|
/******************************************************************************/
|
|
/* T R A N S I T I O N S */
|
|
/******************************************************************************/
|
|
|
|
void SWITCH_TO (int asked) {
|
|
switch (asked) {
|
|
case (INTER) :
|
|
view = INTER; printf ("SWITCH_TO INTER\n");
|
|
break;
|
|
case (STATE) : // BEGIN_TO_EXEC_STOP
|
|
view = STATE; printf ("SWITCH_TO STATE\n");
|
|
break;
|
|
case (RULES) : // EXEC_STOP_TO_RUN
|
|
view = RULES; printf ("SWITCH_TO RULES\n");
|
|
break;
|
|
case (DATA) : // EXEC_RUN_TO_STOP
|
|
view = DATA; printf ("SWITCH_TO DATA\n");
|
|
break;
|
|
default : ;
|
|
}
|
|
|
|
//q gtk_window_present (GTK_WINDOW (main_window));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
enum { // S T A T E S
|
|
INTER,
|
|
EXEC_STOP,
|
|
EXEC_RUN,
|
|
EDIT_STATE,
|
|
EDIT_RULES_TREE,
|
|
EDIT_RULE,
|
|
EDIT_MEASURE,
|
|
OBSERVE,
|
|
ANALYSE,
|
|
HELP,
|
|
CONFIGURE
|
|
};
|
|
|
|
static int view = EXEC_STOP; // int get_view () {return view;}
|
|
|
|
enum { // T R A N S I T I O N S
|
|
BEGIN_TO_EXEC_STOP
|
|
EXEC_STOP_TO_RUN,
|
|
EXEC_RUN_TO_STOP,
|
|
EXEC_TO_INTER,
|
|
INTER_TO_EDIT,
|
|
EDIT_TO_INTER,
|
|
INTER_TO_EXEC,
|
|
};
|
|
|
|
|
|
void set_view (int prescribed) {
|
|
view = prescribed; if (0) printf ("view = %d\n", view);
|
|
|
|
switch (view) {
|
|
case (0) : // EXEC_STOP DATA_ANALYSIS
|
|
view = EXEC_RUN;
|
|
break;
|
|
case (1) : // EXEC_RUN
|
|
// Ici, il faudra prévenir l'utilisateur par une pop-up window : (sauvegarde automatique sinon)
|
|
// S'il ne prend pas la main, les données de la simulation en cours risquent d'être perdues
|
|
view = EXEC_STOP;
|
|
break;
|
|
case (2) : // EXEC_STOP_EDIT_STOP
|
|
view = EXEC_RUN_EDIT_RULE;
|
|
break;
|
|
case (3) : // EXEC_RUN_EDIT_RULE
|
|
view = EXEC_STOP_EDIT_RULE;
|
|
break;
|
|
case (4) : // EXEC_STOP_EDIT_MEASURE
|
|
view = EXEC_RUN_EDIT_MEASURE;
|
|
break;
|
|
case (5) : // EXEC_RUN_EDIT_MEASURE
|
|
view = EXEC_STOP_EDIT_MEASURE;
|
|
break;
|
|
case (6) : // EDIT_STATE
|
|
break;
|
|
case (7) : // EDIT_RULE
|
|
break;
|
|
case (8) : // OBSERVE
|
|
break;
|
|
case (9) : // INTERPRET
|
|
break;
|
|
case (10) : // HELP
|
|
break;
|
|
case (11) : // CONFIGURE
|
|
break;
|
|
case (12) : // OTHER
|
|
break;
|
|
default : ;
|
|
}
|
|
} */
|