Compare commits
No commits in common. "355a6d4969f09052b3f0153a7a89ee3478531f82" and "97bc0ef4b6a8526b5201dc306d44cef45c4e4f83" have entirely different histories.
355a6d4969
...
97bc0ef4b6
|
@ -0,0 +1,143 @@
|
|||
static GLuint *buffer_lines_origin = NULL;
|
||||
---
|
||||
long get_buffer_lines_size() {return buffer_lines_size / 2;}
|
||||
void inc_buffer_lines_size(long inc) {buffer_lines_size += inc * 2;}
|
||||
void dec_buffer_lines_size(long dec) {buffer_lines_size -= dec * 2;}
|
||||
|
||||
void xxx_draw_line (GLuint *lines_origin, int a, int b, long lines_index)
|
||||
{
|
||||
// https://docs.gtk.org/glib/func.realloc.html
|
||||
printf("xxx_draw_line %ld\n", lines_index);
|
||||
buffer_lines_origin = g_realloc(lines_origin, sizeof(GLuint) * 2);
|
||||
*(lines_origin + lines_index + 0) = a; // lines_index ++;
|
||||
*(lines_origin + lines_index + 1) = b; // lines_index ++;
|
||||
}
|
||||
|
||||
/* (gdb) help
|
||||
List of classes of commands:
|
||||
|
||||
aliases -- User-defined aliases of other commands.
|
||||
breakpoints -- Making program stop at certain points.
|
||||
data -- Examining data.
|
||||
files -- Specifying and examining files.
|
||||
internals -- Maintenance commands.
|
||||
obscure -- Obscure features.
|
||||
running -- Running the program.
|
||||
stack -- Examining the stack.
|
||||
status -- Status inquiries.
|
||||
support -- Support facilities.
|
||||
text-user-interface -- TUI is the GDB text based interface.
|
||||
tracepoints -- Tracing of program execution without stopping the program.
|
||||
user-defined -- User-defined commands.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------
|
||||
GLuint arrows[] = {
|
||||
1, 0, 0, 0, 0,
|
||||
/* 1, 1, 1, 0, 0, */
|
||||
/* 1, 2, 2, 1, 1, */
|
||||
/* 1, 3, 2, 2, 1, */
|
||||
/* 1, 4, 3, 0, 1, */
|
||||
/* 1, 5, 3, 0, 2, */
|
||||
/* 1, 1, 3, 0, 2, */
|
||||
/* 1, 0, 2, 0, 2, */
|
||||
/* 1, 5, 2, 1, 1, */
|
||||
// load, site, x, y, z
|
||||
};
|
||||
|
||||
static void get_model_data_and_user_preferences(){
|
||||
|
||||
|
||||
model_space_size_x = 1; // 0 < model_space_size_x
|
||||
model_space_size_y = 1; // 0 < model_space_size_y
|
||||
model_space_size_z = 1; // 0 < model_space_size_z
|
||||
|
||||
// XXX ONLY space drawed, no arrows yet
|
||||
|
||||
model_arrows_nb = sizeof(arrows); // assert : l'emplacement des flèches est contraint
|
||||
// par model_space_size_x, y, z et le nombre de sites
|
||||
|
||||
central_stars_nb = 0; // à calculer TODO
|
||||
// ! WARNING ! Pour l'instant égal au nombre de flèches ! (central stars réécrites)
|
||||
central_stars_nb = model_arrows_nb;
|
||||
|
||||
// pref_mark_unit_space = 0; // 0 = no marks, 1 = 1st, 2 = last, 3 = both
|
||||
// pref_style_lines_planes = 0; // 0 = arrows as lines, 1 = as planes, 2 = mix
|
||||
// pref_style_mix_colors = 0; // TODO
|
||||
pref_show_grid = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
||||
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
||||
pref_test_diagonal = 1;
|
||||
}
|
||||
-------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
in buffers.c (line 283)
|
||||
|
||||
static void draw_line (GLuint *lines_origin, int a, int b)
|
||||
{
|
||||
xxx_draw_line (lines_origin, a, b, lines_index);
|
||||
lines_index += 2;
|
||||
// *(lines_origin + lines_index) = a; lines_index ++;
|
||||
// *(lines_origin + lines_index) = b; lines_index ++;
|
||||
}
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
[ n] load site x y z ---- < arrows array > ------------------------------------------------------------
|
||||
[ 0] = 1, 0, 0, 0, 0
|
||||
[ 1] = 0, 0, 0, 217808480, 32708
|
||||
[ 2] = 217809344, 32708, 217807968, 32708, 217810080
|
||||
[ 3] = 32708, -69297984, 32707, 229965808, 32708
|
||||
[ 4] = 229944176, 32708, 217808608, 32708, 229970384
|
||||
[ 5] = 32708, 217808576, 32708, 217809024, 32708
|
||||
[ 6] = 217808992, 32708, -69297888, 32707, 229954976
|
||||
[ 7] = 32708, 217808512, 32708, 229949456, 32708
|
||||
[ 8] = 229942736, 32708, 0, 0, 0
|
||||
[ 9] = 0, 0, 0, 226977440, 32708
|
||||
[10] = 217810048, 32708, 217808352, 32708, 217808704
|
||||
[11] = 32708, -69297600, 32707, 217808448, 32708
|
||||
[12] = 217807808, 32708, 217808896, 32708, 217809312
|
||||
[13] = 32708, 217807872, 32708, 225561296, 32708
|
||||
[14] = 217814880, 32708, 217814944, 32708, 217807776
|
||||
[15] = 32708, 229974752, 32708, 217811040, 32708
|
||||
[16] = 229947200, 32708, 0, 0, 33506144
|
||||
[17] = 0, 0, 0, 0, 0
|
||||
[18] = 33204048, 0, 0, 0, 33587952
|
||||
[19] = 0, 30217696, 0, 30245088, 0
|
||||
|
||||
[ n] load site x y z ---- < arrows array > ------------------------------------------------------------
|
||||
[ 0] = 1, 0, 0, 0, 0
|
||||
[ 1] = 0, 0, 0, 2105314912, 32683
|
||||
[ 2] = 2105315776, 32683, 2105314400, 32683, 2105316512
|
||||
[ 3] = 32683, 2019551424, 32683, 2117545968, 32683
|
||||
[ 4] = 2117524336, 32683, 2105315040, 32683, 2117550544
|
||||
[ 5] = 32683, 2105315008, 32683, 2105315456, 32683
|
||||
[ 6] = 2105315424, 32683, 2019551520, 32683, 2117535136
|
||||
[ 7] = 32683, 2105314944, 32683, 2117529616, 32683
|
||||
[ 8] = 2117522896, 32683, 0, 0, 0
|
||||
[ 9] = 0, 0, 0, 2114557600, 32683
|
||||
[10] = 2105316480, 32683, 2105314784, 32683, 2105315136
|
||||
[11] = 32683, 2019551808, 32683, 2105314880, 32683
|
||||
[12] = 2105314240, 32683, 2105315328, 32683, 2105315744
|
||||
[13] = 32683, 2105314304, 32683, 2113141456, 32683
|
||||
[14] = 2105321312, 32683, 2105321376, 32683, 2105314208
|
||||
[15] = 32683, 2117554912, 32683, 2105317472, 32683
|
||||
[16] = 2117527360, 32683, 0, 0, 16032608
|
||||
[17] = 0, 0, 0, 0, 0
|
||||
[18] = 15766240, 0, 0, 0, 15950576
|
||||
[19] = 0, 12654048, 0, 12681440, 0
|
||||
|
113
include/ui.h
113
include/ui.h
|
@ -56,42 +56,79 @@ G_DECLARE_FINAL_TYPE (GemGraphClientApplication,
|
|||
|
||||
GemGraphClientApplication *gem_graph_client_application_new(const char *application_id,
|
||||
GApplicationFlags flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
void ui_enable_action (const char *name);
|
||||
void ui_disable_action (const char *name);
|
||||
void ui_enable_action(const char *name);
|
||||
|
||||
void ui_disable_action(const char *name);
|
||||
|
||||
//
|
||||
// Actions
|
||||
//
|
||||
void on_about_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_quit_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_preferences_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_togglesidebar_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_editmode_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_runmode_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_presentmode_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_openfile_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_closefile_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_savefile_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_toast_close_action(GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data);
|
||||
|
||||
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_preferences_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_togglesidebar_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_editmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_runmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_presentmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_openfile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_closefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_savefile_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_toast_close_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
|
||||
static const GActionEntry app_actions[] = {
|
||||
{ "quit", on_quit_action, NULL, NULL, NULL },
|
||||
{ "about", on_about_action, NULL, NULL, NULL },
|
||||
{ "preferences", on_preferences_action, NULL, NULL, NULL },
|
||||
{ "quit", on_quit_action, NULL, NULL, NULL },
|
||||
{ "about", on_about_action, NULL, NULL, NULL },
|
||||
{ "preferences", on_preferences_action, NULL, NULL, NULL },
|
||||
{ "togglesidebar", on_togglesidebar_action, NULL, NULL, NULL },
|
||||
{ "editmode", on_editmode_action, NULL, NULL, NULL },
|
||||
{ "runmode", on_runmode_action, NULL, NULL, NULL },
|
||||
{ "presentmode", on_presentmode_action, NULL, NULL, NULL },
|
||||
{ "openfile", on_openfile_action, NULL, NULL, NULL },
|
||||
{ "closefile", on_closefile_action, NULL, NULL, NULL },
|
||||
{ "savefile", on_savefile_action, NULL, NULL, NULL },
|
||||
{ "toastclose", on_toast_close_action, NULL, NULL, NULL },
|
||||
{ "editmode", on_editmode_action, NULL, NULL, NULL },
|
||||
{ "runmode", on_runmode_action, NULL, NULL, NULL },
|
||||
{ "presentmode", on_presentmode_action, NULL, NULL, NULL },
|
||||
{ "openfile", on_openfile_action, NULL, NULL, NULL },
|
||||
{ "closefile", on_closefile_action, NULL, NULL, NULL },
|
||||
{ "savefile", on_savefile_action, NULL, NULL, NULL },
|
||||
{ "toastclose", on_toast_close_action, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
//
|
||||
// Actions responses
|
||||
|
||||
//
|
||||
void on_openfile_response(GtkNativeDialog *native,
|
||||
int response,
|
||||
GemGraphClientWindow *self);
|
||||
|
@ -100,21 +137,29 @@ void on_openfile_response_complete(GObject *source_object,
|
|||
GAsyncResult *result,
|
||||
GemGraphClientWindow *self);
|
||||
|
||||
//
|
||||
// General events
|
||||
//
|
||||
void on_axis_value_change(GtkAdjustment *adjustment, gpointer data);
|
||||
|
||||
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data);
|
||||
gboolean on_render (GtkGLArea * area, GdkGLContext * context);
|
||||
void on_realize (GtkWidget *widget);
|
||||
void on_unrealize (GtkWidget *widget);
|
||||
void on_close_window (GtkWidget *widget);
|
||||
gboolean on_render(GtkGLArea * area, GdkGLContext * context);
|
||||
|
||||
void on_realize(GtkWidget *widget);
|
||||
|
||||
void on_unrealize(GtkWidget *widget);
|
||||
|
||||
void on_close_window(GtkWidget *widget);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
//
|
||||
// Window primitives
|
||||
//
|
||||
|
||||
void ui_set_stack (const char *mode);
|
||||
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_set_stack(const char *mode);
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ int main(int argc, char **argv)
|
|||
|
||||
app = gem_graph_client_application_new("org.alec.gemgraph",
|
||||
G_APPLICATION_DEFAULT_FLAGS);
|
||||
Hello();
|
||||
|
||||
res = g_application_run(G_APPLICATION(app), argc, argv);
|
||||
return res;
|
||||
|
|
|
@ -96,11 +96,21 @@ static void gem_graph_client_application_init(GemGraphClientApplication *self)
|
|||
self);
|
||||
|
||||
// Setup shortcuts
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.quit", (const char *[]) { "<primary>q", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.editmode", (const char *[]) { "<primary>e", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.runmode", (const char *[]) { "<primary>r", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.presentmode",(const char *[]) { "<primary>p", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self), "app.savefile", (const char *[]) { "<primary>s", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self),
|
||||
"app.quit",
|
||||
(const char *[]) { "<primary>q", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self),
|
||||
"app.editmode",
|
||||
(const char *[]) { "<primary>e", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self),
|
||||
"app.runmode",
|
||||
(const char *[]) { "<primary>r", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self),
|
||||
"app.presentmode",
|
||||
(const char *[]) { "<primary>p", NULL });
|
||||
gtk_application_set_accels_for_action(GTK_APPLICATION(self),
|
||||
"app.savefile",
|
||||
(const char *[]) { "<primary>s", NULL });
|
||||
|
||||
application = self;
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<!-- interface-name gem-graph.ui -->
|
||||
<requires lib="gtk" version="4.6"/>
|
||||
<template class="GemGraphClientWindow" parent="GtkApplicationWindow">
|
||||
<property name="default-height">700</property>
|
||||
<property name="default-width">440</property>
|
||||
<property name="default-height">900</property>
|
||||
<property name="default-width">1400</property>
|
||||
<property name="icon-name">application-x-executable</property>
|
||||
<property name="title">GemGraph 0.1.0</property>
|
||||
<style>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<object class="GtkOverlay" id="toast_overlay">
|
||||
<child>
|
||||
<object class="GtkPaned" id="main_paned">
|
||||
<property name="position">440</property>
|
||||
<property name="position">400</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="side_stack">
|
||||
<child>
|
||||
|
@ -52,14 +52,11 @@
|
|||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="run_controls">
|
||||
<property name="margin-top">0</property>
|
||||
<property name="margin-bottom">0</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-top">50</property>
|
||||
<property name="margin-bottom">50</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="run_play_control">
|
||||
<property name="margin-top">0</property>
|
||||
<property name="margin-bottom">0</property>
|
||||
<!--property name="label" translatable="yes">Hello !</property-->
|
||||
<property name="icon-name"></property>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -73,22 +70,6 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="runlib_stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">runlib_conditions_and_rules</property>
|
||||
<property name="title" translatable="yes">Rules</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label_runlib_conditions_and_rules">
|
||||
<property name="justify">center</property>
|
||||
<property name="label" translatable="yes"><b>runlib_conditions_and_rules</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="margin-top">50</property>
|
||||
<property name="margin-bottom">50</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">runlib_objects</property>
|
||||
|
@ -110,10 +91,26 @@
|
|||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">runlib_conditions_and_rules</property>
|
||||
<property name="title" translatable="yes">Rules & Conds</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label_runlib_conditions_and_rules">
|
||||
<property name="justify">center</property>
|
||||
<property name="label" translatable="yes"><b>runlib_conditions_and_rules</b></property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="margin-top">50</property>
|
||||
<property name="margin-bottom">50</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">runlib_states</property>
|
||||
<property name="title" translatable="yes">States</property>
|
||||
<property name="title" translatable="yes">Savedstates</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label_runlib_states">
|
||||
|
@ -349,4 +346,3 @@
|
|||
</section>
|
||||
</menu>
|
||||
</interface>
|
||||
|
||||
|
|
|
@ -29,51 +29,3 @@
|
|||
#include "../../include/ui.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COL_NAME = 0,
|
||||
COL_AGE,
|
||||
NUM_COLS
|
||||
} ;
|
||||
|
||||
static GtkTreeModel *
|
||||
create_and_fill_model (void)
|
||||
{
|
||||
GtkListStore *store = gtk_list_store_new (NUM_COLS,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/* Append a row and fill in some data */
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COL_NAME, "Heinz El-Mann",
|
||||
COL_AGE, 51,
|
||||
-1);
|
||||
|
||||
/* append another row and fill in some data */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COL_NAME, "Jane Doe",
|
||||
COL_AGE, 23,
|
||||
-1);
|
||||
|
||||
/* ... and a third row */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COL_NAME, "Joe Bungop",
|
||||
COL_AGE, 91,
|
||||
-1);
|
||||
|
||||
return GTK_TREE_MODEL (store);
|
||||
}
|
||||
|
||||
void Hello(void)
|
||||
{
|
||||
GtkWidget *view; // = gtk_tree_view_new ();
|
||||
printf("Hello, from src/ui/tree.c ! -------------------------\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
147
src/ui/window.c
147
src/ui/window.c
|
@ -80,19 +80,45 @@ static void gem_graph_client_window_class_init(GemGraphClientWindowClass *klass)
|
|||
bytes = g_bytes_new_take(contents, len);
|
||||
gtk_widget_class_set_template(GTK_WIDGET_CLASS(klass), bytes);
|
||||
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_titlebar);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, side_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_paned);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_button_mode);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_button_sidebar);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, toast_revealer);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, toast_close_button);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, toast_text);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, run_glarea);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, run_controls);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, runlib_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, runlib_objects);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
main_titlebar);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
main_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
side_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
main_paned);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
main_button_mode);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
main_button_sidebar);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
toast_revealer);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
toast_close_button);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
toast_text);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
run_glarea);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
run_controls);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
runlib_stack);
|
||||
gtk_widget_class_bind_template_child(widget_class,
|
||||
GemGraphClientWindow,
|
||||
runlib_objects);
|
||||
}
|
||||
|
||||
static void gem_graph_client_window_init(GemGraphClientWindow *self)
|
||||
|
@ -112,26 +138,56 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
|
|||
void ui_set_stack(const char *mode)
|
||||
{
|
||||
|
||||
if (window->main_stack == NULL) { g_printerr("Can't find self->main_stack !\n"); return;}
|
||||
if (window->side_stack == NULL) { g_printerr("Can't find self->side_stack !\n"); return;}
|
||||
gtk_stack_set_visible_child_full(window->main_stack, mode, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
gtk_stack_set_visible_child_full(window->side_stack, mode, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
if (window->main_stack == NULL) {
|
||||
g_printerr("Can't find self->main_stack !\n");
|
||||
return;
|
||||
}
|
||||
if (window->side_stack == NULL) {
|
||||
g_printerr("Can't find self->side_stack !\n");
|
||||
return;
|
||||
}
|
||||
gtk_stack_set_visible_child_full(window->main_stack,
|
||||
mode,
|
||||
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
gtk_stack_set_visible_child_full(window->side_stack,
|
||||
mode,
|
||||
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
|
||||
|
||||
// Switch on the first letter of the mode, because switch is soooo simple :)
|
||||
switch(mode[0]) {
|
||||
case 'e': gtk_menu_button_set_icon_name(window->main_button_mode, "document-edit-symbolic"); break;
|
||||
case 'r': gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic"); break;
|
||||
case 'p': gtk_menu_button_set_icon_name(window->main_button_mode, "x-office-presentation-symbolic");break;
|
||||
case 'h': gtk_paned_set_position(window->main_paned, 0);
|
||||
gtk_menu_button_set_icon_name(window->main_button_mode, "user-home-symbolic"); break;
|
||||
default: break;
|
||||
case 'e':
|
||||
gtk_menu_button_set_icon_name(window->main_button_mode,
|
||||
"document-edit-symbolic");
|
||||
break;
|
||||
case 'r':
|
||||
gtk_menu_button_set_icon_name(window->main_button_mode,
|
||||
"system-run-symbolic");
|
||||
break;
|
||||
case 'p':
|
||||
gtk_menu_button_set_icon_name(window->main_button_mode,
|
||||
"x-office-presentation-symbolic");
|
||||
break;
|
||||
case 'h':
|
||||
gtk_paned_set_position(window->main_paned, 0);
|
||||
gtk_menu_button_set_icon_name(window->main_button_mode,
|
||||
"user-home-symbolic");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ui_send_internal_notification(const char *message)
|
||||
{
|
||||
if (window->toast_revealer == NULL) {g_printerr("Can't find self->toast_overlay !\n"); return;}
|
||||
if (window->toast_text == NULL) {g_printerr("Can't find self->toast_overlay !\n"); return;}
|
||||
if (window->toast_revealer == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->toast_text == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_label_set_label(window->toast_text, message);
|
||||
gtk_revealer_set_reveal_child(window->toast_revealer, true);
|
||||
|
@ -139,8 +195,15 @@ void ui_send_internal_notification(const char *message)
|
|||
|
||||
void ui_close_internal_notification(void)
|
||||
{
|
||||
if (window->toast_revealer == NULL) {g_printerr("Can't find self->toast_overlay !\n"); return;}
|
||||
if (window->toast_text == NULL) {g_printerr("Can't find self->toast_overlay !\n"); return;}
|
||||
if (window->toast_revealer == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->toast_text == NULL) {
|
||||
g_printerr("Can't find self->toast_overlay !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_revealer_set_reveal_child(window->toast_revealer, false);
|
||||
}
|
||||
|
@ -154,10 +217,20 @@ static inline GtkWidget *create_axis_slider(int axis)
|
|||
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
switch (axis) {
|
||||
case X_AXIS: text = "X"; break;
|
||||
case Y_AXIS: text = "Y"; break;
|
||||
case Z_AXIS: text = "Z"; break;
|
||||
default: g_assert_not_reached();
|
||||
case X_AXIS:
|
||||
text = "X";
|
||||
break;
|
||||
|
||||
case Y_AXIS:
|
||||
text = "Y";
|
||||
break;
|
||||
|
||||
case Z_AXIS:
|
||||
text = "Z";
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
label = gtk_label_new(text);
|
||||
|
@ -165,8 +238,9 @@ static inline GtkWidget *create_axis_slider(int axis)
|
|||
gtk_widget_show(label);
|
||||
|
||||
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),
|
||||
GINT_TO_POINTER(axis));
|
||||
g_signal_connect(adj, "value-changed",
|
||||
G_CALLBACK(on_axis_value_change),
|
||||
GINT_TO_POINTER(axis));
|
||||
slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj);
|
||||
gtk_box_append(GTK_BOX(box), slider);
|
||||
gtk_widget_set_hexpand(slider, TRUE);
|
||||
|
@ -216,7 +290,10 @@ void ui_toggle_sidebar(void)
|
|||
{
|
||||
int position = gtk_paned_get_position(window->main_paned);
|
||||
|
||||
if (position != 0) gtk_paned_set_position(window->main_paned, 0);
|
||||
else gtk_paned_set_position(window->main_paned, 400);
|
||||
if (position != 0) {
|
||||
gtk_paned_set_position(window->main_paned, 0);
|
||||
} else {
|
||||
gtk_paned_set_position(window->main_paned, 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<child>
|
||||
<object class="GtkBox" id="run_controls">
|
||||
<property name="margin-top">50</property>
|
||||
<property name="margin-bottom">50</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="run_play_control">
|
||||
<property name="icon-name"></property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue