Cleanup & refactor
This commit is contained in:
parent
8aae05fefc
commit
ef901d4a48
|
@ -30,6 +30,8 @@
|
|||
|
||||
extern float rotation_angles[N_AXIS];
|
||||
|
||||
extern GtkWidget *gl_area;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GEM_GRAPH_CLIENT_TYPE_WINDOW (gem_graph_client_window_get_type())
|
||||
|
@ -156,8 +158,8 @@ void on_close_window(GtkWidget *widget);
|
|||
|
||||
void ui_set_stack(const char *mode);
|
||||
|
||||
void ui_send_notification(const char *message);
|
||||
void ui_setup_glarea(GtkGLArea *target, GtkBox *target_controls);
|
||||
void ui_send_internal_notification(const char *message);
|
||||
void ui_close_internal_notification(void);
|
||||
void ui_toggle_sidebar();
|
||||
void ui_setup_glarea();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "../../include/base.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/ui.h"
|
||||
|
||||
void on_about_action(GSimpleAction *action,
|
||||
|
|
|
@ -137,10 +137,16 @@
|
|||
<object class="GtkStackPage">
|
||||
<property name="name">presentation</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes"><b>Main zone: presentation mode</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGlArea" id="presentation_glarea">
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="presentation_controls">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
@ -149,10 +155,16 @@
|
|||
<object class="GtkStackPage">
|
||||
<property name="name">edition</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes"><b>Main zone: edition mode</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGlArea" id="edition_glarea">
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="edition_controls">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
|
|
@ -27,14 +27,13 @@
|
|||
#include <glib-2.0/glib.h>
|
||||
|
||||
#include "../../include/base.h"
|
||||
#include "../../include/graphics.h"
|
||||
#include "../../include/ui.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
float rotation_angles[N_AXIS] = { 0.0 }; // Rotation angles on each axis
|
||||
|
||||
static GtkWidget *gl_area = NULL;
|
||||
GtkWidget *gl_area = NULL;
|
||||
|
||||
static GemGraphClientWindow *window;
|
||||
|
||||
|
@ -122,7 +121,7 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
|
|||
ui_toggle_sidebar();
|
||||
|
||||
// Setup GLArea
|
||||
ui_setup_glarea();
|
||||
ui_setup_glarea(window->run_glarea, window->run_controls);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -242,13 +241,13 @@ static inline GtkWidget *create_axis_slider(int axis)
|
|||
return box;
|
||||
}
|
||||
|
||||
void ui_setup_glarea()
|
||||
void ui_setup_glarea(GtkGLArea *target, GtkBox *target_controls)
|
||||
{
|
||||
int i, minor=4, major=0;
|
||||
GtkWidget * controls;
|
||||
GtkWidget *controls;
|
||||
|
||||
gl_area = GTK_WIDGET(window->run_glarea);
|
||||
controls = GTK_WIDGET(window->run_controls);
|
||||
gl_area = GTK_WIDGET(target);
|
||||
controls = GTK_WIDGET(target_controls);
|
||||
gtk_widget_set_hexpand(gl_area, TRUE);
|
||||
gtk_widget_set_vexpand(gl_area, TRUE);
|
||||
gtk_widget_set_halign(gl_area, GTK_ALIGN_CENTER);
|
||||
|
@ -270,7 +269,7 @@ void ui_setup_glarea()
|
|||
for(i = 0; i < N_AXIS; i++)
|
||||
gtk_box_append(GTK_BOX(controls), create_axis_slider(i));
|
||||
|
||||
gtk_gl_area_set_auto_render(window->run_glarea, true);
|
||||
gtk_gl_area_set_auto_render(target, true);
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(gl_area));
|
||||
gtk_gl_area_set_required_version( GTK_GL_AREA(gl_area), minor, major);
|
||||
|
|
Loading…
Reference in New Issue