WIP: contain.g_signal_connect (GTK_BUTTON (get_btt_run_xor_edit()), clicked, G_CALLBACK (on_togglerunedit_action()), NULL);

This commit is contained in:
Jean Sirmai 2024-05-31 22:34:15 +02:00
parent abf5c4ca3e
commit 8163333422
Signed by: jean
GPG Key ID: FB3115C340E057E3
18 changed files with 195 additions and 61 deletions

30
callback.c Normal file
View File

@ -0,0 +1,30 @@
#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h>
#include "hot.h"
#include "display.h"
#include "contain.h"
#include "texts.h"
void ui_toggle_run_edit()
{
if (get_run_edit_mode()) {g_printerr("Can't find self->main_button_run_edit !\n"); return;}
printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ());
if (get_run_edit_mode()) {
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "system-run-symbolic");
set_run_edit_mode (0);
} else {
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "document-edit-symbolic");
set_run_edit_mode (1);
}
printf(" > %d\n", get_run_edit_mode ());
}
void on_togglerunedit_action(GSimpleAction *action, GVariant *parameter, gpointer user_data) {
// GemGraphClientApplication *self = user_data;
// g_assert (GEM_GRAPH_CLIENT_IS_APPLICATION(self));
printf("| >>> callback.on_togglerunedit_action() >>> ");
ui_toggle_run_edit ();
}

1
callback.h Normal file
View File

@ -0,0 +1 @@
void on_togglerunedit_action(GSimpleAction *action, GVariant *parameter, gpointer user_data);

107
contain.c
View File

@ -95,8 +95,8 @@ GtkWidget *get_edit_space_page_new(){
GtkWidget *get_selected_rules_vpaned_new(){ GtkWidget *get_selected_rules_vpaned_new(){
GtkPaned *V_selected_1_vs_2 = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL)); GtkPaned *V_selected_1_vs_2 = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
// GtkWidget *règle_sélectionnée_n_1 = gtk_frame_new ("(1)"); GtkWidget *règle_sélectionnée_n_1 = gtk_frame_new ("(1)");
// GtkWidget *règle_sélectionnée_n_2 = gtk_frame_new ("(2)"); GtkWidget *règle_sélectionnée_n_2 = gtk_frame_new ("(2)");
GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); GtkBox *up_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (up_box, GTK_WIDGET (get_image_GLUTAMATE())); gtk_box_append (up_box, GTK_WIDGET (get_image_GLUTAMATE()));
@ -119,8 +119,8 @@ GtkWidget *get_selected_rules_vpaned_new(){
// gtk_paned_set_start_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_1)); // gtk_paned_set_start_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_1));
// gtk_paned_set_end_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_2)); // gtk_paned_set_end_child (V_selected_1_vs_2, GTK_WIDGET (règle_sélectionnée_n_2));
// gtk_box_append ( GTK_BOX(règle_sélectionnée_n_1), GTK_WIDGET (up_box));//, GTK_WIDGET (get_image_GLUTAMATE())); gtk_box_append ( GTK_BOX (règle_sélectionnée_n_1), GTK_WIDGET (up_box));//, GTK_WIDGET (get_image_GLUTAMATE()));
// gtk_box_append ( GTK_BOX(règle_sélectionnée_n_2), GTK_WIDGET (bottom_box));//, GTK_WIDGET (get_image_GLUTAMATE())); gtk_box_append ( GTK_BOX (règle_sélectionnée_n_2), GTK_WIDGET (bottom_box));//, GTK_WIDGET (get_image_GLUTAMATE()));
return GTK_WIDGET (V_selected_1_vs_2); return GTK_WIDGET (V_selected_1_vs_2);
} }
@ -167,12 +167,103 @@ GtkWidget *get_run_space_page_new(){
return GTK_WIDGET (page_box); return GTK_WIDGET (page_box);
} }
GtkWidget *get_btt_run_xor_edit() {
GtkWidget *run_xor_edit = gtk_toggle_button_new ();
return GTK_WIDGET (run_xor_edit);
}
void window_bar(GtkWindow *window, char *title){ void window_bar(GtkWindow *window, char *title){
GtkWidget *titlebar = gtk_header_bar_new(); GtkWidget *header_bar = gtk_header_bar_new();
gtk_window_set_title (window, title); // gtk_window_set_title (window, title);
gtk_window_set_titlebar (window, titlebar); // header_bar gtk_window_set_titlebar (window, header_bar);
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START // GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout); // gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "document-edit-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "text-editor-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "system-run-symbolic");
// gtk_actionable_set_action_name (GTK_ACTIONABLE (get_btt_run_xor_edit()), "app.togglerunedit");
g_signal_connect (GTK_BUTTON (get_btt_run_xor_edit()), "clicked", G_CALLBACK (on_togglerunedit_action()), NULL);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), get_btt_run_xor_edit());
gtk_window_set_titlebar (window, header_bar);
GtkWidget *run_stop_model_exec = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "system-shutdown-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "media-playback-start-symbolic");
gtk_button_set_icon_name (GTK_BUTTON (run_stop_model_exec), "media-playback-pause-symbolic");
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), run_stop_model_exec);
// https://iconduck.com/sets/adwaita-icon-theme
GtkWidget *go_home = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (go_home), "go-home-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), go_home);
GtkWidget *user_trash = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (user_trash), "user-trash-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), user_trash);
GtkWidget *help_biblio = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_biblio), "accessories-dictionary-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_biblio);
GtkWidget *help_doc = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_doc), "emblem-documents-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_doc);
GtkWidget *help_about = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_about), "help-about-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_about);
GtkWidget *help_faq = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (help_faq), "help-faq-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), help_faq);
GtkWidget *terminal = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (terminal), "utilities-terminal-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), terminal);
GtkWidget *search = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (search), "folder-saved-search-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), search);
GtkWidget *preferences_desktop_appearance = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (preferences_desktop_appearance), "preferences-desktop-appearance-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), preferences_desktop_appearance);
GtkWidget *preferences_system = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (preferences_system), "preferences-system-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), preferences_system);
GtkWidget *document_properties = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (document_properties), "document-properties-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), document_properties);
GtkWidget *text_edit = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (text_edit), "text-editor-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), text_edit);
GtkWidget *applications_utilities = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (applications_utilities), "applications-utilities-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), applications_utilities);
GtkWidget *open_menu = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (open_menu), "open-menu-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), open_menu);
GtkWidget *power_max = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_max), "power-profile-performance-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_max);
GtkWidget *power_middle = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_middle), "power-profile-balanced-rtl-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_middle);
GtkWidget *power_low = gtk_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (power_low), "power-profile-power-saver-symbolic");
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), power_low);
} }
void activate (GtkApplication *app, gpointer user_data) { void activate (GtkApplication *app, gpointer user_data) {
@ -207,7 +298,7 @@ void activate (GtkApplication *app, gpointer user_data) {
gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane)); gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane));
gtk_window_present (GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window));
gtk_notebook_set_current_page (run_notebook, 1); // @see hot.c 2024-05-11 (line 68) gtk_notebook_set_current_page (run_notebook, 0); // @see hot.c 2024-05-11 (line 68)
gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68) gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68)
} }

View File

@ -30,4 +30,8 @@ GtkBox *get_XYZ_box();
GtkWidget *get_OBJECTS_and_SITUATIONS(); GtkWidget *get_OBJECTS_and_SITUATIONS();
GtkBox *get_ELAPSED_TIME_box(); GtkBox *get_ELAPSED_TIME_box();
GtkWidget *get_btt_run_xor_edit();
void window_bar(GtkWindow *window, char *title); void window_bar(GtkWindow *window, char *title);

67
hot.c
View File

@ -3,7 +3,7 @@
#include "warm.h" #include "warm.h"
#include "cold.h" #include "cold.h"
#include "display.h" //#include "display.h"
#include "contain.h" #include "contain.h"
#include "texts.h" #include "texts.h"
@ -12,6 +12,10 @@
// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management // https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL // GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
static int run_edit_mode_val = 0;
void set_run_edit_mode(int prescribed_mode) {run_edit_mode_val = prescribed_mode;}
int get_run_edit_mode () {return run_edit_mode_val;}
static struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;}; static struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;};
static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child); static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child);
@ -22,35 +26,36 @@ static struct TreeNode_t *create_user_tree_node (const gchar* text){
return node; return node;
} }
static void create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root){ static void let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
/* struct TreeNode_t *move_random = create_user_tree_node("move random"); add_child_node(tree_root, move_random); struct TreeNode_t *a = create_user_tree_node("We, the people");add_child_node(tree_root, a);
struct TreeNode_t *move_determ = create_user_tree_node("move determ"); add_child_node(tree_root, move_determ); struct TreeNode_t *b = create_user_tree_node("in Order to"); add_child_node(tree_root, b);
struct TreeNode_t *transport = create_user_tree_node("transport"); add_child_node(tree_root, transport);*/ struct TreeNode_t *c = create_user_tree_node("do establish"); add_child_node(tree_root, c);
struct TreeNode_t *transform = create_user_tree_node("transform"); add_child_node(tree_root, transform); struct TreeNode_t *aa = create_user_tree_node("aware of"); add_child_node(a, aa);
struct TreeNode_t *regulate = create_user_tree_node("regulate"); add_child_node(tree_root, regulate); struct TreeNode_t *aaa = create_user_tree_node("our rights"); add_child_node(aa, aaa);
/* struct TreeNode_t *isole = create_user_tree_node("isolated object"); add_child_node(move_random, isole); struct TreeNode_t *aab = create_user_tree_node("our duties"); add_child_node(aa, aab);
struct TreeNode_t *relie = create_user_tree_node("part of object"); add_child_node(move_random, relie); struct TreeNode_t *aaaa = create_user_tree_node("read"); add_child_node(aaa, aaaa);
struct TreeNode_t *no_payload = create_user_tree_node("free"); add_child_node(transport, no_payload); struct TreeNode_t *aaab = create_user_tree_node("write"); add_child_node(aaa, aaab);
struct TreeNode_t *charged = create_user_tree_node("charged"); add_child_node(transport, charged); struct TreeNode_t *aaac = create_user_tree_node("copy"); add_child_node(aaa, aaac);
struct TreeNode_t *spontaneous = create_user_tree_node("spontaneous"); add_child_node(transform, spontaneous);*/ struct TreeNode_t *aaad = create_user_tree_node("edit"); add_child_node(aaa, aaad);
struct TreeNode_t *catalysed = create_user_tree_node("catalysed"); add_child_node(transform, catalysed); struct TreeNode_t *aaaba= create_user_tree_node("code"); add_child_node(aaab, aaaba);
/* struct TreeNode_t *isole_1D = create_user_tree_node("isolated object move 1D"); add_child_node(isole, isole_1D); struct TreeNode_t *aaabb= create_user_tree_node("language"); add_child_node(aaab, aaabb);
struct TreeNode_t *isole_2D = create_user_tree_node("isolated object move 2D"); add_child_node(isole, isole_2D); struct TreeNode_t *aaabc= create_user_tree_node("any art..."); add_child_node(aaab, aaabc);
struct TreeNode_t *isole_3D = create_user_tree_node("isolated object move 3D"); add_child_node(isole, isole_3D); struct TreeNode_t *aaadb= create_user_tree_node("publish"); add_child_node(aaac, aaadb);
struct TreeNode_t *translat_2D = create_user_tree_node("translation"); add_child_node(isole_2D, translat_2D); struct TreeNode_t *aaada= create_user_tree_node("create"); add_child_node(aaad, aaada);
struct TreeNode_t *rotat_2D = create_user_tree_node("rotation"); add_child_node(isole_2D, rotat_2D); struct TreeNode_t *aaba = create_user_tree_node("learn"); add_child_node(aab, aaba);
struct TreeNode_t *rotat_X_2D = create_user_tree_node("rotation axe X"); add_child_node(rotat_2D, rotat_X_2D); struct TreeNode_t *aabb = create_user_tree_node("help"); add_child_node(aab, aabb);
struct TreeNode_t *rotat_Y_2D = create_user_tree_node("rotation axe Y"); add_child_node(rotat_2D, rotat_Y_2D); struct TreeNode_t *ba = create_user_tree_node("promote"); add_child_node(b, ba);
struct TreeNode_t *translat_3D = create_user_tree_node("translation"); add_child_node(isole_3D, translat_3D); struct TreeNode_t *bb = create_user_tree_node("individual"); add_child_node(b, bb);
struct TreeNode_t *rotat_3D = create_user_tree_node("rotation"); add_child_node(isole_3D, rotat_3D); struct TreeNode_t *bc = create_user_tree_node("and common"); add_child_node(b, bc);
struct TreeNode_t *rotat_X_3D = create_user_tree_node("rotation axe X"); add_child_node(rotat_3D, rotat_X_3D); struct TreeNode_t *bca = create_user_tree_node("education"); add_child_node(bc, bca);
struct TreeNode_t *rotat_Y_3D = create_user_tree_node("rotation axe Y"); add_child_node(rotat_3D, rotat_Y_3D); struct TreeNode_t *bcb = create_user_tree_node("mutual"); add_child_node(bc, bcb);
struct TreeNode_t *rotat_Z_3D = create_user_tree_node("rotation axe Z"); add_child_node(rotat_3D, rotat_Z_3D); struct TreeNode_t *bcc = create_user_tree_node("support"); add_child_node(bc, bcc);
struct TreeNode_t *control = create_user_tree_node("negative feedback (control)"); add_child_node(regulate, control); struct TreeNode_t *bcd = create_user_tree_node("health"); add_child_node(bc, bcd);
struct TreeNode_t *enhance = create_user_tree_node("positive feedback (enhance)"); add_child_node(regulate, enhance);*/ struct TreeNode_t *bcda = create_user_tree_node("mental"); add_child_node(bcd, bcda);
struct TreeNode_t *n_importe = create_user_tree_node("n'importe"); add_child_node(catalysed, n_importe); struct TreeNode_t *bcdb = create_user_tree_node("physical"); add_child_node(bcd, bcdb);
struct TreeNode_t *quoi = create_user_tree_node("quoi"); add_child_node(n_importe, quoi); struct TreeNode_t *ca = create_user_tree_node("free"); add_child_node(c, ca);
struct TreeNode_t *ma_qué = create_user_tree_node("ma_qué"); add_child_node(quoi, ma_qué); struct TreeNode_t *cb = create_user_tree_node("code"); add_child_node(c, cb);
struct TreeNode_t *cc = create_user_tree_node("access"); add_child_node(c, cc);
} }
void on_user_tree_expander_toggled(GtkExpander *expander, gpointer user_data) void on_user_tree_expander_toggled(GtkExpander *expander, gpointer user_data)
@ -123,7 +128,7 @@ static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child)
GtkScrolledWindow *get_user_rules_tree (){ GtkScrolledWindow *get_user_rules_tree (){
struct TreeNode_t *tree_root = create_user_tree_node("root"); struct TreeNode_t *tree_root = create_user_tree_node("root");
create_a_complex_useless_and_expensive_tree (tree_root); let_us_create_a_complex_useless_and_expensive_tree (tree_root);
GtkStringList *model = gtk_string_list_new(NULL); GtkStringList *model = gtk_string_list_new(NULL);
gtk_string_list_append (model, tree_root->text); gtk_string_list_append (model, tree_root->text);

3
hot.h
View File

@ -13,3 +13,6 @@
#include "contain.h" #include "contain.h"
GtkScrolledWindow *get_user_rules_tree (); GtkScrolledWindow *get_user_rules_tree ();
void set_run_edit_mode(int prescribed_mode);
int get_run_edit_mode();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB