summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-05-25 12:36:26 +0200
committerThomas White <taw@physics.org>2019-05-25 12:36:26 +0200
commitf8a9c7b6c9a9ea05c157baac95765df1c3977af0 (patch)
tree291b92e5dae176fa659414c97fb27694d2c73835
parent9d4d46b2c8264de1eb33ad96a2acb1e52020ae22 (diff)
Empty window and initial data structures
-rw-r--r--src/nanolight.c36
-rw-r--r--src/nanolight.h70
2 files changed, 95 insertions, 11 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index c9f60d3..94ae685 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -32,13 +32,6 @@
#include <libintl.h>
#define _(x) gettext(x)
-static void quit_sig(GSimpleAction *action, GVariant *parameter, gpointer vp)
-{
- GApplication *app = vp;
- g_application_quit(app);
-}
-
-
static void show_help(const char *s)
{
printf(_("Syntax: %s [options]\n\n"), s);
@@ -47,17 +40,27 @@ static void show_help(const char *s)
}
+static gboolean draw_sig(GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+ cairo_set_source_rgb(cr, 0.0, 0.0, 0.2);
+ cairo_paint(cr);
+ return FALSE;
+}
+
+
int main(int argc, char *argv[])
{
int c;
+ GtkWidget *mainwindow;
+ GtkWidget *da;
+
+ gtk_init(&argc, &argv);
- /* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
{0, 0, NULL, 0}
};
- /* Short options */
while ((c = getopt_long(argc, argv, "h", longopts, NULL)) != -1) {
switch (c)
@@ -79,8 +82,19 @@ int main(int argc, char *argv[])
g_type_init();
#endif
- bindtextdomain("colloquium", LOCALEDIR);
- textdomain("colloquium");
+ bindtextdomain("nanolight", LOCALEDIR);
+ textdomain("nanolight");
+
+ mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_fullscreen(GTK_WINDOW(mainwindow));
+ g_signal_connect_swapped(G_OBJECT(mainwindow), "destroy", gtk_main_quit, NULL);
+
+ da = gtk_drawing_area_new();
+ gtk_container_add(GTK_CONTAINER(mainwindow), GTK_WIDGET(da));
+ g_signal_connect(G_OBJECT(da), "draw", G_CALLBACK(draw_sig), NULL);
+
+ gtk_widget_show_all(mainwindow);
+ gtk_main();
return 0;
}
diff --git a/src/nanolight.h b/src/nanolight.h
new file mode 100644
index 0000000..4ab4d5a
--- /dev/null
+++ b/src/nanolight.h
@@ -0,0 +1,70 @@
+/*
+ * nanolight.h
+ *
+ * Copyright © 2019 Thomas White <taw@bitwiz.me.uk>
+ *
+ * This file is part of NanoLight.
+ *
+ * NanoLight is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NANOLIGHT_H
+#define NANOLIGHT_H
+
+/* Attribute flags */
+#define ATTR_NONE (0)
+#define ATTR_16BIT (1)
+
+enum attr_class
+{
+ ATT_INTENSITY,
+ ATT_PAN,
+ ATT_TILT
+};
+
+
+struct attribute
+{
+ char *name;
+ enum attr_class cls;
+ int props;
+ int n_addrs;
+ int *addrs;
+};
+
+
+struct fixture_class
+{
+ char *name;
+ int n_attrs;
+ struct attribute *attrs;
+};
+
+
+struct fixture
+{
+ char *label;
+ struct fixture_class *cls;
+};
+
+
+struct nanolight
+{
+ int n_fixtures;
+ struct fixture *fixtures;
+};
+
+
+#endif /* NANOLIGHT_H */