one rule reorganization
This commit is contained in:
parent
c6ed3c5c0f
commit
96305bb4b7
|
@ -37,19 +37,6 @@
|
||||||
|
|
||||||
char *util_read_file (char *filename);
|
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
|
typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément
|
||||||
|
|
||||||
|
|
|
@ -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_synth_page(); // in : widget / synth / dispatch.c
|
||||||
void *widget_get_state_page(); // in : widget / state / 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_data_page(); // in : widget / data / dispatch.c
|
||||||
void *widget_get_measure_page();// in : widget / measure / dispatch.c
|
void *widget_get_measure_page();// in : widget / measure / dispatch.c
|
||||||
void *widget_get_engine_page(); // in : fsm / engine / engine.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 */
|
/* 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()
|
// call: widget / rules / dispatch.c / widget_get_rules_page()
|
||||||
// def: widget / rules / tree_tools / dispatch.c (= left)
|
// def: widget / rules / tree_tools / dispatch.c (= left)
|
||||||
// def: widget / rules / selected / dispatch.c (= right)
|
// def: widget / rules / selected / dispatch.c (= right)
|
||||||
|
|
||||||
void *widget_get_rules_tree_tools_pane();
|
#define LIST_W 190
|
||||||
void *widget_get_single_selected_rule_pane();
|
#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 / pilot_box.c
|
||||||
// def: widget / rules / tree_tools / freq.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
|
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 / dispatch.c
|
||||||
// def: widget / rules / selected / edit.c
|
// def: widget / rules / selected / edit.c
|
||||||
// def: widget / rules / selected / enquire.c
|
// def: widget / rules / selected / enquire.c
|
||||||
|
@ -203,6 +219,8 @@ void *widget_get_btt_rule_identity();
|
||||||
|
|
||||||
// def: widget / rules / selected / wip_menu.c
|
// def: widget / rules / selected / wip_menu.c
|
||||||
GtkEntry widget_set_item_text (GtkWidget *list_box, const char *text, bool editable);
|
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 */
|
/* D A T A */
|
||||||
|
|
21
src/signal.c
21
src/signal.c
|
@ -274,8 +274,27 @@ static void switch_state_rules_data()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (RULES) :
|
case (RULES) :
|
||||||
|
/* 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_window_set_child (GTK_WINDOW (widget_get_main_window ()),
|
||||||
GTK_WIDGET (widget_get_rules_page()));
|
GTK_WIDGET (widget_all_vs_selected_one));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (DATA) :
|
case (DATA) :
|
||||||
|
|
|
@ -32,16 +32,9 @@
|
||||||
#include "../../../include/signal.h"
|
#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.
|
||||||
|
*/
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "../../../../include/signal.h"
|
#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));
|
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 (widget_get_rules_pilot_box ()));
|
|
@ -61,7 +61,7 @@ static void action_b (GSimpleAction *action,
|
||||||
GVariant *parameter,
|
GVariant *parameter,
|
||||||
GApplication *application) {printf ("action_b() in widget/dispatch.c\n");}
|
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 |\
|
printf ("widget/dispatch |\
|
||||||
on_windows_startup() is in: widget/dispatch.c NOT in: src/signal.c\n");
|
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 |\
|
printf ("widget/dispatch |\
|
||||||
on_windows_activation() is in: widget/dispatch.c NOT in: src/signal.c\n");
|
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_application_activate (G_APPLICATION (app)); < how ? > in main.c is
|
||||||
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||||
|
|
||||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
dialog_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));
|
text_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// 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_main_window (main_window, app); // def: widget/topbar/dispatch
|
||||||
widget_design_dialog_window (main_window, dialog_window);
|
widget_design_dialog_window (main_window, dialog_window);
|
||||||
widget_design_text_window (main_window, text_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);
|
GtkApplication *app2 = GTK_APPLICATION (app);
|
||||||
GSimpleAction *act_b = g_simple_action_new ("do_b", NULL);
|
GSimpleAction *act_b = g_simple_action_new ("do_b", NULL);
|
||||||
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_b));
|
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (act_b));
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Graphics - initialization and graphic stack management *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2023-2024 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../../include/fsm.h"
|
||||||
|
#include "../../../../include/widget.h"
|
||||||
|
#include "../../../../include/signal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Graphics - initialization and graphic stack management *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2023-2024 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../../include/fsm.h"
|
||||||
|
#include "../../../../include/widget.h"
|
||||||
|
#include "../../../../include/signal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,21 @@
|
||||||
#include "../../../../include/widget.h"
|
#include "../../../../include/widget.h"
|
||||||
#include "../../../../include/signal.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()
|
void *widget_get_selected_rule_algebra()
|
||||||
{
|
{
|
||||||
|
@ -50,9 +65,3 @@ void *widget_get_selected_rule_algebra()
|
||||||
return GTK_WIDGET (conditions_actions_names_box);
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Graphics - initialization and graphic stack management *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2023-2024 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../../include/fsm.h"
|
||||||
|
#include "../../../../include/widget.h"
|
||||||
|
#include "../../../../include/signal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Graphics - initialization and graphic stack management *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2023-2024 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../../../include/fsm.h"
|
||||||
|
#include "../../../../include/widget.h"
|
||||||
|
#include "../../../../include/signal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,22 +27,23 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
#include "../../../../include/fsm.h"
|
#include "../../../include/fsm.h"
|
||||||
#include "../../../../include/widget.h"
|
#include "../../../include/widget.h"
|
||||||
#include "../../../../include/signal.h"
|
#include "../../../include/signal.h"
|
||||||
|
|
||||||
|
|
||||||
void *widget_get_selected_rule()
|
void *widget_get_selected_rule()
|
||||||
{
|
{
|
||||||
GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *one_rule = 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 (one_rule, GTK_WIDGET (widget_get_selected_rule_algebra ()));
|
||||||
gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (one_rule, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_algebra ()));
|
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));
|
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()));
|
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()));
|
GTK_WIDGET (widget_get_rule_edit()));
|
||||||
else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane,
|
else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane,
|
||||||
GTK_WIDGET (widget_get_rule_enquire()));
|
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_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_start_child (rule_itself_vs_explore_edit_pane, FALSE);
|
||||||
gtk_paned_set_shrink_end_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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,23 +32,6 @@
|
||||||
#include "../../../../include/signal.h"
|
#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()
|
static GtkBox *rec_XYZ_box()
|
||||||
{
|
{
|
||||||
GtkBox *XYZ_labels_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
|
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 - - - - - - - - - - - - - - //
|
return camera;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Rules *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Rules *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* 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 <http://www.gnu.org/licenses/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,211 +0,0 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
* *
|
|
||||||
* Gem-graph client *
|
|
||||||
* *
|
|
||||||
* Rules *
|
|
||||||
* *
|
|
||||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
|
||||||
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
|
||||||
* *
|
|
||||||
* 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 <http://www.gnu.org/licenses/>. *
|
|
||||||
* *
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
|
|
||||||
#include "../../../../include/fsm.h"
|
|
||||||
#include "../../../../include/widget.h"
|
|
||||||
#include "../../../../include/signal.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
*/
|
|
|
@ -57,7 +57,7 @@ void *widget_get_state_page()
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
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 (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 (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)));
|
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
|
||||||
GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
Loading…
Reference in New Issue