Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Jean Sirmai | e93358f6dc | |
Jean Sirmai | 5c5bd709d9 | |
Jean Sirmai | 270b2feba5 | |
Jean Sirmai | 6adcdc7d96 | |
Jean Sirmai | b40b3e2598 | |
Jean Sirmai | 29b09fa771 | |
Jean Sirmai | 53f2fea60c | |
Jean Sirmai | 31957b7835 | |
Jean Sirmai | aa3c7bcc82 | |
Jean Sirmai | e6871816a4 | |
Jean Sirmai | bd252031c7 | |
Jean Sirmai | 0f0c21b299 | |
Jean Sirmai | 981886d79b | |
Jean Sirmai | 4cd7a0215a | |
Jean Sirmai | 83c3254732 |
14
(notes)
14
(notes)
|
@ -24,6 +24,20 @@ 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.
After Width: | Height: | Size: 130 KiB |
Binary file not shown.
After Width: | Height: | Size: 551 KiB |
88
automaton.c
88
automaton.c
|
@ -8,39 +8,34 @@
|
|||
/* S T A T E S */
|
||||
/******************************************************************************/
|
||||
|
||||
/* (exec / edit)
|
||||
* X
|
||||
* (state / rules / data)
|
||||
* X
|
||||
* (measure / analyse / interpret)
|
||||
* X
|
||||
* (read / write)
|
||||
/* (exec / edit) < MODE
|
||||
* X
|
||||
* (state / rules / data) < VIEW
|
||||
* X
|
||||
* (measure / analyse / interpret)
|
||||
*/
|
||||
|
||||
static int status = INTER; // int get_status () {return status;}
|
||||
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) : // 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;
|
||||
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;
|
||||
default : ;
|
||||
}
|
||||
|
||||
//q gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +46,31 @@ void SWITCH_TO (int asked) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
enum { // S T A T E S
|
||||
INTER,
|
||||
|
@ -66,7 +86,7 @@ enum { // S T A T E S
|
|||
CONFIGURE
|
||||
};
|
||||
|
||||
static int status = EXEC_STOP; // int get_status () {return status;}
|
||||
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
|
||||
|
@ -79,29 +99,29 @@ enum { // T R A N S I T I O N S
|
|||
};
|
||||
|
||||
|
||||
void set_status (int prescribed) {
|
||||
status = prescribed; if (0) printf ("status = %d\n", status);
|
||||
void set_view (int prescribed) {
|
||||
view = prescribed; if (0) printf ("view = %d\n", view);
|
||||
|
||||
switch (status) {
|
||||
switch (view) {
|
||||
case (0) : // EXEC_STOP DATA_ANALYSIS
|
||||
status = EXEC_RUN;
|
||||
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
|
||||
status = EXEC_STOP;
|
||||
view = EXEC_STOP;
|
||||
break;
|
||||
case (2) : // EXEC_STOP_EDIT_STOP
|
||||
status = EXEC_RUN_EDIT_RULE;
|
||||
view = EXEC_RUN_EDIT_RULE;
|
||||
break;
|
||||
case (3) : // EXEC_RUN_EDIT_RULE
|
||||
status = EXEC_STOP_EDIT_RULE;
|
||||
view = EXEC_STOP_EDIT_RULE;
|
||||
break;
|
||||
case (4) : // EXEC_STOP_EDIT_MEASURE
|
||||
status = EXEC_RUN_EDIT_MEASURE;
|
||||
view = EXEC_RUN_EDIT_MEASURE;
|
||||
break;
|
||||
case (5) : // EXEC_RUN_EDIT_MEASURE
|
||||
status = EXEC_STOP_EDIT_MEASURE;
|
||||
view = EXEC_STOP_EDIT_MEASURE;
|
||||
break;
|
||||
case (6) : // EDIT_STATE
|
||||
break;
|
||||
|
|
24
automaton.h
24
automaton.h
|
@ -1,9 +1,25 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <assert.h>
|
||||
|
||||
void set_status (int prescribed);
|
||||
int get_status ();
|
||||
/******************************************************************************/
|
||||
/* S T A T E S */
|
||||
/******************************************************************************/
|
||||
|
||||
enum choice { INTER, STATE, RULES, DATA };
|
||||
/* (exec / edit) < MODE
|
||||
* X
|
||||
* (state / rules / data) < VIEW
|
||||
* X
|
||||
* (measure / analyse / interpret) < DATA
|
||||
*/
|
||||
/******************************************************************************/
|
||||
|
||||
void SWITCH_TO (int asked);
|
||||
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);
|
||||
|
|
61
callback.c
61
callback.c
|
@ -166,44 +166,55 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
|
|||
/******************************************************************************/
|
||||
/* B U T T O N S */
|
||||
/******************************************************************************/
|
||||
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_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_STATE_RULES_DATA (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data)
|
||||
{
|
||||
const char* current_label = gtk_button_get_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA));
|
||||
if (0) printf ("callback.c (line 191) - current_label = %s\n", current_label);
|
||||
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);}
|
||||
|
||||
if (! strcmp (current_label, "analyse")) {
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " state ");
|
||||
window_main_child (main_window, 0);
|
||||
}
|
||||
else if (! strcmp (current_label, " state ")) {
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), " rules ");
|
||||
window_main_child (main_window, 1);
|
||||
}
|
||||
else {
|
||||
gtk_button_set_label (GTK_BUTTON (btt_toggle_STATE_RULES_DATA), "analyse");
|
||||
window_main_child (main_window, 2);
|
||||
}
|
||||
}
|
||||
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);}
|
||||
|
||||
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_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");
|
||||
SWITCH_TO (INTER);
|
||||
toggle_TO (RUN, 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");
|
||||
SWITCH_TO (RULES);
|
||||
toggle_TO (RUN, RULES);
|
||||
}
|
||||
|
||||
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data) {
|
||||
|
|
12
callback.h
12
callback.h
|
@ -14,10 +14,14 @@ void on_glarea_unrealize (GtkWidget *widget);
|
|||
|
||||
void on_axis_value_change (GtkAdjustment *adjustment, 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 (GtkWidget *btt_toggle_STATE_RULES_DATA, gpointer data);
|
||||
void on_toggle_observ_interpret (GtkWidget *btt_toggle_observ_interpret, 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_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);
|
||||
|
|
168
contain.c
168
contain.c
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "callback.h"
|
||||
#include "automaton.h"
|
||||
|
@ -146,77 +147,72 @@ 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 *window, char *title){
|
||||
void window_header_bar (GtkWindow *main_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);
|
||||
gtk_window_set_titlebar (main_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);
|
||||
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);
|
||||
|
||||
gpointer no_local_data = NULL;
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||
|
||||
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);
|
||||
// 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");
|
||||
|
||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||
// 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 *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 "));
|
||||
g_signal_connect (btt_toggle_STATE_RULES_DATA, "clicked", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_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 (btt_XOR_EXEC_EDIT));
|
||||
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_toggle_STATE_RULES_DATA));
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (observ_interpret));
|
||||
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
|
||||
// gtk_window_set_child (main_window, GTK_WIDGET (get_STATE_VIEW_box()));
|
||||
}
|
||||
|
||||
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)));
|
||||
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_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_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, 0); // 0 is the state page
|
||||
// window_main_child (main_window, STATE);
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
|
@ -232,6 +228,8 @@ 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)
|
||||
{
|
||||
|
@ -303,3 +301,87 @@ 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