From b8e70e8231c5355f4635207ca38d44e88861a9f7 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 10 Nov 2023 09:51:37 +0100 Subject: [PATCH] WIP: lecture + mises en forme (arrays) perso; qui fait quoi ? --- draft getters-setters & co (résumé) | 143 --------------------------- src/ui/application.c | 20 +--- src/ui/gemgraph.ui | 50 +++++----- src/ui/window.c | 147 +++++++--------------------- tree (learning)/bout de code | 13 +++ 5 files changed, 80 insertions(+), 293 deletions(-) delete mode 100644 draft getters-setters & co (résumé) create mode 100644 tree (learning)/bout de code diff --git a/draft getters-setters & co (résumé) b/draft getters-setters & co (résumé) deleted file mode 100644 index 296f612..0000000 --- a/draft getters-setters & co (résumé) +++ /dev/null @@ -1,143 +0,0 @@ -static GLuint *buffer_lines_origin = NULL; ---- -long get_buffer_lines_size() {return buffer_lines_size / 2;} -void inc_buffer_lines_size(long inc) {buffer_lines_size += inc * 2;} -void dec_buffer_lines_size(long dec) {buffer_lines_size -= dec * 2;} - -void xxx_draw_line (GLuint *lines_origin, int a, int b, long lines_index) -{ - // https://docs.gtk.org/glib/func.realloc.html - printf("xxx_draw_line %ld\n", lines_index); - buffer_lines_origin = g_realloc(lines_origin, sizeof(GLuint) * 2); - *(lines_origin + lines_index + 0) = a; // lines_index ++; - *(lines_origin + lines_index + 1) = b; // lines_index ++; -} - -/* (gdb) help -List of classes of commands: - -aliases -- User-defined aliases of other commands. -breakpoints -- Making program stop at certain points. -data -- Examining data. -files -- Specifying and examining files. -internals -- Maintenance commands. -obscure -- Obscure features. -running -- Running the program. -stack -- Examining the stack. -status -- Status inquiries. -support -- Support facilities. -text-user-interface -- TUI is the GDB text based interface. -tracepoints -- Tracing of program execution without stopping the program. -user-defined -- User-defined commands. -*/ - - - - - - - - - - - -------------------------------------------------------------------------------------------- -GLuint arrows[] = { - 1, 0, 0, 0, 0, - /* 1, 1, 1, 0, 0, */ - /* 1, 2, 2, 1, 1, */ - /* 1, 3, 2, 2, 1, */ - /* 1, 4, 3, 0, 1, */ - /* 1, 5, 3, 0, 2, */ - /* 1, 1, 3, 0, 2, */ - /* 1, 0, 2, 0, 2, */ - /* 1, 5, 2, 1, 1, */ -// load, site, x, y, z -}; - -static void get_model_data_and_user_preferences(){ - - - model_space_size_x = 1; // 0 < model_space_size_x - model_space_size_y = 1; // 0 < model_space_size_y - model_space_size_z = 1; // 0 < model_space_size_z - - // XXX ONLY space drawed, no arrows yet - - model_arrows_nb = sizeof(arrows); // assert : l'emplacement des flèches est contraint - // par model_space_size_x, y, z et le nombre de sites - - central_stars_nb = 0; // à calculer TODO - // ! WARNING ! Pour l'instant égal au nombre de flèches ! (central stars réécrites) - central_stars_nb = model_arrows_nb; - -// pref_mark_unit_space = 0; // 0 = no marks, 1 = 1st, 2 = last, 3 = both -// pref_style_lines_planes = 0; // 0 = arrows as lines, 1 = as planes, 2 = mix -// pref_style_mix_colors = 0; // TODO - pref_show_grid = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc - // xyz, 0, x, y, z, xy, xz, yz, xyz - pref_test_diagonal = 1; -} -------------------------------------------------------------------------------------------- - - - - -in buffers.c (line 283) - -static void draw_line (GLuint *lines_origin, int a, int b) -{ - xxx_draw_line (lines_origin, a, b, lines_index); - lines_index += 2; - // *(lines_origin + lines_index) = a; lines_index ++; - // *(lines_origin + lines_index) = b; lines_index ++; -} - ---------------------------------------------------------------------------- - - - -[ n] load site x y z ---- < arrows array > ------------------------------------------------------------ -[ 0] = 1, 0, 0, 0, 0 -[ 1] = 0, 0, 0, 217808480, 32708 -[ 2] = 217809344, 32708, 217807968, 32708, 217810080 -[ 3] = 32708, -69297984, 32707, 229965808, 32708 -[ 4] = 229944176, 32708, 217808608, 32708, 229970384 -[ 5] = 32708, 217808576, 32708, 217809024, 32708 -[ 6] = 217808992, 32708, -69297888, 32707, 229954976 -[ 7] = 32708, 217808512, 32708, 229949456, 32708 -[ 8] = 229942736, 32708, 0, 0, 0 -[ 9] = 0, 0, 0, 226977440, 32708 -[10] = 217810048, 32708, 217808352, 32708, 217808704 -[11] = 32708, -69297600, 32707, 217808448, 32708 -[12] = 217807808, 32708, 217808896, 32708, 217809312 -[13] = 32708, 217807872, 32708, 225561296, 32708 -[14] = 217814880, 32708, 217814944, 32708, 217807776 -[15] = 32708, 229974752, 32708, 217811040, 32708 -[16] = 229947200, 32708, 0, 0, 33506144 -[17] = 0, 0, 0, 0, 0 -[18] = 33204048, 0, 0, 0, 33587952 -[19] = 0, 30217696, 0, 30245088, 0 - -[ n] load site x y z ---- < arrows array > ------------------------------------------------------------ -[ 0] = 1, 0, 0, 0, 0 -[ 1] = 0, 0, 0, 2105314912, 32683 -[ 2] = 2105315776, 32683, 2105314400, 32683, 2105316512 -[ 3] = 32683, 2019551424, 32683, 2117545968, 32683 -[ 4] = 2117524336, 32683, 2105315040, 32683, 2117550544 -[ 5] = 32683, 2105315008, 32683, 2105315456, 32683 -[ 6] = 2105315424, 32683, 2019551520, 32683, 2117535136 -[ 7] = 32683, 2105314944, 32683, 2117529616, 32683 -[ 8] = 2117522896, 32683, 0, 0, 0 -[ 9] = 0, 0, 0, 2114557600, 32683 -[10] = 2105316480, 32683, 2105314784, 32683, 2105315136 -[11] = 32683, 2019551808, 32683, 2105314880, 32683 -[12] = 2105314240, 32683, 2105315328, 32683, 2105315744 -[13] = 32683, 2105314304, 32683, 2113141456, 32683 -[14] = 2105321312, 32683, 2105321376, 32683, 2105314208 -[15] = 32683, 2117554912, 32683, 2105317472, 32683 -[16] = 2117527360, 32683, 0, 0, 16032608 -[17] = 0, 0, 0, 0, 0 -[18] = 15766240, 0, 0, 0, 15950576 -[19] = 0, 12654048, 0, 12681440, 0 - diff --git a/src/ui/application.c b/src/ui/application.c index 25c0c62..6312982 100644 --- a/src/ui/application.c +++ b/src/ui/application.c @@ -96,21 +96,11 @@ static void gem_graph_client_application_init(GemGraphClientApplication *self) self); // Setup shortcuts - gtk_application_set_accels_for_action(GTK_APPLICATION(self), - "app.quit", - (const char *[]) { "q", NULL }); - gtk_application_set_accels_for_action(GTK_APPLICATION(self), - "app.editmode", - (const char *[]) { "e", NULL }); - gtk_application_set_accels_for_action(GTK_APPLICATION(self), - "app.runmode", - (const char *[]) { "r", NULL }); - gtk_application_set_accels_for_action(GTK_APPLICATION(self), - "app.presentmode", - (const char *[]) { "p", NULL }); - gtk_application_set_accels_for_action(GTK_APPLICATION(self), - "app.savefile", - (const char *[]) { "s", NULL }); + gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.quit", (const char *[]) { "q", NULL }); + gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.editmode", (const char *[]) { "e", NULL }); + gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.runmode", (const char *[]) { "r", NULL }); + gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.presentmode",(const char *[]) { "p", NULL }); + gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.savefile", (const char *[]) { "s", NULL }); application = self; diff --git a/src/ui/gemgraph.ui b/src/ui/gemgraph.ui index 60ed7c3..551619d 100644 --- a/src/ui/gemgraph.ui +++ b/src/ui/gemgraph.ui @@ -4,8 +4,8 @@