<signal name=clicked handler=ui_toggle_sidebar /> (line 36) < ?
This commit is contained in:
parent
b978bcfe20
commit
a7d74c81c1
5
Makefile
5
Makefile
|
@ -41,10 +41,15 @@ NTHREADS= $(shell nproc)
|
|||
|
||||
CC=gcc
|
||||
WARNINGS= -Wall
|
||||
|
||||
# applications should be compiled with the -Wl,--export-dynamic argument inside their compiler flags, < ?
|
||||
# and linked against gmodule-export-2.0. < ? TODO
|
||||
|
||||
DEBUG= -ggdb -fno-omit-frame-pointer -fdiagnostics-color=always -fsanitize=bounds -fstack-check
|
||||
#-fsanitize=address \
|
||||
#-fsanitize=pointer-compare -fsanitize=pointer-subtract \
|
||||
#-fsanitize=leak -fsanitize=undefined -fsanitize=null -fsanitize=bounds
|
||||
|
||||
OPTIMIZE= -O3
|
||||
INCLUDE= $(shell pkg-config --cflags glib-2.0 libxml-2.0 gtk4)
|
||||
LIBS= $(shell pkg-config --libs glib-2.0 libxml-2.0 gtk4) -lGL -lGLU -lm -lepoxy -lX11 -lGLEW
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/* E coli by David S. Goodsell (2009) */
|
||||
/* --- */
|
||||
/* Knowing that only a dynamic model can explain this phenomenon, */
|
||||
/* let's let this beautiful freeze frame be our guide. */
|
||||
/* let this beautiful freeze frame be our guide. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -58,11 +58,6 @@
|
|||
#define W_IMAGE_LOCAL W / 16
|
||||
#define H_IMAGE_LOCAL H / 16
|
||||
|
||||
//GtkWidget *get_selected_rules_vpaned_new();
|
||||
|
||||
//void activate (GtkApplication *app, gpointer user_data);
|
||||
|
||||
|
||||
// Graphical axis
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
/* */
|
||||
/* E coli by David S. Goodsell (2009) */
|
||||
/* --- */
|
||||
/* Knowing that only a dynamic model can explain this phenomenon, */
|
||||
/* let's let this beautiful freeze frame be our guide. */
|
||||
/* Knowing that only a dynamic model can explore this phenomenon, */
|
||||
/* let this beautiful freeze frame be our guide. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
/* */
|
||||
/* E coli by David S. Goodsell (2009) */
|
||||
/* --- */
|
||||
/* Let this freeze frame guide us towards the model */
|
||||
/* that alone can account for the phenomenon ! */
|
||||
/* Knowing that only a dynamic model can explain this phenomenon, */
|
||||
/* let this beautiful freeze frame be our guide. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/* E coli by David S. Goodsell (2009) */
|
||||
/* --- */
|
||||
/* Knowing that only a dynamic model can explain this phenomenon, */
|
||||
/* let's let this beautiful freeze frame be our guide. */
|
||||
/* let this beautiful freeze frame be our guide. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
10
include/ui.h
10
include/ui.h
|
@ -130,6 +130,16 @@ void on_glarea_realize(GtkWidget *widget);
|
|||
void on_glarea_unrealize(GtkWidget *widget);
|
||||
|
||||
void on_close_window(GtkWidget *widget);
|
||||
/*
|
||||
* A GtkBuilder holds a reference to all objects that it has constructed
|
||||
* and drops these references when it is finalized.
|
||||
* This finalization can cause the destruction of non-widget objects or widgets
|
||||
* which are not contained in a toplevel window.
|
||||
* For toplevel windows constructed by a builder, it is the responsibility of the user
|
||||
* to call gtk_window_destroy() to get rid of them and all the widgets they contain.
|
||||
* https://docs.gtk.org/gtk4/class.Builder.html
|
||||
*/
|
||||
void gtk_window_destroy (GtkWindow* window); // (in application.c) TODO ?
|
||||
|
||||
//
|
||||
// Tree-related events
|
||||
|
|
24
src/main.c
24
src/main.c
|
@ -28,7 +28,31 @@
|
|||
#include "../include/base.h"
|
||||
#include "../include/ui.h"
|
||||
|
||||
/* ----------------------- DOCUMENTATION ---------------------------------- */
|
||||
|
||||
// https://docs.gtk.org/gio/class.Application.html
|
||||
// https://docs.gtk.org/glib/main-loop.html
|
||||
// https://developer.gnome.org/documentation/tutorials/main-contexts.html
|
||||
// https://developer.gnome.org/documentation/tutorials/lists.html
|
||||
// https://developer.gnome.org/documentation/tutorials/application.html
|
||||
// https://developer.gnome.org/documentation/introduction.html
|
||||
// https://docs.gtk.org/gtk3/getting_started.html < WARNING Gtk3
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* The main entry point for your application should only create a GtkApplication instance,
|
||||
* set up the signal handlers, and then call g_application_run().
|
||||
* When saving and Loading Window State, you will need a GSettings schema,
|
||||
* to define the keys, the type of the values, and default value for each key.
|
||||
* Once you have a schema, you can map window properties to the GSettings keys defined by that schema
|
||||
* To use GAction you should be using GtkApplication.
|
||||
* GSimpleAction has two interesting signals: activate and change-state.
|
||||
* You can add a GAction to anything implementing the GActionMap interface, including GtkApplication.
|
||||
* This is done with g_action_map_add_action() and g_action_map_add_action_entries().
|
||||
* Pre- and post-condition assertions are implemented using g_return_if_fail() and g_return_val_if_fail().
|
||||
*
|
||||
* https://docs.gtk.org/gtk4/class.Builder.html
|
||||
* https://developer.gnome.org/documentation/tutorials/widget-templates.html
|
||||
*/
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "../../include/ui.h"
|
||||
|
||||
#define COMMUTE 1 // 0 first design (2023) based on <gemgraph.ui> XML data
|
||||
// 1 2024 May design, free of the XML encryption mechanism
|
||||
#define COMMUTE 0 // 0 first design (2023) based on <gemgraph.ui> XML data
|
||||
// 1 2024 May design, free of Builder & templates
|
||||
|
||||
/* Window actual presentation on screen */
|
||||
static void gem_graph_client_application_activate (GApplication *app)
|
||||
|
@ -41,16 +41,15 @@ static void gem_graph_client_application_activate (GApplication *app)
|
|||
NULL));
|
||||
|
||||
switch(COMMUTE) { // enum {...} in ui.h
|
||||
case GG_2023:
|
||||
// Launch with sidebar of gtk_notebook_append_pagef
|
||||
case GG_2023: // Launch with sidebar of gtk_notebook_append_pagef
|
||||
ui_toggle_sidebar();
|
||||
ui_set_stack (HOME_MODE);
|
||||
ui_debug_model_loading (window, "data/models/dimers random walk.xml");
|
||||
// XXX the window closes when a leaf expander is clicked (Erreur de segmentation)
|
||||
break;
|
||||
case GG_2024_05:
|
||||
// see > in contain.c
|
||||
case GG_2024_05: // see > in contain.c
|
||||
experimental_activate_00 (app, window);
|
||||
// ui_debug_model_loading (window, "data/models/dimers random walk.xml");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -127,7 +126,7 @@ void ui_send_notification(const char *message)
|
|||
static void gem_graph_client_application_class_init (GemGraphClientApplicationClass *klass)
|
||||
{
|
||||
GApplicationClass *app_class = G_APPLICATION_CLASS(klass);
|
||||
|
||||
// app_class->activate = experimental_activate_00;// (app, window); < ?? XXX
|
||||
app_class->activate = gem_graph_client_application_activate;
|
||||
}
|
||||
|
||||
|
@ -142,3 +141,5 @@ GemGraphClientApplication *gem_graph_client_application_new(
|
|||
"flags", flags,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void gtk_window_destroy (GtkWindow* window) {printf("gtk_window_destroy() < TODO");}
|
||||
|
|
|
@ -181,7 +181,7 @@ void experimental_activate_00 (GtkApplication *app, GtkWindow *window) {
|
|||
window_bar (window, "E coli (with permission from David S. Goodsell, 2009)");
|
||||
|
||||
GtkNotebook *run_notebook = GTK_NOTEBOOK (gtk_notebook_new());
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(run_notebook), GTK_POS_TOP); // GTK_POS_LEFT
|
||||
gtk_notebook_set_tab_pos (run_notebook, GTK_POS_TOP); // GTK_POS_LEFT
|
||||
|
||||
gtk_notebook_append_page (run_notebook, get_run_space_page_new(), gtk_label_new ("space"));
|
||||
gtk_notebook_append_page (run_notebook, get_run_rules_page_new(), gtk_label_new ("rules"));
|
||||
|
@ -191,7 +191,7 @@ void experimental_activate_00 (GtkApplication *app, GtkWindow *window) {
|
|||
gtk_notebook_append_page (run_notebook, get_run_help_page_new(), gtk_label_new ("help"));
|
||||
|
||||
GtkNotebook *edit_notebook = GTK_NOTEBOOK (gtk_notebook_new());
|
||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(edit_notebook), GTK_POS_TOP); // GTK_POS_RIGHT
|
||||
gtk_notebook_set_tab_pos (edit_notebook, GTK_POS_TOP); // GTK_POS_RIGHT
|
||||
|
||||
gtk_notebook_append_page (edit_notebook, get_edit_space_page_new(), gtk_label_new ("space"));
|
||||
gtk_notebook_append_page (edit_notebook, get_edit_rules_page_new(), gtk_label_new ("rules"));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/* E coli by David S. Goodsell (2009) */
|
||||
/* --- */
|
||||
/* Knowing that only a dynamic model can explain this phenomenon, */
|
||||
/* let's let this beautiful freeze frame be our guide. */
|
||||
/* let this beautiful freeze frame be our guide. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -25,6 +25,7 @@ GtkWidget *get_image_ALL_SPACE(){
|
|||
image = gtk_image_new_from_file("data/image/aXoris.png");
|
||||
image = gtk_picture_new_for_filename ("data/image/gg sketch.png");
|
||||
image = gtk_picture_new_for_filename ("data/image/E coli (Goodsell).png");
|
||||
// ui_setup_glarea (RUN_MODE, GTK_WIDGET(image)); < un essai...
|
||||
gtk_widget_set_size_request (GTK_WIDGET (image), W_IMAGE, H_IMAGE);
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<property name="icon-name">sidebar-show-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Display/hide sidebar</property>
|
||||
<property name="action-name">app.togglesidebar</property>
|
||||
<signal name="clicked" handler="ui_toggle_sidebar" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -108,20 +108,26 @@ char* ui_tree_create_model_func (GObject *item, gpointer root)
|
|||
return ui_tree_get_children_model (cur);
|
||||
}
|
||||
|
||||
static void print_widget_hierarchy(GtkWidget *widget){
|
||||
assert(widget);
|
||||
printf("[src/ui/views.ui_create_tree (GtkWidget *w)] widgets hiercharchy : %s > %s > %s > %s > %s > %s > %s > %s\n",\
|
||||
gtk_widget_get_name (GTK_WIDGET (gtk_widget_get_root (widget))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (widget)))))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (widget))))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (widget)))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (widget))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (widget)),\
|
||||
gtk_widget_get_name (widget),\
|
||||
gtk_widget_get_name (gtk_widget_get_first_child (widget))
|
||||
);
|
||||
}
|
||||
|
||||
// Application activation callback
|
||||
void ui_create_tree (GtkWidget *target_widget)
|
||||
{
|
||||
assert(target_widget);
|
||||
printf("[src/ui/views.ui_create_tree (GtkWidget *w)] widgets hiercharchy : %s > %s > %s > %s > %s > %s > %s > %s\n",\
|
||||
gtk_widget_get_name (GTK_WIDGET (gtk_widget_get_root (target_widget))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (target_widget)))))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (target_widget))))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (gtk_widget_get_parent (target_widget)))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (gtk_widget_get_parent (target_widget))),\
|
||||
gtk_widget_get_name (gtk_widget_get_parent (target_widget)),\
|
||||
gtk_widget_get_name (target_widget),\
|
||||
gtk_widget_get_name (gtk_widget_get_first_child (target_widget))
|
||||
);
|
||||
print_widget_hierarchy(target_widget);
|
||||
|
||||
// We don't want to add another tree in another scrolled_window into the current GtkBox, so :
|
||||
if (gtk_widget_get_first_child (target_widget)) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue