gem-graph-client/in_depth.c

111 lines
2.6 KiB
C
Raw Normal View History

#include <gtk-4.0/gtk/gtk.h>
#include <assert.h>
#include "callback.h"
2024-06-04 06:25:47 +02:00
/******************************************************************************/
2024-06-09 11:23:42 +02:00
/* S T A T E S */
2024-06-04 06:25:47 +02:00
/******************************************************************************/
2024-06-09 13:27:15 +02:00
// (exec / edit) X (state / rules / measure) X (observ / interpret / read / write)
enum { // S T A T E S
INTER,
2024-06-09 13:27:15 +02:00
EXEC_STOP,
EXEC_RUN,
EDIT_STATE,
EDIT_RULE,
MEASURE,
2024-06-09 11:23:42 +02:00
OBSERVE,
ANALYSE,
2024-06-09 11:23:42 +02:00
HELP,
CONFIGURE
};
2024-06-04 06:25:47 +02:00
static int status = EXEC_STOP; // int get_status () {return status;}
2024-06-04 06:25:47 +02:00
enum { // T R A N S I T I O N S
EXEC_TO_RUN,
RUN_TO_EXEC,
EXEC_TO_INTER,
INTER_TO_EDIT,
EDIT_TO_INTER,
INTER_TO_EXEC,
};
2024-06-04 06:25:47 +02:00
/******************************************************************************/
2024-06-09 11:23:42 +02:00
/* T R A N S I T I O N S */
2024-06-04 06:25:47 +02:00
/******************************************************************************/
void SWITCH_TO (int asked) {
switch (asked) {
case (0) : // EXEC_TO_RUN
status = EXEC_RUN;
break;
case (1) : // RUN_TO_EXEC
status = EXEC_STOP;
break;
case (2) : // EXEC_TO_INTER
status = INTER;
break;
case (3) : // EDIT_TO_INTER
// Ici, il faudra prévenir l'utilisateur par une pop-up window : TODO (sauvegarde automatique sinon)
// S'il ne prend pas la main, les données de la simulation en cours risquent d'être perdues
status = INTER;
break;
default : ;
}
//q gtk_window_present (GTK_WINDOW (main_window));
}
/*
2024-06-09 13:27:15 +02:00
void set_status (int prescribed) {
status = prescribed; if (0) printf ("status = %d\n", status);
2024-06-09 13:27:15 +02:00
switch (status) {
case (0) : // EXEC_STOP
2024-06-09 13:27:15 +02:00
status = EXEC_RUN;
break;
case (1) : // EXEC_RUN
// Ici, il faudra prévenir l'utilisateur par une pop-up window : TODO (sauvegarde automatique sinon)
// S'il ne prend pas la main, les données de la simulation en cours risquent d'être perdues
2024-06-09 13:27:15 +02:00
status = EXEC_STOP;
break;
case (2) : // EXEC_STOP_EDIT_STOP
2024-06-09 13:27:15 +02:00
status = EXEC_RUN_EDIT_RULE;
break;
case (3) : // EXEC_RUN_EDIT_RULE
2024-06-09 13:27:15 +02:00
status = EXEC_STOP_EDIT_RULE;
break;
case (4) : // EXEC_STOP_EDIT_MEASURE
2024-06-09 13:27:15 +02:00
status = EXEC_RUN_EDIT_MEASURE;
break;
case (5) : // EXEC_RUN_EDIT_MEASURE
2024-06-09 13:27:15 +02:00
status = EXEC_STOP_EDIT_MEASURE;
break;
case (6) : // EDIT_STATE
2024-06-09 13:27:15 +02:00
break;
case (7) : // EDIT_RULE
2024-06-09 13:27:15 +02:00
break;
case (8) : // OBSERVE
2024-06-09 13:27:15 +02:00
break;
case (9) : // INTERPRET
2024-06-09 13:27:15 +02:00
break;
case (10) : // HELP
2024-06-09 13:27:15 +02:00
break;
case (11) : // CONFIGURE
2024-06-09 13:27:15 +02:00
break;
case (12) : // OTHER
2024-06-09 13:27:15 +02:00
break;
default : ;
}
} */