WIP: cleaning, simplifying, organizing #include graph_area.h g_signal_connect (...)

This commit is contained in:
Jean Sirmai 2024-06-06 09:41:08 +02:00
parent bd1c1a2817
commit 68c5c445b4
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 14 additions and 30 deletions

10
(notes)
View File

@ -4,14 +4,6 @@ contain.c: (136) gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
graph_area.h: (177) static inline GLuint create_shader(const int stack_id, int type, const char *src) {...} graph_area.h: (177) static inline GLuint create_shader(const int stack_id, int type, const char *src) {...}
graph_area.h:////////////////////////// shader = glCreateShader(type);
graph_area.h:////////////////////////// glShaderSource(shader, 1, &src, NULL);
graph_area.h:////////////////////////// glCompileShader(shader);
graph_area.h:////////////////////////// glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
graph_area.h:////////////////////////// glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len);
graph_area.h:////////////////////////// glGetShaderInfoLog(shader, log_len, NULL, buffer);
graph_area.h:////////////////////////// glDeleteShader(shader);
graph_area.c:////////////////////////// stack_index[i].stack_id = graphics_init(&error_buffer); graph_area.c:////////////////////////// stack_index[i].stack_id = graphics_init(&error_buffer);
graph_area.c:////////////////////////// if (graphics_shutdown(stack_index[i].stack_id, graph_area.c:////////////////////////// if (graphics_shutdown(stack_index[i].stack_id,
@ -33,6 +25,7 @@ graph_area.c:////////////////////////// G_CALLBACK(on_glarea
graph_area.c:////////////////////////// g_signal_connect(gl_area, graph_area.c:////////////////////////// g_signal_connect(gl_area,
graph_area.c:////////////////////////// "unrealize", graph_area.c:////////////////////////// "unrealize",
graph_area.c:////////////////////////// G_CALLBACK(on_glarea_unrealize), NULL); graph_area.c:////////////////////////// G_CALLBACK(on_glarea_unrealize), NULL);
graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT); graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT);
graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
graph_stack.c:////////////////////////// glEnable(GL_MULTISAMPLE); graph_stack.c:////////////////////////// glEnable(GL_MULTISAMPLE);
@ -64,6 +57,7 @@ graph_stack.c:////////////////////////// arrow.z);
graph_stack.c:////////////////////////// } graph_stack.c:////////////////////////// }
graph_stack.c:////////////////////////// if (stack->arrows_nb != announced_arrows_nb) graph_stack.c:////////////////////////// if (stack->arrows_nb != announced_arrows_nb)
graph_stack.c:////////////////////////// g_printerr("ARGH : all the arrows have not been parsed !\n"); graph_stack.c:////////////////////////// g_printerr("ARGH : all the arrows have not been parsed !\n");
init.c.todo:////////////////////////// vertex = create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader); init.c.todo:////////////////////////// vertex = create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
init.c.todo:////////////////////////// fragment = create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader); init.c.todo:////////////////////////// fragment = create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -93,7 +93,7 @@ bool ui_init_graphic_stack(void *container_widget, GError *error_buffer)
//g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n", //g_printerr("[debug] ui_init_graphic_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 = graphics_init(&error_buffer); stack_index[i].stack_id = graphics_init(&error_buffer);
//g_printerr("[debug] ui_init_graphic_stack() : stack_id is %d\n", //g_printerr("[debug] ui_init_graphic_stack() : stack_id is %d\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)
@ -117,10 +117,10 @@ bool ui_shutdown_graphic_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 (graphics_shutdown(stack_index[i].stack_id, if (graphics_shutdown(stack_index[i].stack_id,
////////////////////////// &error_buffer) == false) { &error_buffer) == false) {
////////////////////////// return false; return false;
////////////////////////// } }
stack_index[i].stack_id = 0; stack_index[i].stack_id = 0;
return true; return true;
} }
@ -169,7 +169,7 @@ bool ui_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) {
////////////////////////// graphic_stack[stack_index[i].stack_id].rotation_angles[axis] = value; graphic_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;
} }
@ -188,7 +188,7 @@ void ui_shutdown_all_graphic_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++) {
////////////////////////// graphics_shutdown(stack_index[i].stack_id, NULL); graphics_shutdown(stack_index[i].stack_id, NULL);
} }
return; return;
} }
@ -230,9 +230,7 @@ GtkWidget *create_axis_slider(int axis)
gtk_widget_set_visible (label, TRUE); gtk_widget_set_visible (label, TRUE);
adj = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 12.0, 0.0); adj = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
////////////////////////// g_signal_connect(adj, "value-changed", ////////////////////////// g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label);
////////////////////////// G_CALLBACK(on_axis_value_change),
////////////////////////// (gpointer) label);
slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj); slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append(GTK_BOX(box), slider); gtk_box_append(GTK_BOX(box), slider);
gtk_widget_set_hexpand(slider, TRUE); gtk_widget_set_hexpand(slider, TRUE);
@ -288,17 +286,9 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
//gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER); //gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER);
// The main "draw" call for GtkGLArea // The main "draw" call for GtkGLArea
////////////////////////// g_signal_connect(GTK_GL_AREA(gl_area), ////////////////////////// g_signal_connect(GTK_GL_AREA(gl_area), "render", G_CALLBACK(on_glarea_render), NULL);
////////////////////////// "render", ////////////////////////// g_signal_connect(gl_area, "realize", G_CALLBACK(on_glarea_realize), NULL);
////////////////////////// G_CALLBACK(on_glarea_render), NULL); ////////////////////////// g_signal_connect(gl_area, "unrealize", G_CALLBACK(on_glarea_unrealize), NULL);
////////////////////////// g_signal_connect(gl_area,
////////////////////////// "realize",
////////////////////////// G_CALLBACK(on_glarea_realize), NULL);
////////////////////////// g_signal_connect(gl_area,
////////////////////////// "unrealize",
////////////////////////// G_CALLBACK(on_glarea_unrealize), NULL);
stack_index[stack_index_size-1].container_widget = stack_index[stack_index_size-1].container_widget =
(void*)target_widget; (void*)target_widget;