WIP: adding a 'pilot box' in the rules pane

This commit is contained in:
Jean Sirmai 2024-07-28 16:50:39 +02:00
parent 6f84e6ca10
commit bcb4cfc9ed
Signed by: jean
GPG Key ID: FB3115C340E057E3
7 changed files with 125 additions and 83 deletions

View File

@ -87,7 +87,7 @@ int widget_get_object_transparency (int i); // top
// called in : src/widget/rules/distrib.c // called in : src/widget/rules/distrib.c
void *widget_get_selected_rule(); void *widget_get_selected_rule();
void *widget_get_rules_tree(); void *widget_get_rules_tree_and_pilot_box();
void *widget_get_rules_page(); void *widget_get_rules_page();
void *widget_get_rule_edit_controls(); void *widget_get_rule_edit_controls();
void *widget_get_rule_explore_controls(); void *widget_get_rule_explore_controls();

View File

@ -157,3 +157,10 @@ int main (int argc, char **argv)
// GTK itself does not support event sounds, << A GREAT WAY TO DEBUG ! TODO // GTK itself does not support event sounds, << A GREAT WAY TO DEBUG ! TODO
// you have to use a loadable module like the one that comes with libcanberra. // you have to use a loadable module like the one that comes with libcanberra.
// Property GtkSettings:gtk-error-bell
// property gtk-error-bell: gboolean [ read, write ]
// When TRUE, keyboard navigation and other input-related errors will cause a beep.

View File

@ -73,26 +73,35 @@
void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) { void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
struct TreeNode_t *a = widget_create_user_tree_node("We, the people");widget_add_child_node(tree_root, a); struct TreeNode_t *a = widget_create_user_tree_node("aware of"); widget_add_child_node(tree_root, a);
struct TreeNode_t *b = widget_create_user_tree_node("in Order to"); widget_add_child_node(tree_root, b); struct TreeNode_t *b = widget_create_user_tree_node("eager to"); widget_add_child_node(tree_root, b);
struct TreeNode_t *c = widget_create_user_tree_node("do establish"); widget_add_child_node(tree_root, c); struct TreeNode_t *c = widget_create_user_tree_node("decide"); widget_add_child_node(tree_root, c);
struct TreeNode_t *aa = widget_create_user_tree_node("aware of"); widget_add_child_node(a, aa); struct TreeNode_t *aaa = widget_create_user_tree_node("our rights"); widget_add_child_node(a, aaa);
struct TreeNode_t *aaa = widget_create_user_tree_node("our rights"); widget_add_child_node(aa, aaa); struct TreeNode_t *aab = widget_create_user_tree_node("our duties"); widget_add_child_node(a, aab);
struct TreeNode_t *aab = widget_create_user_tree_node("our duties"); widget_add_child_node(aa, aab);
struct TreeNode_t *aaa0 = widget_create_user_tree_node("speak"); widget_add_child_node(aaa, aaa0); struct TreeNode_t *aaa0 = widget_create_user_tree_node("speak"); widget_add_child_node(aaa, aaa0);
struct TreeNode_t *aaa1 = widget_create_user_tree_node("question"); widget_add_child_node(aaa, aaa1);
struct TreeNode_t *aaaa = widget_create_user_tree_node("read"); widget_add_child_node(aaa, aaaa); struct TreeNode_t *aaaa = widget_create_user_tree_node("read"); widget_add_child_node(aaa, aaaa);
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab); struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
struct TreeNode_t *aaaf = widget_create_user_tree_node("imagine"); widget_add_child_node(aaa, aaaf); struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
struct TreeNode_t *aaae = widget_create_user_tree_node("share"); widget_add_child_node(aaa, aaae); struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
struct TreeNode_t *aaac = widget_create_user_tree_node("copy"); widget_add_child_node(aaa, aaac); struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
struct TreeNode_t *aaad = widget_create_user_tree_node("edit"); widget_add_child_node(aaa, aaad);
struct TreeNode_t *aaaba= widget_create_user_tree_node("code"); widget_add_child_node(aaab, aaaba); struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
struct TreeNode_t *aaabb= widget_create_user_tree_node("language"); widget_add_child_node(aaab, aaabb);
struct TreeNode_t *aaabc= widget_create_user_tree_node("any art"); widget_add_child_node(aaab, aaabc); struct TreeNode_t *aaadx = widget_create_user_tree_node("edit"); widget_add_child_node(aaae, aaadx);
struct TreeNode_t *aaadb= widget_create_user_tree_node("publish"); widget_add_child_node(aaac, aaadb); struct TreeNode_t *aaadb = widget_create_user_tree_node("publish"); widget_add_child_node(aaae, aaadb);
struct TreeNode_t *aaada= widget_create_user_tree_node("create"); widget_add_child_node(aaad, aaada); // struct TreeNode_t *aaada = widget_create_user_tree_node("manifest"); widget_add_child_node(aaad, aaada);
struct TreeNode_t *aaba = widget_create_user_tree_node("learn"); widget_add_child_node(aab, aaba); struct TreeNode_t *aaba = widget_create_user_tree_node("learn"); widget_add_child_node(aab, aaba);
struct TreeNode_t *aabb = widget_create_user_tree_node("help"); widget_add_child_node(aab, aabb);
struct TreeNode_t *aabl = widget_create_user_tree_node("access"); widget_add_child_node(aaac, aabl);
struct TreeNode_t *aabm = widget_create_user_tree_node("free"); widget_add_child_node(aaac, aabm);
struct TreeNode_t *aabn = widget_create_user_tree_node("tools"); widget_add_child_node(aaac, aabn);
struct TreeNode_t *aabb = widget_create_user_tree_node("share"); widget_add_child_node(aab, aabb);
struct TreeNode_t *aabc = widget_create_user_tree_node("help"); widget_add_child_node(aab, aabc);
struct TreeNode_t *ba = widget_create_user_tree_node("promote"); widget_add_child_node(b, ba); struct TreeNode_t *ba = widget_create_user_tree_node("promote"); widget_add_child_node(b, ba);
struct TreeNode_t *bb = widget_create_user_tree_node("individual"); widget_add_child_node(b, bb); struct TreeNode_t *bb = widget_create_user_tree_node("individual"); widget_add_child_node(b, bb);
struct TreeNode_t *bc = widget_create_user_tree_node("and common"); widget_add_child_node(b, bc); struct TreeNode_t *bc = widget_create_user_tree_node("and common"); widget_add_child_node(b, bc);
@ -209,6 +218,14 @@ GtkBox *get_an_impression_of_what_a_rules_comparator_could_be(){
gtk_box_append (comparator, GTK_WIDGET (compare_left)); gtk_box_append (comparator, GTK_WIDGET (compare_left));
gtk_box_append (comparator, GTK_WIDGET (compare_right)); gtk_box_append (comparator, GTK_WIDGET (compare_right));
/*
GtkScrolledWindow *comparator = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new ());
GtkBox *inside = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (inside, GTK_WIDGET (compare_left));
gtk_box_append (inside, GTK_WIDGET (compare_right));
gtk_scrolled_window_set_child (comparator, GTK_WIDGET (inside));
*/
return comparator; return comparator;
} }

View File

@ -63,7 +63,7 @@ static void *widget_rule_itself_vs_explore_edit_pane()
void *widget_get_rules_page() void *widget_get_rules_page()
{ {
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); 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_start_child (H_tree_vs_selected, GTK_WIDGET (widget_get_rules_tree_and_pilot_box()));
gtk_paned_set_end_child (H_tree_vs_selected, GTK_WIDGET (widget_rule_itself_vs_explore_edit_pane())); 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_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_wide_handle (H_tree_vs_selected, TRUE);

View File

@ -32,7 +32,8 @@
#include "../../../include/signal.h" #include "../../../include/signal.h"
void *widget_get_rules_tree (){ static void *widget_get_rules_tree ()
{
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre"); // GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
@ -41,7 +42,7 @@ void *widget_get_rules_tree (){
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_get_user_rules_tree())); 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 gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET
(get_an_impression_of_what_a_rules_comparator_could_be())); (get_an_impression_of_what_a_rules_comparator_could_be()));
gtk_paned_set_position (H_tree_vs_comparison, 300); gtk_paned_set_position (H_tree_vs_comparison, 200);
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE); 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_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_shrink_start_child (H_tree_vs_comparison, FALSE);
@ -50,3 +51,19 @@ void *widget_get_rules_tree (){
return GTK_WIDGET (H_tree_vs_comparison); return GTK_WIDGET (H_tree_vs_comparison);
} }
static void *widget_get_rules_pilot_box ()
{
GtkBox *rules_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (rules_pilot_box,
GTK_WIDGET (gtk_label_new ("\n - - - - - - - (some widgets here) - - - - - - - \n")));
return rules_pilot_box;
}
void *widget_get_rules_tree_and_pilot_box ()
{
GtkBox *rules_tree_and_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_pilot_box ()));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_tree ()));
return rules_tree_and_pilot_box;
}

View File

@ -189,6 +189,7 @@ static void window_header_bar_right (GtkWidget *header_bar)
GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ()); GtkButton *btt_go_home = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (btt_go_home, "go-home-symbolic"); gtk_button_set_icon_name (btt_go_home, "go-home-symbolic");
// gtk_widget_error_bell (GTK_WIDGET (btt_go_home)); << TODO si c'est possible ?
g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data); g_signal_connect (btt_go_home, "clicked", G_CALLBACK (on_clicked_home), no_local_data);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home)); gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home));

View File

@ -85,7 +85,7 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
void *widget_get_user_rules_tree () void *widget_get_user_rules_tree ()
{ {
struct TreeNode_t *tree_root = widget_create_user_tree_node("root"); struct TreeNode_t *tree_root = widget_create_user_tree_node("We, the people,");
widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root); widget_let_us_create_a_complex_useless_and_expensive_tree (tree_root);
GtkStringList *model = gtk_string_list_new(NULL); GtkStringList *model = gtk_string_list_new(NULL);