From 6f84e6ca10dd81e59176be3a6a9017a1235a79cc Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 28 Jul 2024 05:44:48 +0200 Subject: [PATCH] Finite State Machine OK (transitions EXEC / EDIT in State and Rules pages) --- include/widget.h | 4 ++-- src/widget/rules/distrib.c | 43 +++++++++++++++++++++-------------- src/widget/rules/explore_edit | 4 ++-- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/include/widget.h b/include/widget.h index e65e6dc..7324a5e 100644 --- a/include/widget.h +++ b/include/widget.h @@ -89,8 +89,8 @@ int widget_get_object_transparency (int i); // top void *widget_get_selected_rule(); void *widget_get_rules_tree(); void *widget_get_rules_page(); -void *widget_get_rule_edit_control(); -//void *widget_get_rule_explore_control(); +void *widget_get_rule_edit_controls(); +void *widget_get_rule_explore_controls(); /******************************************************************************/ diff --git a/src/widget/rules/distrib.c b/src/widget/rules/distrib.c index 87799f4..b447d61 100644 --- a/src/widget/rules/distrib.c +++ b/src/widget/rules/distrib.c @@ -32,30 +32,39 @@ #include "../../../include/signal.h" -static void *widget_get_rule_explore_control() +static void *static_widget_get_rule_explore_controls() { - return gtk_label_new - ("_______________\n RULE EXPLORE\n controls\n'''''''''''''''''''''''''"); + return gtk_label_new ("________________\n RULE EXPLORE\n\ + controls\n'''''''''''''''''''''''''''''"); } -static void *widget_rule_itself_vs_explore_edit () { - - GtkPaned *rule_itself_vs_explore_edit = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); - gtk_paned_set_start_child (rule_itself_vs_explore_edit, GTK_WIDGET (widget_get_selected_rule ())); - gtk_paned_set_end_child (rule_itself_vs_explore_edit, GTK_WIDGET (widget_get_rule_explore_control ())); - gtk_paned_set_position (rule_itself_vs_explore_edit, 800); // WARNING : c'est une position "absolue" - gtk_paned_set_wide_handle (rule_itself_vs_explore_edit, TRUE); - gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit, FALSE); - gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit, FALSE); - - return GTK_WIDGET (rule_itself_vs_explore_edit); +static void *static_widget_get_rule_edit_controls() +{ + return gtk_label_new + ("___________\n RULE EDIT\n controls\n''''''''''''''''''''"); } -void *widget_get_rules_page () { +static void *widget_rule_itself_vs_explore_edit_pane() +{ + GtkPaned *rule_itself_vs_explore_edit_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); + gtk_paned_set_start_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_selected_rule())); + if (fsm_get_exec_edit()) gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane, + GTK_WIDGET (static_widget_get_rule_edit_controls())); + else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane, + GTK_WIDGET (static_widget_get_rule_explore_controls())); + gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 800); // WARNING : c'est une position "absolue" + gtk_paned_set_wide_handle (rule_itself_vs_explore_edit_pane, TRUE); + gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE); + gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit_pane, FALSE); + return GTK_WIDGET (rule_itself_vs_explore_edit_pane); +} + +void *widget_get_rules_page() +{ GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (widget_get_rules_tree ())); - gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (widget_rule_itself_vs_explore_edit ())); + gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (widget_get_rules_tree())); + gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (widget_rule_itself_vs_explore_edit_pane())); gtk_paned_set_position (H_tree_vs_selected, 340); // WARNING : c'est une position "absolue" gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE); gtk_paned_set_shrink_start_child (H_tree_vs_selected, FALSE); diff --git a/src/widget/rules/explore_edit b/src/widget/rules/explore_edit index a82c614..9218967 100644 --- a/src/widget/rules/explore_edit +++ b/src/widget/rules/explore_edit @@ -32,14 +32,14 @@ #include "../../../include/signal.h" -void *widget_get_rule_edit_control() +void *widget_get_rule_explore_controls() { return gtk_label_new ("_____________\n RULE EDIT\n controls\n'''''''''''''''''''''''"); } /* -void *widget_get_rule_explore_control() +void *widget_get_rule_explore_controls() { return gtk_label_new ("_____________\n RULE EXPLORE\n controls\n'''''''''''''''''''''''");