diff --git a/include/fsm.h b/include/fsm.h index aa5c7b3..0162016 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -37,9 +37,9 @@ /******************************************************************************/ // called by widgets through signal functions -enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor -enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor -enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor +enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor +enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; // xor +enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor #define n_rules 128 // arbitrary diff --git a/include/widget.h b/include/widget.h index a85f23b..35c2c17 100644 --- a/include/widget.h +++ b/include/widget.h @@ -34,8 +34,8 @@ /******************************************************************************/ /* W I N D O W S */ /******************************************************************************/ -// called in init.c -// functions are in topbar.c +// called in dispatch.c +// functions are in topbar.c void widget_design_main_window (GtkWindow *main_window); void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window); @@ -43,7 +43,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window // called in topbar.c -// functions are in init.c +// functions are in dispatch.c void *widget_get_main_window(); void *widget_get_dialog_window(); @@ -51,6 +51,7 @@ void *widget_get_text_window(); // functions are in topbar +void *widget_get_btt_synth(); void *widget_get_btt_state(); void *widget_get_btt_rules(); void *widget_get_btt_data(); @@ -64,6 +65,7 @@ void window_header_bar_right (GtkWidget *header_bar); /******************************************************************************/ // called in signal.c +void *widget_get_synth_page(); // in : src/widget/synth/dispatch.c void *widget_get_state_page(); // in : src/widget/state/dispatch.c void *widget_get_rules_page(); // in : src/widget/rules/dispatch.c void *widget_get_data_page(); // in : src/widget/data /dispatch.c @@ -138,7 +140,7 @@ void *widget_get_user_rules_tree (); // see "labo.c" for specification of the tr /******************************************************************************/ // texts in : data / text / // functions in : widget / stock.c -// used by text_window (see topbar.c)) +// used by text_window (see topbar/dispatch.c)) char *widget_get_text_address_theory (); char *widget_get_text_address_about_commands (); diff --git a/src/fsm.c b/src/fsm.c index 499fbf4..2e01c4c 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -98,7 +98,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value) /******************************************************************************/ static char *tab_0 [] = { "EXEC", "EDIT" }; -static char *tab_1 [] = { "STATE", "RULES", "DATA" }; +static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" }; static void debug_printing (int choice, int value, int sub_automaton) { diff --git a/src/signal.c b/src/signal.c index 4b8ab86..73eb845 100644 --- a/src/signal.c +++ b/src/signal.c @@ -262,6 +262,11 @@ static void switch_state_rules_data() { switch (fsm_get_state_rules_data()) { + case (SYNTH) : + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_get_synth_page())); + break; + case (STATE) : gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), GTK_WIDGET (widget_get_state_page())); @@ -289,9 +294,10 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data) = gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button)); int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button)); - if ( ! strcmp (toggled_button_name, "state")) fsm_set_state_rules_data (STATE); - if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES); - if ( ! strcmp (toggled_button_name, "data")) fsm_set_state_rules_data (DATA); + if ( ! strcmp (toggled_button_name, "synth")) fsm_set_state_rules_data (SYNTH); + if ( ! strcmp (toggled_button_name, "state")) fsm_set_state_rules_data (STATE); + if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES); + if ( ! strcmp (toggled_button_name, "results")) fsm_set_state_rules_data (DATA); if (is_active) switch_state_rules_data(); } diff --git a/src/widget/data/results.c b/src/widget/data/results.c index d5dd29d..c9eb2e1 100644 --- a/src/widget/data/results.c +++ b/src/widget/data/results.c @@ -44,7 +44,7 @@ void *widget_get_results_page () { gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png"))); - gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions")); + gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions (1D, 2D)")); gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png"))); diff --git a/src/widget/synth/dispatch.c b/src/widget/synth/dispatch.c new file mode 100644 index 0000000..241f7df --- /dev/null +++ b/src/widget/synth/dispatch.c @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Windows && Headers * +* * +* Copyright © 2021 Libre en Communs * +* Copyright © 2021 Adrien Bourmault * +* Copyright © 2021 Jean Sirmai * +* * +* This file is part of Gem-graph. * +* * +* This program is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Affero General Public License * +* as published by the Free Software Foundation, * +* either version 3 of the License, * +* or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; * +* without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. * +* See the GNU Affero General Public License for more details. * +* * +* You should have received a copy of the GNU Affero General Public License * +* along with this program. If not, see . * +* * +* * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include "../../../include/base.h" +#include "../../../include/signal.h" +#include "../../../include/widget.h" + + +void *widget_get_synth_page() {return NULL;} diff --git a/src/widget/topbar/left.c b/src/widget/topbar/left.c index e481f99..6436899 100644 --- a/src/widget/topbar/left.c +++ b/src/widget/topbar/left.c @@ -37,41 +37,48 @@ /* M A I N W I N D O W T O P B A R ( L E F T ) */ /******************************************************************************/ -static GtkButton *btt_STATE, *btt_RULES, *btt_DATA; +static GtkButton *btt_SYNTH, *btt_STATE, *btt_RULES, *btt_DATA; +void *widget_get_btt_synth () {return btt_SYNTH;} void *widget_get_btt_state () {return btt_STATE;} void *widget_get_btt_rules () {return btt_RULES;} void *widget_get_btt_data () {return btt_DATA;} void window_header_bar_left (GtkWidget *header_bar) { - gpointer no_local_data = NULL; + gpointer no_local_data = NULL; - 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-balanced-rtl-symbolic"); - g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit), 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-balanced-rtl-symbolic"); + g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit), no_local_data); - GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | ")); + GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | ")); - GtkCheckButton *group_state_rules_data = GTK_CHECK_BUTTON (gtk_check_button_new ()); + GtkCheckButton *group_state_rules_data = GTK_CHECK_BUTTON (gtk_check_button_new ()); - btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); - g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); - gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_state_rules_data); + btt_SYNTH = GTK_BUTTON (gtk_check_button_new_with_label ("synth")); + g_signal_connect (btt_SYNTH, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); + gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_SYNTH), group_state_rules_data); + gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_SYNTH), FALSE); - btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules")); - g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); - gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_state_rules_data); + btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state")); + g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); + gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_STATE), group_state_rules_data); - btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data")); - g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); - gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_state_rules_data); + btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules")); + g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); + gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_RULES), group_state_rules_data); - 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_STATE)); - gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES)); - gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA)); + btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("results")); + g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); + gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_DATA), group_state_rules_data); + + 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_SYNTH)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_STATE)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES)); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA)); }