Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | ba8ff7f65c |
14
(notes)
14
(notes)
|
@ -24,20 +24,6 @@ graph_stack.c: (316) stack->arrows_nb = set_arrow (stack_id, stack->arrows_nb
|
|||
|
||||
contain is called (#included) in : callback, display, tree, graph_stack, graph_area, init,
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
https://developer.gnome.org/documentation/guidelines.html
|
||||
https://developer.gnome.org/documentation/guidelines/devel-docs.html
|
||||
|
||||
https://docs.gtk.org/gtk4/class.StackPage.html
|
||||
https://docs.gtk.org/gtk4/class.Stack.html
|
||||
https://docs.gtk.org/gtk4/class.StackSwitcher.html
|
||||
|
||||
https://docs.gtk.org/gtk4/method.StackSwitcher.set_stack.html
|
||||
https://docs.gtk.org/gtk4/ctor.StackSwitcher.new.html
|
||||
https://docs.gtk.org/gtk4/ctor.Stack.new.html
|
||||
|
||||
https://docs.gtk.org/gtk4/class.ToggleButton.html
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 130 KiB |
Binary file not shown.
Before Width: | Height: | Size: 551 KiB |
82
automaton.c
82
automaton.c
|
@ -8,34 +8,39 @@
|
|||
/* S T A T E S */
|
||||
/******************************************************************************/
|
||||
|
||||
/* (exec / edit) < MODE
|
||||
/* (exec / edit)
|
||||
* X
|
||||
* (state / rules / data) < VIEW
|
||||
* (state / rules / data)
|
||||
* 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;}
|
||||
|
||||
static int status = INTER; // int get_status () {return status;}
|
||||
|
||||
/******************************************************************************/
|
||||
/* T R A N S I T I O N S */
|
||||
/******************************************************************************/
|
||||
|
||||
void toggle_TO (int mode, int view) {
|
||||
switch (view) {
|
||||
case (INTER) : printf ("switch to INTER\n"); break;
|
||||
case (STATE) : printf ("switch to STATE\n"); break;
|
||||
case (RULES) : printf ("switch to RULES\n"); break;
|
||||
case (DATA) : printf ("switch to DATA \n"); break;
|
||||
void SWITCH_TO (int asked) {
|
||||
switch (asked) {
|
||||
case (INTER) : // BEGIN_TO_EXEC_STOP
|
||||
status = STATE; printf ("SWITCH_TO INTER\n");
|
||||
break;
|
||||
case (STATE) : // EXEC_STOP_TO_RUN
|
||||
status = RULES; printf ("SWITCH_TO STATE\n");
|
||||
break;
|
||||
case (RULES) : // EXEC_RUN_TO_STOP
|
||||
status = DATA; printf ("SWITCH_TO RULES\n");
|
||||
break;
|
||||
case (DATA) : // EXEC_TO_INTER
|
||||
status = INTER; printf ("SWITCH_TO DATA\n");
|
||||
break;
|
||||
default : ;
|
||||
}
|
||||
|
||||
//q gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,31 +51,6 @@ void toggle_TO (int mode, int view) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
enum { // S T A T E S
|
||||
INTER,
|
||||
|
@ -86,7 +66,7 @@ enum { // S T A T E S
|
|||
CONFIGURE
|
||||
};
|
||||
|
||||
static int view = EXEC_STOP; // int get_view () {return view;}
|
||||
static int status = EXEC_STOP; // int get_status () {return status;}
|
||||
|
||||
enum { // T R A N S I T I O N S
|
||||
BEGIN_TO_EXEC_STOP
|
||||
|
@ -99,29 +79,29 @@ enum { // T R A N S I T I O N S
|
|||
};
|
||||
|
||||
|
||||
void set_view (int prescribed) {
|
||||
view = prescribed; if (0) printf ("view = %d\n", view);
|
||||
void set_status (int prescribed) {
|
||||
status = prescribed; if (0) printf ("status = %d\n", status);
|
||||
|
||||
switch (view) {
|
||||
switch (status) {
|
||||
case (0) : // EXEC_STOP DATA_ANALYSIS
|
||||
view = EXEC_RUN;
|
||||
status = 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;
|
||||
status = EXEC_STOP;
|
||||
break;
|
||||
case (2) : // EXEC_STOP_EDIT_STOP
|
||||
view = EXEC_RUN_EDIT_RULE;
|
||||
status = EXEC_RUN_EDIT_RULE;
|
||||
break;
|
||||
case (3) : // EXEC_RUN_EDIT_RULE
|
||||
view = EXEC_STOP_EDIT_RULE;
|
||||
status = EXEC_STOP_EDIT_RULE;
|
||||
break;
|
||||
case (4) : // EXEC_STOP_EDIT_MEASURE
|
||||
view = EXEC_RUN_EDIT_MEASURE;
|
||||
status = EXEC_RUN_EDIT_MEASURE;
|
||||
break;
|
||||
case (5) : // EXEC_RUN_EDIT_MEASURE
|
||||
view = EXEC_STOP_EDIT_MEASURE;
|
||||
status = EXEC_STOP_EDIT_MEASURE;
|
||||
break;
|
||||
case (6) : // EDIT_STATE
|
||||
break;
|
||||
|
|
24
automaton.h
24
automaton.h
|
@ -1,25 +1,9 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <assert.h>
|
||||
|
||||
/******************************************************************************/
|
||||
/* S T A T E S */
|
||||
/******************************************************************************/
|
||||
void set_status (int prescribed);
|
||||
int get_status ();
|
||||
|
||||
/* (exec / edit) < MODE
|
||||
* X
|
||||
* (state / rules / data) < VIEW
|
||||
* X
|
||||
* (measure / analyse / interpret) < DATA
|
||||
*/
|
||||
/******************************************************************************/
|
||||
enum choice { INTER, STATE, RULES, DATA };
|
||||
|
||||
void set_view (int prescribed);
|
||||
int get_view ();
|
||||
void set_mode (int prescribed);
|
||||
int get_mode ();
|
||||
|
||||
enum mode { RUN, EDIT };
|
||||
enum view { INTER, STATE, RULES, DATA };
|
||||
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };
|
||||
|
||||
void toggle_TO (int mode, int view);
|
||||
void SWITCH_TO (int asked);
|
||||
|
|
86
callback.c
86
callback.c
|
@ -166,55 +166,71 @@ 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) {
|
||||
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-performance-symbolic");
|
||||
// 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_button_set_icon_name (GTK_BUTTON (btt_XOR_EXEC_EDIT), "text-editor-symbolic");
|
||||
// gtk_widget_set_sensitive (GTK_WIDGET (btt_MODEL_RUN_STOP), FALSE);
|
||||
set_mode (1);
|
||||
}
|
||||
void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data) {}
|
||||
void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data) {}
|
||||
void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec) {
|
||||
// gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "power-profile-balanced-rtl-symbolic");
|
||||
// gtk_button_set_label (GTK_BUTTON (btt_run_stop_model_exec), " run ");
|
||||
// gtk_widget_set_sensitive (GTK_WIDGET (btt_run_stop_model_exec), TRUE);
|
||||
}
|
||||
|
||||
|
||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data) {
|
||||
g_print ("Toggle button %s is active: %s\n",
|
||||
gtk_button_get_label (GTK_BUTTON (btt_open_STATE)),
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)) ? "Yes" : "No");
|
||||
}//{window_main_child (main_window, STATE); toggle_TO (RUN, STATE);}
|
||||
void on_toggle_STATE_RULES_DATA (GtkButton *btt_toggle_STATE_RULES_DATA,
|
||||
GtkButton *btt_toggle_STATE_DATA_RULES)
|
||||
{
|
||||
const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA));
|
||||
if (0) printf ("callback.c (line 182) - current_label = %s\n", current_label);
|
||||
|
||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
||||
g_print ("Toggle button %s is active: %s\n",
|
||||
gtk_button_get_label (GTK_BUTTON (btt_open_RULES)),
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_RULES)) ? "Yes" : "No");
|
||||
}//{window_main_child (main_window, RULES); toggle_TO (RUN, RULES);}
|
||||
if (! strcmp (current_label, "analyse")) {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " state ");
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), " state ");
|
||||
window_main_child (main_window, 0);
|
||||
}
|
||||
else if (! strcmp (current_label, " state ")) {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " rules ");
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), " rules ");
|
||||
window_main_child (main_window, 1);
|
||||
}
|
||||
else {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, "analyse");
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_DATA_RULES), "analyse");
|
||||
window_main_child (main_window, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
||||
g_print ("Toggle button %s is active: %s\n",
|
||||
gtk_button_get_label (GTK_BUTTON (btt_open_DATA)),
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_DATA)) ? "Yes" : "No");
|
||||
}//{window_main_child (main_window, DATA); toggle_TO (RUN, DATA);}
|
||||
void on_toggle_STATE_DATA_RULES (GtkButton *btt_toggle_STATE_RULES_DATA,
|
||||
GtkButton *btt_toggle_STATE_DATA_RULES)
|
||||
{
|
||||
const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA));
|
||||
if (0) printf ("callback.c (line 205) - current_label = %s\n", current_label);
|
||||
|
||||
if (! strcmp (current_label, "analyse")) {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " state ");
|
||||
gtk_button_set_label (btt_toggle_STATE_DATA_RULES, " state ");
|
||||
window_main_child (main_window, 0);
|
||||
}
|
||||
else if (! strcmp (current_label, " rules ")) {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, "analyse");
|
||||
gtk_button_set_label (btt_toggle_STATE_DATA_RULES, "analyse");
|
||||
window_main_child (main_window, 1);
|
||||
}
|
||||
else {
|
||||
gtk_button_set_label (btt_toggle_STATE_RULES_DATA, " rules ");
|
||||
gtk_button_set_label (btt_toggle_STATE_DATA_RULES, " rules ");
|
||||
window_main_child (main_window, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
||||
printf ("callback.c (line 201) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
||||
toggle_TO (RUN, INTER);
|
||||
SWITCH_TO (INTER);
|
||||
}
|
||||
|
||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
gtk_window_close (GTK_WINDOW (data));
|
||||
printf ("callback.c (line 206) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
|
||||
toggle_TO (RUN, RULES);
|
||||
SWITCH_TO (RULES);
|
||||
}
|
||||
|
||||
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data) {
|
||||
|
|
13
callback.h
13
callback.h
|
@ -14,14 +14,11 @@ void on_glarea_unrealize (GtkWidget *widget);
|
|||
|
||||
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
|
||||
|
||||
void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN_STOP);
|
||||
void on_toggle_MODEL_RUN_STOP (GtkWidget *btt_MODEL_RUN_STOP, gpointer data);
|
||||
|
||||
// https://docs.gtk.org/gtk4/class.ToggleButton.html
|
||||
|
||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer data);
|
||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data);
|
||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data);
|
||||
void on_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec);
|
||||
void on_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data);
|
||||
void on_toggle_STATE_RULES_DATA (GtkButton *btt_toggle_STATE_RULES_DATA, GtkButton *btt_toggle_STATE_DATA_RULES);
|
||||
void on_toggle_STATE_DATA_RULES (GtkButton *btt_toggle_STATE_DATA_RULES, GtkButton *btt_toggle_STATE_RULES_DATA);
|
||||
void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, gpointer data);
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data);
|
||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data);
|
||||
|
|
171
contain.c
171
contain.c
|
@ -1,6 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "callback.h"
|
||||
#include "automaton.h"
|
||||
|
@ -147,72 +146,80 @@ GtkWidget *get_SPACE_EDIT_controls_box() {
|
|||
return GTK_WIDGET (label_ad_hoc);
|
||||
}
|
||||
|
||||
GtkWidget *get_STATE_VIEW_box(){
|
||||
GtkBox *space_view_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (space_view_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
return GTK_WIDGET (space_view_box);
|
||||
}
|
||||
|
||||
void window_main_child_bottom (GtkBox *page_box){
|
||||
// gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
// gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_controls_box()));
|
||||
}
|
||||
|
||||
// static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
static void icons_for_fun (GtkHeaderBar *header_bar);
|
||||
|
||||
void window_header_bar (GtkWindow *main_window, char *title){
|
||||
void window_header_bar (GtkWindow *window, char *title){
|
||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
gtk_window_set_titlebar (main_window, header_bar);
|
||||
gtk_window_set_titlebar (window, header_bar);
|
||||
|
||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic");
|
||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), NULL);
|
||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
// https://docs.gtk.org/gtk4/class.Stack.html
|
||||
GtkWidget *switcher_SRD = gtk_stack_switcher_new ();
|
||||
GtkWidget *stack_SRD = gtk_stack_new ();
|
||||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher_SRD), GTK_STACK (stack_SRD));
|
||||
/*
|
||||
GtkStackPage* page_child_space = gtk_stack_add_child (GTK_STACK (stack_SRD), GTK_WIDGET (get_STATE_VIEW_box()));
|
||||
GtkStackPage* page_child_rules = gtk_stack_add_child (GTK_STACK (stack_SRD), GTK_WIDGET (get_edit_rules_page_new()));
|
||||
GtkStackPage* page_child_data = gtk_stack_add_child (GTK_STACK (stack_SRD), GTK_WIDGET (get_measures_page_new()));
|
||||
*/
|
||||
gtk_stack_add_titled (GTK_STACK (stack_SRD), GTK_WIDGET (get_STATE_VIEW_box()), "name_space", "space");
|
||||
gtk_stack_add_titled (GTK_STACK (stack_SRD), GTK_WIDGET (get_edit_rules_page_new()), "name_rules", "rules");
|
||||
gtk_stack_add_titled (GTK_STACK (stack_SRD), GTK_WIDGET (get_measures_page_new()), "name_data", "data analysis");
|
||||
GtkButton *exec_xor_edit = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic");
|
||||
gtk_button_set_icon_name (exec_xor_edit, "power-profile-balanced-rtl-symbolic");
|
||||
// g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (on_toggle_exec_edit), run_stop_model_exec);
|
||||
|
||||
// gtk_stack_set_visible_child (GTK_STACK (stack_SRD), GTK_STACK_PAGE (page_child_space));
|
||||
// printf("gtk_stack_get_child = %s\n", gtk_stack_page_get_name (GTK_STACK_PAGE (gtk_stack_get_visible_child (GTK_STACK (stack_SRD)))));
|
||||
// gtk_stack_page_get_name (GTK_STACK_PAGE (gtk_stack_get_visible_child (GTK_STACK (stack_SRD)))));
|
||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new ("------------"));
|
||||
|
||||
GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
||||
g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (on_toggle_model_exec), no_local_data);
|
||||
|
||||
GtkButton *btt_toggle_STATE_RULES_DATA = GTK_BUTTON (gtk_button_new_with_label (" state "));
|
||||
GtkButton *btt_toggle_STATE_DATA_RULES = GTK_BUTTON (gtk_button_new_with_label (" state "));
|
||||
g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_RULES_DATA), btt_toggle_STATE_DATA_RULES);
|
||||
g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_DATA_RULES), btt_toggle_STATE_RULES_DATA);
|
||||
|
||||
// GtkButton *observ_interpret = GTK_BUTTON (gtk_button_new_with_label ("data analysis"));
|
||||
// g_signal_connect (observ_interpret, "clicked", G_CALLBACK (on_toggle_observ_interpret), no_local_data);
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (exec_xor_edit));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (switcher_SRD));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_STATE_RULES_DATA));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_toggle_STATE_DATA_RULES));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (observ_interpret));
|
||||
|
||||
// gtk_window_set_child (main_window, GTK_WIDGET (get_STATE_VIEW_box()));
|
||||
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||
}
|
||||
|
||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||
// in_depth.c : enum { STATE, RULES, MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };
|
||||
switch (selected_page) {
|
||||
case (0) : // STATE
|
||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
|
||||
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()));
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (page_box));
|
||||
break;
|
||||
case (1) : gtk_window_set_child (main_window, GTK_WIDGET (get_rules_page_new())); break;
|
||||
case (2) : gtk_window_set_child (main_window, GTK_WIDGET (get_measures_page_new())); break;
|
||||
case (3) : gtk_window_set_child (main_window, GTK_WIDGET (get_results_page_new())); break;
|
||||
case (4) : gtk_window_set_child (main_window, GTK_WIDGET (get_discuss_page_new())); break;
|
||||
case (5) : gtk_window_set_child (main_window, GTK_WIDGET (get_help_page_new())); break;
|
||||
default : gtk_window_set_child (main_window, GTK_WIDGET (get_SPACE_VIEW_box())); // + un "help message"
|
||||
}
|
||||
}
|
||||
|
||||
void main_window_design (GtkWindow *main_window){
|
||||
// window_main_child (main_window, STATE);
|
||||
window_main_child (main_window, 0); // 0 is the state page
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
|
@ -228,8 +235,6 @@ void main_window_design (GtkWindow *main_window){
|
|||
|
||||
|
||||
|
||||
/*
|
||||
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||
|
||||
static void icons_for_fun (GtkHeaderBar *header_bar)
|
||||
{
|
||||
|
@ -301,87 +306,3 @@ static void icons_for_fun (GtkHeaderBar *header_bar)
|
|||
gtk_button_set_icon_name (power_low, "power-profile-power-saver-symbolic");
|
||||
gtk_header_bar_pack_end (header_bar, GTK_WIDGET (power_low));
|
||||
}
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
Je fais un essai avec un stack_switcher 2024-06-18
|
||||
|
||||
void window_header_bar (GtkWindow *window, char *title){
|
||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
gtk_window_set_titlebar (window, header_bar);
|
||||
|
||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
GtkButton *btt_MODEL_RUN_STOP = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
||||
g_signal_connect (btt_MODEL_RUN_STOP, "clicked", G_CALLBACK (on_toggle_MODEL_RUN_STOP), no_local_data);
|
||||
|
||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic");
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic");
|
||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), btt_MODEL_RUN_STOP);
|
||||
|
||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||
|
||||
GtkButton *btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||
GtkButton *btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||
GtkButton *btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
||||
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
||||
// int selected = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE));
|
||||
// if (0) printf("%d\n", selected);
|
||||
// if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (btt_open_STATE)))
|
||||
|
||||
// g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
||||
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||
|
||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
|
||||
// GObject *a_stack_page = g_object_new (GTK_STACK_PAGE ? );
|
||||
// https://docs.gtk.org/gobject/tutorial.html#how-to-define-and-implement-a-new-gobject
|
||||
|
||||
GtkWidget *a_stack = gtk_stack_new ();
|
||||
GtkWidget *switcher_SRD = gtk_stack_switcher_new ();
|
||||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher_SRD), GTK_STACK (a_stack));
|
||||
gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (page_box), "a_name", "space");
|
||||
// gtk_stack_page_set_visible (*self, TRUE);
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_STATE));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_RULES));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_open_DATA));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (switcher_SRD));
|
||||
|
||||
// icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue