Renommage get/set et noms de fonctions après audit
This commit is contained in:
parent
7213efb714
commit
31923af432
|
@ -0,0 +1,9 @@
|
||||||
|
les fonctions commençant par get devraient renvoyer des valeurs et non pas des widgets
|
||||||
|
> "get_..." remplacé par "rec_..." pour les widgets
|
||||||
|
> "set_..." remplacé par "fix_..." pour les widgets
|
||||||
|
|
||||||
|
ne pas utiliser la taille de fenêtre comme comme référence
|
||||||
|
> corrigé
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,7 @@
|
||||||
#include <glib-2.0/glib.h>
|
#include <glib-2.0/glib.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
// #define G_APPLICATION_DEFAULT_FLAGS 0 < work TODO here ?
|
// #define G_APPLICATION_DEFAULT_FLAGS 0 TODO What was this declaration for ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
* Structure describing a gl_area and its parameters, used to create a table
|
* Structure describing a gl_area and its parameters, used to create a table
|
||||||
* of Gem-graph client current gl_areas
|
* of Gem-graph client current gl_areas
|
||||||
*/
|
*/
|
||||||
struct graph_stack_t {
|
struct graphics_stack_t {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -85,15 +85,15 @@ struct graph_stack_t {
|
||||||
/*
|
/*
|
||||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||||
*/
|
*/
|
||||||
extern struct graph_stack_t *graph_stack;
|
extern struct graphics_stack_t *graphics_stack;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure describing a gl_area and its parameters, used to create a table
|
* Structure describing a gl_area and its parameters, used to create a table
|
||||||
* of Gem-graph client current gl_areas
|
* of Gem-graph client current gl_areas
|
||||||
*/
|
*/
|
||||||
bool graph_render_stack(GtkWidget *container_widget);
|
bool graphics_render_stack(GtkWidget *container_widget);
|
||||||
|
|
||||||
bool graph_setup_glarea(int target_mode, GtkWidget *target_widget);
|
bool graphics_setup_glarea(int target_mode, GtkWidget *target_widget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes a gl_area
|
* Initializes a gl_area
|
||||||
|
@ -102,7 +102,7 @@ bool graph_setup_glarea(int target_mode, GtkWidget *target_widget);
|
||||||
*
|
*
|
||||||
* @return true if initialized
|
* @return true if initialized
|
||||||
*/
|
*/
|
||||||
int graph_init(void *error_buffer);
|
int graphics_init(void *error_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draws the current buffer to a gl_area
|
* Draws the current buffer to a gl_area
|
||||||
|
@ -111,7 +111,7 @@ int graph_init(void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw(const int graph_stack_id);
|
void graphics_draw(const int graphics_stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdowns a gl_area
|
* Shutdowns a gl_area
|
||||||
|
@ -120,7 +120,7 @@ void graph_draw(const int graph_stack_id);
|
||||||
*
|
*
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
bool graph_shutdown(const int graph_stack_id, void *error_buffer);
|
bool graphics_shutdown(const int graphics_stack_id, void *error_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the shaders of a gl_area and link them to a program
|
* Initializes the shaders of a gl_area and link them to a program
|
||||||
|
@ -129,18 +129,18 @@ bool graph_shutdown(const int graph_stack_id, void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return true if initialized
|
* @return true if initialized
|
||||||
*/
|
*/
|
||||||
bool graph_init_shaders(const int graph_stack_id);
|
bool graphics_init_shaders(const int graphics_stack_id);
|
||||||
|
|
||||||
bool graph_init_graph_stack(void *container_widget, GError *error_buffer);
|
bool graphics_init_graphics_stack(void *container_widget, GError *error_buffer);
|
||||||
bool graph_shutdown_graph_stack(void *container_widget, GError *error_buffer);
|
bool graphics_shutdown_graphics_stack(void *container_widget, GError *error_buffer);
|
||||||
bool graph_update_axis_stack(GtkWidget *container_widget, int axis, int value);
|
bool graphics_update_axis_stack(GtkWidget *container_widget, int axis, int value);
|
||||||
|
|
||||||
/* Initializes the buffer of a gl_area
|
/* Initializes the buffer of a gl_area
|
||||||
* Calls according to the user preferences
|
* Calls according to the user preferences
|
||||||
* @param gl_area, ptr to the gl_area widget
|
* @param gl_area, ptr to the gl_area widget
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_init_buffers(const int graph_stack_id);
|
void graphics_init_buffers(const int graphics_stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draws a vertex (x, y, z)
|
* Draws a vertex (x, y, z)
|
||||||
|
@ -150,7 +150,7 @@ void graph_init_buffers(const int graph_stack_id);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_vertex (const int graph_stack_id,
|
void graphics_draw_vertex (const int graphics_stack_id,
|
||||||
GLfloat x,
|
GLfloat x,
|
||||||
GLfloat y,
|
GLfloat y,
|
||||||
GLfloat z);
|
GLfloat z);
|
||||||
|
@ -163,7 +163,7 @@ void graph_draw_vertex (const int graph_stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_color (const int graph_stack_id, GLfloat r, GLfloat g, GLfloat b);
|
void graphics_draw_color (const int graphics_stack_id, GLfloat r, GLfloat g, GLfloat b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe a line from a to b into the line buffer
|
* Writes values to describe a line from a to b into the line buffer
|
||||||
|
@ -172,7 +172,7 @@ void graph_draw_color (const int graph_stack_id, GLfloat r, GLfloat g, GLfloat b
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_line (const int graph_stack_id, GLuint a, GLuint b);
|
void graphics_draw_line (const int graphics_stack_id, GLuint a, GLuint b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
||||||
|
@ -181,7 +181,7 @@ void graph_draw_line (const int graph_stack_id, GLuint a, GLuint b);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_plan (const int graph_stack_id, GLuint a, GLuint b, GLuint c);
|
void graphics_draw_plan (const int graphics_stack_id, GLuint a, GLuint b, GLuint c);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Created and compile a shader
|
* Created and compile a shader
|
||||||
|
@ -191,7 +191,7 @@ void graph_draw_plan (const int graph_stack_id, GLuint a, GLuint b, GLuint c);
|
||||||
*
|
*
|
||||||
* @return shader id
|
* @return shader id
|
||||||
*/
|
*/
|
||||||
static inline GLuint graph_create_shader(const int graph_stack_id, int type, const char *src)
|
static inline GLuint graphics_create_shader(const int graphics_stack_id, int type, const char *src)
|
||||||
{
|
{
|
||||||
GLuint shader;
|
GLuint shader;
|
||||||
int status;
|
int status;
|
||||||
|
@ -225,47 +225,48 @@ static inline GLuint graph_create_shader(const int graph_stack_id, int type, con
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void graph_print_stack(int graph_stack_id)
|
static inline void graphics_print_stack(int graphics_stack_id)
|
||||||
{
|
{
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
|
|
||||||
printf("\n[n=%d]***************", n);
|
printf("\n[n=%d]***************", n);
|
||||||
|
|
||||||
printf("id = %d\tmode = %d\n",
|
printf("id = %d\tmode = %d\n",
|
||||||
graph_stack[graph_stack_id].id,
|
graphics_stack[graphics_stack_id].id,
|
||||||
graph_stack[graph_stack_id].mode);
|
graphics_stack[graphics_stack_id].mode);
|
||||||
|
|
||||||
printf("rotation_angles = ");
|
printf("rotation_angles = ");
|
||||||
for (int i = 0; i < N_AXIS; i++) {
|
for (int i = 0; i < N_AXIS; i++) {
|
||||||
printf("%f\t", graph_stack[graph_stack_id].rotation_angles[i]); // Rotation angles on each axis
|
printf("%f\t", graphics_stack[graphics_stack_id].rotation_angles[i]);
|
||||||
|
// Rotation angles on each axis
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("vao = %d\n", graph_stack[graph_stack_id].vao);
|
printf("vao = %d\n", graphics_stack[graphics_stack_id].vao);
|
||||||
printf("position_buffer = %d\n", graph_stack[graph_stack_id].position_buffer);
|
printf("position_buffer = %d\n", graphics_stack[graphics_stack_id].position_buffer);
|
||||||
printf("color_buffer = %d\n", graph_stack[graph_stack_id].color_buffer);
|
printf("color_buffer = %d\n", graphics_stack[graphics_stack_id].color_buffer);
|
||||||
printf("program = %d\n", graph_stack[graph_stack_id].program);
|
printf("program = %d\n", graphics_stack[graphics_stack_id].program);
|
||||||
printf("m = %d\n", graph_stack[graph_stack_id].m);
|
printf("m = %d\n", graphics_stack[graphics_stack_id].m);
|
||||||
printf("v = %d\n", graph_stack[graph_stack_id].v);
|
printf("v = %d\n", graphics_stack[graphics_stack_id].v);
|
||||||
printf("p = %d\n", graph_stack[graph_stack_id].p);
|
printf("p = %d\n", graphics_stack[graphics_stack_id].p);
|
||||||
|
|
||||||
printf("arrows_ptr = %p\n", graph_stack[graph_stack_id].arrows_ptr);
|
printf("arrows_ptr = %p\n", graphics_stack[graphics_stack_id].arrows_ptr);
|
||||||
printf("arrows_nb = %ld\n", graph_stack[graph_stack_id].arrows_nb);
|
printf("arrows_nb = %ld\n", graphics_stack[graphics_stack_id].arrows_nb);
|
||||||
|
|
||||||
printf("buffer_vertex_origin = %p\n", graph_stack[graph_stack_id].buffer_vertex_origin);
|
printf("buffer_vertex_origin = %p\n", graphics_stack[graphics_stack_id].buffer_vertex_origin);
|
||||||
printf("buffer_colors_origin = %p\n", graph_stack[graph_stack_id].buffer_colors_origin);
|
printf("buffer_colors_origin = %p\n", graphics_stack[graphics_stack_id].buffer_colors_origin);
|
||||||
printf("buffer_lines_origin = %p\n", graph_stack[graph_stack_id].buffer_lines_origin);
|
printf("buffer_lines_origin = %p\n", graphics_stack[graphics_stack_id].buffer_lines_origin);
|
||||||
printf("buffer_plans_origin = %p\n", graph_stack[graph_stack_id].buffer_plans_origin);
|
printf("buffer_plans_origin = %p\n", graphics_stack[graphics_stack_id].buffer_plans_origin);
|
||||||
|
|
||||||
printf("buffer_vertex_size = %ld\n", graph_stack[graph_stack_id].buffer_vertex_size);
|
printf("buffer_vertex_size = %ld\n", graphics_stack[graphics_stack_id].buffer_vertex_size);
|
||||||
printf("buffer_colors_size = %ld\n", graph_stack[graph_stack_id].buffer_colors_size);
|
printf("buffer_colors_size = %ld\n", graphics_stack[graphics_stack_id].buffer_colors_size);
|
||||||
printf("buffer_lines_size = %ld\n", graph_stack[graph_stack_id].buffer_lines_size);
|
printf("buffer_lines_size = %ld\n", graphics_stack[graphics_stack_id].buffer_lines_size);
|
||||||
printf("buffer_plans_size = %ld\n", graph_stack[graph_stack_id].buffer_plans_size);
|
printf("buffer_plans_size = %ld\n", graphics_stack[graphics_stack_id].buffer_plans_size);
|
||||||
|
|
||||||
printf("buffer_vertex_0_arrow = %ld\n", graph_stack[graph_stack_id].buffer_vertex_0_arrow);
|
printf("buffer_vertex_0_arrow = %ld\n", graphics_stack[graphics_stack_id].buffer_vertex_0_arrow);
|
||||||
printf("buffer_colors_0_arrow = %ld\n", graph_stack[graph_stack_id].buffer_colors_0_arrow);
|
printf("buffer_colors_0_arrow = %ld\n", graphics_stack[graphics_stack_id].buffer_colors_0_arrow);
|
||||||
printf("buffer_lines_0_arrow = %ld\n", graph_stack[graph_stack_id].buffer_lines_0_arrow);
|
printf("buffer_lines_0_arrow = %ld\n", graphics_stack[graphics_stack_id].buffer_lines_0_arrow);
|
||||||
printf("buffer_plans_0_arrow = %ld\n", graph_stack[graph_stack_id].buffer_plans_0_arrow);
|
printf("buffer_plans_0_arrow = %ld\n", graphics_stack[graphics_stack_id].buffer_plans_0_arrow);
|
||||||
|
|
||||||
printf("********************\n");
|
printf("********************\n");
|
||||||
n++;
|
n++;
|
||||||
|
@ -279,7 +280,7 @@ static inline void graph_print_stack(int graph_stack_id)
|
||||||
*
|
*
|
||||||
* @return true if initialized
|
* @return true if initialized
|
||||||
*/
|
*/
|
||||||
int graph_init(void *error_buffer);
|
int graphics_init(void *error_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draws the current buffer to a gl_area
|
* Draws the current buffer to a gl_area
|
||||||
|
@ -288,7 +289,7 @@ int graph_init(void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
//void graph_draw(const int graph_stack_id);
|
//void graphics_draw(const int graphics_stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdowns a gl_area
|
* Shutdowns a gl_area
|
||||||
|
@ -297,7 +298,7 @@ int graph_init(void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
bool graph_shutdown(const int graph_stack_id, void *error_buffer);
|
bool graphics_shutdown(const int graphics_stack_id, void *error_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the shaders of a gl_area and link them to a program
|
* Initializes the shaders of a gl_area and link them to a program
|
||||||
|
@ -306,14 +307,14 @@ bool graph_shutdown(const int graph_stack_id, void *error_buffer);
|
||||||
*
|
*
|
||||||
* @return true if initialized
|
* @return true if initialized
|
||||||
*/
|
*/
|
||||||
bool graph_init_shaders(const int graph_stack_id);
|
bool graphics_init_shaders(const int graphics_stack_id);
|
||||||
|
|
||||||
/* Initializes the buffer of a gl_area
|
/* Initializes the buffer of a gl_area
|
||||||
* Calls according to the user preferences
|
* Calls according to the user preferences
|
||||||
* @param gl_area, ptr to the gl_area widget
|
* @param gl_area, ptr to the gl_area widget
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_init_buffers(const int graph_stack_id);
|
void graphics_init_buffers(const int graphics_stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Draws a vertex (x, y, z)
|
* Draws a vertex (x, y, z)
|
||||||
|
@ -323,7 +324,7 @@ void graph_init_buffers(const int graph_stack_id);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_vertex (const int graph_stack_id,
|
void graphics_draw_vertex (const int graphics_stack_id,
|
||||||
GLfloat x,
|
GLfloat x,
|
||||||
GLfloat y,
|
GLfloat y,
|
||||||
GLfloat z);
|
GLfloat z);
|
||||||
|
@ -336,7 +337,7 @@ void graph_draw_vertex (const int graph_stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_color (const int graph_stack_id, GLfloat r, GLfloat g, GLfloat b);
|
void graphics_draw_color (const int graphics_stack_id, GLfloat r, GLfloat g, GLfloat b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe a line from a to b into the line buffer
|
* Writes values to describe a line from a to b into the line buffer
|
||||||
|
@ -345,7 +346,7 @@ void graph_draw_color (const int graph_stack_id, GLfloat r, GLfloat g, GLfloat b
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_line (const int graph_stack_id, GLuint a, GLuint b);
|
void graphics_draw_line (const int graphics_stack_id, GLuint a, GLuint b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
* Writes values to describe an (a,b,c) plan (triangle) into the plan buffer
|
||||||
|
@ -354,11 +355,11 @@ void graph_draw_line (const int graph_stack_id, GLuint a, GLuint b);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_plan (const int graph_stack_id, GLuint a, GLuint b, GLuint c);
|
void graphics_draw_plan (const int graphics_stack_id, GLuint a, GLuint b, GLuint c);
|
||||||
|
|
||||||
void graph_model_setup (const int graph_stack_id);
|
void graphics_model_setup (const int graphics_stack_id);
|
||||||
|
|
||||||
int graph_draw_one_arrow_vertex (const int graph_stack_id,
|
int graphics_draw_one_arrow_vertex (const int graphics_stack_id,
|
||||||
int space_X,
|
int space_X,
|
||||||
int space_Y,
|
int space_Y,
|
||||||
int space_Z,
|
int space_Z,
|
||||||
|
@ -368,7 +369,7 @@ int graph_draw_one_arrow_vertex (const int graph_stack_id,
|
||||||
int y,
|
int y,
|
||||||
int z);
|
int z);
|
||||||
|
|
||||||
int graph_draw_one_arrow_line(const int graph_stack_id,
|
int graphics_draw_one_arrow_line(const int graphics_stack_id,
|
||||||
int offset_vertex);
|
int offset_vertex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -378,13 +379,13 @@ int graph_draw_one_arrow_line(const int graph_stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
int graph_draw_space_ridges_vertex (const int graph_stack_id,
|
int graphics_draw_space_ridges_vertex (const int graphics_stack_id,
|
||||||
long offset_vertex,
|
long offset_vertex,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
long z);
|
long z);
|
||||||
|
|
||||||
int graph_draw_space_ridges_lines (const int graph_stack_id);
|
int graphics_draw_space_ridges_lines (const int graphics_stack_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes grid lines on space faces
|
* Writes grid lines on space faces
|
||||||
|
@ -393,18 +394,18 @@ int graph_draw_space_ridges_lines (const int graph_stack_id);
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
long graph_draw_grids_on_space_faces_vertex (const int graph_stack_id,
|
long graphics_draw_grids_on_space_faces_vertex (const int graphics_stack_id,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
long z);
|
long z);
|
||||||
|
|
||||||
long graph_draw_grids_on_space_faces_lines (const int graph_stack_id,
|
long graphics_draw_grids_on_space_faces_lines (const int graphics_stack_id,
|
||||||
long offset_vertex,
|
long offset_vertex,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
long z);
|
long z);
|
||||||
|
|
||||||
int graph_set_arrow (int graph_stack_id,
|
int graphics_set_arrow (int graphics_stack_id,
|
||||||
int arrows_nb,
|
int arrows_nb,
|
||||||
int space_X,
|
int space_X,
|
||||||
int space_Y,
|
int space_Y,
|
||||||
|
|
|
@ -28,19 +28,21 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
bool model_init(const char *content, size_t length, const char *basename);
|
|
||||||
bool model_shutdown(void);
|
|
||||||
|
|
||||||
char model_get_dim(void);
|
bool parse_model_init(const char *content, size_t length, const char *basename);
|
||||||
long model_get_dim_value(const char *axis);
|
bool parse_model_shutdown(void);
|
||||||
char model_get_multiplicity(void);
|
|
||||||
bool model_get_next_state(char *new_state_id);
|
char parse_model_get_dim(void);
|
||||||
bool model_get_next_arrow(struct arrow_t *new_arrow,
|
long parse_model_get_dim_value(const char *axis);
|
||||||
|
char parse_model_get_multiplicity(void);
|
||||||
|
bool parse_model_get_next_state(char *new_state_id);
|
||||||
|
bool parse_model_get_next_arrow(struct arrow_t *new_arrow,
|
||||||
const char *state_id,
|
const char *state_id,
|
||||||
char dimension);
|
char dimension);
|
||||||
|
|
||||||
long model_get_state_arrows_count(const char *state_id);
|
long parse_model_get_state_arrows_count(const char *state_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
// void on_auto_notification (const char *message);
|
// void on_auto_notification (const char *message);
|
||||||
|
@ -90,18 +90,6 @@ void on_clicked_menu_experiment (GtkWidget *btt_menu, gpointer list_box);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,16 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* W I N D O W S */
|
/* W I N D O W S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void widget_head_set_MAIN_WINDOW (GtkApplication *app);
|
void widget_head_fix_MAIN_WINDOW (GtkApplication *app);
|
||||||
void widget_head_set_DIALOG_WINDOW (GtkApplication *app);
|
void widget_head_fix_DIALOG_WINDOW (GtkApplication *app);
|
||||||
void widget_head_set_TEXT_WINDOW (GtkApplication *app);
|
void widget_head_fix_TEXT_WINDOW (GtkApplication *app);
|
||||||
|
|
||||||
void widget_head_MAIN_WINDOW_design (GtkWindow *main_window);
|
void widget_head_MAIN_WINDOW_design (GtkWindow *main_window);
|
||||||
void widget_head_DIALOG_WINDOW_design (GtkWindow *main_window,
|
void widget_head_DIALOG_WINDOW_design (GtkWindow *main_window,
|
||||||
|
@ -45,20 +45,20 @@ void widget_head_DIALOG_WINDOW_design (GtkWindow *main_window,
|
||||||
void widget_head_TEXT_WINDOW_design (GtkWindow *main_window,
|
void widget_head_TEXT_WINDOW_design (GtkWindow *main_window,
|
||||||
GtkWindow *text_window);
|
GtkWindow *text_window);
|
||||||
|
|
||||||
GtkWindow *widget_head_get_MAIN_WINDOW();
|
GtkWindow *widget_head_rec_MAIN_WINDOW();
|
||||||
GtkWindow *widget_head_get_DIALOG_WINDOW();
|
GtkWindow *widget_head_rec_DIALOG_WINDOW();
|
||||||
GtkWindow *widget_head_get_TEXT_WINDOW();
|
GtkWindow *widget_head_rec_TEXT_WINDOW();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* W I D G E T S */
|
/* W I D G E T S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
GtkWidget *get_STATE_page();
|
GtkWidget *widget_rec_STATE_page();
|
||||||
GtkWidget *get_RULES_page();
|
GtkWidget *widget_rec_RULES_page();
|
||||||
GtkWidget *get_STOCK_page();
|
GtkWidget *widget_rec_STOCK_page();
|
||||||
|
|
||||||
GtkWidget *get_STOCK_text (gchar *text_name);
|
GtkWidget *widget_rec_STOCK_text (gchar *text_name);
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -66,9 +66,9 @@ GtkWidget *get_STOCK_text (gchar *text_name);
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
struct MenuNode_t {gchar *text; struct MenuNode_t *child, *next;};
|
struct MenuNode_t {gchar *text; struct MenuNode_t *child, *next;};
|
||||||
struct MenuNode_t *create_user_menu_node (const gchar* text);
|
struct MenuNode_t *widget_create_user_menu_node (const gchar* text);
|
||||||
|
|
||||||
GtkWidget *get_menu_anchor();
|
GtkWidget *widget_rec_menu_anchor();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -76,12 +76,12 @@ GtkWidget *get_menu_anchor();
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;};
|
struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;};
|
||||||
struct TreeNode_t *create_user_tree_node (const gchar* text);
|
struct TreeNode_t *widget_create_user_tree_node (const gchar* text);
|
||||||
|
|
||||||
void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child);
|
void widget_add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child);
|
||||||
void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
|
void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root);
|
||||||
|
|
||||||
GtkScrolledWindow *get_user_rules_tree ();
|
GtkScrolledWindow *widget_rec_user_rules_tree ();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -89,11 +89,11 @@ GtkScrolledWindow *get_user_rules_tree ();
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// images are in : data / image /
|
// images are in : data / image /
|
||||||
|
|
||||||
GtkWidget *get_image_E_coli();
|
GtkWidget *widget_rec_image_E_coli();
|
||||||
GtkWidget *get_image_GLUTAMATE();
|
GtkWidget *widget_rec_image_GLUTAMATE();
|
||||||
GtkWidget *get_image_GLUTAMINE();
|
GtkWidget *widget_rec_image_GLUTAMINE();
|
||||||
GtkWidget *get_image_ATP();
|
GtkWidget *widget_rec_image_ATP();
|
||||||
GtkWidget *get_image_AMP();
|
GtkWidget *widget_rec_image_AMP();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -101,9 +101,9 @@ GtkWidget *get_image_AMP();
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// texts are in : data / text /
|
// texts are in : data / text /
|
||||||
|
|
||||||
gchar *get_text_address_THEORY ();
|
gchar *widget_rec_text_address_THEORY ();
|
||||||
gchar *get_text_address_ABOUT_COMMANDS ();
|
gchar *widget_rec_text_address_ABOUT_COMMANDS ();
|
||||||
gchar *get_text_address_ANY ();
|
gchar *widget_rec_text_address_ANY ();
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_vertex (const int stack_id,
|
void graphics_draw_vertex (const int stack_id,
|
||||||
GLfloat x,
|
GLfloat x,
|
||||||
GLfloat y,
|
GLfloat y,
|
||||||
GLfloat z)
|
GLfloat z)
|
||||||
|
@ -47,22 +47,22 @@ void graph_draw_vertex (const int stack_id,
|
||||||
//g_printerr("stack_id is %d\n", stack_id);
|
//g_printerr("stack_id is %d\n", stack_id);
|
||||||
//g_printerr("graphic_stack is at %p\n", graphic_stack);
|
//g_printerr("graphic_stack is at %p\n", graphic_stack);
|
||||||
//g_printerr("graphic_stack[stack_id] is at %p\n", graphic_stack + stack_id);
|
//g_printerr("graphic_stack[stack_id] is at %p\n", graphic_stack + stack_id);
|
||||||
volatile struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
volatile struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
|
|
||||||
//g_printerr("Currently stack->buffer_vertex_origin @ %p\n", stack->buffer_vertex_origin);
|
//g_printerr("Currently stack->buffer_vertex_origin @ %p\n", stack->buffer_vertex_origin);
|
||||||
|
|
||||||
//assert (stack->buffer_vertex_origin);
|
//assert (stack->buffer_vertex_origin);
|
||||||
|
|
||||||
graph_stack->buffer_vertex_origin =
|
graphics_stack->buffer_vertex_origin =
|
||||||
g_realloc (graph_stack->buffer_vertex_origin,
|
g_realloc (graphics_stack->buffer_vertex_origin,
|
||||||
(graph_stack->buffer_vertex_size + 3) * sizeof(GLfloat));
|
(graphics_stack->buffer_vertex_size + 3) * sizeof(GLfloat));
|
||||||
//print_stack(stack_id);
|
//print_stack(stack_id);
|
||||||
|
|
||||||
graph_stack->buffer_vertex_origin[graph_stack->buffer_vertex_size + 0] = x;
|
graphics_stack->buffer_vertex_origin[graphics_stack->buffer_vertex_size + 0] = x;
|
||||||
graph_stack->buffer_vertex_origin[graph_stack->buffer_vertex_size + 1] = y;
|
graphics_stack->buffer_vertex_origin[graphics_stack->buffer_vertex_size + 1] = y;
|
||||||
graph_stack->buffer_vertex_origin[graph_stack->buffer_vertex_size + 2] = z;
|
graphics_stack->buffer_vertex_origin[graphics_stack->buffer_vertex_size + 2] = z;
|
||||||
|
|
||||||
graph_stack->buffer_vertex_size += 3;
|
graphics_stack->buffer_vertex_size += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -72,23 +72,23 @@ void graph_draw_vertex (const int stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_color (const int stack_id,
|
void graphics_draw_color (const int stack_id,
|
||||||
GLfloat r,
|
GLfloat r,
|
||||||
GLfloat g,
|
GLfloat g,
|
||||||
GLfloat b)
|
GLfloat b)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
|
|
||||||
graph_stack->buffer_colors_origin = g_realloc (graph_stack->buffer_colors_origin,
|
graphics_stack->buffer_colors_origin = g_realloc (graphics_stack->buffer_colors_origin,
|
||||||
(graph_stack->buffer_colors_size + 3) * sizeof(GLfloat));
|
(graphics_stack->buffer_colors_size + 3) * sizeof(GLfloat));
|
||||||
|
|
||||||
assert (graph_stack->buffer_colors_origin);
|
assert (graphics_stack->buffer_colors_origin);
|
||||||
|
|
||||||
graph_stack->buffer_colors_origin[graph_stack->buffer_colors_size + 0] = r;
|
graphics_stack->buffer_colors_origin[graphics_stack->buffer_colors_size + 0] = r;
|
||||||
graph_stack->buffer_colors_origin[graph_stack->buffer_colors_size + 1] = g;
|
graphics_stack->buffer_colors_origin[graphics_stack->buffer_colors_size + 1] = g;
|
||||||
graph_stack->buffer_colors_origin[graph_stack->buffer_colors_size + 2] = b;
|
graphics_stack->buffer_colors_origin[graphics_stack->buffer_colors_size + 2] = b;
|
||||||
|
|
||||||
graph_stack->buffer_colors_size += 3;
|
graphics_stack->buffer_colors_size += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -98,21 +98,21 @@ void graph_draw_color (const int stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_line (const int stack_id,
|
void graphics_draw_line (const int stack_id,
|
||||||
GLuint a,
|
GLuint a,
|
||||||
GLuint b)
|
GLuint b)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
|
|
||||||
graph_stack->buffer_lines_origin = g_realloc (graph_stack->buffer_lines_origin,
|
graphics_stack->buffer_lines_origin = g_realloc (graphics_stack->buffer_lines_origin,
|
||||||
(graph_stack->buffer_lines_size + 2) * sizeof(GLuint));
|
(graphics_stack->buffer_lines_size + 2) * sizeof(GLuint));
|
||||||
|
|
||||||
assert (graph_stack->buffer_lines_origin);
|
assert (graphics_stack->buffer_lines_origin);
|
||||||
|
|
||||||
graph_stack->buffer_lines_origin[graph_stack->buffer_lines_size + 0] = a;
|
graphics_stack->buffer_lines_origin[graphics_stack->buffer_lines_size + 0] = a;
|
||||||
graph_stack->buffer_lines_origin[graph_stack->buffer_lines_size + 1] = b;
|
graphics_stack->buffer_lines_origin[graphics_stack->buffer_lines_size + 1] = b;
|
||||||
|
|
||||||
graph_stack->buffer_lines_size += 2;
|
graphics_stack->buffer_lines_size += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -122,23 +122,23 @@ void graph_draw_line (const int stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw_plan (const int stack_id,
|
void graphics_draw_plan (const int stack_id,
|
||||||
GLuint a,
|
GLuint a,
|
||||||
GLuint b,
|
GLuint b,
|
||||||
GLuint c)
|
GLuint c)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *stack = &graph_stack[stack_id];
|
struct graphics_stack_t *stack = &graphics_stack[stack_id];
|
||||||
|
|
||||||
graph_stack->buffer_plans_origin = g_realloc (graph_stack->buffer_plans_origin,
|
graphics_stack->buffer_plans_origin = g_realloc (graphics_stack->buffer_plans_origin,
|
||||||
(graph_stack->buffer_plans_size + 3) * sizeof(GLuint));
|
(graphics_stack->buffer_plans_size + 3) * sizeof(GLuint));
|
||||||
|
|
||||||
assert (stack->buffer_plans_origin);
|
assert (stack->buffer_plans_origin);
|
||||||
|
|
||||||
graph_stack->buffer_plans_origin[graph_stack->buffer_plans_size + 0] = a;
|
graphics_stack->buffer_plans_origin[graphics_stack->buffer_plans_size + 0] = a;
|
||||||
graph_stack->buffer_plans_origin[graph_stack->buffer_plans_size + 1] = b;
|
graphics_stack->buffer_plans_origin[graphics_stack->buffer_plans_size + 1] = b;
|
||||||
graph_stack->buffer_plans_origin[graph_stack->buffer_plans_size + 2] = c;
|
graphics_stack->buffer_plans_origin[graphics_stack->buffer_plans_size + 2] = c;
|
||||||
|
|
||||||
graph_stack->buffer_plans_size += 3;
|
graphics_stack->buffer_plans_size += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -148,13 +148,13 @@ void graph_draw_plan (const int stack_id,
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_draw(const int stack_id)
|
void graphics_draw(const int stack_id)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *stack = &graph_stack[stack_id];
|
struct graphics_stack_t *stack = &graphics_stack[stack_id];
|
||||||
|
|
||||||
g_printerr("[debug] graph_draw() started\n");
|
g_printerr("[debug] graphics_draw() started\n");
|
||||||
|
|
||||||
graph_print_stack(stack_id);
|
graphics_print_stack(stack_id);
|
||||||
|
|
||||||
GLint cur_viewport[4];
|
GLint cur_viewport[4];
|
||||||
glGetIntegerv(GL_VIEWPORT, cur_viewport);
|
glGetIntegerv(GL_VIEWPORT, cur_viewport);
|
||||||
|
@ -204,5 +204,5 @@ void graph_draw(const int stack_id)
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
g_printerr("[debug] graph_draw() ended\n");
|
g_printerr("[debug] graphics_draw() ended\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "../../include/graphics.h"
|
#include "../../include/graphics.h"
|
||||||
|
|
||||||
int graph_draw_space_ridges_vertex (const int stack_id,
|
int graphics_draw_space_ridges_vertex (const int stack_id,
|
||||||
long offset_vertex,
|
long offset_vertex,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
|
@ -36,44 +36,44 @@ int graph_draw_space_ridges_vertex (const int stack_id,
|
||||||
{
|
{
|
||||||
GLfloat max = fmax(x, y); max = fmax(max, z);
|
GLfloat max = fmax(x, y); max = fmax(max, z);
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex - y / max, - z / max);
|
graphics_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex - y / max, - z / max);
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex - y / max, - z / max);
|
graphics_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex - y / max, - z / max);
|
||||||
graph_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex + y / max, - z / max);
|
graphics_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex + y / max, - z / max);
|
||||||
graph_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex - y / max, + z / max);
|
graphics_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex - y / max, + z / max);
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex + y / max, - z / max);
|
graphics_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex + y / max, - z / max);
|
||||||
graph_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex - y / max, + z / max);
|
graphics_draw_vertex (stack_id, offset_vertex + x / max, offset_vertex - y / max, + z / max);
|
||||||
graph_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex + y / max, + z / max);
|
graphics_draw_vertex (stack_id, offset_vertex - x / max, offset_vertex + y / max, + z / max);
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, offset_vertex + x / max, + y / max, + z / max);
|
graphics_draw_vertex (stack_id, offset_vertex + x / max, + y / max, + z / max);
|
||||||
|
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
graph_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
graphics_draw_color (stack_id, 0.8f, 0.6f, 0.5f);
|
||||||
|
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
int graph_draw_space_ridges_lines (const int stack_id)
|
int graphics_draw_space_ridges_lines (const int stack_id)
|
||||||
{
|
{
|
||||||
graph_draw_line (stack_id, 0, 1); graph_draw_line (stack_id, 7, 4);
|
graphics_draw_line (stack_id, 0, 1); graphics_draw_line (stack_id, 7, 4);
|
||||||
graph_draw_line (stack_id, 0, 2); graph_draw_line (stack_id, 7, 5);
|
graphics_draw_line (stack_id, 0, 2); graphics_draw_line (stack_id, 7, 5);
|
||||||
graph_draw_line (stack_id, 0, 3); graph_draw_line (stack_id, 7, 6);
|
graphics_draw_line (stack_id, 0, 3); graphics_draw_line (stack_id, 7, 6);
|
||||||
|
|
||||||
graph_draw_line (stack_id, 1, 4); graph_draw_line (stack_id, 2, 4);
|
graphics_draw_line (stack_id, 1, 4); graphics_draw_line (stack_id, 2, 4);
|
||||||
graph_draw_line (stack_id, 1, 5); graph_draw_line (stack_id, 3, 5);
|
graphics_draw_line (stack_id, 1, 5); graphics_draw_line (stack_id, 3, 5);
|
||||||
graph_draw_line (stack_id, 2, 6); graph_draw_line (stack_id, 3, 6);
|
graphics_draw_line (stack_id, 2, 6); graphics_draw_line (stack_id, 3, 6);
|
||||||
|
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
long graph_draw_grids_on_space_faces_vertex (const int stack_id,
|
long graphics_draw_grids_on_space_faces_vertex (const int stack_id,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
long z)
|
long z)
|
||||||
|
@ -82,52 +82,52 @@ long graph_draw_grids_on_space_faces_vertex (const int stack_id,
|
||||||
|
|
||||||
for (i = 1; i < x; i++) {
|
for (i = 1; i < x; i++) {
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, (2 * i / x - 1) * x / max, - y / max, - z / max);
|
graphics_draw_vertex (stack_id, (2 * i / x - 1) * x / max, - y / max, - z / max);
|
||||||
graph_draw_vertex (stack_id, (2 * i / x - 1) * x / max, - y / max, z / max);
|
graphics_draw_vertex (stack_id, (2 * i / x - 1) * x / max, - y / max, z / max);
|
||||||
graph_draw_vertex (stack_id, (2 * i / x - 1) * x / max, y / max, z / max);
|
graphics_draw_vertex (stack_id, (2 * i / x - 1) * x / max, y / max, z / max);
|
||||||
graph_draw_vertex (stack_id, (2 * i / x - 1) * x / max, y / max, - z / max);
|
graphics_draw_vertex (stack_id, (2 * i / x - 1) * x / max, y / max, - z / max);
|
||||||
|
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* offset_vertex += (x - 1) * 4; */ /* offset_colors += (x - 1) * 4; */
|
/* offset_vertex += (x - 1) * 4; */ /* offset_colors += (x - 1) * 4; */
|
||||||
|
|
||||||
for (i = 1; i < y; i++) {
|
for (i = 1; i < y; i++) {
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, - x / max, (2 * i / y - 1) * y / max, - z / max);
|
graphics_draw_vertex (stack_id, - x / max, (2 * i / y - 1) * y / max, - z / max);
|
||||||
graph_draw_vertex (stack_id, - x / max, (2 * i / y - 1) * y / max, z / max);
|
graphics_draw_vertex (stack_id, - x / max, (2 * i / y - 1) * y / max, z / max);
|
||||||
graph_draw_vertex (stack_id, x / max, (2 * i / y - 1) * y / max, z / max);
|
graphics_draw_vertex (stack_id, x / max, (2 * i / y - 1) * y / max, z / max);
|
||||||
graph_draw_vertex (stack_id, x / max, (2 * i / y - 1) * y / max, - z / max);
|
graphics_draw_vertex (stack_id, x / max, (2 * i / y - 1) * y / max, - z / max);
|
||||||
|
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* offset_vertex += (y - 1) * 4; */ /* offset_colors += (y - 1) * 4; */
|
/* offset_vertex += (y - 1) * 4; */ /* offset_colors += (y - 1) * 4; */
|
||||||
|
|
||||||
for (i = 1; i < z; i++) {
|
for (i = 1; i < z; i++) {
|
||||||
|
|
||||||
graph_draw_vertex (stack_id, - x / max, - y / max, (2 * i / z - 1) * z / max);
|
graphics_draw_vertex (stack_id, - x / max, - y / max, (2 * i / z - 1) * z / max);
|
||||||
graph_draw_vertex (stack_id, - x / max, y / max, (2 * i / z - 1) * z / max);
|
graphics_draw_vertex (stack_id, - x / max, y / max, (2 * i / z - 1) * z / max);
|
||||||
graph_draw_vertex (stack_id, x / max, y / max, (2 * i / z - 1) * z / max);
|
graphics_draw_vertex (stack_id, x / max, y / max, (2 * i / z - 1) * z / max);
|
||||||
graph_draw_vertex (stack_id, x / max, - y / max, (2 * i / z - 1) * z / max);
|
graphics_draw_vertex (stack_id, x / max, - y / max, (2 * i / z - 1) * z / max);
|
||||||
|
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
graph_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
graphics_draw_color (stack_id, 0.55f, 0.55f, 0.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x + y + z - 3) * 3;
|
return (x + y + z - 3) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long graph_draw_grids_on_space_faces_lines (const int stack_id,
|
long graphics_draw_grids_on_space_faces_lines (const int stack_id,
|
||||||
long offset_vertex,
|
long offset_vertex,
|
||||||
long x,
|
long x,
|
||||||
long y,
|
long y,
|
||||||
|
@ -137,24 +137,24 @@ long graph_draw_grids_on_space_faces_lines (const int stack_id,
|
||||||
|
|
||||||
for (int i = 0; i < x - 1; i ++) {
|
for (int i = 0; i < x - 1; i ++) {
|
||||||
|
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 1, offset_vertex + i * 4 + 2);
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset_vertex += (x - 1) * 4;
|
offset_vertex += (x - 1) * 4;
|
||||||
|
|
||||||
for (int i = 0; i < y - 1; i ++) {
|
for (int i = 0; i < y - 1; i ++) {
|
||||||
|
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 2, offset_vertex + i * 4 + 3);
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset_vertex += (y - 1) * 4;
|
offset_vertex += (y - 1) * 4;
|
||||||
|
|
||||||
for (int i = 0; i < z - 1; i ++) {
|
for (int i = 0; i < z - 1; i ++) {
|
||||||
|
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 0, offset_vertex + i * 4 + 1);
|
||||||
graph_draw_line (stack_id, offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
graphics_draw_line (stack_id, offset_vertex + i * 4 + 3, offset_vertex + i * 4 + 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x + y + z - 3) * 4;
|
return (x + y + z - 3) * 4;
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#define TEST 0
|
#define TEST 0
|
||||||
|
|
||||||
struct graph_stack_t *graph_stack = NULL;
|
struct graphics_stack_t *graphics_stack = NULL;
|
||||||
size_t graph_stack_size = 0;
|
size_t graphics_stack_size = 0;
|
||||||
int *free_stack_slot = NULL;
|
int *free_stack_slot = NULL;
|
||||||
size_t free_stack_slot_size = 0;
|
size_t free_stack_slot_size = 0;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ size_t free_stack_slot_size = 0;
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void graph_debug_callback(GLenum source, GLenum type, GLuint id,
|
static void graphics_debug_callback(GLenum source, GLenum type, GLuint id,
|
||||||
GLenum severity, GLsizei length,
|
GLenum severity, GLsizei length,
|
||||||
const GLchar *msg, const void *data)
|
const GLchar *msg, const void *data)
|
||||||
{
|
{
|
||||||
|
@ -105,17 +105,17 @@ static void graph_debug_callback(GLenum source, GLenum type, GLuint id,
|
||||||
*
|
*
|
||||||
* @return id if initialized
|
* @return id if initialized
|
||||||
*/
|
*/
|
||||||
int graph_init(void *error_buffer)
|
int graphics_init(void *error_buffer)
|
||||||
{
|
{
|
||||||
int cur_id = 0;
|
int cur_id = 0;
|
||||||
struct graph_stack_t *graph_stack = NULL;
|
struct graphics_stack_t *graphics_stack = NULL;
|
||||||
|
|
||||||
g_printerr("[debug] graph_init()\n");
|
g_printerr("[debug] graphics_init()\n");
|
||||||
|
|
||||||
if (graph_stack == NULL) {
|
if (graphics_stack == NULL) {
|
||||||
graph_stack = g_malloc0 (sizeof(struct graph_stack_t));
|
graphics_stack = g_malloc0 (sizeof(struct graphics_stack_t));
|
||||||
graph_stack_size = 1;
|
graphics_stack_size = 1;
|
||||||
g_printerr("[debug] graph_init(): init graph_stack @ %p\n", graph_stack);
|
g_printerr("[debug] graphics_init(): init graphics_stack @ %p\n", graphics_stack);
|
||||||
} else {
|
} else {
|
||||||
// Check if there are free slots
|
// Check if there are free slots
|
||||||
if (free_stack_slot_size) {
|
if (free_stack_slot_size) {
|
||||||
|
@ -126,33 +126,33 @@ int graph_init(void *error_buffer)
|
||||||
free_stack_slot_size-- *
|
free_stack_slot_size-- *
|
||||||
sizeof(int));
|
sizeof(int));
|
||||||
} else {
|
} else {
|
||||||
cur_id = graph_stack_size;
|
cur_id = graphics_stack_size;
|
||||||
graph_stack = g_realloc (graph_stack,
|
graphics_stack = g_realloc (graphics_stack,
|
||||||
++graph_stack_size *
|
++graphics_stack_size *
|
||||||
sizeof(struct graph_stack_t));
|
sizeof(struct graphics_stack_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&graph_stack[cur_id], 0, sizeof(struct graph_stack_t));
|
memset(&graphics_stack[cur_id], 0, sizeof(struct graphics_stack_t));
|
||||||
|
|
||||||
g_printerr("[debug] graph_init() : graph_stack (@0x%p) has %ld elements\n",
|
g_printerr("[debug] graphics_init() : graphics_stack (@0x%p) has %ld elements\n",
|
||||||
graph_stack,
|
graphics_stack,
|
||||||
graph_stack_size);
|
graphics_stack_size);
|
||||||
|
|
||||||
graph_stack = &graph_stack[cur_id];
|
graphics_stack = &graphics_stack[cur_id];
|
||||||
graph_stack->id = cur_id;
|
graphics_stack->id = cur_id;
|
||||||
|
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
if (!graph_init_shaders(cur_id)) return -1;
|
if (!graphics_init_shaders(cur_id)) return -1;
|
||||||
|
|
||||||
graph_print_stack(cur_id);
|
graphics_print_stack(cur_id);
|
||||||
|
|
||||||
graph_init_buffers(cur_id);
|
graphics_init_buffers(cur_id);
|
||||||
|
|
||||||
glDebugMessageCallback(graph_debug_callback, NULL);
|
glDebugMessageCallback(graphics_debug_callback, NULL);
|
||||||
|
|
||||||
//print_stack(cur_id);
|
//print_stack(cur_id);
|
||||||
|
|
||||||
|
@ -166,37 +166,37 @@ int graph_init(void *error_buffer)
|
||||||
*
|
*
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
bool graph_shutdown(const int id, void *error_buffer)
|
bool graphics_shutdown(const int id, void *error_buffer)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
|
|
||||||
if (id >= graph_stack_size ||
|
if (id >= graphics_stack_size ||
|
||||||
graph_stack_size == 0 ||
|
graphics_stack_size == 0 ||
|
||||||
graph_stack == NULL)
|
graphics_stack == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
graph_stack = &graph_stack[id];
|
graphics_stack = &graphics_stack[id];
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
free(graph_stack->arrows_ptr);
|
free(graphics_stack->arrows_ptr);
|
||||||
graph_stack->arrows_ptr = NULL;
|
graphics_stack->arrows_ptr = NULL;
|
||||||
graph_stack->arrows_nb = 0;
|
graphics_stack->arrows_nb = 0;
|
||||||
|
|
||||||
glDeleteBuffers(1, &graph_stack->position_buffer);
|
glDeleteBuffers(1, &graphics_stack->position_buffer);
|
||||||
glDeleteBuffers(1, &graph_stack->color_buffer);
|
glDeleteBuffers(1, &graphics_stack->color_buffer);
|
||||||
glDeleteProgram(graph_stack->program);
|
glDeleteProgram(graphics_stack->program);
|
||||||
|
|
||||||
g_free(graph_stack->buffer_vertex_origin);
|
g_free(graphics_stack->buffer_vertex_origin);
|
||||||
g_free(graph_stack->buffer_colors_origin);
|
g_free(graphics_stack->buffer_colors_origin);
|
||||||
g_free(graph_stack->buffer_lines_origin);
|
g_free(graphics_stack->buffer_lines_origin);
|
||||||
g_free(graph_stack->buffer_plans_origin);
|
g_free(graphics_stack->buffer_plans_origin);
|
||||||
|
|
||||||
if (graph_stack_size == 1) {
|
if (graphics_stack_size == 1) {
|
||||||
free(graph_stack);
|
free(graphics_stack);
|
||||||
graph_stack = NULL;
|
graphics_stack = NULL;
|
||||||
graph_stack_size = 0;
|
graphics_stack_size = 0;
|
||||||
} else {
|
} else {
|
||||||
memset(&graph_stack[id], 0, sizeof(struct graph_stack_t));
|
memset(&graphics_stack[id], 0, sizeof(struct graphics_stack_t));
|
||||||
free_stack_slot = g_realloc(free_stack_slot,
|
free_stack_slot = g_realloc(free_stack_slot,
|
||||||
++free_stack_slot_size *
|
++free_stack_slot_size *
|
||||||
sizeof(int));
|
sizeof(int));
|
||||||
|
@ -219,17 +219,17 @@ bool graph_shutdown(const int id, void *error_buffer)
|
||||||
* and allows ulterior creations, suppressions or modifications of the arrows[] array
|
* and allows ulterior creations, suppressions or modifications of the arrows[] array
|
||||||
*
|
*
|
||||||
* draws the space()
|
* draws the space()
|
||||||
* triggers graph_set_arrows() that modifies the list () and draws arrows
|
* triggers graphics_set_arrows() that modifies the list () and draws arrows
|
||||||
*
|
*
|
||||||
* Initialisation du générateur pseudo-aléatoire
|
* Initialisation du générateur pseudo-aléatoire
|
||||||
* Attention, les vertex centraux de chaque unité d'espace (cube)
|
* Attention, les vertex centraux de chaque unité d'espace (cube)
|
||||||
* peuvent être redondants (max 6)
|
* peuvent être redondants (max 6)
|
||||||
*/
|
*/
|
||||||
void graph_model_setup (const int stack_id)
|
void graphics_model_setup (const int stack_id)
|
||||||
{
|
{
|
||||||
/* I N I T I A L D A T A S P E C I F I C A T I O N */
|
/* I N I T I A L D A T A S P E C I F I C A T I O N */
|
||||||
|
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
char dimension;
|
char dimension;
|
||||||
long space_X;
|
long space_X;
|
||||||
long space_Y;
|
long space_Y;
|
||||||
|
@ -238,7 +238,7 @@ void graph_model_setup (const int stack_id)
|
||||||
int density_max;
|
int density_max;
|
||||||
char multiplicity;
|
char multiplicity;
|
||||||
|
|
||||||
dimension = model_get_dim();
|
dimension = parse_model_get_dim();
|
||||||
|
|
||||||
g_print("[GRAPH DEBUG] dim = %d\n", dimension);
|
g_print("[GRAPH DEBUG] dim = %d\n", dimension);
|
||||||
|
|
||||||
|
@ -248,16 +248,16 @@ void graph_model_setup (const int stack_id)
|
||||||
|
|
||||||
switch(dimension) {
|
switch(dimension) {
|
||||||
case 3:
|
case 3:
|
||||||
space_Z = model_get_dim_value("z");
|
space_Z = parse_model_get_dim_value("z");
|
||||||
;
|
;
|
||||||
case 2:
|
case 2:
|
||||||
space_Y = model_get_dim_value("y");
|
space_Y = parse_model_get_dim_value("y");
|
||||||
;
|
;
|
||||||
// even in 1D, we must be able to see a grid (or not !)
|
// even in 1D, we must be able to see a grid (or not !)
|
||||||
if (!space_Y)
|
if (!space_Y)
|
||||||
space_Y = 1;
|
space_Y = 1;
|
||||||
case 1:
|
case 1:
|
||||||
space_X = model_get_dim_value("x");
|
space_X = parse_model_get_dim_value("x");
|
||||||
;
|
;
|
||||||
if (!space_X)
|
if (!space_X)
|
||||||
space_X = 1;
|
space_X = 1;
|
||||||
|
@ -270,39 +270,39 @@ void graph_model_setup (const int stack_id)
|
||||||
g_print("[GRAPH DEBUG] z = %ld\n", space_Z);
|
g_print("[GRAPH DEBUG] z = %ld\n", space_Z);
|
||||||
|
|
||||||
density_max = space_X * space_Y * space_Z;
|
density_max = space_X * space_Y * space_Z;
|
||||||
graph_stack->arrows_nb = 0;
|
graphics_stack->arrows_nb = 0;
|
||||||
|
|
||||||
multiplicity = model_get_multiplicity();
|
multiplicity = parse_model_get_multiplicity();
|
||||||
g_print("[GRAPH DEBUG] site_multiplicity = %d, density_max = %d\n", multiplicity, density_max);
|
g_print("[GRAPH DEBUG] site_multiplicity = %d, density_max = %d\n", multiplicity, density_max);
|
||||||
|
|
||||||
/* S P A C E D R A W I N G */
|
/* S P A C E D R A W I N G */
|
||||||
|
|
||||||
graph_draw_space_ridges_vertex (stack_id, graph_stack->buffer_vertex_size, space_X, space_Y, space_Z);
|
graphics_draw_space_ridges_vertex (stack_id, graphics_stack->buffer_vertex_size, space_X, space_Y, space_Z);
|
||||||
graph_draw_space_ridges_lines (stack_id);
|
graphics_draw_space_ridges_lines (stack_id);
|
||||||
graph_draw_grids_on_space_faces_vertex (stack_id, space_X, space_Y, space_Z);
|
graphics_draw_grids_on_space_faces_vertex (stack_id, space_X, space_Y, space_Z);
|
||||||
graph_draw_grids_on_space_faces_lines (stack_id, graph_stack->buffer_lines_size, space_X, space_Y, space_Z);
|
graphics_draw_grids_on_space_faces_lines (stack_id, graphics_stack->buffer_lines_size, space_X, space_Y, space_Z);
|
||||||
|
|
||||||
graph_stack->buffer_vertex_0_arrow = graph_stack->buffer_vertex_size;
|
graphics_stack->buffer_vertex_0_arrow = graphics_stack->buffer_vertex_size;
|
||||||
graph_stack->buffer_colors_0_arrow = graph_stack->buffer_colors_size;
|
graphics_stack->buffer_colors_0_arrow = graphics_stack->buffer_colors_size;
|
||||||
graph_stack->buffer_lines_0_arrow = graph_stack->buffer_lines_size;
|
graphics_stack->buffer_lines_0_arrow = graphics_stack->buffer_lines_size;
|
||||||
|
|
||||||
/* A R R O W S D R A W I N G */
|
/* A R R O W S D R A W I N G */
|
||||||
|
|
||||||
char state_id[30] = {0};
|
char state_id[30] = {0};
|
||||||
struct arrow_t arrow = {0};
|
struct arrow_t arrow = {0};
|
||||||
|
|
||||||
assert(model_get_next_state((char *)&state_id));
|
assert(parse_model_get_next_state((char *)&state_id));
|
||||||
|
|
||||||
g_print("[GRAPH DEBUG] first state is = %s\n", state_id);
|
g_print("[GRAPH DEBUG] first state is = %s\n", state_id);
|
||||||
|
|
||||||
announced_arrows_nb = model_get_state_arrows_count(state_id);
|
announced_arrows_nb = parse_model_get_state_arrows_count(state_id);
|
||||||
|
|
||||||
g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
|
g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
|
||||||
|
|
||||||
while (model_get_next_arrow(&arrow, (char *)&state_id, dimension)) {
|
while (parse_model_get_next_arrow(&arrow, (char *)&state_id, dimension)) {
|
||||||
g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
|
g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
|
||||||
graph_stack->arrows_nb = graph_set_arrow (stack_id,
|
graphics_stack->arrows_nb = graphics_set_arrow (stack_id,
|
||||||
graph_stack->arrows_nb,
|
graphics_stack->arrows_nb,
|
||||||
space_X,
|
space_X,
|
||||||
space_Y,
|
space_Y,
|
||||||
space_Z,
|
space_Z,
|
||||||
|
@ -313,7 +313,7 @@ void graph_model_setup (const int stack_id)
|
||||||
arrow.z);
|
arrow.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph_stack->arrows_nb != announced_arrows_nb)
|
if (graphics_stack->arrows_nb != announced_arrows_nb)
|
||||||
g_printerr("ARGH : not all arrows have been parsed !\n");
|
g_printerr("ARGH : not all arrows have been parsed !\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,21 +323,21 @@ void graph_model_setup (const int stack_id)
|
||||||
* @param gl_area, ptr to the gl_area widget
|
* @param gl_area, ptr to the gl_area widget
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void graph_init_buffers(const int stack_id)
|
void graphics_init_buffers(const int stack_id)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
graph_model_setup(stack_id);
|
graphics_model_setup(stack_id);
|
||||||
|
|
||||||
GLuint vao, vertex_buffer, color_buffer;
|
GLuint vao, vertex_buffer, color_buffer;
|
||||||
|
|
||||||
glGenBuffers(1, &vertex_buffer);
|
glGenBuffers(1, &vertex_buffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
graph_stack->buffer_vertex_size *
|
graphics_stack->buffer_vertex_size *
|
||||||
sizeof(graph_stack->buffer_vertex_origin[0]),
|
sizeof(graphics_stack->buffer_vertex_origin[0]),
|
||||||
graph_stack->buffer_vertex_origin,
|
graphics_stack->buffer_vertex_origin,
|
||||||
GL_STATIC_DRAW);
|
GL_STATIC_DRAW);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -345,9 +345,9 @@ void graph_init_buffers(const int stack_id)
|
||||||
// colors
|
// colors
|
||||||
glGenBuffers(1, &color_buffer);
|
glGenBuffers(1, &color_buffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, color_buffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, graph_stack->buffer_colors_size *
|
glBufferData(GL_ARRAY_BUFFER, graphics_stack->buffer_colors_size *
|
||||||
sizeof(graph_stack->buffer_colors_origin[0]),
|
sizeof(graphics_stack->buffer_colors_origin[0]),
|
||||||
graph_stack->buffer_colors_origin,
|
graphics_stack->buffer_colors_origin,
|
||||||
GL_STATIC_DRAW);
|
GL_STATIC_DRAW);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -355,9 +355,9 @@ void graph_init_buffers(const int stack_id)
|
||||||
glGenVertexArrays(1, &vao);
|
glGenVertexArrays(1, &vao);
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
|
|
||||||
graph_stack->vao = vao;
|
graphics_stack->vao = vao;
|
||||||
graph_stack->position_buffer = vertex_buffer;
|
graphics_stack->position_buffer = vertex_buffer;
|
||||||
graph_stack->color_buffer = color_buffer;
|
graphics_stack->color_buffer = color_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -367,9 +367,9 @@ void graph_init_buffers(const int stack_id)
|
||||||
*
|
*
|
||||||
* @return true if initialized
|
* @return true if initialized
|
||||||
*/
|
*/
|
||||||
bool graph_init_shaders(const int stack_id)
|
bool graphics_init_shaders(const int stack_id)
|
||||||
{
|
{
|
||||||
struct graph_stack_t *graph_stack = NULL; // *graph_stack = &graph_stack[stack_id]; TODO
|
struct graphics_stack_t *graphics_stack = NULL; // *graphics_stack = &graphics_stack[stack_id]; TODO
|
||||||
char *vertex_shader;
|
char *vertex_shader;
|
||||||
char *fragment_shader;
|
char *fragment_shader;
|
||||||
int status;
|
int status;
|
||||||
|
@ -383,10 +383,10 @@ bool graph_init_shaders(const int stack_id)
|
||||||
vertex_shader = read_file(VERTEX_SHADER_FILE);
|
vertex_shader = read_file(VERTEX_SHADER_FILE);
|
||||||
if (vertex_shader == NULL)
|
if (vertex_shader == NULL)
|
||||||
return false;
|
return false;
|
||||||
vertex = graph_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
|
vertex = graphics_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
|
||||||
|
|
||||||
if(vertex == 0) {
|
if(vertex == 0) {
|
||||||
graph_stack->program = 0;
|
graphics_stack->program = 0;
|
||||||
g_free(vertex_shader);
|
g_free(vertex_shader);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -395,11 +395,11 @@ bool graph_init_shaders(const int stack_id)
|
||||||
fragment_shader = read_file(FRAG_SHADER_FILE);
|
fragment_shader = read_file(FRAG_SHADER_FILE);
|
||||||
if (fragment_shader == NULL)
|
if (fragment_shader == NULL)
|
||||||
return false;
|
return false;
|
||||||
fragment = graph_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
|
fragment = graphics_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
|
||||||
|
|
||||||
if(fragment == 0) {
|
if(fragment == 0) {
|
||||||
glDeleteShader(vertex);
|
glDeleteShader(vertex);
|
||||||
graph_stack->program = 0;
|
graphics_stack->program = 0;
|
||||||
g_free(vertex_shader);
|
g_free(vertex_shader);
|
||||||
g_free(fragment_shader);
|
g_free(fragment_shader);
|
||||||
return false;
|
return false;
|
||||||
|
@ -408,7 +408,7 @@ bool graph_init_shaders(const int stack_id)
|
||||||
// Link shaders to program
|
// Link shaders to program
|
||||||
program = glCreateProgram();
|
program = glCreateProgram();
|
||||||
printf("\n------------------------------------------------------------------------------------------\n");
|
printf("\n------------------------------------------------------------------------------------------\n");
|
||||||
printf("[debug] graph_init_shaders() : program = %d, vertex = %d, fragment = %d\n\
|
printf("[debug] graphics_init_shaders() : program = %d, vertex = %d, fragment = %d\n\
|
||||||
exec > ** (myprogram:-----): WARNING ** : --:--:--:---: Linking failure: (address)\n",
|
exec > ** (myprogram:-----): WARNING ** : --:--:--:---: Linking failure: (address)\n",
|
||||||
program, vertex, fragment);
|
program, vertex, fragment);
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ bool graph_init_shaders(const int stack_id)
|
||||||
glAttachShader(program, vertex);
|
glAttachShader(program, vertex);
|
||||||
glAttachShader(program, fragment);
|
glAttachShader(program, fragment);
|
||||||
|
|
||||||
printf("Failed to link the graphic stack to widgets ! <> see init.c graph_init_shaders()\n");
|
printf("Failed to link the graphic stack to widgets ! <> see init.c graphics_init_shaders()\n");
|
||||||
printf("the error in not : vertex shader lacks `main' but : failed to link... (comment line 140)\n");
|
printf("the error in not : vertex shader lacks `main' but : failed to link... (comment line 140)\n");
|
||||||
// https://registry.khronos.org/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml
|
// https://registry.khronos.org/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml
|
||||||
// glLinkProgram(program); // Linking failure: (address)
|
// glLinkProgram(program); // Linking failure: (address)
|
||||||
|
@ -467,10 +467,10 @@ bool graph_init_shaders(const int stack_id)
|
||||||
glDeleteShader(vertex);
|
glDeleteShader(vertex);
|
||||||
glDeleteShader(fragment);
|
glDeleteShader(fragment);
|
||||||
|
|
||||||
graph_stack->program = program;
|
graphics_stack->program = program;
|
||||||
graph_stack->m = m;
|
graphics_stack->m = m;
|
||||||
graph_stack->v = v;
|
graphics_stack->v = v;
|
||||||
graph_stack->p = p;
|
graphics_stack->p = p;
|
||||||
|
|
||||||
g_free(vertex_shader);
|
g_free(vertex_shader);
|
||||||
g_free(fragment_shader);
|
g_free(fragment_shader);
|
||||||
|
|
|
@ -38,7 +38,7 @@ static struct stack_index_t *stack_index = NULL;
|
||||||
size_t stack_index_size = 0;
|
size_t stack_index_size = 0;
|
||||||
|
|
||||||
|
|
||||||
int graph_set_arrow (int stack_id, // 2024-06-27 DEBUG !
|
int graphics_set_arrow (int stack_id, // 2024-06-27 DEBUG !
|
||||||
int arrows_nb,
|
int arrows_nb,
|
||||||
int space_X,
|
int space_X,
|
||||||
int space_Y,
|
int space_Y,
|
||||||
|
@ -48,7 +48,7 @@ int graph_set_arrow (int stack_id, // 2024-06-27 DEBUG !
|
||||||
int arrow_x,
|
int arrow_x,
|
||||||
int arrow_y,
|
int arrow_y,
|
||||||
int arrow_z) {
|
int arrow_z) {
|
||||||
printf("graph_area.c > int graph_set_arrow (...) 2024-06-27 DEBUG\n");
|
printf("graphics_area.c > int graphics_set_arrow (...) 2024-06-27 DEBUG\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} // 2024-06-27 DEBUG !
|
} // 2024-06-27 DEBUG !
|
||||||
|
@ -62,7 +62,7 @@ int graph_set_arrow (int stack_id, // 2024-06-27 DEBUG !
|
||||||
*
|
*
|
||||||
* @returns stack_id
|
* @returns stack_id
|
||||||
*/
|
*/
|
||||||
long graph_get_graph_stack(void *container_widget)
|
long graphics_get_graphics_stack(void *container_widget)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
|
@ -80,7 +80,7 @@ long graph_get_graph_stack(void *container_widget)
|
||||||
*
|
*
|
||||||
* @returns stack_id
|
* @returns stack_id
|
||||||
*/
|
*/
|
||||||
long graph_is_graph_stack_ready(void *container_widget)
|
long graphics_is_graphics_stack_ready(void *container_widget)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
|
@ -98,20 +98,20 @@ long graph_is_graph_stack_ready(void *container_widget)
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
bool graph_init_graph_stack(void *container_widget, GError *error_buffer)
|
bool graphics_init_graphics_stack(void *container_widget, GError *error_buffer)
|
||||||
{
|
{
|
||||||
g_printerr("[debug] graph_init_graph_stack()\n");
|
g_printerr("[debug] graphics_init_graphics_stack()\n");
|
||||||
|
|
||||||
g_printerr("[debug] graph_init_graph_stack() : target is %p\n", container_widget);
|
g_printerr("[debug] graphics_init_graphics_stack() : target is %p\n", container_widget);
|
||||||
|
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
g_printerr("[debug] graph_init_graph_stack() : i is %d\n", i);
|
g_printerr("[debug] graphics_init_graphics_stack() : i is %d\n", i);
|
||||||
g_printerr("[debug] graph_init_graph_stack() : target would be %p\n",
|
g_printerr("[debug] graphics_init_graphics_stack() : target would be %p\n",
|
||||||
stack_index[i].container_widget);
|
stack_index[i].container_widget);
|
||||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||||
stack_index[i].stack_id = graph_init(&error_buffer);
|
stack_index[i].stack_id = graphics_init(&error_buffer);
|
||||||
g_printerr("[debug] graph_init_graph_stack() : stack_id is %ld\n",
|
g_printerr("[debug] graphics_init_graphics_stack() : stack_id is %ld\n",
|
||||||
stack_index[i].stack_id);
|
stack_index[i].stack_id);
|
||||||
if (stack_index[i].stack_id >= 0)
|
if (stack_index[i].stack_id >= 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -129,12 +129,12 @@ bool graph_init_graph_stack(void *container_widget, GError *error_buffer)
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
bool graph_shutdown_graph_stack(void *container_widget, GError *error_buffer)
|
bool graphics_shutdown_graphics_stack(void *container_widget, GError *error_buffer)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||||
if (graph_shutdown(stack_index[i].stack_id,
|
if (graphics_shutdown(stack_index[i].stack_id,
|
||||||
&error_buffer) == false) {
|
&error_buffer) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ bool graph_shutdown_graph_stack(void *container_widget, GError *error_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void graph_clean_stack_index(void)
|
void graphics_clean_stack_index(void)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
|
@ -162,19 +162,19 @@ void graph_clean_stack_index(void)
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
bool graph_render_stack(GtkWidget *container_widget)
|
bool graphics_render_stack(GtkWidget *container_widget)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||||
graph_draw (stack_index[i].stack_id);
|
graphics_draw (stack_index[i].stack_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void graph_draw(const int stack_id) {printf("graph_area.c > void graph_draw(const int stack_id) (161)\n");}
|
//void graphics_draw(const int stack_id) {printf("graphics_area.c > void graphics_draw(const int stack_id) (161)\n");}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look for stack entry and triggers OpenGL for drawing
|
* Look for stack entry and triggers OpenGL for drawing
|
||||||
|
@ -183,12 +183,12 @@ bool graph_render_stack(GtkWidget *container_widget)
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
bool graph_update_axis_stack(GtkWidget *container_widget, int axis, int value)
|
bool graphics_update_axis_stack(GtkWidget *container_widget, int axis, int value)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||||
graph_stack[stack_index[i].stack_id].rotation_angles[axis] = value;
|
graphics_stack[stack_index[i].stack_id].rotation_angles[axis] = value;
|
||||||
gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
|
gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -203,11 +203,11 @@ bool graph_update_axis_stack(GtkWidget *container_widget, int axis, int value)
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
void graph_shutdown_all_graph_stacks(void)
|
void graphics_shutdown_all_graphics_stacks(void)
|
||||||
{
|
{
|
||||||
// look for stack_index entry
|
// look for stack_index entry
|
||||||
for (int i = 0; i < stack_index_size; i++) {
|
for (int i = 0; i < stack_index_size; i++) {
|
||||||
graph_shutdown(stack_index[i].stack_id, NULL);
|
graphics_shutdown(stack_index[i].stack_id, NULL);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -263,20 +263,20 @@ GtkWidget *create_axis_slider(int axis)
|
||||||
/*
|
/*
|
||||||
* Creates GLArea and indexes it
|
* Creates GLArea and indexes it
|
||||||
*
|
*
|
||||||
* @params target_mode, meaning which graph_stack we're on
|
* @params target_mode, meaning which graphics_stack we're on
|
||||||
* target_widget, meaning the box that will host the GLArea
|
* target_widget, meaning the box that will host the GLArea
|
||||||
*
|
*
|
||||||
* @returns bool, true if success
|
* @returns bool, true if success
|
||||||
*/
|
*/
|
||||||
bool graph_setup_glarea(int target_mode, GtkWidget *target_widget)
|
bool graphics_setup_glarea(int target_mode, GtkWidget *target_widget)
|
||||||
{
|
{
|
||||||
GtkWidget *gl_area;
|
GtkWidget *gl_area;
|
||||||
|
|
||||||
g_printerr("[debug] graph_setup_glarea()\n");
|
g_printerr("[debug] graphics_setup_glarea()\n");
|
||||||
|
|
||||||
assert(target_widget);
|
assert(target_widget);
|
||||||
|
|
||||||
g_printerr("[debug] graph_setup_glarea() : target is %p\n", target_widget);
|
g_printerr("[debug] graphics_setup_glarea() : target is %p\n", target_widget);
|
||||||
|
|
||||||
if (stack_index == NULL) {
|
if (stack_index == NULL) {
|
||||||
stack_index = g_malloc(sizeof(struct stack_index_t));
|
stack_index = g_malloc(sizeof(struct stack_index_t));
|
||||||
|
@ -314,9 +314,9 @@ bool graph_setup_glarea(int target_mode, GtkWidget *target_widget)
|
||||||
|
|
||||||
stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
||||||
|
|
||||||
g_printerr("[debug] graph_setup_glarea() : set target to %p\n", target_widget);
|
g_printerr("[debug] graphics_setup_glarea() : set target to %p\n", target_widget);
|
||||||
|
|
||||||
g_printerr("[debug] graph_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
g_printerr("[debug] graphics_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
||||||
stack_index,
|
stack_index,
|
||||||
stack_index_size);
|
stack_index_size);
|
||||||
|
|
||||||
|
|
54
src/parse.c
54
src/parse.c
|
@ -44,9 +44,9 @@
|
||||||
#define SUCCESSFUL_READ_ARROW_XYZ (READ_SITE | READ_WEIGHT | READ_X | READ_Y | READ_Z)
|
#define SUCCESSFUL_READ_ARROW_XYZ (READ_SITE | READ_WEIGHT | READ_X | READ_Y | READ_Z)
|
||||||
|
|
||||||
static xmlDocPtr model;
|
static xmlDocPtr model;
|
||||||
static xmlHashTablePtr model_hashtable;
|
static xmlHashTablePtr parse_model_hashtable;
|
||||||
|
|
||||||
bool model_init(const char *content, size_t length, const char *basename)
|
bool parse_parse_model_init(const char *content, size_t length, const char *basename)
|
||||||
{
|
{
|
||||||
xmlNode *node;
|
xmlNode *node;
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ bool model_init(const char *content, size_t length, const char *basename)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
model_hashtable = xmlHashCreate(0);
|
parse_model_hashtable = xmlHashCreate(0);
|
||||||
|
|
||||||
if (model_hashtable == NULL) {
|
if (parse_model_hashtable == NULL) {
|
||||||
g_printerr("Can't create model hash table !\n");
|
g_printerr("Can't create model hash table !\n");
|
||||||
xmlFreeDoc(model);
|
xmlFreeDoc(model);
|
||||||
return false;
|
return false;
|
||||||
|
@ -88,10 +88,10 @@ bool model_init(const char *content, size_t length, const char *basename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool model_shutdown(void)
|
bool parse_model_shutdown(void)
|
||||||
{
|
{
|
||||||
xmlFreeDoc(model);
|
xmlFreeDoc(model);
|
||||||
xmlHashFree(model_hashtable, NULL);
|
xmlHashFree(parse_model_hashtable, NULL);
|
||||||
|
|
||||||
// Cleanup function for the XML library
|
// Cleanup function for the XML library
|
||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
|
@ -142,14 +142,14 @@ static inline xmlChar* getLastTag(xmlChar *path)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
static xmlNodePtr model_get_node(xmlChar *path)
|
static xmlNodePtr parse_model_get_node(xmlChar *path)
|
||||||
{
|
{
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
xmlChar *extrait;
|
xmlChar *extrait;
|
||||||
xmlChar *reste, *last;
|
xmlChar *reste, *last;
|
||||||
|
|
||||||
// Lookup for node from path in hash table
|
// Lookup for node from path in hash table
|
||||||
node = xmlHashLookup(model_hashtable, path);
|
node = xmlHashLookup(parse_model_hashtable, path);
|
||||||
|
|
||||||
// Found a node in hash table
|
// Found a node in hash table
|
||||||
if (node) {
|
if (node) {
|
||||||
|
@ -174,7 +174,7 @@ static xmlNodePtr model_get_node(xmlChar *path)
|
||||||
while (node && xmlStrcmp(node->name, last)) {
|
while (node && xmlStrcmp(node->name, last)) {
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
xmlHashAddEntry (model_hashtable, path, node);
|
xmlHashAddEntry (parse_model_hashtable, path, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@ -186,7 +186,7 @@ static xmlNodePtr model_get_node(xmlChar *path)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
static inline long model_get_node_long_attrib(xmlNodePtr node, char *id)
|
static inline long parse_model_get_node_long_attrib(xmlNodePtr node, char *id)
|
||||||
{
|
{
|
||||||
xmlAttr *attribute;
|
xmlAttr *attribute;
|
||||||
xmlChar* value;
|
xmlChar* value;
|
||||||
|
@ -207,7 +207,7 @@ static inline long model_get_node_long_attrib(xmlNodePtr node, char *id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool model_get_node_str_attrib(xmlNodePtr node,
|
static inline bool parse_model_get_node_str_attrib(xmlNodePtr node,
|
||||||
char *id,
|
char *id,
|
||||||
char *dest)
|
char *dest)
|
||||||
{
|
{
|
||||||
|
@ -231,11 +231,11 @@ static inline bool model_get_node_str_attrib(xmlNodePtr node,
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
char model_get_dim(void)
|
char parse_model_get_dim(void)
|
||||||
{
|
{
|
||||||
// xmlAttr *attribute;
|
// xmlAttr *attribute;
|
||||||
// xmlChar* value;
|
// xmlChar* value;
|
||||||
xmlNodePtr node = model_get_node(
|
xmlNodePtr node = parse_model_get_node(
|
||||||
(xmlChar *)"parameters/space-param/dimension");
|
(xmlChar *)"parameters/space-param/dimension");
|
||||||
|
|
||||||
if (xmlHasProp (node, (xmlChar *) "z")) return 3;
|
if (xmlHasProp (node, (xmlChar *) "z")) return 3;
|
||||||
|
@ -244,22 +244,22 @@ char model_get_dim(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long model_get_dim_value(const char *axis)
|
long parse_model_get_dim_value(const char *axis)
|
||||||
{
|
{
|
||||||
// xmlAttr *attribute;
|
// xmlAttr *attribute;
|
||||||
// xmlChar *value;
|
// xmlChar *value;
|
||||||
// long ret_value;
|
// long ret_value;
|
||||||
xmlNodePtr node = model_get_node(
|
xmlNodePtr node = parse_model_get_node(
|
||||||
(xmlChar *)"parameters/space-param/dimension");
|
(xmlChar *)"parameters/space-param/dimension");
|
||||||
|
|
||||||
return model_get_node_long_attrib(node, (char *)axis);
|
return parse_model_get_node_long_attrib(node, (char *)axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
char model_get_multiplicity(void)
|
char parse_model_get_multiplicity(void)
|
||||||
{
|
{
|
||||||
// xmlAttr *attribute;
|
// xmlAttr *attribute;
|
||||||
// xmlChar* value;
|
// xmlChar* value;
|
||||||
xmlNodePtr node = model_get_node(
|
xmlNodePtr node = parse_model_get_node(
|
||||||
(xmlChar *)"parameters/space-param/site_multiplicity");
|
(xmlChar *)"parameters/space-param/site_multiplicity");
|
||||||
|
|
||||||
if (node->children)
|
if (node->children)
|
||||||
|
@ -269,7 +269,7 @@ char model_get_multiplicity(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool model_get_next_state(char *new_state_id)
|
bool parse_model_get_next_state(char *new_state_id)
|
||||||
{
|
{
|
||||||
static xmlNodePtr cur_node = NULL;
|
static xmlNodePtr cur_node = NULL;
|
||||||
// xmlAttr *attribute;
|
// xmlAttr *attribute;
|
||||||
|
@ -277,7 +277,7 @@ bool model_get_next_state(char *new_state_id)
|
||||||
|
|
||||||
if (cur_node == NULL) {
|
if (cur_node == NULL) {
|
||||||
// Get first state
|
// Get first state
|
||||||
cur_node = model_get_node((xmlChar *)"savedstates/state");
|
cur_node = parse_model_get_node((xmlChar *)"savedstates/state");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Get next state
|
// Get next state
|
||||||
|
@ -288,14 +288,14 @@ bool model_get_next_state(char *new_state_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup in properties
|
// Lookup in properties
|
||||||
if (model_get_node_str_attrib(cur_node, "id", new_state_id))
|
if (parse_model_get_node_str_attrib(cur_node, "id", new_state_id))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
cur_node = NULL;
|
cur_node = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long model_get_state_arrows_count(const char *state_id)
|
long parse_model_get_state_arrows_count(const char *state_id)
|
||||||
{
|
{
|
||||||
xmlNodePtr cur_node = NULL;
|
xmlNodePtr cur_node = NULL;
|
||||||
// xmlAttr *attribute;
|
// xmlAttr *attribute;
|
||||||
|
@ -309,14 +309,14 @@ long model_get_state_arrows_count(const char *state_id)
|
||||||
assert(state_id);
|
assert(state_id);
|
||||||
|
|
||||||
// Get first state node
|
// Get first state node
|
||||||
cur_node = model_get_node((xmlChar *)"savedstates/state");
|
cur_node = parse_model_get_node((xmlChar *)"savedstates/state");
|
||||||
|
|
||||||
// Lookup in properties
|
// Lookup in properties
|
||||||
while (cur_node && cur_node->properties) {
|
while (cur_node && cur_node->properties) {
|
||||||
// attribute = cur_node->properties; < usage ?
|
// attribute = cur_node->properties; < usage ?
|
||||||
|
|
||||||
// Look for the id attribute
|
// Look for the id attribute
|
||||||
if (model_get_node_str_attrib(cur_node, "id", (char *)&temp_char)) {
|
if (parse_model_get_node_str_attrib(cur_node, "id", (char *)&temp_char)) {
|
||||||
if (!xmlStrcmp((const xmlChar *)temp_char, (const xmlChar *)state_id)) {
|
if (!xmlStrcmp((const xmlChar *)temp_char, (const xmlChar *)state_id)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -346,7 +346,7 @@ long model_get_state_arrows_count(const char *state_id)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool model_get_next_arrow(struct arrow_t *new_arrow,
|
bool parse_model_get_next_arrow(struct arrow_t *new_arrow,
|
||||||
const char *state_id,
|
const char *state_id,
|
||||||
char dimension)
|
char dimension)
|
||||||
{
|
{
|
||||||
|
@ -364,14 +364,14 @@ bool model_get_next_arrow(struct arrow_t *new_arrow,
|
||||||
|
|
||||||
if (cur_node == NULL) {
|
if (cur_node == NULL) {
|
||||||
// Get first state node
|
// Get first state node
|
||||||
cur_node = model_get_node((xmlChar *)"savedstates/state");
|
cur_node = parse_model_get_node((xmlChar *)"savedstates/state");
|
||||||
|
|
||||||
// Lookup in properties
|
// Lookup in properties
|
||||||
while (cur_node && cur_node->properties) {
|
while (cur_node && cur_node->properties) {
|
||||||
attribute = cur_node->properties;
|
attribute = cur_node->properties;
|
||||||
|
|
||||||
// Look for the id attribute
|
// Look for the id attribute
|
||||||
if (model_get_node_str_attrib(cur_node, "id", (char *)&temp_char)) {
|
if (parse_model_get_node_str_attrib(cur_node, "id", (char *)&temp_char)) {
|
||||||
if (!xmlStrcmp((xmlChar *)temp_char, (const xmlChar *)state_id)) {
|
if (!xmlStrcmp((xmlChar *)temp_char, (const xmlChar *)state_id)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,14 +64,14 @@ static void on_auto_notification (const char *message)
|
||||||
void on_windows_activation (GtkApplication *app,
|
void on_windows_activation (GtkApplication *app,
|
||||||
gpointer no_user_data)
|
gpointer no_user_data)
|
||||||
{
|
{
|
||||||
widget_head_set_MAIN_WINDOW (app);
|
widget_head_fix_MAIN_WINDOW (app);
|
||||||
widget_head_MAIN_WINDOW_design (widget_head_get_MAIN_WINDOW());
|
widget_head_MAIN_WINDOW_design (widget_head_rec_MAIN_WINDOW());
|
||||||
|
|
||||||
widget_head_set_DIALOG_WINDOW (app);
|
widget_head_fix_DIALOG_WINDOW (app);
|
||||||
widget_head_DIALOG_WINDOW_design (widget_head_get_MAIN_WINDOW(), widget_head_get_DIALOG_WINDOW());
|
widget_head_DIALOG_WINDOW_design (widget_head_rec_MAIN_WINDOW(), widget_head_rec_DIALOG_WINDOW());
|
||||||
|
|
||||||
widget_head_set_TEXT_WINDOW (app);
|
widget_head_fix_TEXT_WINDOW (app);
|
||||||
widget_head_TEXT_WINDOW_design (widget_head_get_MAIN_WINDOW(), widget_head_get_TEXT_WINDOW());
|
widget_head_TEXT_WINDOW_design (widget_head_rec_MAIN_WINDOW(), widget_head_rec_TEXT_WINDOW());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ gboolean on_glarea_render(GtkGLArea *area,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph_render_stack(gtk_widget_get_parent(GTK_WIDGET(area))) == false) {
|
if (graphics_render_stack(gtk_widget_get_parent(GTK_WIDGET(area))) == false) {
|
||||||
on_auto_notification("Failed to render corresponding graphic stack !");
|
on_auto_notification("Failed to render corresponding graphic stack !");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ void on_glarea_realize(GtkWidget *widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link graphical stack to widget
|
// Link graphical stack to widget
|
||||||
if (graph_init_graph_stack(gtk_widget_get_parent(widget),
|
if (graphics_init_graphics_stack(gtk_widget_get_parent(widget),
|
||||||
internal_error) == false) {
|
internal_error) == false) {
|
||||||
on_auto_notification(
|
on_auto_notification(
|
||||||
"Failed to link the graphic stack to widgets !");
|
"Failed to link the graphic stack to widgets !");
|
||||||
|
@ -184,7 +184,7 @@ void on_glarea_unrealize(GtkWidget *widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy graphic stack
|
// Destroy graphic stack
|
||||||
if (graph_shutdown_graph_stack(gtk_widget_get_parent(widget),
|
if (graphics_shutdown_graphics_stack(gtk_widget_get_parent(widget),
|
||||||
internal_error) == false) {
|
internal_error) == false) {
|
||||||
on_auto_notification(
|
on_auto_notification(
|
||||||
"Failed to shutdown the graphic stack !");
|
"Failed to shutdown the graphic stack !");
|
||||||
|
@ -206,7 +206,7 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
|
||||||
g_assert(axis >= 0 && axis < N_AXIS);
|
g_assert(axis >= 0 && axis < N_AXIS);
|
||||||
|
|
||||||
/* Update the rotation angle */
|
/* Update the rotation angle */
|
||||||
graph_update_axis_stack(container_widget,
|
graphics_update_axis_stack(container_widget,
|
||||||
axis,
|
axis,
|
||||||
gtk_adjustment_get_value(adjustment));
|
gtk_adjustment_get_value(adjustment));
|
||||||
|
|
||||||
|
@ -251,18 +251,18 @@ static void switch_STATE_RULES_DATA()
|
||||||
switch (get_STATE_RULES_DATA()) {
|
switch (get_STATE_RULES_DATA()) {
|
||||||
|
|
||||||
case (STATE) :
|
case (STATE) :
|
||||||
gtk_window_set_child (widget_head_get_MAIN_WINDOW(),
|
gtk_window_set_child (widget_head_rec_MAIN_WINDOW(),
|
||||||
GTK_WIDGET (get_STATE_page()));
|
GTK_WIDGET (widget_rec_STATE_page()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (RULES) :
|
case (RULES) :
|
||||||
gtk_window_set_child (widget_head_get_MAIN_WINDOW(),
|
gtk_window_set_child (widget_head_rec_MAIN_WINDOW(),
|
||||||
GTK_WIDGET (get_RULES_page()));
|
GTK_WIDGET (widget_rec_RULES_page()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (DATA) :
|
case (DATA) :
|
||||||
gtk_window_set_child (widget_head_get_MAIN_WINDOW(),
|
gtk_window_set_child (widget_head_rec_MAIN_WINDOW(),
|
||||||
GTK_WIDGET (get_STOCK_page()));
|
GTK_WIDGET (widget_rec_STOCK_page()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
@ -284,7 +284,7 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
|
||||||
"text-editor-symbolic");
|
"text-editor-symbolic");
|
||||||
|
|
||||||
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
|
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
|
||||||
// gtk_window_present (GTK_WINDOW (widget_head_get_DIALOG_WINDOW())); // works once only !
|
// gtk_window_present (GTK_WINDOW (widget_head_rec_DIALOG_WINDOW())); // works once only !
|
||||||
|
|
||||||
set_EXEC_EDIT (EDIT);
|
set_EXEC_EDIT (EDIT);
|
||||||
}
|
}
|
||||||
|
@ -350,14 +350,14 @@ void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
|
||||||
|
|
||||||
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
|
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
|
||||||
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
|
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
|
||||||
gtk_window_present (GTK_WINDOW (widget_head_get_TEXT_WINDOW()));
|
gtk_window_present (GTK_WINDOW (widget_head_rec_TEXT_WINDOW()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
|
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
|
||||||
{
|
{
|
||||||
printf ("callback.on_clicked_HOME() button presents the dialog_window\
|
printf ("callback.on_clicked_HOME() button presents the dialog_window\
|
||||||
( :- ) but it works only once.\n"); // TODO
|
( :- ) but it works only once.\n"); // TODO
|
||||||
gtk_window_present (GTK_WINDOW (widget_head_get_DIALOG_WINDOW()));
|
gtk_window_present (GTK_WINDOW (widget_head_rec_DIALOG_WINDOW()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,35 +103,35 @@ void learning_how_to_create_a_menu (GtkMenuButton* menu_button) { // Je veux qu
|
||||||
|
|
||||||
|
|
||||||
void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
|
void labo_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_t *tree_root) {
|
||||||
struct TreeNode_t *a = create_user_tree_node("We, the people");add_child_node(tree_root, a);
|
struct TreeNode_t *a = widget_create_user_tree_node("We, the people");widget_add_child_node(tree_root, a);
|
||||||
struct TreeNode_t *b = create_user_tree_node("in Order to"); add_child_node(tree_root, b);
|
struct TreeNode_t *b = widget_create_user_tree_node("in Order to"); widget_add_child_node(tree_root, b);
|
||||||
struct TreeNode_t *c = create_user_tree_node("do establish"); add_child_node(tree_root, c);
|
struct TreeNode_t *c = widget_create_user_tree_node("do establish"); widget_add_child_node(tree_root, c);
|
||||||
struct TreeNode_t *aa = create_user_tree_node("aware of"); add_child_node(a, aa);
|
struct TreeNode_t *aa = widget_create_user_tree_node("aware of"); widget_add_child_node(a, aa);
|
||||||
struct TreeNode_t *aaa = create_user_tree_node("our rights"); add_child_node(aa, aaa);
|
struct TreeNode_t *aaa = widget_create_user_tree_node("our rights"); widget_add_child_node(aa, aaa);
|
||||||
struct TreeNode_t *aab = create_user_tree_node("our duties"); add_child_node(aa, aab);
|
struct TreeNode_t *aab = widget_create_user_tree_node("our duties"); widget_add_child_node(aa, aab);
|
||||||
struct TreeNode_t *aaaa = create_user_tree_node("read"); add_child_node(aaa, aaaa);
|
struct TreeNode_t *aaaa = widget_create_user_tree_node("read"); widget_add_child_node(aaa, aaaa);
|
||||||
struct TreeNode_t *aaab = create_user_tree_node("write"); add_child_node(aaa, aaab);
|
struct TreeNode_t *aaab = widget_create_user_tree_node("write"); widget_add_child_node(aaa, aaab);
|
||||||
struct TreeNode_t *aaac = create_user_tree_node("copy"); add_child_node(aaa, aaac);
|
struct TreeNode_t *aaac = widget_create_user_tree_node("copy"); widget_add_child_node(aaa, aaac);
|
||||||
struct TreeNode_t *aaad = create_user_tree_node("edit"); add_child_node(aaa, aaad);
|
struct TreeNode_t *aaad = widget_create_user_tree_node("edit"); widget_add_child_node(aaa, aaad);
|
||||||
struct TreeNode_t *aaaba= create_user_tree_node("code"); add_child_node(aaab, aaaba);
|
struct TreeNode_t *aaaba= widget_create_user_tree_node("code"); widget_add_child_node(aaab, aaaba);
|
||||||
struct TreeNode_t *aaabb= create_user_tree_node("language"); add_child_node(aaab, aaabb);
|
struct TreeNode_t *aaabb= widget_create_user_tree_node("language"); widget_add_child_node(aaab, aaabb);
|
||||||
struct TreeNode_t *aaabc= create_user_tree_node("any art..."); add_child_node(aaab, aaabc);
|
struct TreeNode_t *aaabc= widget_create_user_tree_node("any art..."); widget_add_child_node(aaab, aaabc);
|
||||||
struct TreeNode_t *aaadb= create_user_tree_node("publish"); add_child_node(aaac, aaadb);
|
struct TreeNode_t *aaadb= widget_create_user_tree_node("publish"); widget_add_child_node(aaac, aaadb);
|
||||||
struct TreeNode_t *aaada= create_user_tree_node("create"); add_child_node(aaad, aaada);
|
struct TreeNode_t *aaada= widget_create_user_tree_node("create"); widget_add_child_node(aaad, aaada);
|
||||||
struct TreeNode_t *aaba = create_user_tree_node("learn"); add_child_node(aab, aaba);
|
struct TreeNode_t *aaba = widget_create_user_tree_node("learn"); widget_add_child_node(aab, aaba);
|
||||||
struct TreeNode_t *aabb = create_user_tree_node("help"); add_child_node(aab, aabb);
|
struct TreeNode_t *aabb = widget_create_user_tree_node("help"); widget_add_child_node(aab, aabb);
|
||||||
struct TreeNode_t *ba = create_user_tree_node("promote"); add_child_node(b, ba);
|
struct TreeNode_t *ba = widget_create_user_tree_node("promote"); widget_add_child_node(b, ba);
|
||||||
struct TreeNode_t *bb = create_user_tree_node("individual"); add_child_node(b, bb);
|
struct TreeNode_t *bb = widget_create_user_tree_node("individual"); widget_add_child_node(b, bb);
|
||||||
struct TreeNode_t *bc = create_user_tree_node("and common"); add_child_node(b, bc);
|
struct TreeNode_t *bc = widget_create_user_tree_node("and common"); widget_add_child_node(b, bc);
|
||||||
struct TreeNode_t *bca = create_user_tree_node("education"); add_child_node(bc, bca);
|
struct TreeNode_t *bca = widget_create_user_tree_node("education"); widget_add_child_node(bc, bca);
|
||||||
struct TreeNode_t *bcb = create_user_tree_node("mutual"); add_child_node(bc, bcb);
|
struct TreeNode_t *bcb = widget_create_user_tree_node("mutual"); widget_add_child_node(bc, bcb);
|
||||||
struct TreeNode_t *bcc = create_user_tree_node("support"); add_child_node(bc, bcc);
|
struct TreeNode_t *bcc = widget_create_user_tree_node("support"); widget_add_child_node(bc, bcc);
|
||||||
struct TreeNode_t *bcd = create_user_tree_node("health"); add_child_node(bc, bcd);
|
struct TreeNode_t *bcd = widget_create_user_tree_node("health"); widget_add_child_node(bc, bcd);
|
||||||
struct TreeNode_t *bcda = create_user_tree_node("mental"); add_child_node(bcd, bcda);
|
struct TreeNode_t *bcda = widget_create_user_tree_node("mental"); widget_add_child_node(bcd, bcda);
|
||||||
struct TreeNode_t *bcdb = create_user_tree_node("physical"); add_child_node(bcd, bcdb);
|
struct TreeNode_t *bcdb = widget_create_user_tree_node("physical"); widget_add_child_node(bcd, bcdb);
|
||||||
struct TreeNode_t *ca = create_user_tree_node("free"); add_child_node(c, ca);
|
struct TreeNode_t *ca = widget_create_user_tree_node("free"); widget_add_child_node(c, ca);
|
||||||
struct TreeNode_t *cb = create_user_tree_node("code"); add_child_node(c, cb);
|
struct TreeNode_t *cb = widget_create_user_tree_node("code"); widget_add_child_node(c, cb);
|
||||||
struct TreeNode_t *cc = create_user_tree_node("access"); add_child_node(c, cc);
|
struct TreeNode_t *cc = widget_create_user_tree_node("access"); widget_add_child_node(c, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void labo_create_a_simple_gtk_string_list () {
|
void labo_create_a_simple_gtk_string_list () {
|
||||||
|
|
|
@ -29,10 +29,8 @@
|
||||||
|
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
|
|
||||||
#define W 1920 // TODO 2024-06-30
|
#define W_IMAGE_LOCAL 1920 / 64 // 1920 x 960 ad hoc (pour mon écran)
|
||||||
#define H 960 // Ad hoc (pour mon écran)
|
#define H_IMAGE_LOCAL 960 / 64
|
||||||
#define W_IMAGE_LOCAL W / 64
|
|
||||||
#define H_IMAGE_LOCAL H / 64
|
|
||||||
|
|
||||||
static GtkWidget *get_selected_rules_vpaned_new() {
|
static GtkWidget *get_selected_rules_vpaned_new() {
|
||||||
GtkPaned *EXEC_CONTROLS_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
|
GtkPaned *EXEC_CONTROLS_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
|
||||||
|
@ -42,14 +40,14 @@ static GtkWidget *get_selected_rules_vpaned_new() {
|
||||||
gtk_paned_set_shrink_end_child (EXEC_CONTROLS_pane, FALSE);
|
gtk_paned_set_shrink_end_child (EXEC_CONTROLS_pane, FALSE);
|
||||||
|
|
||||||
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 (widget_rec_image_GLUTAMATE()));
|
||||||
gtk_box_append (up_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
gtk_box_append (up_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||||
gtk_box_append (up_box, GTK_WIDGET (get_image_GLUTAMINE()));
|
gtk_box_append (up_box, GTK_WIDGET (widget_rec_image_GLUTAMINE()));
|
||||||
|
|
||||||
GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
GtkBox *bottom_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||||
gtk_box_append (bottom_box, GTK_WIDGET (get_image_ATP()));
|
gtk_box_append (bottom_box, GTK_WIDGET (widget_rec_image_ATP()));
|
||||||
gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
gtk_box_append (bottom_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||||
gtk_box_append (bottom_box, GTK_WIDGET (get_image_AMP()));
|
gtk_box_append (bottom_box, GTK_WIDGET (widget_rec_image_AMP()));
|
||||||
|
|
||||||
gtk_paned_set_start_child (EXEC_CONTROLS_pane, GTK_WIDGET (up_box));
|
gtk_paned_set_start_child (EXEC_CONTROLS_pane, GTK_WIDGET (up_box));
|
||||||
gtk_paned_set_end_child (EXEC_CONTROLS_pane, GTK_WIDGET (bottom_box));
|
gtk_paned_set_end_child (EXEC_CONTROLS_pane, GTK_WIDGET (bottom_box));
|
||||||
|
@ -60,13 +58,13 @@ static GtkWidget *get_selected_rules_vpaned_new() {
|
||||||
static GtkBox *get_rules_comparator_new(){
|
static GtkBox *get_rules_comparator_new(){
|
||||||
GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (comparator), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
gtk_widget_set_size_request (GTK_WIDGET (comparator), W_IMAGE_LOCAL, H_IMAGE_LOCAL);
|
||||||
gtk_box_append (comparator, GTK_WIDGET (get_image_ATP()));
|
gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_ATP()));
|
||||||
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (comparator, GTK_WIDGET (get_image_AMP()));
|
gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_AMP()));
|
||||||
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (comparator, GTK_WIDGET (get_image_GLUTAMATE()));
|
gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_GLUTAMATE()));
|
||||||
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (comparator, GTK_WIDGET (get_image_GLUTAMINE()));
|
gtk_box_append (comparator, GTK_WIDGET (widget_rec_image_GLUTAMINE()));
|
||||||
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
gtk_box_append (comparator, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png")));
|
gtk_box_append (comparator, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png")));
|
||||||
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
gtk_box_append (comparator, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||||
|
@ -83,7 +81,7 @@ static GtkWidget *get_rules_tree_hpaned_new(){
|
||||||
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
|
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
|
||||||
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
|
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
|
||||||
|
|
||||||
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (get_user_rules_tree()));
|
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (widget_rec_user_rules_tree()));
|
||||||
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (get_rules_comparator_new()));
|
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (get_rules_comparator_new()));
|
||||||
gtk_paned_set_position (H_tree_vs_comparison, 300);
|
gtk_paned_set_position (H_tree_vs_comparison, 300);
|
||||||
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE);
|
gtk_paned_set_wide_handle (H_tree_vs_comparison, TRUE);
|
||||||
|
@ -93,7 +91,7 @@ static GtkWidget *get_rules_tree_hpaned_new(){
|
||||||
return GTK_WIDGET (H_tree_vs_comparison);
|
return GTK_WIDGET (H_tree_vs_comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_RULES_page() {
|
GtkWidget *widget_rec_RULES_page() {
|
||||||
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
|
||||||
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
|
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
|
||||||
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");
|
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
#include "../../include/signal.h"
|
#include "../../include/signal.h"
|
||||||
|
|
||||||
#define W 1920 // TODO 2024-06-30 (Ad hoc pour mon écran)
|
|
||||||
#define H 960
|
|
||||||
#define H_STYLES_PANE 30
|
|
||||||
#define UPPER_COMPARTMENT_PARTITION 600
|
#define UPPER_COMPARTMENT_PARTITION 600
|
||||||
#define LOWER_COMPARTMENT_PARTITION 1300
|
#define LOWER_COMPARTMENT_PARTITION 1300
|
||||||
|
|
||||||
|
@ -196,7 +193,7 @@ static GtkWidget *get_SPACE_VIEW_box()
|
||||||
GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
GtkBox *central_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
gtk_box_append (central_box, GTK_WIDGET (get_image_E_coli()));
|
gtk_box_append (central_box, GTK_WIDGET (widget_rec_image_E_coli()));
|
||||||
// ui_setup_glarea (0, GTK_WIDGET (central_box));
|
// ui_setup_glarea (0, GTK_WIDGET (central_box));
|
||||||
|
|
||||||
gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
gtk_box_append (central_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||||
|
@ -247,7 +244,7 @@ static GtkWidget *get_SEQUENCE_CONTROL_box()
|
||||||
* - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations
|
* - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations
|
||||||
* afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */
|
* afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */
|
||||||
|
|
||||||
GtkWidget *get_STATE_page()
|
GtkWidget *widget_rec_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 (get_OBJECTS_and_SITUATIONS()));
|
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "../../include/signal.h"
|
#include "../../include/signal.h"
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
|
|
||||||
GtkWidget *get_STOCK_page () {
|
GtkWidget *widget_rec_STOCK_page () {
|
||||||
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
|
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
|
||||||
|
|
||||||
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
|
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
|
||||||
|
@ -64,7 +64,7 @@ GtkWidget *get_STOCK_page () {
|
||||||
return GTK_WIDGET (data_box);
|
return GTK_WIDGET (data_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_STOCK_text (gchar *text_address) {
|
GtkWidget *widget_rec_STOCK_text (gchar *text_address) {
|
||||||
GtkWidget *view = gtk_text_view_new ();
|
GtkWidget *view = gtk_text_view_new ();
|
||||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
|
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
|
||||||
|
@ -85,15 +85,15 @@ GtkWidget *get_STOCK_text (gchar *text_address) {
|
||||||
/* T E X T S */
|
/* T E X T S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
gchar *get_text_address_THEORY () {
|
gchar *widget_rec_text_address_THEORY () {
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *get_text_address_ABOUT_COMMANDS () {
|
gchar *widget_rec_text_address_ABOUT_COMMANDS () {
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *get_text_address_ANY () {
|
gchar *widget_rec_text_address_ANY () {
|
||||||
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
|
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,31 +103,31 @@ gchar *get_text_address_ANY () {
|
||||||
/* I M A G E S */
|
/* I M A G E S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
GtkWidget *get_image_E_coli(){
|
GtkWidget *widget_rec_image_E_coli(){
|
||||||
GtkWidget *image = gtk_picture_new_for_filename
|
GtkWidget *image = gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png");
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/E coli by D Goodsell.png");
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_image_GLUTAMATE(){
|
GtkWidget *widget_rec_image_GLUTAMATE(){
|
||||||
GtkWidget *image = gtk_picture_new_for_filename
|
GtkWidget *image = gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png");
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png");
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_image_GLUTAMINE(){
|
GtkWidget *widget_rec_image_GLUTAMINE(){
|
||||||
GtkWidget *image = gtk_picture_new_for_filename
|
GtkWidget *image = gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png");
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png");
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_image_ATP(){
|
GtkWidget *widget_rec_image_ATP(){
|
||||||
GtkWidget *image = gtk_picture_new_for_filename
|
GtkWidget *image = gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png");
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png");
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_image_AMP(){
|
GtkWidget *widget_rec_image_AMP(){
|
||||||
GtkWidget *image = gtk_picture_new_for_filename
|
GtkWidget *image = gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png");
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png");
|
||||||
return image;
|
return image;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "../../include/signal.h"
|
#include "../../include/signal.h"
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
|
|
||||||
#define W_TEXT_WINDOW 700
|
#define W_TEXT_WINDOW 700 // ad hoc (mais sans conséquences ici)
|
||||||
#define H_TEXT_WINDOW 1000
|
#define H_TEXT_WINDOW 1000
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,17 +43,17 @@
|
||||||
static GtkWindow *main_window, *dialog_window, *text_window;
|
static GtkWindow *main_window, *dialog_window, *text_window;
|
||||||
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
||||||
|
|
||||||
GtkWindow *widget_head_get_MAIN_WINDOW() { return main_window; }
|
GtkWindow *widget_head_rec_MAIN_WINDOW() { return main_window; }
|
||||||
GtkWindow *widget_head_get_DIALOG_WINDOW() { return dialog_window; }
|
GtkWindow *widget_head_rec_DIALOG_WINDOW() { return dialog_window; }
|
||||||
GtkWindow *widget_head_get_TEXT_WINDOW() { return text_window; }
|
GtkWindow *widget_head_rec_TEXT_WINDOW() { return text_window; }
|
||||||
|
|
||||||
void widget_head_set_MAIN_WINDOW (GtkApplication *app)
|
void widget_head_fix_MAIN_WINDOW (GtkApplication *app)
|
||||||
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||||
|
|
||||||
void widget_head_set_DIALOG_WINDOW (GtkApplication *app)
|
void widget_head_fix_DIALOG_WINDOW (GtkApplication *app)
|
||||||
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||||
|
|
||||||
void widget_head_set_TEXT_WINDOW (GtkApplication *app)
|
void widget_head_fix_TEXT_WINDOW (GtkApplication *app)
|
||||||
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ void widget_head_TEXT_WINDOW_design (GtkWindow *main_window, GtkWindow *text_win
|
||||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||||
gtk_window_set_titlebar (text_window, header_bar);
|
gtk_window_set_titlebar (text_window, header_bar);
|
||||||
|
|
||||||
GtkWidget *child = get_STOCK_text (get_text_address_THEORY());
|
GtkWidget *child = widget_rec_STOCK_text (widget_rec_text_address_THEORY());
|
||||||
child = get_STOCK_text (get_text_address_ABOUT_COMMANDS());
|
child = widget_rec_STOCK_text (widget_rec_text_address_ABOUT_COMMANDS());
|
||||||
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
|
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
|
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,9 @@
|
||||||
#include "../../include/signal.h"
|
#include "../../include/signal.h"
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
|
|
||||||
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL
|
|
||||||
|
|
||||||
|
void widget_add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child)
|
||||||
void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){
|
{
|
||||||
if (parent->child) {
|
if (parent->child) {
|
||||||
struct TreeNode_t *cur = parent->child;
|
struct TreeNode_t *cur = parent->child;
|
||||||
while (cur && cur->next) {cur = cur->next;}
|
while (cur && cur->next) {cur = cur->next;}
|
||||||
|
@ -42,14 +41,16 @@ void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){
|
||||||
} else parent->child = child;
|
} else parent->child = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TreeNode_t *create_user_tree_node (const gchar* text){
|
struct TreeNode_t *widget_create_user_tree_node (const gchar* text)
|
||||||
|
{
|
||||||
struct TreeNode_t *node = g_malloc0 (sizeof(struct TreeNode_t));
|
struct TreeNode_t *node = g_malloc0 (sizeof(struct TreeNode_t));
|
||||||
node->text = g_strdup (text);
|
node->text = g_strdup (text);
|
||||||
node->child = NULL; // if (0) printf("create_user_tree_node %s\n", text);
|
node->child = NULL; // if (0) printf("create_user_tree_node %s\n", text);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GListModel* get_user_tree_model_child (struct TreeNode_t *parent){
|
static GListModel *get_user_tree_model_child (struct TreeNode_t *parent)
|
||||||
|
{
|
||||||
GtkStringList *list = NULL;
|
GtkStringList *list = NULL;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
if (0) printf("[get_user_tree_model_child] here is %s content : ", parent->text);
|
if (0) printf("[get_user_tree_model_child] here is %s content : ", parent->text);
|
||||||
|
@ -60,12 +61,13 @@ static GListModel* get_user_tree_model_child (struct TreeNode_t *parent){
|
||||||
if (0) printf("%s ", child->text);
|
if (0) printf("%s ", child->text);
|
||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
} // else printf("hot.c GListModel* get_user_tree_model_child (struct TreeNode_t *parent) child = %d \n", parent);
|
}
|
||||||
if (0) printf("\n");
|
if (0) printf("\n");
|
||||||
return G_LIST_MODEL(list);
|
return G_LIST_MODEL(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GListModel* get_user_tree_model (GObject *item, gpointer root){
|
static GListModel *get_user_tree_model (GObject *item, gpointer root)
|
||||||
|
{
|
||||||
struct TreeNode_t *cur = (struct TreeNode_t *)root;
|
struct TreeNode_t *cur = (struct TreeNode_t *)root;
|
||||||
struct TreeNode_t *parent = root;
|
struct TreeNode_t *parent = root;
|
||||||
const gchar *string = gtk_string_object_get_string (GTK_STRING_OBJECT (item));
|
const gchar *string = gtk_string_object_get_string (GTK_STRING_OBJECT (item));
|
||||||
|
@ -75,13 +77,15 @@ static GListModel* get_user_tree_model (GObject *item, gpointer root){
|
||||||
if (cur == NULL) {cur = parent->child; parent = cur;}
|
if (cur == NULL) {cur = parent->child; parent = cur;}
|
||||||
}
|
}
|
||||||
if (0) printf("[get_user_user_tree_model] looked for %s in %s item\n", cur->text, string);
|
if (0) printf("[get_user_user_tree_model] looked for %s in %s item\n", cur->text, string);
|
||||||
// ! WARNING ! TODO CUR EST L'ENFANT, MAINTENANT DONC, SI CUR EST UNE FEUILLE, JE N'ATTEINDRAI PAS SON ENFANT
|
// ! WARNING ! TODO CUR EST L'ENFANT, MAINTENANT
|
||||||
|
// DONC, SI CUR EST UNE FEUILLE, JE N'ATTEINDRAI PAS SON ENFANT
|
||||||
|
|
||||||
return get_user_tree_model_child (cur);
|
return get_user_tree_model_child (cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkScrolledWindow *get_user_rules_tree ()
|
GtkScrolledWindow *widget_rec_user_rules_tree ()
|
||||||
{
|
{
|
||||||
struct TreeNode_t *tree_root = create_user_tree_node("root");
|
struct TreeNode_t *tree_root = widget_create_user_tree_node("root");
|
||||||
labo_let_us_create_a_complex_useless_and_expensive_tree (tree_root);
|
labo_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);
|
||||||
|
@ -114,4 +118,3 @@ GtkScrolledWindow *get_user_rules_tree ()
|
||||||
return scrolled_window;
|
return scrolled_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue