Rules with a right pane 'camera' and three lists (conditions, actions, identity)

This commit is contained in:
Jean Sirmai 2024-07-30 03:21:39 +02:00
parent b4100e31c6
commit 1ad7ba36ef
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 112 additions and 62 deletions

View File

@ -60,7 +60,7 @@ void *widget_get_rules_page(); // in : src/widget/rules.c
void *widget_get_stock_page(); // in : src/widget/stock.c void *widget_get_stock_page(); // in : src/widget/stock.c
#define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran) #define W_IMAGE_LOCAL 1920 / 32 // 1920 x 960 ad hoc (pour mon écran)
#define H_IMAGE_LOCAL 960 #define H_IMAGE_LOCAL 800
/******************************************************************************/ /******************************************************************************/
/* S T A T E */ /* S T A T E */

View File

@ -52,7 +52,7 @@ void *widget_rule_itself_vs_explore_edit_pane()
GTK_WIDGET (widget_get_rule_edit_controls())); GTK_WIDGET (widget_get_rule_edit_controls()));
else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane, else gtk_paned_set_end_child (rule_itself_vs_explore_edit_pane,
GTK_WIDGET (widget_get_rule_explore_controls())); GTK_WIDGET (widget_get_rule_explore_controls()));
gtk_paned_set_position (rule_itself_vs_explore_edit_pane, 660); // WARNING : c'est une position "absolue" 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_wide_handle (rule_itself_vs_explore_edit_pane, TRUE);
gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE); gtk_paned_set_shrink_start_child (rule_itself_vs_explore_edit_pane, FALSE);
gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit_pane, FALSE); gtk_paned_set_shrink_end_child (rule_itself_vs_explore_edit_pane, FALSE);

View File

@ -49,101 +49,152 @@ static void *get_btt_conditions_list()
gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE); gtk_popover_set_cascade_popdown (GTK_POPOVER (pop), TRUE);
GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ()); GtkMenuButton *conditions = GTK_MENU_BUTTON (gtk_menu_button_new ());
const char *condition_text_1 = "conditions list"; gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), "conditions");
gtk_menu_button_set_label (GTK_MENU_BUTTON (conditions), condition_text_1);
gtk_menu_button_set_always_show_arrow (conditions, TRUE); gtk_menu_button_set_always_show_arrow (conditions, TRUE);
gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop)); gtk_menu_button_set_popover (conditions, GTK_WIDGET (pop));
gtk_widget_set_halign (GTK_WIDGET (conditions), GTK_ALIGN_START); // gtk_widget_set_halign (GTK_WIDGET (conditions), GTK_ALIGN_START);
return conditions; 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() 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)); GtkBox *conditions_actions_names_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkLayoutManager *conditions_actions_names_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL); GtkLayoutManager *conditions_actions_identity_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (conditions_actions_names_layout), 100); // << TODO gtk_widget_set_layout_manager (GTK_WIDGET (conditions_actions_names_box),
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (conditions_actions_names_layout)); 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_conditions_list ()));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_assign_list()));
GtkButton *actions = GTK_BUTTON (gtk_button_new_with_label ("\n actions list\n")); gtk_box_append (conditions_actions_names_box, GTK_WIDGET (get_btt_rule_identity()));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (actions));
gtk_widget_set_halign (GTK_WIDGET (actions), GTK_ALIGN_CENTER);
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
GtkButton *names = GTK_BUTTON (gtk_button_new_with_label ("\n names list\n"));
gtk_box_append (conditions_actions_names_box, GTK_WIDGET (names));
gtk_widget_set_halign (GTK_WIDGET (names), GTK_ALIGN_END);
return GTK_WIDGET (conditions_actions_names_box); return GTK_WIDGET (conditions_actions_names_box);
} }
static void *get_under_rule_before()
{
GtkBox *under_rule_before_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (under_rule_before_box,
GTK_WIDGET (gtk_label_new ("\n | - - - - - (some widgets here) - - - - |\
[ rule_before ] | - - - - - (some other widgets there) - - - - - | \n")));
return GTK_WIDGET (under_rule_before_box);
}
static void *get_under_rule_after()
{
GtkBox *under_rule_after_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (under_rule_after_box,
GTK_WIDGET (gtk_label_new ("\n | - - - - - - (some widgets here) - - - - - - |\
[ rule_after ] | - - - - - - (some other widgets there) - - - - - - |\n")));
return GTK_WIDGET (under_rule_after_box);
}
static void *get_rule_before() static void *get_rule_before()
{ {
GtkBox *rule_before = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkWidget *rule_before = GTK_WIDGET (gtk_picture_new_for_filename \
gtk_box_append (rule_before, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png"));
gtk_box_append (rule_before, GTK_WIDGET (gtk_picture_new_for_filename gtk_widget_set_size_request (GTK_WIDGET (rule_before), 0, H_IMAGE_LOCAL);
("/home/jean/Gem-Graph/gem-graph-client/data/image/AMP.png")));
gtk_box_append (rule_before, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (rule_before, GTK_WIDGET (get_under_rule_before()));
// gtk_widget_set_size_request (GTK_WIDGET (rule_before), W_IMAGE_LOCAL / 2, H_IMAGE_LOCAL / 2);
return GTK_WIDGET (rule_before); return GTK_WIDGET (rule_before);
} }
static void *get_rule_after() static void *get_rule_after()
{ {
GtkBox *rule_after = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); GtkWidget *rule_after = GTK_WIDGET (gtk_picture_new_for_filename \
gtk_box_append (rule_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL))); ("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png"));
gtk_box_append (rule_after, GTK_WIDGET (gtk_picture_new_for_filename gtk_widget_set_size_request (GTK_WIDGET (rule_after), 0, H_IMAGE_LOCAL);
("/home/jean/Gem-Graph/gem-graph-client/data/image/ADP.png")));
gtk_box_append (rule_after, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
gtk_box_append (rule_after, GTK_WIDGET (get_under_rule_after()));
// gtk_widget_set_size_request (GTK_WIDGET (rule_after), W_IMAGE_LOCAL / 12, H_IMAGE_LOCAL / 12);
return GTK_WIDGET (rule_after); return GTK_WIDGET (rule_after);
} }
void *deprec_widget_get_selected_rule() {
GtkPaned *before_vs_after = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); static GtkBox *rec_XYZ_box()
gtk_paned_set_start_child (before_vs_after, GTK_WIDGET (get_rule_before ())); {
gtk_paned_set_end_child (before_vs_after, GTK_WIDGET (get_rule_after ())); GtkBox *XYZ_labels_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); // spacing = 2
gtk_paned_set_wide_handle (before_vs_after, TRUE); GtkBox *XYZ_scrollbar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_paned_set_shrink_start_child (before_vs_after, TRUE); // GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
gtk_paned_set_shrink_end_child (before_vs_after, TRUE); // (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_paned_set_position (before_vs_after, 730); // WARNING : c'est une position "absolue" gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
// gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL, H_IMAGE_LOCAL); 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")
return GTK_WIDGET (before_vs_after); 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() { 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)); 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 (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 (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 (get_rule_after ()));
// gtk_widget_set_size_request (GTK_WIDGET (before_vs_after), W_IMAGE_LOCAL / 10, H_IMAGE_LOCAL / 10); 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); return GTK_WIDGET (before_vs_after);
} }
@ -155,7 +206,6 @@ void *widget_get_selected_rule() {
gtk_box_append (images_and_texts, GTK_WIDGET (widget_get_selected_rule_images ())); 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 (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (images_and_texts, GTK_WIDGET (get_conditions_actions_names_box ())); gtk_box_append (images_and_texts, GTK_WIDGET (get_conditions_actions_names_box ()));
// gtk_widget_set_size_request (GTK_WIDGET (images_and_texts), W_IMAGE_LOCAL / 10, H_IMAGE_LOCAL / 10);
return GTK_WIDGET (images_and_texts); return GTK_WIDGET (images_and_texts);
} }