Le bouton [exec_xor_edit] contrôle le bouton [run_stop_model_exec]
This commit is contained in:
parent
4e14d68b1e
commit
a4a5c24c1b
19
callback.c
19
callback.c
|
@ -44,7 +44,7 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* obje
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* B U T T O N S */
|
/* B U T T O N S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data)
|
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, GtkWidget *btt_run_stop_model_exec)
|
||||||
{
|
{
|
||||||
if (get_exec_edit_mode()) {
|
if (get_exec_edit_mode()) {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "system-run-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "system-run-symbolic");
|
||||||
|
@ -53,27 +53,24 @@ void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data)
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "document-edit-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "document-edit-symbolic");
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "text-editor-symbolic"); // I hesitate
|
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "text-editor-symbolic"); // I hesitate
|
||||||
set_exec_edit_mode (1);
|
set_exec_edit_mode (1);
|
||||||
|
|
||||||
|
if (! get_run_xor_stop_exec()) { // il faudra une pop-up window, ici, TODO
|
||||||
|
// pour prévenir l'utilisateur du risque de perte des données de la simulation en cours
|
||||||
|
set_run_xor_stop_exec (0);
|
||||||
|
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-pause-symbolic");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data)
|
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data)
|
||||||
{
|
{
|
||||||
if (get_run_xor_stop_exec()) {
|
if (get_run_xor_stop_exec() && ! get_exec_edit_mode()) {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-start-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-start-symbolic");
|
||||||
set_run_xor_stop_exec (0);
|
set_run_xor_stop_exec (0);
|
||||||
} else {
|
} else {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-pause-symbolic");
|
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-pause-symbolic");
|
||||||
// gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "system-shutdown-symbolic");
|
|
||||||
// I hesitate : The button should then toggle between activable xor inactivable states
|
|
||||||
set_run_xor_stop_exec (1);
|
set_run_xor_stop_exec (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_model_exec_depends_on_edition (GtkWidget *btt_run_stop_model_exec, gpointer data)
|
|
||||||
{
|
|
||||||
if (get_run_xor_stop_exec() && get_exec_edit_mode()) {
|
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-start-symbolic");
|
|
||||||
// set_run_xor_stop_exec (0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ void ui_disable_action (const char *name);
|
||||||
|
|
||||||
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data);
|
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data);
|
||||||
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data);
|
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data);
|
||||||
void ui_model_exec_depends_on_edition (GtkWidget *btt_run_stop_model_exec, gpointer data);
|
|
||||||
|
|
||||||
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||||
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||||
|
|
20
contain.c
20
contain.c
|
@ -280,25 +280,23 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
// 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);
|
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||||
|
|
||||||
|
GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_toggle_button_new ());
|
||||||
|
gtk_button_set_icon_name (run_stop_model_exec, "system-shutdown-symbolic");
|
||||||
|
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-pause-symbolic");
|
||||||
|
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-start-symbolic");
|
||||||
|
g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (ui_toggle_model_exec), NULL);
|
||||||
|
|
||||||
GtkButton *exec_xor_edit = GTK_BUTTON (gtk_toggle_button_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, "system-run-symbolic");
|
||||||
// g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_run_edit), NULL);
|
// g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_run_edit), NULL);
|
||||||
gtk_button_set_icon_name (exec_xor_edit, "document-edit-symbolic");
|
gtk_button_set_icon_name (exec_xor_edit, "document-edit-symbolic");
|
||||||
gtk_button_set_icon_name (exec_xor_edit, "text-editor-symbolic");
|
gtk_button_set_icon_name (exec_xor_edit, "text-editor-symbolic");
|
||||||
gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic");
|
gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic");
|
||||||
g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_exec_edit), NULL);
|
g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_exec_edit), run_stop_model_exec);
|
||||||
g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_model_exec_depends_on_edition), NULL);
|
|
||||||
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 (exec_xor_edit));
|
||||||
|
|
||||||
gtk_window_set_titlebar (window, header_bar);
|
|
||||||
|
|
||||||
GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_toggle_button_new ());
|
|
||||||
gtk_button_set_icon_name (run_stop_model_exec, "system-shutdown-symbolic");
|
|
||||||
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-pause-symbolic");
|
|
||||||
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-start-symbolic");
|
|
||||||
g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (ui_toggle_model_exec), NULL);
|
|
||||||
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 (run_stop_model_exec));
|
||||||
|
gtk_window_set_titlebar (window, header_bar);
|
||||||
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
in_depth.c
12
in_depth.c
|
@ -12,15 +12,9 @@ static int run_stop_val = STOP;
|
||||||
// --- EXEC / EDIT ---------------------------------------------------------
|
// --- EXEC / EDIT ---------------------------------------------------------
|
||||||
|
|
||||||
int get_exec_edit_mode () {return run_edit_mode_val;}
|
int get_exec_edit_mode () {return run_edit_mode_val;}
|
||||||
void set_exec_edit_mode (int prescribed_mode)
|
void set_exec_edit_mode (int prescribed_mode) {run_edit_mode_val = prescribed_mode;}
|
||||||
{
|
// if (prescribed_mode == EDIT_MODE && run_stop_val == RUN) run_stop_val = STOP;
|
||||||
run_edit_mode_val = prescribed_mode;
|
// serait redondant car déjà fait dans le callback ui_toggle_exec_edit()
|
||||||
if (! run_stop_val) {
|
|
||||||
run_stop_val = STOP;
|
|
||||||
// Là, il faut envoyer un signal > signal connect
|
|
||||||
// set_run_xor_stop_exec (STOP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- RUN / STOP ----------------------------------------------------------
|
// --- RUN / STOP ----------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue