Introducing page : SYNTH

This commit is contained in:
Jean Sirmai 2024-08-04 12:21:24 +02:00
parent 29dd9a4529
commit f2c7d17e7e
Signed by: jean
GPG Key ID: FB3115C340E057E3
7 changed files with 85 additions and 34 deletions

View File

@ -37,9 +37,9 @@
/******************************************************************************/ /******************************************************************************/
// called by widgets through signal functions // called by widgets through signal functions
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; // xor
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
#define n_rules 128 // arbitrary #define n_rules 128 // arbitrary

View File

@ -34,8 +34,8 @@
/******************************************************************************/ /******************************************************************************/
/* W I N D O W S */ /* W I N D O W S */
/******************************************************************************/ /******************************************************************************/
// called in init.c // called in dispatch.c
// functions are in topbar.c // functions are in topbar.c
void widget_design_main_window (GtkWindow *main_window); void widget_design_main_window (GtkWindow *main_window);
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_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 // called in topbar.c
// functions are in init.c // functions are in dispatch.c
void *widget_get_main_window(); void *widget_get_main_window();
void *widget_get_dialog_window(); void *widget_get_dialog_window();
@ -51,6 +51,7 @@ void *widget_get_text_window();
// functions are in topbar // functions are in topbar
void *widget_get_btt_synth();
void *widget_get_btt_state(); void *widget_get_btt_state();
void *widget_get_btt_rules(); void *widget_get_btt_rules();
void *widget_get_btt_data(); void *widget_get_btt_data();
@ -64,6 +65,7 @@ void window_header_bar_right (GtkWidget *header_bar);
/******************************************************************************/ /******************************************************************************/
// called in signal.c // 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_state_page(); // in : src/widget/state/dispatch.c
void *widget_get_rules_page(); // in : src/widget/rules/dispatch.c void *widget_get_rules_page(); // in : src/widget/rules/dispatch.c
void *widget_get_data_page(); // in : src/widget/data /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 / // texts in : data / text /
// functions in : widget / stock.c // 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_theory ();
char *widget_get_text_address_about_commands (); char *widget_get_text_address_about_commands ();

View File

@ -98,7 +98,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
/******************************************************************************/ /******************************************************************************/
static char *tab_0 [] = { "EXEC", "EDIT" }; 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) static void debug_printing (int choice, int value, int sub_automaton)
{ {

View File

@ -262,6 +262,11 @@ static void switch_state_rules_data()
{ {
switch (fsm_get_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) : case (STATE) :
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_state_page())); 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)); = gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
int is_active = gtk_check_button_get_active (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, "synth")) fsm_set_state_rules_data (SYNTH);
if ( ! strcmp (toggled_button_name, "rules")) fsm_set_state_rules_data (RULES); if ( ! strcmp (toggled_button_name, "state")) fsm_set_state_rules_data (STATE);
if ( ! strcmp (toggled_button_name, "data")) fsm_set_state_rules_data (DATA); 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(); if (is_active) switch_state_rules_data();
} }

View File

@ -44,7 +44,7 @@ void *widget_get_results_page () {
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename 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"))); ("/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 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"))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png")));

View File

@ -0,0 +1,36 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Windows && Headers *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_synth_page() {return NULL;}

View File

@ -37,41 +37,48 @@
/* M A I N W I N D O W T O P B A R ( L E F T ) */ /* 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_state () {return btt_STATE;}
void *widget_get_btt_rules () {return btt_RULES;} void *widget_get_btt_rules () {return btt_RULES;}
void *widget_get_btt_data () {return btt_DATA;} void *widget_get_btt_data () {return btt_DATA;}
void window_header_bar_left (GtkWidget *header_bar) 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 ()); 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, "system-run-symbolic");
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-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); 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")); btt_SYNTH = GTK_BUTTON (gtk_check_button_new_with_label ("synth"));
g_signal_connect (btt_STATE, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); 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_STATE), group_state_rules_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")); btt_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
g_signal_connect (btt_RULES, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); 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_RULES), group_state_rules_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")); btt_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data); 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_DATA), group_state_rules_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)); btt_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("results"));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label)); g_signal_connect (btt_DATA, "toggled", G_CALLBACK (on_toggle_state_rules_data), no_local_data);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_STATE)); 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_RULES));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_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));
} }