From a70987a860a2e85b3bd9eccc9e7f952f774cc354 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sat, 27 Jul 2024 12:34:32 +0200 Subject: [PATCH] in widget is a rule directory. It has three files : rules_tree.c selected_rule.c & distrib.c --- include/fsm.h | 9 ++-- include/signal.h | 5 --- include/widget.h | 12 ++++++ src/widget/rules/distrib.c | 47 +++++++++++++++++++++ src/widget/{rules.c => rules/rules_tree.c} | 35 ++-------------- src/widget/rules/selected_rule.c | 48 ++++++++++++++++++++++ 6 files changed, 116 insertions(+), 40 deletions(-) create mode 100644 src/widget/rules/distrib.c rename src/widget/{rules.c => rules/rules_tree.c} (64%) create mode 100644 src/widget/rules/selected_rule.c diff --git a/include/fsm.h b/include/fsm.h index 379e3c6..a6e3dbe 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -43,7 +43,7 @@ enum fsm_choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor -#define n_objects 32 +#define n_objects 32 // arbitrary... #define n_situations 128 @@ -56,7 +56,8 @@ void fsm_set_exec_edit (int value); void fsm_set_state_rules_data (int value); void fsm_set_store_restore_reset (int target, int value); -void fsm_reset_all_situations_transparencies_at_value (int value); -bool fsm_get_preferences_state (); -void fsm_set_preferences_state (bool value); +void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... + +bool fsm_get_preferences_state (); +void fsm_set_preferences_state (bool value); diff --git a/include/signal.h b/include/signal.h index 7f91e0e..466067f 100644 --- a/include/signal.h +++ b/include/signal.h @@ -128,11 +128,6 @@ void on_clicked_search (GtkWidget *btt_menu, gpointer list_box); /******************************************************************************/ void on_updating_objects_transparencies (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -/* -void on_objects_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -void on_objects_box_do_store (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -void on_objects_box_do_restore (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); -*/ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar); diff --git a/include/widget.h b/include/widget.h index 58374d4..ae6cb40 100644 --- a/include/widget.h +++ b/include/widget.h @@ -59,6 +59,8 @@ void *widget_get_state_page(); // in : src/widget/state/distrib.c void *widget_get_rules_page(); // in : src/widget/rules.c void *widget_get_stock_page(); // in : src/widget/stock.c +#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran) +#define H_IMAGE_LOCAL 960 /******************************************************************************/ /* S T A T E */ @@ -79,6 +81,16 @@ int widget_get_object_transparency (int i); // top +/******************************************************************************/ +/* R U L E S */ +/******************************************************************************/ +// called in : src/widget/rules/distrib.c + +void *get_the_selected_rule(); +void *get_rules_tree(); +void *widget_get_rules_page(); + + /******************************************************************************/ /* S T O C K */ /******************************************************************************/ diff --git a/src/widget/rules/distrib.c b/src/widget/rules/distrib.c new file mode 100644 index 0000000..d98e7ba --- /dev/null +++ b/src/widget/rules/distrib.c @@ -0,0 +1,47 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Rules * +* * +* Copyright © 2021 Libre en Communs * +* 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/fsm.h" +#include "../../../include/widget.h" +#include "../../../include/signal.h" + + +void *widget_get_rules_page() { + GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); + // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); + // GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection"); + gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (get_rules_tree())); + gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (get_the_selected_rule())); + gtk_paned_set_position (H_tree_vs_selected, 400); // 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); + gtk_paned_set_shrink_end_child (H_tree_vs_selected, FALSE); + return GTK_WIDGET (H_tree_vs_selected); +} + diff --git a/src/widget/rules.c b/src/widget/rules/rules_tree.c similarity index 64% rename from src/widget/rules.c rename to src/widget/rules/rules_tree.c index 9dc663c..107f028 100644 --- a/src/widget/rules.c +++ b/src/widget/rules/rules_tree.c @@ -27,26 +27,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "../../include/widget.h" +#include "../../../include/fsm.h" +#include "../../../include/widget.h" +#include "../../../include/signal.h" -#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran) -#define H_IMAGE_LOCAL 960 -static GtkWidget *rec_selected_rules_vpaned_new() { - - GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); - gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (bottom_box, GTK_WIDGET (gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); - gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (bottom_box, GTK_WIDGET (gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"))); - gtk_widget_set_size_request (GTK_WIDGET (bottom_box), W_IMAGE_LOCAL, H_IMAGE_LOCAL); - - return GTK_WIDGET (bottom_box); -} - -static GtkWidget *rec_rules_tree_hpaned_new(){ +void *get_rules_tree(){ GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre"); @@ -64,16 +50,3 @@ static GtkWidget *rec_rules_tree_hpaned_new(){ return GTK_WIDGET (H_tree_vs_comparison); } -void *widget_get_rules_page() { - GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles"); - // GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection"); - gtk_paned_set_start_child (H_tree_vs_selected, GTK_WIDGET (rec_rules_tree_hpaned_new())); - gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (rec_selected_rules_vpaned_new())); - gtk_paned_set_position (H_tree_vs_selected, 400); // 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); - gtk_paned_set_shrink_end_child (H_tree_vs_selected, FALSE); - return GTK_WIDGET (H_tree_vs_selected); -} - diff --git a/src/widget/rules/selected_rule.c b/src/widget/rules/selected_rule.c new file mode 100644 index 0000000..cb1215f --- /dev/null +++ b/src/widget/rules/selected_rule.c @@ -0,0 +1,48 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Gem-graph client * +* * +* Rules * +* * +* Copyright © 2021 Libre en Communs * +* 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/fsm.h" +#include "../../../include/widget.h" +#include "../../../include/signal.h" + + +void *get_the_selected_rule() { + + GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (bottom_box, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); + gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (bottom_box, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"))); + gtk_widget_set_size_request (GTK_WIDGET (bottom_box), W_IMAGE_LOCAL, H_IMAGE_LOCAL); + + return GTK_WIDGET (bottom_box); +} +