WIP: colmatage, encore...

This commit is contained in:
Jean Sirmai 2024-06-06 23:23:25 +02:00
parent 63337bfbf4
commit 52b39570d3
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 27 additions and 1 deletions

View File

@ -130,6 +130,29 @@ void on_glarea_unrealize(GtkWidget *widget)
} }
} }
void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
{
GtkWidget *slider = gtk_widget_get_parent(GTK_WIDGET(data));
GtkWidget *container_widget = gtk_widget_get_parent(GTK_WIDGET(slider));
const gchar *label_text = gtk_label_get_label(GTK_LABEL(data));
// THANKS ASCIIIII/Unicode/Whateverrr !
int axis = label_text[0] - 'X';
g_assert(axis >= 0 && axis < N_AXIS);
/* Update the rotation angle */
ui_update_axis_stack(container_widget,
axis,
gtk_adjustment_get_value(adjustment));
/* Update the contents of the GL drawing area */
}
/******************************************************************************/ /******************************************************************************/
/* B U T T O N S */ /* B U T T O N S */
/******************************************************************************/ /******************************************************************************/

View File

@ -11,6 +11,8 @@ gboolean on_glarea_render(GtkGLArea *area, GdkGLContext *context);
void on_glarea_realize(GtkWidget *widget); void on_glarea_realize(GtkWidget *widget);
void on_glarea_unrealize(GtkWidget *widget); void on_glarea_unrealize(GtkWidget *widget);
void on_axis_value_change(GtkAdjustment *adjustment, gpointer data);
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data); void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data);
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data); void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data);

View File

@ -231,7 +231,7 @@ GtkWidget *create_axis_slider(int axis)
gtk_widget_set_visible (label, TRUE); gtk_widget_set_visible (label, TRUE);
adj = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 12.0, 0.0); adj = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
////////////////////////// g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label); g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label);
slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj); slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append(GTK_BOX(box), slider); gtk_box_append(GTK_BOX(box), slider);
gtk_widget_set_hexpand(slider, TRUE); gtk_widget_set_hexpand(slider, TRUE);

View File

@ -119,6 +119,7 @@ bool graphics_init_shaders(const int stack_id);
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer); bool ui_init_graphic_stack(void *container_widget, GError *error_buffer);
bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer); bool ui_shutdown_graphic_stack(void *container_widget, GError *error_buffer);
bool ui_update_axis_stack(GtkWidget *container_widget, int axis, int value);
/* Initializes the buffer of a gl_area /* Initializes the buffer of a gl_area
* Calls according to the user preferences * Calls according to the user preferences