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
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_rule_edit_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
// 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) {
struct TreeNode_t *a = widget_create_user_tree_node("We, the people");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 *c = widget_create_user_tree_node("do establish"); 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(aa, aaa);
struct TreeNode_t *aab = widget_create_user_tree_node("our duties"); widget_add_child_node(aa, aab);
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("eager to"); widget_add_child_node(tree_root, b);
struct TreeNode_t *c = widget_create_user_tree_node("decide"); widget_add_child_node(tree_root, c);
struct TreeNode_t *aaa = widget_create_user_tree_node("our rights"); widget_add_child_node(a, aaa);
struct TreeNode_t *aab = widget_create_user_tree_node("our duties"); widget_add_child_node(a, aab);
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 *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 *aaae = widget_create_user_tree_node("share"); widget_add_child_node(aaa, aaae);
struct TreeNode_t *aaac = widget_create_user_tree_node("copy"); widget_add_child_node(aaa, aaac);
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 *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 *aaadb= widget_create_user_tree_node("publish"); widget_add_child_node(aaac, aaadb);
struct TreeNode_t *aaada= widget_create_user_tree_node("create"); widget_add_child_node(aaad, aaada);
struct TreeNode_t *aaac = widget_create_user_tree_node("compute"); widget_add_child_node(aaa, aaac);
struct TreeNode_t *aaad = widget_create_user_tree_node("code"); widget_add_child_node(aaa, aaad);
struct TreeNode_t *aaae = widget_create_user_tree_node("interact"); widget_add_child_node(aaa, aaae);
struct TreeNode_t *aaaco = widget_create_user_tree_node("copy"); widget_add_child_node(aaaa, aaaco);
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(aaae, aaadb);
// 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 *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 *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);
@ -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_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;
}

View File

@ -63,7 +63,7 @@ static void *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_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_position (H_tree_vs_selected, 340); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (H_tree_vs_selected, TRUE);

View File

@ -32,7 +32,8 @@
#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));
// 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_end_child (H_tree_vs_comparison, GTK_WIDGET
(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_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);
@ -50,3 +51,19 @@ void *widget_get_rules_tree (){
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 ());
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);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_go_home));
@ -205,8 +206,8 @@ static void window_header_bar_right (GtkWidget *header_bar)
// https://discourse.gnome.org/t/when-do-we-really-have-to-use-gtk-popover-present-to-show-a-popover-at-a-given-widget/17566/5
// https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
// https://discourse.gnome.org/t/when-do-we-really-have-to-use-gtk-popover-present-to-show-a-popover-at-a-given-widget/17566/5
// https://stackoverflow.com/questions/69135934/creating-a-simple-menubar-menu-and-menu-item-in-c-using-gtk4
GtkWidget* list_box = gtk_list_box_new();
@ -231,11 +232,11 @@ static void window_header_bar_right (GtkWidget *header_bar)
g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL);
// gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu);
// gtk_menu_item_activate (label_C);
// g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect));
// GMenuItem *label_E = g_menu_item_new("connect", "app.connect");
// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (label_E));
// gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu);
// gtk_menu_item_activate (label_C);
// g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect));
// GMenuItem *label_E = g_menu_item_new("connect", "app.connect");
// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (label_E));
@ -246,7 +247,7 @@ static void window_header_bar_right (GtkWidget *header_bar)
/*
/*
https://docs.gtk.org/gtk4/class.ListView.html
GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list ();
@ -259,7 +260,7 @@ static void window_header_bar_right (GtkWidget *header_bar)
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
*/
*/
@ -275,7 +276,7 @@ static void window_header_bar_right (GtkWidget *header_bar)
printf("selected_row = %s\n",
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (selected_row))));
// g_signal_connect (label_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
// g_signal_connect (label_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data);
}

View File

@ -85,7 +85,7 @@ static GListModel *get_user_tree_model (GObject *item, gpointer root)
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);
GtkStringList *model = gtk_string_list_new(NULL);