WIP: cleaning (widgets & graphics sub-dir creation I)

This commit is contained in:
Jean Sirmai 2024-07-03 12:26:48 +02:00
parent 20747ca733
commit 16f41ef343
Signed by: jean
GPG Key ID: FB3115C340E057E3
14 changed files with 39 additions and 39 deletions

View File

@ -135,7 +135,7 @@ gboolean on_glarea_render(GtkGLArea *area,
return false; return false;
} }
if (ui_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 (ui_init_graphic_stack(gtk_widget_get_parent(widget), if (graphics_init_graphic_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 (ui_shutdown_graphic_stack(gtk_widget_get_parent(widget), if (graphics_shutdown_graphic_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 */
ui_update_axis_stack(container_widget, graphics_update_axis_stack(container_widget,
axis, axis,
gtk_adjustment_get_value(adjustment)); gtk_adjustment_get_value(adjustment));

View File

@ -28,8 +28,8 @@
#include <cglm/cglm.h> #include <cglm/cglm.h>
#include "../include/base.h" #include "../../include/base.h"
#include "../include/graphics.h" #include "../../include/graphics.h"
/* /*
* Writes values to describe a vertex at (x,y,z) intoq the vertex buffer * Writes values to describe a vertex at (x,y,z) intoq the vertex buffer

View File

@ -25,8 +25,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/graphics.h" #include "../../include/graphics.h"
#include "../include/callbacks.h" #include "../../include/callbacks.h"
struct stack_index_t { struct stack_index_t {
long stack_id; long stack_id;
@ -62,7 +62,7 @@ int set_arrow (int stack_id, // 2024-06-27 DEBUG !
* *
* @returns stack_id * @returns stack_id
*/ */
long ui_get_graphic_stack(void *container_widget) long graphics_get_graphic_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 ui_get_graphic_stack(void *container_widget)
* *
* @returns stack_id * @returns stack_id
*/ */
long ui_is_graphic_stack_ready(void *container_widget) long graphics_is_graphic_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 ui_is_graphic_stack_ready(void *container_widget)
* *
* @returns bool, true if success * @returns bool, true if success
*/ */
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer) bool graphics_init_graphic_stack(void *container_widget, GError *error_buffer)
{ {
g_printerr("[debug] ui_init_graphic_stack()\n"); g_printerr("[debug] graphics_init_graphic_stack()\n");
g_printerr("[debug] ui_init_graphic_stack() : target is %p\n", container_widget); g_printerr("[debug] graphics_init_graphic_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] ui_init_graphic_stack() : i is %d\n", i); g_printerr("[debug] graphics_init_graphic_stack() : i is %d\n", i);
g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n", g_printerr("[debug] graphics_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 %ld\n", g_printerr("[debug] graphics_init_graphic_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,7 +129,7 @@ bool ui_init_graphic_stack(void *container_widget, GError *error_buffer)
* *
* @returns bool, true if success * @returns bool, true if success
*/ */
bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer) bool graphics_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++) {
@ -146,7 +146,7 @@ bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer)
} }
void ui_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,7 +162,7 @@ void ui_clean_stack_index(void)
* *
* @returns bool, true if success * @returns bool, true if success
*/ */
bool ui_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++) {
@ -183,7 +183,7 @@ bool ui_render_stack(GtkWidget *container_widget)
* *
* @returns bool, true if success * @returns bool, true if success
*/ */
bool ui_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++) {
@ -203,7 +203,7 @@ bool ui_update_axis_stack(GtkWidget *container_widget, int axis, int value)
* *
* @returns bool, true if success * @returns bool, true if success
*/ */
void ui_shutdown_all_graphic_stacks(void) void graphics_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++) {
@ -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 ui_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 ui_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] ui_setup_glarea()\n"); g_printerr("[debug] graphics_setup_glarea()\n");
assert(target_widget); assert(target_widget);
g_printerr("[debug] ui_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 ui_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] ui_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] ui_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);

View File

@ -26,8 +26,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/graphics.h" #include "../../include/graphics.h"
#include "../include/parsing.h" #include "../../include/parsing.h"
#define TEST 0 #define TEST 0

View File

@ -26,7 +26,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/graphics.h" #include "../../include/graphics.h"
int draw_space_ridges_vertex (const int stack_id, int draw_space_ridges_vertex (const int stack_id,
long offset_vertex, long offset_vertex,

View File

@ -28,7 +28,7 @@
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
#include "../include/graphics.h" #include "../../include/graphics.h"
/* 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

View File

@ -25,7 +25,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/callbacks.h" #include "../../include/callbacks.h"
void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){ void dialog_window_design (GtkWindow *main_window, GtkWindow *dialog_window){
char *title = " Save the current model before modifying it? "; char *title = " Save the current model before modifying it? ";

View File

@ -28,8 +28,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/callbacks.h" #include "../../include/callbacks.h"
#include "../include/widgets.h" #include "../../include/widgets.h"
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
// https://docs.gtk.org/gtk4/section-text-widget.html // https://docs.gtk.org/gtk4/section-text-widget.html

View File

@ -27,7 +27,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/widgets.h" #include "../../include/widgets.h"
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO // https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery

View File

@ -27,7 +27,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/widgets.h" #include "../../include/widgets.h"
// https://blog.gtk.org/2020/09/08/on-list-models/ < TODO // https://blog.gtk.org/2020/09/08/on-list-models/ < TODO
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery

View File

@ -26,9 +26,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../include/base.h" #include "../../include/base.h"
#include "../include/callbacks.h" #include "../../include/callbacks.h"
#include "../include/widgets.h" #include "../../include/widgets.h"
#define W 1920 // TODO 2024-06-30 #define W 1920 // TODO 2024-06-30
#define H 960 // Ad hoc (pour mon écran) #define H 960 // Ad hoc (pour mon écran)