diff --git a/data/image/a quote from Martin Fowler.png b/data/image/a quote from Martin Fowler.png new file mode 100644 index 0000000..09c1a05 Binary files /dev/null and b/data/image/a quote from Martin Fowler.png differ diff --git a/data/stamp/ADP.jpg b/data/stamp/ADP.jpg new file mode 100644 index 0000000..4693930 Binary files /dev/null and b/data/stamp/ADP.jpg differ diff --git a/data/stamp/ADP.pdf b/data/stamp/ADP.pdf new file mode 100644 index 0000000..9a2544e Binary files /dev/null and b/data/stamp/ADP.pdf differ diff --git a/data/stamp/AMP.jpg b/data/stamp/AMP.jpg new file mode 100644 index 0000000..5c9924e Binary files /dev/null and b/data/stamp/AMP.jpg differ diff --git a/data/stamp/AMP.xcf b/data/stamp/AMP.xcf new file mode 100644 index 0000000..058dbd4 Binary files /dev/null and b/data/stamp/AMP.xcf differ diff --git a/src/widget/rules/tree_tools/compare.c b/src/widget/rules/tree_tools/compare.c index a0cb673..a62ccad 100644 --- a/src/widget/rules/tree_tools/compare.c +++ b/src/widget/rules/tree_tools/compare.c @@ -35,35 +35,30 @@ #define H_IMAGE_ABSURD 960 #define MAX_SIZE 255 -// ----------------------------------------------------------------------- -// Below is ^c^v from RMS C manual +// ----------------------------------------------------------------------------- +// Below is ^c^v from RMS C manual (p 77) 24 * 256 * 256 * 2 = 3 145 728 // -struct intlistlink {int datum; struct intlistlink *next;} babar; -struct intlistlink *my_list = NULL; -struct intlistlink *alloc_intlistlink () +struct images_bff {GtkWidget *arr[MAX_SIZE]; int top;}; +static struct images_bff *my_list = NULL, *babar = NULL; +static struct images_bff *alloc_images_bff () { - struct intlistlink *p; - p = malloc (sizeof (struct intlistlink)); + struct images_bff *p; + p = malloc (sizeof (struct images_bff)); if (p == NULL) printf ("fatal: ran out of storage"); - p->datum = 0; - p->next = NULL; + p->arr[MAX_SIZE] = NULL; + p->top = 0; return p; } -void add_to_mylist (int my_int) +static void add_to_mylist (int my_int) { - struct intlistlink *p = alloc_intlistlink (); - p->datum = my_int; - p->next = my_list; + struct images_bff *p = alloc_images_bff (); + p->arr[MAX_SIZE] = NULL; // TODO + p->top = my_int; my_list = p; } -void free_intlist (struct intlistlink *p) +static void free_intlist (struct images_bff *p) { - while (p) - { - struct intlistlink *q = p; - p = p->next; - free (q); - } + // TODO } // TODO free_intlist (mylist); // TODO mylist = NULL; @@ -103,7 +98,30 @@ static GtkWidget *peek(Stack *stack) } // ----------------------------------------------------------- -// confrontation of both examples and methods +// 2024-08-01 +// GTK possède un espace mémoire où les widgets sont alloués/désalloués +// Un widget ne conserve pas son pointeur. Son adresse peut changer. +// Donc créer une stack de widget avec un outil hors GTK n'est pas faisable >> +// - soit tu traites les images hors de GTK, +// - soit tu trouves un outil dans GTK pour ce type d'opération. +// C'est le cas de toute bibliothèque externe que tu utilises : +// Tu n'as pas le droit de faire d'assomptions sur les espaces mémoires externes. + +// J'imagine un tableau de vignettes, toutes de même taille. +// https://en.wikipedia.org/wiki/Color_depth 24 * 256 * 256 * 2 = 3 145 728 +// Aucun utilisateur ne comparera toutes les règles une à une. 🤔️ +// On ne peut en comparer qu'une centaine au plus à la fois. +// +// Chaque utilisateur sélectionnera UNE vignette (par règle) +// pour pouvoir comparer SES quelques règles d'intérêt. +// Et si ces vignettes sont perdues, rien de grave ! +// Elles seront toujours très faciles à refaire. 🙂️ +// +// Toute vignette aura UNE règle +// mais toute règle n'aura pas nécessairement de vignette. 🤔️ +// Donc une application injective & non-surjective. +// +// https://docs.gtk.org/gio/iface.ListModel.html?q=icon << TODO static void *push_images_onto_stack (Stack stack_b); @@ -117,23 +135,32 @@ void *get_an_impression_of_what_a_rules_comparator_could_be(){ initialize(&stack_b); - push_images_onto_stack (stack_b); +// push_images_onto_stack (stack_b); + push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/glutathione.png"))); + push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/ribonuclease.png"))); push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png"))); push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"))); push(&stack_b, GTK_WIDGET (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/insuline.png"))); + push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename + ("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png"))); printf(" --------- \n");//%d\n", *stack_b->arr[0]); - peek(&stack_b); +// peek(&stack_b); // gtk_box_append (compare_left, peek(&stack_b)); gtk_box_append (compare_left, pop(&stack_b)); gtk_box_append (compare_left, pop(&stack_b)); gtk_box_append (compare_left, pop(&stack_b)); -// gtk_box_append (compare_left, pop(&stack)); + gtk_box_append (compare_left, pop(&stack_b)); + gtk_box_append (compare_left, pop(&stack_b)); + gtk_box_append (compare_left, pop(&stack_b)); +// gtk_box_append (compare_left, pop(&stack_b)); GtkBox *comparator = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); gtk_box_append (comparator, GTK_WIDGET (compare_left)); @@ -163,7 +190,7 @@ static void *push_images_onto_stack (Stack stack) printf("compare.c push_images_onto_stack() start >> "); start = clock(); - push(&stack, GTK_WIDGET (gtk_picture_new_for_filename + push(&stack, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"))); push(&stack, GTK_WIDGET (gtk_picture_new_for_filename ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png")));