Start implementing the GUI for the 3D-LED-Cube

This commit is contained in:
Aaron Mueller 2011-11-08 22:32:09 +01:00
parent 36e9290611
commit c10808004c
3 changed files with 142 additions and 0 deletions

View file

@ -2,6 +2,7 @@ CC=gcc
CFLAGS=-Wall
INCLUDES=-I/usr/include/GL
LIBS=-lglut -lGLU -lGL -lm
GTKLIBS=`pkg-config --cflags --libs gtk+-2.0` -export-dynamic
SRCDIR=src
@ -14,7 +15,11 @@ all:
chmod +x ledcube-edit
strip ledcube-edit
gui:
$(CC) $(CFLAGS) $(GTKLIBS) -o gui $(SRCDIR)/main_gui.c
clean:
rm -f *.o
rm -f gui
#rm -f ledcube-edit

26
editor/src/main_gui.c Normal file
View file

@ -0,0 +1,26 @@
#include <gtk/gtk.h>
void on_window_destroy(GtkObject *object, gpointer userData) {
gtk_main_quit();
}
int main (int argc, char *argv[]) {
GtkBuilder *builder;
GtkWidget *window;
gtk_set_locale();
gtk_init(&argc, &argv);
builder = gtk_builder_new();
gtk_builder_add_from_file(builder, "src/main_gui.ui", NULL);
gtk_builder_connect_signals(builder, NULL);
window = GTK_WIDGET(gtk_builder_get_object(builder, "main_window"));
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(window);
gtk_main();
return 0;
}

111
editor/src/main_gui.ui Normal file
View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="main_window">
<property name="visible">True</property>
<property name="resizable">False</property>
<property name="window_position">center-always</property>
<signal name="destroy" handler="on_window_destroy"/>
<child>
<object class="GtkVBox" id="outher_frame">
<property name="visible">True</property>
<child>
<object class="GtkHandleBox" id="handle">
<property name="visible">True</property>
<child>
<object class="GtkToolbar" id="toolbar">
<property name="visible">True</property>
<property name="toolbar_style">both-horiz</property>
<child>
<object class="GtkToolItem" id="combobox_frame">
<property name="visible">True</property>
<property name="border_width">7</property>
<child>
<object class="GtkComboBoxEntry" id="combobox_port">
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="button_connect">
<property name="visible">True</property>
<property name="label" translatable="yes">Connect to cube</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-connect</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkSeparatorToolItem" id="saparator">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="button_add">
<property name="visible">True</property>
<property name="label" translatable="yes">toolbutton3</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-add</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="button_remove">
<property name="visible">True</property>
<property name="label" translatable="yes">toolbutton3</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-delete</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHScale" id="frame_control">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="drawing_area">
<property name="width_request">500</property>
<property name="height_request">500</property>
<property name="visible">True</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>