From 96305bb4b72f6b1afcbd53dbad45435d8406c1b0 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 10 Sep 2024 13:40:57 +0200 Subject: [PATCH] one rule reorganization --- include/util.h | 13 -- include/widget.h | 30 ++- src/signal.c | 23 +- .../compare/interest.c} | 0 src/widget/{rules => all_rules}/dispatch.c | 15 +- .../{rules => all_rules}/tree/dispatch.c | 2 +- src/widget/{rules => all_rules}/tree/freq.c | 0 src/widget/{rules => all_rules}/tree/labo.c | 0 .../{rules => all_rules}/tree/pilot_box.c | 0 src/widget/{rules => all_rules}/tree/tree.c | 0 src/widget/dispatch.c | 27 ++- src/widget/one_rule/algebra/assign.c | 65 ++++++ src/widget/one_rule/algebra/conditions.c | 66 ++++++ .../algebra/dispatch.c} | 21 +- src/widget/one_rule/algebra/identity.c | 64 ++++++ src/widget/one_rule/algebra/utilities.c | 109 +++++++++ .../dispatch.c} | 22 +- .../geometry.c => one_rule/geometry/camera.c} | 40 +--- src/widget/one_rule/geometry/dispatch.c | 47 ++++ .../edit.c => one_rule/geometry/edit_tools.c} | 0 .../{rules => one_rule}/geometry/enquire.c | 0 src/widget/one_rule/geometry/geometry.c | 63 ++++++ src/widget/rules/algebra/utilities.c | 211 ------------------ src/widget/state/dispatch.c | 2 +- 24 files changed, 520 insertions(+), 300 deletions(-) rename src/widget/{rules/tree/compare.c => all_rules/compare/interest.c} (100%) rename src/widget/{rules => all_rules}/dispatch.c (77%) rename src/widget/{rules => all_rules}/tree/dispatch.c (98%) rename src/widget/{rules => all_rules}/tree/freq.c (100%) rename src/widget/{rules => all_rules}/tree/labo.c (100%) rename src/widget/{rules => all_rules}/tree/pilot_box.c (100%) rename src/widget/{rules => all_rules}/tree/tree.c (100%) create mode 100644 src/widget/one_rule/algebra/assign.c create mode 100644 src/widget/one_rule/algebra/conditions.c rename src/widget/{rules/algebra/dispatch_cond_act_id.c => one_rule/algebra/dispatch.c} (83%) create mode 100644 src/widget/one_rule/algebra/identity.c create mode 100644 src/widget/one_rule/algebra/utilities.c rename src/widget/{rules/geometry/dispatch_edit_enq.c => one_rule/dispatch.c} (81%) rename src/widget/{rules/geometry/geometry.c => one_rule/geometry/camera.c} (73%) create mode 100644 src/widget/one_rule/geometry/dispatch.c rename src/widget/{rules/geometry/edit.c => one_rule/geometry/edit_tools.c} (100%) rename src/widget/{rules => one_rule}/geometry/enquire.c (100%) create mode 100644 src/widget/one_rule/geometry/geometry.c delete mode 100644 src/widget/rules/algebra/utilities.c diff --git a/include/util.h b/include/util.h index 735095e..6e46335 100644 --- a/include/util.h +++ b/include/util.h @@ -37,19 +37,6 @@ char *util_read_file (char *filename); -//------------------------------------------------------------------------------ -// https://chgi.developpez.com/liste/ < ^c^v -// Copyright © 2016 CGi. -// Aucune reproduction, même partielle, ne peut être faite de ce site -// ni de l'ensemble de son contenu : textes, documents, images, etc. -// sans l'autorisation expresse de l'auteur. -// Sinon vous encourez selon la loi jusqu'à trois ans de prison -// et jusqu'à 300 000 € de dommages et intérêts. - -// Le piratage est illégal, -// de même que sont interdits: cracks, warez, sérials (sauf évaluation), etc. -// Est bien sûr autorisé tout ce qui concerne les logiciels gratuits, freewares et évaluation. -//------------------------------------------------------------------------------ typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément diff --git a/include/widget.h b/include/widget.h index 488a7d6..1f24e83 100644 --- a/include/widget.h +++ b/include/widget.h @@ -105,11 +105,20 @@ void window_design_topbar_right (GtkWidget *header_bar, GtkApplication *app); void *widget_get_synth_page(); // in : widget / synth / dispatch.c void *widget_get_state_page(); // in : widget / state / dispatch.c -void *widget_get_rules_page(); // in : widget / rules / dispatch.c void *widget_get_data_page(); // in : widget / data / dispatch.c void *widget_get_measure_page();// in : widget / measure / dispatch.c void *widget_get_engine_page(); // in : fsm / engine / engine.c +/* The rules page consists of two half-pages in a GtkPaned widget : + * - on the left, widgets for controlling or editing all the rules. + * - on the right, widgets for controlling or editing the selected rule. + * This distribution is therefore moved into signal switch_state_rules_data() + * and the previous "widget_get_rules_page()" function which was in: + * widget / rules / dispatch.c is replaced (2024-09-10) by the two functions : + * - widget_get_all_rules_left_pane() in widget / all_rules / dispatch + * - widget_get_selected_rule_right_pane() in widget / one_rule / dispatch */ + +#define ALL_VS_SELECTED 340 /******************************************************************************/ /* S Y N T H */ @@ -163,17 +172,24 @@ void widget_state_XYZ_reset_all(); /******************************************************************************/ -/* R U L E S */ +/* A L L R U L E S */ +/******************************************************************************/ +/******************************************************************************/ +/* O N E R U L E */ /******************************************************************************/ // 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_single_selected_rule_pane(); +#define LIST_W 190 +#define LIST_H 114 +void *widget_get_all_rules_left_pane(); +void *widget_get_selected_rule_right_pane(); -// call: widget / rules / tree_tools / dispatch.c / widget_get_rules_tree_tools_pane() +void *widget_get_geometry_algebra(); + +// call: widget / rules / tree_tools / dispatch.c / widget_get_all_rules_left_pane() // def: widget / rules / tree_tools / pilot_box.c // def: widget / rules / tree_tools / freq.c @@ -182,7 +198,7 @@ void *widget_get_rules_tree_tools(); // pilot_box.c void *widget_get_rules_use(); // freq.c -// call: widget / rules / selected / dispatch.c / widget_get_single_selected_rule_pane() +// call: widget / rules / selected / dispatch.c / widget_get_one_rule_right_pane() // def: widget / rules / selected / dispatch.c // def: widget / rules / selected / edit.c // def: widget / rules / selected / enquire.c @@ -203,6 +219,8 @@ void *widget_get_btt_rule_identity(); // def: widget / rules / selected / wip_menu.c GtkEntry widget_set_item_text (GtkWidget *list_box, const char *text, bool editable); +void *widget_get_selected_rule_camera(); +void *widget_get_selected_rule_before_after(); /******************************************************************************/ /* D A T A */ diff --git a/src/signal.c b/src/signal.c index b64c9a6..d50075d 100644 --- a/src/signal.c +++ b/src/signal.c @@ -274,8 +274,27 @@ static void switch_state_rules_data() break; case (RULES) : - gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), - GTK_WIDGET (widget_get_rules_page())); + /* The rules page consists of two half-pages in a GtkPaned widget : + * - on the left, widgets for controlling or editing all the rules. + * - on the right, widgets for controlling or editing the selected rule. + * This distribution is therefore moved to this file + * instead of having a "widget_get_rules_page()" function. + */ + GtkPaned *widget_all_vs_selected_one = + GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); + + gtk_paned_set_start_child (widget_all_vs_selected_one, + GTK_WIDGET (widget_get_all_rules_left_pane())); + gtk_paned_set_end_child (widget_all_vs_selected_one, + GTK_WIDGET (widget_get_selected_rule_right_pane())); + + gtk_paned_set_position (widget_all_vs_selected_one, ALL_VS_SELECTED); + gtk_paned_set_wide_handle (widget_all_vs_selected_one, TRUE); + gtk_paned_set_shrink_start_child (widget_all_vs_selected_one, FALSE); + gtk_paned_set_shrink_end_child (widget_all_vs_selected_one, FALSE); + + gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), + GTK_WIDGET (widget_all_vs_selected_one)); break; case (DATA) : diff --git a/src/widget/rules/tree/compare.c b/src/widget/all_rules/compare/interest.c similarity index 100% rename from src/widget/rules/tree/compare.c rename to src/widget/all_rules/compare/interest.c diff --git a/src/widget/rules/dispatch.c b/src/widget/all_rules/dispatch.c similarity index 77% rename from src/widget/rules/dispatch.c rename to src/widget/all_rules/dispatch.c index 405f764..869309c 100644 --- a/src/widget/rules/dispatch.c +++ b/src/widget/all_rules/dispatch.c @@ -32,16 +32,9 @@ #include "../../../include/signal.h" -void *widget_get_rules_page() -{ - GtkPaned *tree_vs_selected_one = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_paned_set_start_child (tree_vs_selected_one, GTK_WIDGET (widget_get_rules_tree_tools_pane())); - gtk_paned_set_end_child (tree_vs_selected_one, GTK_WIDGET (widget_get_single_selected_rule_pane())); - gtk_paned_set_position (tree_vs_selected_one, 340); // WARNING : c'est une position "absolue" - gtk_paned_set_wide_handle (tree_vs_selected_one, TRUE); - gtk_paned_set_shrink_start_child (tree_vs_selected_one, FALSE); - gtk_paned_set_shrink_end_child (tree_vs_selected_one, FALSE); - return GTK_WIDGET (tree_vs_selected_one); -} +/* The rules page consists of two half-pages: + * - on the left, widgets for controlling or editing all the rules. + * - on the right, widgets for controlling or editing the selected rule. + */ diff --git a/src/widget/rules/tree/dispatch.c b/src/widget/all_rules/tree/dispatch.c similarity index 98% rename from src/widget/rules/tree/dispatch.c rename to src/widget/all_rules/tree/dispatch.c index bcd30c5..aec2b3c 100644 --- a/src/widget/rules/tree/dispatch.c +++ b/src/widget/all_rules/tree/dispatch.c @@ -32,7 +32,7 @@ #include "../../../../include/signal.h" -void *widget_get_rules_tree_tools_pane () +void *widget_get_all_rules_left_pane () { 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 ())); diff --git a/src/widget/rules/tree/freq.c b/src/widget/all_rules/tree/freq.c similarity index 100% rename from src/widget/rules/tree/freq.c rename to src/widget/all_rules/tree/freq.c diff --git a/src/widget/rules/tree/labo.c b/src/widget/all_rules/tree/labo.c similarity index 100% rename from src/widget/rules/tree/labo.c rename to src/widget/all_rules/tree/labo.c diff --git a/src/widget/rules/tree/pilot_box.c b/src/widget/all_rules/tree/pilot_box.c similarity index 100% rename from src/widget/rules/tree/pilot_box.c rename to src/widget/all_rules/tree/pilot_box.c diff --git a/src/widget/rules/tree/tree.c b/src/widget/all_rules/tree/tree.c similarity index 100% rename from src/widget/rules/tree/tree.c rename to src/widget/all_rules/tree/tree.c diff --git a/src/widget/dispatch.c b/src/widget/dispatch.c index ac3248e..035f817 100644 --- a/src/widget/dispatch.c +++ b/src/widget/dispatch.c @@ -61,7 +61,7 @@ static void action_b (GSimpleAction *action, GVariant *parameter, GApplication *application) {printf ("action_b() in widget/dispatch.c\n");} -void on_windows_startup (GtkApplication *app) +void on_windows_startup (GtkApplication *app) // WIP 2024-09 { printf ("widget/dispatch |\ on_windows_startup() is in: widget/dispatch.c NOT in: src/signal.c\n"); @@ -72,18 +72,35 @@ void on_windows_activation (GtkApplication *app) { printf ("widget/dispatch |\ on_windows_activation() is in: widget/dispatch.c NOT in: src/signal.c\n"); -// g_application_activate (G_APPLICATION (app)); < how ? > in main.c is -// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); + // g_application_activate (G_APPLICATION (app)); < how ? > in main.c is + // g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); main_window = GTK_WINDOW (gtk_application_window_new (app)); dialog_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app)); - widget_design_main_window (main_window, app); // def: widget/topbar/dispatch + // ------------------------------------------------------------------------ + // For the breakdown between pages, see signal > switch_state_rules_data() + + // NB The rules page consists of two half-pages in a GtkPaned widget : + // - on the left, widgets for controlling or editing all the rules. + // - on the right, widgets for controlling or editing the selected rule. + + // The preferred 'First Page' (the page displayed when the window is opened) + // is selected in: widget/topbar/left window_design_topbar_left() + // until it is defined in the fsm (2024-09) + // ------------------------------------------------------------------------ + widget_design_main_window (main_window, app); // def: widget/topbar/dispatch widget_design_dialog_window (main_window, dialog_window); widget_design_text_window (main_window, text_window); + // ------------------------------------------------------------------------ - //https://github.com/ToshioCP/Gtk4-tutorial/blob/main/gfm/sec17.md + + + + // ------------------------------------------------------------------------ + // WIP 2024-09 + // https://github.com/ToshioCP/Gtk4-tutorial/blob/main/gfm/sec17.md GtkApplication *app2 = GTK_APPLICATION (app); GSimpleAction *act_b = g_simple_action_new ("do_b", NULL); g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_b)); diff --git a/src/widget/one_rule/algebra/assign.c b/src/widget/one_rule/algebra/assign.c new file mode 100644 index 0000000..c8c0178 --- /dev/null +++ b/src/widget/one_rule/algebra/assign.c @@ -0,0 +1,65 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Gem-graph client * +* Graphics - initialization and graphic stack management * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2023-2024 Adrien Bourmault * +* Copyright © 2024 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" +#include +#include + + +void *widget_get_btt_assignations_list() +{ + 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); + + for (int i = 0; i < 32; i++) + { + char str1[40]; strcpy(str1, "value ("); + char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2); + char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3); + char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4); + char str5[8]; sprintf(str5, "%d) = ", rand() % 10); strcat(str1, str5); + char str6[5]; sprintf(str6, "%d", rand() % 10); strcat(str1, str6); + widget_set_item_text (list_box, str1, TRUE); + } + GtkWidget *pop = gtk_popover_new (); + 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); + + GtkMenuButton *actions = GTK_MENU_BUTTON (gtk_menu_button_new ()); + gtk_menu_button_set_label (GTK_MENU_BUTTON (actions), "actions"); + gtk_menu_button_set_always_show_arrow (actions, TRUE); + gtk_menu_button_set_popover (actions, GTK_WIDGET (pop)); + + return actions; +} + diff --git a/src/widget/one_rule/algebra/conditions.c b/src/widget/one_rule/algebra/conditions.c new file mode 100644 index 0000000..a3fa413 --- /dev/null +++ b/src/widget/one_rule/algebra/conditions.c @@ -0,0 +1,66 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Gem-graph client * +* Graphics - initialization and graphic stack management * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2023-2024 Adrien Bourmault * +* Copyright © 2024 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" +#include +#include + + +void *widget_get_btt_conditions_list() +{ + 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); + + for (int i = 0; i < 32; i++) + { + char str1[40]; strcpy(str1, "if ( value ("); + char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2); + char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3); + char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4); + char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5); + char str6[5]; sprintf(str6, "%d)", rand() % 10); strcat(str1, str6); + widget_set_item_text (list_box, str1, TRUE); + } + GtkWidget *pop = gtk_popover_new (); + 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); + + GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ()); + gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions"); + gtk_menu_button_set_always_show_arrow (conditions, TRUE); + gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop)); + + return conditions; +} + + diff --git a/src/widget/rules/algebra/dispatch_cond_act_id.c b/src/widget/one_rule/algebra/dispatch.c similarity index 83% rename from src/widget/rules/algebra/dispatch_cond_act_id.c rename to src/widget/one_rule/algebra/dispatch.c index d6c3dce..308148b 100644 --- a/src/widget/rules/algebra/dispatch_cond_act_id.c +++ b/src/widget/one_rule/algebra/dispatch.c @@ -31,6 +31,21 @@ #include "../../../../include/widget.h" #include "../../../../include/signal.h" +// utilisé dans conditions et assign < je laisse ici +GtkEntry widget_set_item_text (GtkWidget *list_box, + const char *text, + bool editable) +{ + int text_length = 40; + GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length); + GtkEntry *entry = GTK_ENTRY (gtk_entry_new ()); + gtk_entry_set_overwrite_mode (entry, editable); +// if (! editable) widget_let_us_play_with_events (entry); voit utilities + gtk_entry_get_buffer (entry); + 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_selected_rule_algebra() { @@ -50,9 +65,3 @@ void *widget_get_selected_rule_algebra() return GTK_WIDGET (conditions_actions_names_box); } -// https://juliagtk.github.io/Gtk4.jl/stable/manual/listtreeview/ -// -// https://github.com/ToshioCP/Gtk4-tutorial/blob/main/gfm/sec17.md - - - diff --git a/src/widget/one_rule/algebra/identity.c b/src/widget/one_rule/algebra/identity.c new file mode 100644 index 0000000..08f094e --- /dev/null +++ b/src/widget/one_rule/algebra/identity.c @@ -0,0 +1,64 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Gem-graph client * +* Graphics - initialization and graphic stack management * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2023-2024 Adrien Bourmault * +* Copyright © 2024 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" +#include +#include + +void *widget_get_btt_rule_identity() +{ + 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 + 100, LIST_H); + + widget_set_item_text (list_box, "AMP > ADP", TRUE); + widget_set_item_text (list_box, " > AMP-activated protein kinase", FALSE); + widget_set_item_text (list_box, "date", TRUE); + widget_set_item_text (list_box, "author", TRUE); + widget_set_item_text (list_box, "status", TRUE); + widget_set_item_text (list_box, "activity", TRUE); + widget_set_item_text (list_box, "group", TRUE); + widget_set_item_text (list_box, "last edition date", TRUE); + + GtkWidget *pop = gtk_popover_new (); + 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); + + GtkMenuButton *identity = GTK_MENU_BUTTON (gtk_menu_button_new ()); + gtk_menu_button_set_label (GTK_MENU_BUTTON (identity), "identity"); + gtk_menu_button_set_always_show_arrow (identity, TRUE); + gtk_menu_button_set_popover (identity, GTK_WIDGET (pop)); + + return identity; +} + + diff --git a/src/widget/one_rule/algebra/utilities.c b/src/widget/one_rule/algebra/utilities.c new file mode 100644 index 0000000..1efb15e --- /dev/null +++ b/src/widget/one_rule/algebra/utilities.c @@ -0,0 +1,109 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Gem-graph client * +* Graphics - initialization and graphic stack management * +* * +* Copyright © 2024 Libre en Communs * +* Copyright © 2023-2024 Adrien Bourmault * +* Copyright © 2024 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" +#include +#include + +#define LIST_W 190 +#define LIST_H 114 + + +static void widget_let_us_play_with_events (GtkEntry *entry) +{ + gtk_entry_set_icon_from_icon_name (entry, 0, "text-editor-symbolic"); + gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_PRIMARY, TRUE); +// https://docs.gtk.org/gtk4/input-handling.html +// https://docs.gtk.org/gdk4/enum.EventType.html +// https://docs.gtk.org/gtk4/method.IMContext.filter_keypress.html +// g_signal_connect (entry, "clicked", G_CALLBACK (on_clicked_topbar_right_home), NULL); + g_signal_connect_after( entry, "insert-text", G_CALLBACK (on_entry_name_insert_after), NULL ); + g_signal_connect_after( entry, "delete-text", G_CALLBACK (on_entry_name_delete_after), NULL ); +// icon_press (entry, GTK_ENTRY_ICON_PRIMARY, NULL); +} + + + + +/* 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 +// GtkShortcutAction *act_aa = gtk_callback_action_new (callback_aa, NULL, NULL); + + + GSimpleAction *act_connect = g_simple_action_new("connect", NULL); + g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL); + + + GSimpleAction *act_a = g_simple_action_new ("do_a", NULL); + g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_a)); + g_signal_connect (act_a, "activate", G_CALLBACK (action_a), app); +// GMenuItem *menu_item_do_a = g_menu_item_new ("do_a", "app.do_a"); + + // gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu); + // gtk_menu_item_activate (btt_C); + // g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect)); + // GMenuItem *label_E = g_menu_item_new("connect", "app.do_a"); +// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (menu_item_do_a)); + + + / + https://docs.gtk.org/gtk4/class.ListView.html + GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list (); + + GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new()); + g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL); + g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL); + + GtkStringList *list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory); + + g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL); + + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list); + / + + // ce qui suit ira dans le callback + GtkListBoxRow *selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (list_box)); + if (selected_row != NULL) + printf("selected_row = %s\n", + gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (selected_row)))); + + // g_signal_connect (btt_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data); +*/ + + +// https://juliagtk.github.io/Gtk4.jl/stable/manual/listtreeview/ +// +// https://github.com/ToshioCP/Gtk4-tutorial/blob/main/gfm/sec17.md + + + diff --git a/src/widget/rules/geometry/dispatch_edit_enq.c b/src/widget/one_rule/dispatch.c similarity index 81% rename from src/widget/rules/geometry/dispatch_edit_enq.c rename to src/widget/one_rule/dispatch.c index cbcca6f..b68c6c2 100644 --- a/src/widget/rules/geometry/dispatch_edit_enq.c +++ b/src/widget/one_rule/dispatch.c @@ -27,22 +27,23 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "../../../../include/fsm.h" -#include "../../../../include/widget.h" -#include "../../../../include/signal.h" +#include "../../../include/fsm.h" +#include "../../../include/widget.h" +#include "../../../include/signal.h" void *widget_get_selected_rule() { - GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_geometry ())); - gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_algebra ())); + GtkBox *one_rule = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); + gtk_box_append (one_rule, GTK_WIDGET (widget_get_selected_rule_algebra ())); + gtk_box_append (one_rule, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (one_rule, GTK_WIDGET (widget_get_selected_rule_geometry ())); - return GTK_WIDGET (images_and_texts); + return GTK_WIDGET (one_rule); } -void *widget_get_single_selected_rule_pane() +void *widget_get_selected_rule_right_pane() // < called in signal switch_state_rules_data() + // + on_toggle_state_rules_data() { GtkPaned *rule_itself_vs_explore_edit_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); gtk_paned_set_start_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_selected_rule())); @@ -50,7 +51,7 @@ void *widget_get_single_selected_rule_pane() GTK_WIDGET (widget_get_rule_edit())); else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_rule_enquire())); - gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 640); // WARNING : c'est une position "absolue" + gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 640); // WARNING : position "absolue" gtk_paned_set_wide_handle (rule_itself_vs_explore_edit_pane, TRUE); gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE); gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit_pane, FALSE); @@ -59,4 +60,3 @@ void *widget_get_single_selected_rule_pane() } - diff --git a/src/widget/rules/geometry/geometry.c b/src/widget/one_rule/geometry/camera.c similarity index 73% rename from src/widget/rules/geometry/geometry.c rename to src/widget/one_rule/geometry/camera.c index 1c673bf..a6b29a9 100644 --- a/src/widget/rules/geometry/geometry.c +++ b/src/widget/one_rule/geometry/camera.c @@ -32,23 +32,6 @@ #include "../../../../include/signal.h" -static void *get_rule_before() -{ - GtkWidget *rule_before = GTK_WIDGET (gtk_picture_new_for_filename \ - ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")); - gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, W_IMAGE_800); // OK (provisoire) - return GTK_WIDGET (rule_before); -} - -static void *get_rule_after() -{ - GtkWidget *rule_after = 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 (rule_after), 0, W_IMAGE_800); // OK (provisoire)) - return GTK_WIDGET (rule_after); -} - - static GtkBox *rec_XYZ_box() { GtkBox *XYZ_labels_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2 @@ -89,22 +72,13 @@ static GtkBox *rec_ZOOM_box() } -void *widget_get_selected_rule_geometry() { +void *widget_get_selected_rule_camera() +{ + GtkBox *camera = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); + gtk_box_append (camera, GTK_WIDGET (rec_XYZ_box())); + gtk_box_append (camera, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); + gtk_box_append (camera, GTK_WIDGET (rec_ZOOM_box())); - // - - - - - - - - - - - - C A M E R A - - - - - - - - - - - - - - // - GtkBox *right_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - gtk_box_append (right_box, GTK_WIDGET (rec_XYZ_box())); - gtk_box_append (right_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (right_box, GTK_WIDGET (rec_ZOOM_box())); - - // - - - - - - - - - - - - I M A G E S - - - - - - - - - - - - - - // - GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); - gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_before ())); - gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_after ())); - gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); - gtk_box_append (before_vs_after, GTK_WIDGET (right_box)); - - return GTK_WIDGET (before_vs_after); + return camera; } diff --git a/src/widget/one_rule/geometry/dispatch.c b/src/widget/one_rule/geometry/dispatch.c new file mode 100644 index 0000000..c1ea384 --- /dev/null +++ b/src/widget/one_rule/geometry/dispatch.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_selected_rule_geometry() +{ + GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + gtk_box_append (before_vs_after, GTK_WIDGET (widget_get_selected_rule_before_after())); + gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (before_vs_after, GTK_WIDGET (widget_get_selected_rule_camera())); + + return GTK_WIDGET (before_vs_after); +} + + + + diff --git a/src/widget/rules/geometry/edit.c b/src/widget/one_rule/geometry/edit_tools.c similarity index 100% rename from src/widget/rules/geometry/edit.c rename to src/widget/one_rule/geometry/edit_tools.c diff --git a/src/widget/rules/geometry/enquire.c b/src/widget/one_rule/geometry/enquire.c similarity index 100% rename from src/widget/rules/geometry/enquire.c rename to src/widget/one_rule/geometry/enquire.c diff --git a/src/widget/one_rule/geometry/geometry.c b/src/widget/one_rule/geometry/geometry.c new file mode 100644 index 0000000..bebf090 --- /dev/null +++ b/src/widget/one_rule/geometry/geometry.c @@ -0,0 +1,63 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* 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" + + +static void *widget_get_selected_rule_geometry_before() +{ + GtkWidget *rule_before = GTK_WIDGET (gtk_picture_new_for_filename \ + ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")); + gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, W_IMAGE_800); // OK (provisoire) + return GTK_WIDGET (rule_before); +} + +static void *widget_get_selected_rule_geometry_after() +{ + GtkWidget *rule_after = 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 (rule_after), 0, W_IMAGE_800); // OK (provisoire)) + return GTK_WIDGET (rule_after); +} + + +void *widget_get_selected_rule_before_after() +{ + GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); + gtk_box_append (before_vs_after, GTK_WIDGET (widget_get_selected_rule_geometry_before ())); + gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); + gtk_box_append (before_vs_after, GTK_WIDGET (widget_get_selected_rule_geometry_after ())); + + return GTK_WIDGET (before_vs_after); +} + + + diff --git a/src/widget/rules/algebra/utilities.c b/src/widget/rules/algebra/utilities.c deleted file mode 100644 index d480a54..0000000 --- a/src/widget/rules/algebra/utilities.c +++ /dev/null @@ -1,211 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * -* * -* 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" -#include -#include - -#define LIST_W 190 -#define LIST_H 114 - - -static void widget_let_us_play_with_events (GtkEntry *entry) -{ - gtk_entry_set_icon_from_icon_name (entry, 0, "text-editor-symbolic"); - gtk_entry_set_icon_activatable (entry, GTK_ENTRY_ICON_PRIMARY, TRUE); -// https://docs.gtk.org/gtk4/input-handling.html -// https://docs.gtk.org/gdk4/enum.EventType.html -// https://docs.gtk.org/gtk4/method.IMContext.filter_keypress.html -// g_signal_connect (entry, "clicked", G_CALLBACK (on_clicked_topbar_right_home), NULL); - g_signal_connect_after( entry, "insert-text", G_CALLBACK (on_entry_name_insert_after), NULL ); - g_signal_connect_after( entry, "delete-text", G_CALLBACK (on_entry_name_delete_after), NULL ); -// icon_press (entry, GTK_ENTRY_ICON_PRIMARY, NULL); -} - -GtkEntry widget_set_item_text (GtkWidget *list_box, - const char *text, - bool editable) -{ - int text_length = 40; - GtkEntryBuffer *entry_buffer = gtk_entry_buffer_new (text, text_length); - GtkEntry *entry = GTK_ENTRY (gtk_entry_new ()); - gtk_entry_set_overwrite_mode (entry, editable); - if (! editable) widget_let_us_play_with_events (entry); - gtk_entry_get_buffer (entry); - 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 *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); - - for (int i = 0; i < 32; i++) - { - char str1[40]; strcpy(str1, "if ( value ("); - char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2); - char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3); - char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4); - char str5[8]; sprintf(str5, "%d) == ", rand() % 10); strcat(str1, str5); - char str6[5]; sprintf(str6, "%d)", rand() % 10); strcat(str1, str6); - widget_set_item_text (list_box, str1, TRUE); - } - GtkWidget *pop = gtk_popover_new (); - 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); - - GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ()); - gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions"); - gtk_menu_button_set_always_show_arrow (conditions, TRUE); - gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop)); - - return conditions; -} - -void *widget_get_btt_assignations_list() -{ - 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); - - for (int i = 0; i < 32; i++) - { - char str1[40]; strcpy(str1, "value ("); - char str2[5]; sprintf(str2, "%d, ", rand() % 10); strcat(str1, str2); - char str3[5]; sprintf(str3, "%d, ", rand() % 10); strcat(str1, str3); - char str4[5]; sprintf(str4, "%d, ", rand() % 10); strcat(str1, str4); - char str5[8]; sprintf(str5, "%d) = ", rand() % 10); strcat(str1, str5); - char str6[5]; sprintf(str6, "%d", rand() % 10); strcat(str1, str6); - widget_set_item_text (list_box, str1, TRUE); - } - GtkWidget *pop = gtk_popover_new (); - 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); - - GtkMenuButton *actions = GTK_MENU_BUTTON (gtk_menu_button_new ()); - gtk_menu_button_set_label (GTK_MENU_BUTTON (actions), "actions"); - gtk_menu_button_set_always_show_arrow (actions, TRUE); - gtk_menu_button_set_popover (actions, GTK_WIDGET (pop)); - - return actions; -} - -void *widget_get_btt_rule_identity() -{ - 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 + 100, LIST_H); - - widget_set_item_text (list_box, "AMP > ADP", TRUE); - widget_set_item_text (list_box, " > AMP-activated protein kinase", FALSE); - widget_set_item_text (list_box, "date", TRUE); - widget_set_item_text (list_box, "author", TRUE); - widget_set_item_text (list_box, "status", TRUE); - widget_set_item_text (list_box, "activity", TRUE); - widget_set_item_text (list_box, "group", TRUE); - widget_set_item_text (list_box, "last edition date", TRUE); - - GtkWidget *pop = gtk_popover_new (); - 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); - - GtkMenuButton *identity = GTK_MENU_BUTTON (gtk_menu_button_new ()); - gtk_menu_button_set_label (GTK_MENU_BUTTON (identity), "identity"); - gtk_menu_button_set_always_show_arrow (identity, TRUE); - gtk_menu_button_set_popover (identity, GTK_WIDGET (pop)); - - return identity; -} - - - - - -/* 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 -// GtkShortcutAction *act_aa = gtk_callback_action_new (callback_aa, NULL, NULL); - - - GSimpleAction *act_connect = g_simple_action_new("connect", NULL); - g_signal_connect(act_connect, "activate", G_CALLBACK(connect), NULL); - - - GSimpleAction *act_a = g_simple_action_new ("do_a", NULL); - g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_a)); - g_signal_connect (act_a, "activate", G_CALLBACK (action_a), app); -// GMenuItem *menu_item_do_a = g_menu_item_new ("do_a", "app.do_a"); - - // gtk_menu_button_popup (open_menu); gtk_menu_button_popdown (open_menu); - // gtk_menu_item_activate (btt_C); - // g_action_map_add_action(G_ACTION_MAP(app), G_ACTION(act_connect)); - // GMenuItem *label_E = g_menu_item_new("connect", "app.do_a"); -// gtk_list_box_append (GTK_LIST_BOX (list_box), GTK_WIDGET (menu_item_do_a)); - - - / - https://docs.gtk.org/gtk4/class.ListView.html - GtkStringList *model = gtk_string_list_new (NULL); // model = create_application_list (); - - GtkSignalListItemFactory *factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new()); - g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL); - g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL); - - GtkStringList *list = gtk_list_view_new (GTK_SELECTION_MODEL (gtk_single_selection_new (model)), factory); - - g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL); - - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list); - / - - // ce qui suit ira dans le callback - GtkListBoxRow *selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (list_box)); - if (selected_row != NULL) - printf("selected_row = %s\n", - gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (selected_row)))); - - // g_signal_connect (btt_C, "clicked", G_CALLBACK (on_clicked_HOME), no_local_data); -*/ diff --git a/src/widget/state/dispatch.c b/src/widget/state/dispatch.c index 25477d4..6a1fa47 100644 --- a/src/widget/state/dispatch.c +++ b/src/widget/state/dispatch.c @@ -57,7 +57,7 @@ void *widget_get_state_page() GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); gtk_box_append (page_box, GTK_WIDGET (widget_get_graph_view_control())); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); - gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view(PARTITION_SPACE_VS_CAMERA_IN_STATE))); + gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view (PARTITION_SPACE_VS_CAMERA_IN_STATE))); gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL))); GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL);