Compare commits

...

2 Commits

8 changed files with 197 additions and 68 deletions

View File

@ -65,9 +65,8 @@ void on_glarea_realize (GtkWidget *widget);
void on_glarea_unrealize (GtkWidget *widget);
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
void on_OBJECTS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data);
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar);
void on_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data);
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data);
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data);

View File

@ -31,36 +31,39 @@
#pragma once
#include <gtk-4.0/gtk/gtk.h>
#define n_objects 32
#define n_situations 64
/******************************************************************************/
/* W I N D O W S */
/******************************************************************************/
void widget_topbar_fix_MAIN_WINDOW (GtkApplication *app);
void widget_topbar_fix_DIALOG_WINDOW (GtkApplication *app);
void widget_topbar_fix_TEXT_WINDOW (GtkApplication *app);
void widget_topbar_fix_main_window (GtkApplication *app);
void widget_topbar_fix_dialog_window (GtkApplication *app);
void widget_topbar_fix_text_window (GtkApplication *app);
void widget_topbar_MAIN_WINDOW_design (GtkWindow *main_window);
void widget_topbar_DIALOG_WINDOW_design (GtkWindow *main_window,
GtkWindow *dialog_window);
void widget_topbar_TEXT_WINDOW_design (GtkWindow *main_window,
GtkWindow *text_window);
void widget_topbar_design_main_window (GtkWindow *main_window);
void widget_topbar_design_dialog_window (GtkWindow *main_window,
GtkWindow *dialog_window);
void widget_topbar_design_text_window (GtkWindow *main_window,
GtkWindow *text_window);
GtkWindow *widget_topbar_rec_MAIN_WINDOW();
GtkWindow *widget_topbar_rec_DIALOG_WINDOW();
GtkWindow *widget_topbar_rec_TEXT_WINDOW();
void *widget_topbar_rec_main_window();
GtkWindow *widget_topbar_rec_dialog_window();
GtkWindow *widget_topbar_rec_text_window();
/******************************************************************************/
/* W I D G E T S */
/******************************************************************************/
GtkWidget *widget_rec_STATE_page();
GtkWidget *widget_rec_RULES_page();
GtkWidget *widget_rec_STOCK_page();
GtkWidget *widget_rec_state_page();
GtkWidget *widget_rec_rules_page();
GtkWidget *widget_rec_stock_page();
void *reset_all_objects_transparency_to_value (GtkScrollbar *object_bar, int value);
void reset_all_objects_transparencies_to_value (GtkScrollbar *object_bar[], int value);
GtkWidget *widget_rec_STOCK_text (gchar *text_name);
GtkWidget *widget_rec_stock_text (gchar *text_name);
/******************************************************************************/
@ -103,9 +106,9 @@ GtkWidget *widget_rec_image_AMP();
/******************************************************************************/
// texts are in : data / text /
gchar *widget_rec_text_address_THEORY ();
gchar *widget_rec_text_address_ABOUT_COMMANDS ();
gchar *widget_rec_text_address_ANY ();
gchar *widget_rec_text_address_theory ();
gchar *widget_rec_text_address_about_commands ();
gchar *widget_rec_text_address_any ();
/******************************************************************************/

View File

@ -70,7 +70,7 @@ void fsm_set_OBJECTS_box_RESET_VALUE (int value)
if (choice_OBJECTS_box_RESET_VALUE != value) {
debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
choice_OBJECTS_box_RESET_VALUE = value;
reset_all_objects_transparency_to_value (NULL, value);
reset_all_objects_transparencies_to_value (NULL, value);
}
}

View File

@ -64,14 +64,16 @@ static void on_auto_notification (const char *message)
void on_windows_activation (GtkApplication *app,
gpointer no_user_data)
{
widget_topbar_fix_MAIN_WINDOW (app);
widget_topbar_MAIN_WINDOW_design (widget_topbar_rec_MAIN_WINDOW());
widget_topbar_fix_main_window (app);
widget_topbar_design_main_window (GTK_WINDOW (widget_topbar_rec_main_window ()));
widget_topbar_fix_DIALOG_WINDOW (app);
widget_topbar_DIALOG_WINDOW_design (widget_topbar_rec_MAIN_WINDOW(), widget_topbar_rec_DIALOG_WINDOW());
widget_topbar_fix_dialog_window (app);
widget_topbar_design_dialog_window (GTK_WINDOW (widget_topbar_rec_main_window ()),
widget_topbar_rec_dialog_window());
widget_topbar_fix_TEXT_WINDOW (app);
widget_topbar_TEXT_WINDOW_design (widget_topbar_rec_MAIN_WINDOW(), widget_topbar_rec_TEXT_WINDOW());
widget_topbar_fix_text_window (app);
widget_topbar_design_text_window (GTK_WINDOW (widget_topbar_rec_main_window ()),
widget_topbar_rec_text_window());
}
@ -251,18 +253,18 @@ static void switch_STATE_RULES_DATA()
switch (fsm_get_STATE_RULES_DATA()) {
case (STATE) :
gtk_window_set_child (widget_topbar_rec_MAIN_WINDOW(),
GTK_WIDGET (widget_rec_STATE_page()));
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
GTK_WIDGET (widget_rec_state_page()));
break;
case (RULES) :
gtk_window_set_child (widget_topbar_rec_MAIN_WINDOW(),
GTK_WIDGET (widget_rec_RULES_page()));
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
GTK_WIDGET (widget_rec_rules_page()));
break;
case (DATA) :
gtk_window_set_child (widget_topbar_rec_MAIN_WINDOW(),
GTK_WIDGET (widget_rec_STOCK_page()));
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
GTK_WIDGET (widget_rec_stock_page()));
break;
default :
@ -284,7 +286,7 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
"text-editor-symbolic");
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
// gtk_window_present (GTK_WINDOW (widget_topbar_rec_DIALOG_WINDOW())); // works once only !
// gtk_window_present (GTK_WINDOW (widget_topbar_rec_dialog_window())); // works once only !
fsm_set_EXEC_EDIT (EDIT);
}
@ -316,13 +318,23 @@ void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data)
}
void on_OBJECTS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data)
{
printf ("callback.on_OBJECTS_box_DO_RESET() %f\n",\
gtk_adjustment_get_value (adjustment));
}
void on_SITUATIONS_box_RESET_VALUE (GtkAdjustment *adjustment, gpointer data) {}
void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
@ -333,6 +345,45 @@ void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, GtkScrollbar *reset_scrollba
fsm_set_OBJECTS_box_RESET_VALUE (db);
}
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
{
puts("on_SITUATIONS_box_DO_RESET");
@ -347,14 +398,14 @@ void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_topbar_rec_TEXT_WINDOW()));
gtk_window_present (GTK_WINDOW (widget_topbar_rec_text_window()));
}
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
{
printf ("callback.on_clicked_HOME() button presents the dialog_window\
( :- ) but it works only once.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_topbar_rec_DIALOG_WINDOW()));
gtk_window_present (GTK_WINDOW (widget_topbar_rec_dialog_window()));
}

View File

@ -91,7 +91,7 @@ static GtkWidget *rec_rules_tree_hpaned_new(){
return GTK_WIDGET (H_tree_vs_comparison);
}
GtkWidget *widget_rec_RULES_page() {
GtkWidget *widget_rec_rules_page() {
GtkPaned *H_tree_vs_selected = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre des règles");
// GtkWidget *édition_de_la_règle_sélectionnée_n_1 = gtk_frame_new ("Inspection");

View File

@ -83,16 +83,56 @@ static GtkBox *rec_ZOOM_box()
return ZOOM_box;
}
#define n_objects 32
static GtkScrollbar *object_bar [n_objects];
static GtkAdjustment *adjust_bar [n_objects];
void *reset_all_objects_transparency_to_value (GtkScrollbar *object_bar, int value)
void reset_all_objects_transparencies_to_value (GtkScrollbar *object_bar[],
int value)
{
for (int i = 0; i < n_objects; i++) {
adjust_bar [i] = gtk_adjustment_new (value, 0, 127, 1, 0, 0);
// gtk_scrollbar_set_adjustment (object_bar [i], adjust_bar [i]);
}
for (int i = 0; i < n_objects; i++)
gtk_adjustment_set_value (adjust_bar [i], value);
}
static GtkBox *rec_OBJECTS_box()
@ -106,7 +146,7 @@ static GtkBox *rec_OBJECTS_box()
g_signal_connect (btt_reset, "toggled", G_CALLBACK (on_OBJECTS_box_DO_RESET), reset_scrollbar);
gtk_box_append (objects_box, btt_reset);
// GtkAdjustment *adjust_bar [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size)
// GtkAdjustment *adjust_bar [n_objects]; // (value, lower, upper, step_increment, page_increment, page_size)
for (int i = 0; i < n_objects; i++)
{
adjust_bar [i] = gtk_adjustment_new (rand() % 127, 0, 127, 1, 0, 0);
@ -117,6 +157,42 @@ static GtkBox *rec_OBJECTS_box()
return objects_box;
}
static GtkBox *rec_SITUATIONS_box()
{
GtkBox *situations_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
@ -248,7 +324,7 @@ static GtkWidget *rec_SEQUENCE_CONTROL_box()
* - CONTRAST en haut permet de modifier un à un les contrastes des objets et des situations
* afin de mieux mettre en évidence l'objet ou le phénomène d'intérêt */
GtkWidget *widget_rec_STATE_page()
GtkWidget *widget_rec_state_page()
{
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (page_box, GTK_WIDGET (rec_OBJECTS_and_SITUATIONS()));

View File

@ -31,7 +31,7 @@
#include "../../include/signal.h"
#include "../../include/widget.h"
GtkWidget *widget_rec_STOCK_page () {
GtkWidget *widget_rec_stock_page () {
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
@ -64,7 +64,7 @@ GtkWidget *widget_rec_STOCK_page () {
return GTK_WIDGET (data_box);
}
GtkWidget *widget_rec_STOCK_text (gchar *text_address) {
GtkWidget *widget_rec_stock_text (gchar *text_address) {
GtkWidget *view = gtk_text_view_new ();
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
@ -85,15 +85,15 @@ GtkWidget *widget_rec_STOCK_text (gchar *text_address) {
/* T E X T S */
/******************************************************************************/
gchar *widget_rec_text_address_THEORY () {
gchar *widget_rec_text_address_theory () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/théorie.txt";
}
gchar *widget_rec_text_address_ABOUT_COMMANDS () {
gchar *widget_rec_text_address_about_commands () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/about_commands.txt";
}
gchar *widget_rec_text_address_ANY () {
gchar *widget_rec_text_address_any () {
return "/home/jean/Gem-Graph/gem-graph-client/data/text/any.txt";
}

View File

@ -43,17 +43,17 @@
static GtkWindow *main_window, *dialog_window, *text_window;
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
GtkWindow *widget_topbar_rec_MAIN_WINDOW() { return main_window; }
GtkWindow *widget_topbar_rec_DIALOG_WINDOW() { return dialog_window; }
GtkWindow *widget_topbar_rec_TEXT_WINDOW() { return text_window; }
void *widget_topbar_rec_main_window() { return main_window; }
GtkWindow *widget_topbar_rec_dialog_window() { return dialog_window; }
GtkWindow *widget_topbar_rec_text_window() { return text_window; }
void widget_topbar_fix_MAIN_WINDOW (GtkApplication *app)
void widget_topbar_fix_main_window (GtkApplication *app)
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_topbar_fix_DIALOG_WINDOW (GtkApplication *app)
void widget_topbar_fix_dialog_window (GtkApplication *app)
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_topbar_fix_TEXT_WINDOW (GtkApplication *app)
void widget_topbar_fix_text_window (GtkApplication *app)
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }
@ -62,15 +62,15 @@ void widget_topbar_fix_TEXT_WINDOW (GtkApplication *app)
/* T E X T W I N D O W */
/******************************************************************************/
void widget_topbar_TEXT_WINDOW_design (GtkWindow *main_window, GtkWindow *text_window)
void widget_topbar_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
{
char *title = " Learn more about Gem Graph. ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
gtk_window_set_titlebar (text_window, header_bar);
GtkWidget *child = widget_rec_STOCK_text (widget_rec_text_address_THEORY());
child = widget_rec_STOCK_text (widget_rec_text_address_ABOUT_COMMANDS());
GtkWidget *child = widget_rec_stock_text (widget_rec_text_address_theory());
child = widget_rec_stock_text (widget_rec_text_address_about_commands());
gtk_window_set_child (GTK_WINDOW (text_window), GTK_WIDGET (child));
gtk_widget_set_size_request (GTK_WIDGET (child), W_TEXT_WINDOW, H_TEXT_WINDOW);
@ -85,7 +85,7 @@ void widget_topbar_TEXT_WINDOW_design (GtkWindow *main_window, GtkWindow *text_w
/* D I A L O G W I N D O W */
/******************************************************************************/
void widget_topbar_DIALOG_WINDOW_design (GtkWindow *main_window, GtkWindow *dialog_window)
void widget_topbar_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window)
{
char *title = " Save the current model before modifying it? ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
@ -129,7 +129,7 @@ static GtkWidget *window_header_bar (GtkWindow *window);
static void window_header_bar_left (GtkWidget *header_bar);
static void window_header_bar_right (GtkWidget *header_bar);
void widget_topbar_MAIN_WINDOW_design (GtkWindow *main_window)
void widget_topbar_design_main_window (GtkWindow *main_window)
{
GtkWidget *header_bar = window_header_bar (main_window);
window_header_bar_left (header_bar);