Compare commits

...

2 Commits

16 changed files with 404 additions and 310 deletions

View File

@ -41,6 +41,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <glib-2.0/glib.h>
#include <gtk-4.0/gtk/gtk.h>

View File

@ -29,7 +29,6 @@
#pragma once
#include <stdio.h>
#include <stdbool.h>

View File

@ -86,14 +86,32 @@ int widget_get_object_transparency (int i); // top
/******************************************************************************/
// called in : src/widget/rules/distrib.c
// Define a structure for the stack
#define MAX_SIZE 22
typedef struct {
// Array to store stack elements
GtkWidget *arr[MAX_SIZE];
// Index of the top element in the stack
int top;
} Stack;
void initialize(Stack *stack);
bool isEmpty(Stack *stack);
bool isFull(Stack *stack);
void push(Stack *stack, GtkWidget *value);
GtkWidget *pop(Stack *stack);
GtkWidget *peek(Stack *stack);
void *push_images_onto_stack();
void *widget_get_selected_rule();
void *widget_get_rules_left_pane();
void *widget_get_rules_page();
void *widget_get_rule_edit_controls();
void *widget_get_rule_explore_controls();
void *widget_get_rule_edit();
void *widget_get_rule_analyse();
void *widget_get_rules_right_pane();
void *widget_get_rules_pilot_box();
void *widget_get_rules_tree();
void *widget_get_rules_tree_tools();
void *widget_get_rules_use();
void *widget_get_selected_rule_texts();
void *widget_get_selected_rule_images();
@ -137,7 +155,8 @@ char *widget_get_text_address_any ();
// images in : data / image /
// used by : widget / rules.c
GtkBox *get_an_impression_of_what_a_rules_comparator_could_be();
void *get_an_impression_of_what_a_rules_comparator_could_be();
void *trying_to_fill_the_rules_comparator_from_stack();
/******************************************************************************/
/* L A B O */

View File

@ -120,11 +120,30 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
#define W_IMAGE_ABSURD 1920 / 32 // 1920 x 960 ad hoc (pour mon écran)
#define H_IMAGE_ABSURD 960
GtkBox *get_an_impression_of_what_a_rules_comparator_could_be(){
void *get_an_impression_of_what_a_rules_comparator_could_be(){
GtkBox *compare_left = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_widget_set_size_request (GTK_WIDGET (compare_left), W_IMAGE_ABSURD, H_IMAGE_ABSURD);
Stack stack;
// Initialize the stack
initialize(&stack);
// Push elements onto the stack and print the stack after each push
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")));
//printf("Top element: %p\n", peek(&stack));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png")));
//printf("Top element: %p\n", peek(&stack));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png")));
//printf("Top element: %p\n", peek(&stack));
gtk_box_append (compare_left, peek(&stack));
gtk_box_append (compare_left, peek(&stack));
gtk_box_append (compare_left, peek(&stack));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename
@ -133,8 +152,10 @@ GtkBox *get_an_impression_of_what_a_rules_comparator_could_be(){
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png")));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/legumin.png")));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png")));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png")));
gtk_box_append (compare_left, GTK_WIDGET (gtk_picture_new_for_filename

View File

@ -32,16 +32,16 @@
#include "../../../include/signal.h"
void *widget_get_rules_pilot_box ()
void *widget_get_rules_page()
{
GtkBox *rules_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkButton *btt_show_rules_use = GTK_BUTTON (gtk_button_new ());
gtk_button_set_icon_name (btt_show_rules_use, "go-home-symbolic");
// g_signal_connect (btt_show_rules_use, "clicked", G_CALLBACK (on_show_rules_use), no_local_data);
gtk_box_append (rules_pilot_box, GTK_BUTTON (btt_show_rules_use));
GtkPaned *tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
gtk_paned_set_start_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_left_pane()));
gtk_paned_set_end_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_right_pane()));
gtk_paned_set_position (tree_vs_selected, 340); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (tree_vs_selected, TRUE);
gtk_paned_set_shrink_start_child (tree_vs_selected, FALSE);
gtk_paned_set_shrink_end_child (tree_vs_selected, FALSE);
// gtk_box_append (rules_pilot_box,
// GTK_WIDGET (gtk_label_new ("\n - - - - - - - (some widgets here) - - - - - - - \n")));
return rules_pilot_box;
return GTK_WIDGET (tree_vs_selected);
}

View File

@ -1,212 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Rules *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/fsm.h"
#include "../../../include/widget.h"
#include "../../../include/signal.h"
static void *get_btt_conditions_list()
{
GtkWidget* list_box = gtk_list_box_new();
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("if (value (0,0,1,3) == 2)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("if (value (0,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("if (value (0,1,1,2) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
GtkWidget *label_D = GTK_WIDGET (gtk_label_new("if (value (1,0,1,2) == 1)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D);
GtkWidget *label_E = GTK_WIDGET (gtk_label_new("if (value (1,1,1,0) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E);
GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), list_box);
gtk_popover_present (GTK_POPOVER (pop));
gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE);
gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE);
GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ());
gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions");
gtk_menu_button_set_always_show_arrow (conditions, TRUE);
gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop));
// gtk_widget_set_halign (GTK_WIDGET (conditions), GTK_ALIGN_START);
return conditions;
}
static void *get_btt_assign_list()
{
GtkWidget* list_box = gtk_list_box_new();
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("value (0,0,1,3) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("value (0,1,1,0) == 2)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("value (0,1,1,2) == 1)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
GtkWidget *label_D = GTK_WIDGET (gtk_label_new("value (1,0,1,2) == 0)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D);
GtkWidget *label_E = GTK_WIDGET (gtk_label_new("value (1,1,1,0) == 2)")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E);
GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), list_box);
gtk_popover_present (GTK_POPOVER (pop));
gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE);
gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE);
GtkMenuButton *actions = GTK_MENU_BUTTON (gtk_menu_button_new ());
gtk_menu_button_set_label (GTK_MENU_BUTTON (actions), "actions");
gtk_menu_button_set_always_show_arrow (actions, TRUE);
gtk_menu_button_set_popover (actions, GTK_WIDGET (pop));
// gtk_widget_set_halign (GTK_WIDGET (actions), GTK_ALIGN_START);
return actions;
}
static void *get_btt_rule_identity()
{
GtkWidget* list_box = gtk_list_box_new();
GtkWidget *label_A = GTK_WIDGET (gtk_label_new("AMP > ADP")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_A);
GtkWidget *label_B = GTK_WIDGET (gtk_label_new("AMP-activated protein kinase")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_B);
GtkWidget *label_C = GTK_WIDGET (gtk_label_new("date")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_C);
GtkWidget *label_D = GTK_WIDGET (gtk_label_new("author")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_D);
GtkWidget *label_E = GTK_WIDGET (gtk_label_new("status, activity")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_E);
GtkWidget *label_F = GTK_WIDGET (gtk_label_new("links to other rules")); gtk_list_box_append (GTK_LIST_BOX (list_box), label_F);
GtkWidget *pop = gtk_popover_new ();
gtk_popover_set_child (GTK_POPOVER (pop), list_box);
gtk_popover_present (GTK_POPOVER (pop));
gtk_popover_set_autohide (GTK_POPOVER (pop), FALSE);
gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE);
GtkMenuButton *identity = GTK_MENU_BUTTON (gtk_menu_button_new ());
gtk_menu_button_set_label (GTK_MENU_BUTTON (identity), "identity");
gtk_menu_button_set_always_show_arrow (identity, TRUE);
gtk_menu_button_set_popover (identity, GTK_WIDGET (pop));
// gtk_widget_set_halign (GTK_WIDGET (identity), GTK_ALIGN_START);
return identity;
}
static void *get_conditions_actions_names_box()
{
GtkWidget *label_ad_hoc = GTK_WIDGET (gtk_label_new (\
" "));
GtkBox *conditions_actions_names_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkLayoutManager *conditions_actions_identity_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_layout_manager (GTK_WIDGET (conditions_actions_names_box),
GTK_LAYOUT_MANAGER (conditions_actions_identity_layout));
gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (conditions_actions_identity_layout), 180);
// allocate (GTK_LAYOUT_MANAGER (conditions_actions_identity_layout), get_btt_conditions_list (), 100, 20,100); TODO
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (label_ad_hoc));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_conditions_list ()));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_assign_list()));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_rule_identity()));
return GTK_WIDGET (conditions_actions_names_box);
}
static void *get_rule_before()
{
GtkWidget *rule_before = GTK_WIDGET (gtk_picture_new_for_filename \
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"));
gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, H_IMAGE_LOCAL);
return GTK_WIDGET (rule_before);
}
static void *get_rule_after()
{
GtkWidget *rule_after = GTK_WIDGET (gtk_picture_new_for_filename \
("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"));
gtk_widget_set_size_request (GTK_WIDGET (rule_after), 0, H_IMAGE_LOCAL);
return GTK_WIDGET (rule_after);
}
static GtkBox *rec_XYZ_box()
{
GtkBox *XYZ_labels_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
GtkBox *XYZ_scrollbar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
// GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
// (double min, double max, double step, const char** icons)
GtkAdjustment *X_adjust = gtk_adjustment_new (rand() % 100, 0, 380, 1, 0, 0);
GtkAdjustment *Y_adjust = gtk_adjustment_new (rand() % 200, 0, 380, 1, 0, 0);
GtkAdjustment *Z_adjust = gtk_adjustment_new (rand() % 300, 0, 380, 1, 0, 0);
GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust);
GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust);
GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust);
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, 400);
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
gtk_box_append (XYZ_scrollbar_box, scroll_X);
gtk_box_append (XYZ_scrollbar_box, scroll_Y);
gtk_box_append (XYZ_scrollbar_box, scroll_Z);
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
GtkWidget *btt_reset = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("")));
return XYZ_labels_box;
}
static GtkBox *rec_ZOOM_box()
{
GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
"\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\
---\n arrows\n struct.\n ---\n orient\n state\n in space\n"));
gtk_widget_set_size_request (GTK_WIDGET (ZOOM_box), 10, 80);
gtk_box_append (ZOOM_box, ZOOM_Label);
return ZOOM_box;
}
void *widget_get_selected_rule_images() {
GtkBox *right_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (right_box, GTK_WIDGET (rec_XYZ_box()));
gtk_box_append (right_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (right_box, GTK_WIDGET (rec_ZOOM_box()));
GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_before ()));
gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_after ()));
gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (before_vs_after, GTK_WIDGET (right_box));
return GTK_WIDGET (before_vs_after);
}
void *widget_get_selected_rule() {
GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_images ()));
gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (images_and_texts, GTK_WIDGET (get_conditions_actions_names_box ()));
return GTK_WIDGET (images_and_texts);
}

View File

@ -32,13 +32,11 @@
#include "../../../../include/signal.h"
void *widget_get_selected_rule() {
GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_images ()));
gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_texts ()));
return GTK_WIDGET (images_and_texts);
void *widget_get_rule_analyse()
{
return gtk_label_new ("________________\n RULE ANALYSIS\n\
controls\n'''''''''''''''''''''''''''''");
}

View File

@ -27,21 +27,19 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/fsm.h"
#include "../../../include/widget.h"
#include "../../../include/signal.h"
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
void *widget_get_rule_explore_controls()
{
return gtk_label_new ("________________\n RULE EXPLORE\n\
controls\n'''''''''''''''''''''''''''''");
}
void *widget_get_selected_rule() {
void *widget_get_rule_edit_controls()
{
return gtk_label_new
("___________\n RULE EDIT\n controls\n''''''''''''''''''''");
GtkBox *images_and_texts = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_images ()));
gtk_box_append (images_and_texts, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_texts ()));
return GTK_WIDGET (images_and_texts);
}
void *widget_get_rules_right_pane()
@ -49,9 +47,9 @@ void *widget_get_rules_right_pane()
GtkPaned *rule_itself_vs_explore_edit_pane = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_VERTICAL));
gtk_paned_set_start_child (rule_itself_vs_explore_edit_pane, GTK_WIDGET (widget_get_selected_rule()));
if (fsm_get_exec_edit()) gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane,
GTK_WIDGET (widget_get_rule_edit_controls()));
GTK_WIDGET (widget_get_rule_edit()));
else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane,
GTK_WIDGET (widget_get_rule_explore_controls()));
GTK_WIDGET (widget_get_rule_analyse()));
gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 640); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (rule_itself_vs_explore_edit_pane, TRUE);
gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE);
@ -60,41 +58,4 @@ void *widget_get_rules_right_pane()
return GTK_WIDGET (rule_itself_vs_explore_edit_pane);
}
void *widget_get_rules_pilot_box ()
{
GtkBox *rules_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkButton *btt_show_rules_use = GTK_BUTTON (gtk_button_new_with_label ("rules use"));
// gtk_button_set_icon_name (btt_show_rules_use, "any-symbolic");
// g_signal_connect (btt_show_rules_use, "clicked", G_CALLBACK (on_show_rules_use), no_local_data);
GtkButton *btt_show_rules_comparator = GTK_BUTTON (gtk_button_new_with_label ("comparator"));
GtkButton *btt_expand_tree = GTK_BUTTON (gtk_button_new_with_label ("tree"));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_expand_tree));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_show_rules_use));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_show_rules_comparator));
return rules_pilot_box;
}
void *widget_get_rules_left_pane ()
{
GtkBox *rules_tree_and_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_pilot_box ()));
// TODO non static génère une erreur : "référence indéfinie" <> a linkage pb ? see Makefile ?
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_tree ()));
return rules_tree_and_pilot_box;
}
void *widget_get_rules_page()
{
GtkPaned *tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
gtk_paned_set_start_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_left_pane()));
gtk_paned_set_end_child (tree_vs_selected, GTK_WIDGET (widget_get_rules_right_pane()));
gtk_paned_set_position (tree_vs_selected, 340); // WARNING : c'est une position "absolue"
gtk_paned_set_wide_handle (tree_vs_selected, TRUE);
gtk_paned_set_shrink_start_child (tree_vs_selected, FALSE);
gtk_paned_set_shrink_end_child (tree_vs_selected, FALSE);
return GTK_WIDGET (tree_vs_selected);
}

View File

@ -27,22 +27,15 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/fsm.h"
#include "../../../include/widget.h"
#include "../../../include/signal.h"
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
/*
void *widget_get_rule_explore_controls()
{
return gtk_label_new ("________________\n RULE EXPLORE\n\
controls\n'''''''''''''''''''''''''''''");
}
void *widget_get_rule_edit_controls()
void *widget_get_rule_edit()
{
return gtk_label_new
("___________\n RULE EDIT\n controls\n''''''''''''''''''''");
}
*/

View File

@ -92,11 +92,13 @@ static GtkBox *rec_ZOOM_box()
void *widget_get_selected_rule_images() {
// - - - - - - - - - - - - C A M E R A - - - - - - - - - - - - - - //
GtkBox *right_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (right_box, GTK_WIDGET (rec_XYZ_box()));
gtk_box_append (right_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (right_box, GTK_WIDGET (rec_ZOOM_box()));
// - - - - - - - - - - - - I M A G E S - - - - - - - - - - - - - - //
GtkBox *before_vs_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (before_vs_after, GTK_WIDGET (get_rule_before ()));
gtk_box_append (before_vs_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));

View File

@ -0,0 +1,179 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Rules *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
// design a comparator (using 'before'/'after' stamps)
#define W_IMAGE_ABSURD 1920 / 32 // 1920 x 960 ad hoc (pour mon écran)
#define H_IMAGE_ABSURD 960
Stack stack;
// https://www.geeksforgeeks.org/implement-stack-in-c/
void *trying_to_fill_the_rules_comparator_from_stack(){
GtkBox *compare_left = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_widget_set_size_request (GTK_WIDGET (compare_left), W_IMAGE_ABSURD, H_IMAGE_ABSURD);
// GtkBox *compare_right = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
// gtk_widget_set_size_request (GTK_WIDGET (compare_right), W_IMAGE_ABSURD, H_IMAGE_ABSURD);
// while (!isEmpty(&stack)) {
for (int i = 0; i < MAX_SIZE; i++)
gtk_box_append (compare_left, GTK_WIDGET (peek(&stack)));
// gtk_box_append (compare_right, GTK_WIDGET (pop(&stack)));
//}
GtkScrolledWindow *comparator = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new ());
GtkBox *inside = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (inside, GTK_WIDGET (compare_left));
// gtk_box_append (inside, GTK_WIDGET (compare_right));
gtk_scrolled_window_set_child (comparator, GTK_WIDGET (inside));
return comparator;
}
// structure for the stack is in widget.h (^c^v...)
void initialize (Stack *stack) { stack->top = -1; }
bool isEmpty (Stack *stack) { return stack->top == -1; }
bool isFull (Stack *stack) { return stack->top == MAX_SIZE - 1; }
void push (Stack *stack, GtkWidget *value)
{
// Check for stack overflow
if (isFull(stack)) {
printf("Stack Overflow\n");
return;
}
// Increment top and add the value to the top of the stack
stack->arr[++stack->top] = value;
//printf("Pushed %p onto the stack\n", value);
printf("%d ", stack->top);
}
GtkWidget *pop (Stack *stack) {
// Check for stack underflow
if (isEmpty(stack)) {
printf("Stack Underflow\n");
return NULL;
}
// Return the top element
GtkWidget *popped = stack->arr[stack->top];
// decrement top pointer
stack->top--;
printf("Popped %p from the stack ", popped);
// return the popped element
return popped;
}
GtkWidget *peek(Stack *stack) {
// Check if the stack is empty
if (isEmpty(stack)) {
printf("Stack is empty\n");
return NULL;
}
// Return the top element without removing it
return stack->arr[stack->top];
}
void *push_images_onto_stack (Stack stack)
{
clock_t start, end;
start = clock();
printf("compare.c push_images_onto_stack() Init images stack\nStart filling stack >> ");
initialize(&stack);
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")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamate.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutamine.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/legumin.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/ATP.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/histidine.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/phénylalanine.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/dopamine.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/ribonuclease.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/ascorbic acid.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/biotin.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/erythorbic acid.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glycerol.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/insuline.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/glutathione.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/lactic acid.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/pantothenic acid.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/pyridoxin.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/riboflavin.png")));
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/hb.png")));
end = clock();
long double t = (long double)(end - start) / CLOCKS_PER_SEC;
printf(" << stack filled in time : %Lg\n", t);
// Pop elements from the stack and print the stack after each pop
/* while (!isEmpty(&stack)) {
printf("Top element: %p\n", peek(&stack));
printf("Popped element: %p\n", pop(&stack));
}*/
return 0;
}

View File

@ -0,0 +1,44 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Rules *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
void *widget_get_rules_left_pane ()
{
GtkBox *rules_tree_and_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_pilot_box ()));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (rules_tree_and_pilot_box, GTK_WIDGET (widget_get_rules_tree_tools ()));
return rules_tree_and_pilot_box;
}

View File

@ -0,0 +1,59 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Rules *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
void *widget_get_rules_pilot_box ()
{
GtkBox *rules_pilot_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkButton *btt_show_rules_use = GTK_BUTTON (gtk_button_new_with_label ("rules use"));
// gtk_button_set_icon_name (btt_show_rules_use, "any-symbolic");
// g_signal_connect (btt_show_rules_use, "clicked", G_CALLBACK (on_show_rules_use), no_local_data);
GtkButton *btt_show_rules_comparator = GTK_BUTTON (gtk_button_new_with_label ("comparator"));
GtkButton *btt_expand_tree = GTK_BUTTON (gtk_button_new_with_label ("tree"));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_expand_tree));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_show_rules_use));
gtk_box_append (rules_pilot_box, GTK_WIDGET (btt_show_rules_comparator));
return rules_pilot_box;
}
void *widget_get_rules_tree_tools ()
{
GtkBox *rules_tree_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_user_rules_tree()));
gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_rules_use ()));
push_images_onto_stack ();
gtk_box_append (rules_tree_box, GTK_WIDGET (get_an_impression_of_what_a_rules_comparator_could_be()));
return GTK_WIDGET (rules_tree_box);
}

View File

@ -0,0 +1,40 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Rules *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* This program is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Affero General Public License *
* as published by the Free Software Foundation, *
* either version 3 of the License, *
* or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
// void *widget_get_user_rules_tree() < est à la racine (dans src/widget/)
// Il faut faire le tri entre
// - ce qui appartient à "cet" arbre, et
// - ce qui serait commun à "tous" les arbres utilisés dans gem-graph

View File

@ -27,15 +27,15 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/fsm.h"
#include "../../../include/widget.h"
#include "../../../include/signal.h"
#include "../../../../include/fsm.h"
#include "../../../../include/widget.h"
#include "../../../../include/signal.h"
static GtkScrollbar *rule_bar [n_rules];
static GtkAdjustment *rule_adjust [n_rules];
static void *static_widget_get_rules_use ()
void *widget_get_rules_use ()
{
GtkBox *rules_use_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
GtkWidget *scroll_rules_use = gtk_scrolled_window_new ();
@ -66,13 +66,3 @@ static void *static_widget_get_rules_use ()
}
void *widget_get_rules_tree ()
{
GtkBox *rules_tree_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (rules_tree_box, GTK_WIDGET (widget_get_user_rules_tree()));
gtk_box_append (rules_tree_box, GTK_WIDGET (static_widget_get_rules_use ()));
gtk_box_append (rules_tree_box, GTK_WIDGET (get_an_impression_of_what_a_rules_comparator_could_be()));
return GTK_WIDGET (rules_tree_box);
}