From df71c999f9345dd24ab382427d58ec3d924c0520 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 9 Sep 2024 08:14:04 +0200 Subject: [PATCH] widget/rules/selected/wip_menu.c widget_set_one_item_text_in_list (list_box, text) --- include/widget.h | 54 +++++++++++++------------- src/widget/rules/selected/wip_menu.c | 58 ++++++++++++++++++++++++---- 2 files changed, 78 insertions(+), 34 deletions(-) diff --git a/include/widget.h b/include/widget.h index 6031572..2f48c53 100644 --- a/include/widget.h +++ b/include/widget.h @@ -114,8 +114,8 @@ void *widget_get_engine_page(); // in : fsm / engine / engine.c /******************************************************************************/ /* S Y N T H */ /******************************************************************************/ -// called by : widget / synth / dispatch.c / widget_get_synth_page() -// defined in : widget / synth / time.c +// call: widget / synth / dispatch.c / widget_get_synth_page() +// def: widget / synth / time.c // repartitions.c WIP // correlations.c WIP @@ -130,9 +130,9 @@ void *widget_get_time_dependent_results_and_time_controls(); /******************************************************************************/ /* S T A T E */ /******************************************************************************/ -// called by : widget / state / dispatch.c / widget_get_state_page() -// defined in : widget / state / middle -// defined in : widget / state / bottom +// call: widget / state / dispatch.c / widget_get_state_page() +// def: widget / state / middle +// def: widget / state / bottom #define PARTITION_STATE_TOP 600 #define PARTITION_SPACE_VS_CONTROLS_1 920 @@ -147,17 +147,17 @@ void *widget_get_space_edit_control(); // bottom void *widget_get_sequence_control(); // bottom -// called by : widget / state / top.c / get_situations_box() -// called by : prefer.c -// defined in : widget / state / top.c +// call: widget / state / top.c / get_situations_box() +// call: prefer.c +// def: widget / state / top.c void widget_reset_all_situations_transparencies_to_value (int value); // top void widget_set_object_transparency_to_value (int rank, int value); // top int widget_get_object_transparency (int i); // top -// called by : signal.c -// defined in : widget / state / middle +// call: signal.c +// def: widget / state / middle void widget_state_XYZ_reset_all(); @@ -165,46 +165,48 @@ void widget_state_XYZ_reset_all(); /******************************************************************************/ /* R U L E S */ /******************************************************************************/ -// called by : widget / rules / dispatch.c / widget_get_rules_page() -// defined in : widget / rules / tree_tools / dispatch.c (= left) -// defined in : widget / rules / selected / dispatch.c (= right) +// call: widget / rules / dispatch.c / widget_get_rules_page() +// def: widget / rules / tree_tools / dispatch.c (= left) +// def: widget / rules / selected / dispatch.c (= right) void *widget_get_rules_tree_tools_pane(); void *widget_get_rules_selected_pane(); -// called by : widget / rules / tree_tools / dispatch.c / widget_get_rules_tree_tools_pane() -// defined in : widget / rules / tree_tools / pilot_box.c -// defined in : widget / rules / tree_tools / freq.c +// call: widget / rules / tree_tools / dispatch.c / widget_get_rules_tree_tools_pane() +// def: widget / rules / tree_tools / pilot_box.c +// def: widget / rules / tree_tools / freq.c void *widget_get_rules_pilot_box(); // pilot_box.c void *widget_get_rules_tree_tools(); // pilot_box.c void *widget_get_rules_use(); // freq.c -// called by : widget / rules / selected / dispatch.c / widget_get_rules_selected_pane() -// defined in : widget / rules / selected / dispatch.c -// defined in : widget / rules / selected / edit.c -// defined in : widget / rules / selected / analyse.c +// call: widget / rules / selected / dispatch.c / widget_get_rules_selected_pane() +// def: widget / rules / selected / dispatch.c +// def: widget / rules / selected / edit.c +// def: widget / rules / selected / analyse.c void *widget_get_selected_rule(); // dispatch.c void *widget_get_rule_edit(); // edit.c void *widget_get_rule_analyse(); // analyse.c -// called by : widget / rules / selected / dispatch.c / widget_get_selected_rule() -// defined in : widget / rules / selected / text.c -// defined in : widget / rules / selected / image.c +// call: widget / rules / selected / dispatch.c / widget_get_selected_rule() +// def: widget / rules / selected / text.c +// def: widget / rules / selected / image.c void *widget_get_selected_rule_texts(); void *widget_get_selected_rule_images(); void *widget_get_btt_conditions_list(); +// def: widget / rules / selected / wip_menu.c +GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text); /******************************************************************************/ /* D A T A */ /******************************************************************************/ -// called by : widget / results / dispatch / widget_get_data_page() -// defined in : widget / results / organize.c +// call: widget / results / dispatch / widget_get_data_page() +// def: widget / results / organize.c // display.c #define H_PARTITION_RESULTS 140 @@ -267,7 +269,7 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_ /* M E A S U R E S */ /******************************************************************************/ // called by : signal.c -// defined in : widget / measure / dispatch.c +// def: widget / measure / dispatch.c void *widget_measure_new(); // La séquence logique à suivre pour créer une nouvelle mesure diff --git a/src/widget/rules/selected/wip_menu.c b/src/widget/rules/selected/wip_menu.c index 119f950..1bbf76d 100644 --- a/src/widget/rules/selected/wip_menu.c +++ b/src/widget/rules/selected/wip_menu.c @@ -31,19 +31,54 @@ #include "../../../../include/widget.h" #include "../../../../include/signal.h" +#define LIST_W 190 +#define LIST_H 800 + +GtkEntry widget_set_one_item_text_in_list (GtkWidget *list_box, const char *text) +{ + int text_length = 40; + GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length); + GtkEntry *entry = GTK_ENTRY (gtk_entry_new ()); + gtk_entry_set_buffer (GTK_ENTRY (entry), GTK_ENTRY_BUFFER (entry_buffer)); + gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (entry)); + return *entry; +} void *widget_get_btt_conditions_list() { - GtkWidget* list_box = gtk_list_box_new(); - GtkWidget *label_A = GTK_WIDGET (gtk_label_new("if (value (0,0,1,3) == 2)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A); - GtkWidget *label_B = GTK_WIDGET (gtk_label_new("if (value (0,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B); - GtkWidget *label_C = GTK_WIDGET (gtk_label_new("if (value (0,1,1,2) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C); - GtkWidget *label_D = GTK_WIDGET (gtk_label_new("if (value (1,0,1,2) == 1)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D); - GtkWidget *label_E = GTK_WIDGET (gtk_label_new("if (value (1,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E); + GtkWidget *list_box = gtk_list_box_new(); + GtkWidget *scrolled_list_box = GTK_WIDGET (gtk_scrolled_window_new ()); + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_list_box), list_box); + gtk_widget_set_size_request (GTK_WIDGET (scrolled_list_box), LIST_W, LIST_H); // OK (provisoire) + + widget_set_one_item_text_in_list (list_box, "if ( value ( 0,2,0,1 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 0,0,1,3 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 0,1,1,0 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 0,1,1,2 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 1,0,1,2 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 1,1,1,0 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 2,2,0,1 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 2,0,1,3 ) == 3 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 3,4,1,0 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 5,1,5,2 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 5,0,3,4 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 5,4,1,7 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 6,2,0,1 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 7,7,7,3 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 7,1,4,10 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 7,4,3,2 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 8,0,1,2 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 1,8,1,0 ) == 0 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 2,2,8,1 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 9,9,1,3 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 3,9,4,5 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 5,6,7,12 ) == 1 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 7,0,3,4 ) == 2 )"); + widget_set_one_item_text_in_list (list_box, "if ( value ( 5,9,6,2 ) == 0 )"); GtkWidget *pop = gtk_popover_new (); - gtk_popover_set_child (GTK_POPOVER (pop), list_box); + gtk_popover_set_child (GTK_POPOVER (pop), scrolled_list_box); gtk_popover_present (GTK_POPOVER (pop)); gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE); gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE); @@ -57,7 +92,14 @@ void *widget_get_btt_conditions_list() return conditions; } -/* + + + + + +/* CHANTIER (actions) + + GSimpleActionGroup *ga = g_simple_action_group_new (); GtkShortcutAction *aa = gtk_named_action_new ("aa"); gtk_widget_insert_action_group (btt_A, "aa", G_ACTION_GROUP (ga)); // GActionGroup* group