WIP: > Il faut fusionner les deux enums mode et choice (automaton.h)

This commit is contained in:
Jean Sirmai 2024-06-16 00:06:49 +02:00
parent bd252031c7
commit e6871816a4
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 29 additions and 8 deletions

View File

@ -8,16 +8,23 @@
/* S T A T E S */
/******************************************************************************/
/* (exec / edit)
/* (exec / edit) < MODE
* X
* (state / rules / data)
* (state / rules / data) < STATUS
* 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 status = INTER; // int get_status () {return status;}
void set_status (int prescribed) {status = prescribed;}
int get_status () {return status;}
/******************************************************************************/
/* T R A N S I T I O N S */

View File

@ -3,7 +3,10 @@
void set_status (int prescribed);
int get_status ();
void set_mode (int prescribed);
int get_mode ();
enum mode { RUN, EDIT };
enum choice { INTER, STATE, RULES, DATA };
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };

View File

@ -166,12 +166,23 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
/******************************************************************************/
/* B U T T O N S */
/******************************************************************************/
void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data){}
void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data) {
if (strcmp (gtk_button_get_label (GTK_BUTTON (btt_MODEL_RUN_STOP)), " run "))
gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run ");
else gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " stop ");
}
void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN_STOP) {
if (get_mode()) {
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "power-profile-balanced-rtl-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic");
gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run ");
gtk_button_set_label (GTK_BUTTON (btt_MODEL_RUN_STOP), " run ");
gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), TRUE);
set_mode (0);
} else {
gtk_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "preferences-system-symbolic");
gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE);
set_mode (1);
}
}

View File

@ -213,9 +213,9 @@ void window_main_child (GtkWindow *main_window, int selected_page){
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
window_main_child_bottom (page_box);
// if (get_status ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
// window_main_child_bottom (page_box);
// if (!get_mode ()) gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
// else gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
//SWITCH_TO (STATE);
break;