A pilot box to control the user rules tree, the rules use and the comparator (TODO)

This commit is contained in:
Jean Sirmai 2024-07-29 15:15:08 +02:00
parent f11ab2e05e
commit f0c8d91933
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 36 additions and 21 deletions

View File

@ -43,7 +43,7 @@ enum fsm_choice_STATE_RULES_DATA { 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 64 // arbitrary #define n_rules 128 // arbitrary
#define n_objects 32 // arbitrary too, #define n_objects 32 // arbitrary too,
#define n_situations 128 // and so on... #define n_situations 128 // and so on...

View File

@ -60,7 +60,7 @@ static void *get_rule_before()
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")));
gtk_box_append (rule_before, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (rule_before, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (rule_before, GTK_WIDGET (get_under_rule_before())); gtk_box_append (rule_before, GTK_WIDGET (get_under_rule_before()));
gtk_widget_set_size_request (GTK_WIDGET (rule_before), W_IMAGE_LOCAL / 2, H_IMAGE_LOCAL / 1.46); gtk_widget_set_size_request (GTK_WIDGET (rule_before), W_IMAGE_LOCAL / 4, H_IMAGE_LOCAL / 3);
return GTK_WIDGET (rule_before); return GTK_WIDGET (rule_before);
} }
@ -85,7 +85,7 @@ void *widget_get_selected_rule() {
gtk_paned_set_shrink_start_child (before_vs_after, TRUE); gtk_paned_set_shrink_start_child (before_vs_after, TRUE);
gtk_paned_set_shrink_end_child (before_vs_after, TRUE); gtk_paned_set_shrink_end_child (before_vs_after, TRUE);
gtk_paned_set_position (before_vs_after, 785); // WARNING : c'est une position "absolue" gtk_paned_set_position (before_vs_after, 770); // WARNING : c'est une position "absolue"
// gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL, H_IMAGE_LOCAL); // gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
return GTK_WIDGET (before_vs_after); return GTK_WIDGET (before_vs_after);

View File

@ -38,9 +38,18 @@ static GtkAdjustment *rule_adjust [n_rules];
static void *static_widget_get_rules_use () static void *static_widget_get_rules_use ()
{ {
GtkBox *rules_use_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); GtkBox *rules_use_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
GtkWidget *scroll_rules_use = gtk_scrolled_window_new ();
// gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_rules_use), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
// GtkWidget *frame_rules_use = gtk_frame_new (" Rules use");
// gtk_frame_set_child (GTK_FRAME (frame_rules_use), GTK_WIDGET (scroll_rules_use));
gtk_widget_set_size_request (GTK_WIDGET (scroll_rules_use), W_IMAGE_LOCAL * 2, 0);//H_IMAGE_LOCAL);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll_rules_use), GTK_WIDGET (rules_use_box));
for (int i = 0; i < n_rules; i++) for (int i = 0; i < n_rules; i++)
{ {
rule_adjust [i] = gtk_adjustment_new (exp(i), 0, 127, 1, 0, 0); rule_adjust [i] = gtk_adjustment_new (- rand() % 16 + n_rules - i, 0, 127, 1, 0, 0);
rule_bar [i] = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, rule_bar [i] = GTK_SCROLLBAR (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL,
rule_adjust [i])); rule_adjust [i]));
char tooltip_text[8]; char tooltip_text[8];
@ -53,27 +62,31 @@ static void *static_widget_get_rules_use ()
gtk_box_append (rules_use_box, GTK_WIDGET (rule_bar [i])); gtk_box_append (rules_use_box, GTK_WIDGET (rule_bar [i]));
} }
return rules_use_box; return scroll_rules_use;
}
static void *deprec_widget_get_rules_tree ()
{
GtkPaned *rules_tree_paned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
gtk_paned_set_start_child (rules_tree_paned, GTK_WIDGET (widget_get_user_rules_tree()));
gtk_paned_set_end_child (rules_tree_paned, GTK_WIDGET (static_widget_get_rules_use ()));
// (get_an_impression_of_what_a_rules_comparator_could_be()));
gtk_paned_set_position (rules_tree_paned, 200);
gtk_paned_set_wide_handle (rules_tree_paned, TRUE);
gtk_widget_set_size_request (GTK_WIDGET (rules_tree_paned), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
gtk_paned_set_shrink_start_child (rules_tree_paned, FALSE);
gtk_paned_set_resize_end_child (rules_tree_paned, FALSE);
gtk_paned_set_shrink_end_child (rules_tree_paned, FALSE);
return GTK_WIDGET (rules_tree_paned);
} }
void *widget_get_rules_tree () void *widget_get_rules_tree ()
{ {
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); GtkBox *rules_tree_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_user_rules_tree()));
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre"); gtk_box_append (rules_tree_box, GTK_WIDGET (static_widget_get_rules_use ()));
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection"); gtk_box_append (rules_tree_box, GTK_WIDGET (get_an_impression_of_what_a_rules_comparator_could_be()));
// GTK_SCROLLED_WINDOW return GTK_WIDGET (rules_tree_box);
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_get_user_rules_tree()));
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET
(static_widget_get_rules_use ()));
// (get_an_impression_of_what_a_rules_comparator_could_be()));
gtk_paned_set_position (H_tree_vs_comparison, 200);
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE);
gtk_widget_set_size_request (GTK_WIDGET (H_tree_vs_comparison), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
gtk_paned_set_shrink_start_child (H_tree_vs_comparison, FALSE);
gtk_paned_set_resize_end_child (H_tree_vs_comparison, FALSE);
gtk_paned_set_shrink_end_child (H_tree_vs_comparison, FALSE);
return GTK_WIDGET (H_tree_vs_comparison);
} }

View File

@ -115,6 +115,8 @@ void *widget_get_user_rules_tree ()
gtk_widget_set_vexpand (GTK_WIDGET (scrolled_window), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (scrolled_window), TRUE);
gtk_widget_set_visible (GTK_WIDGET (scrolled_window), TRUE); gtk_widget_set_visible (GTK_WIDGET (scrolled_window), TRUE);
gtk_widget_set_visible (GTK_WIDGET (list_view), TRUE); gtk_widget_set_visible (GTK_WIDGET (list_view), TRUE);
gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), W_IMAGE_LOCAL * 3, 0);
return scrolled_window; return scrolled_window;
} }