summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-03 07:38:57 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-03 07:38:57 -0300
commite1e4430fb706939a2805815ac1bd05cfa79657b5 (patch)
tree0393e736234f8027fd73c87112735e4d8ae25d5f /main.c
parentfe0f661d76a63010c9414530a4d55aff858d819d (diff)
downloadeeshow-e1e4430fb706939a2805815ac1bd05cfa79657b5.tar.gz
eeshow-e1e4430fb706939a2805815ac1bd05cfa79657b5.tar.bz2
eeshow-e1e4430fb706939a2805815ac1bd05cfa79657b5.zip
eeshow/: add rendering on Gtk canvas
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/main.c b/main.c
index af323ba..aaddbdf 100644
--- a/main.c
+++ b/main.c
@@ -17,6 +17,8 @@
#include <unistd.h>
#include <string.h>
+#include <gtk/gtk.h>
+
#include "util.h"
#include "fig.h"
#include "cro.h"
@@ -25,6 +27,7 @@
#include "file.h"
#include "lib.h"
#include "sch.h"
+#include "gui.h"
#include "main.h"
@@ -43,7 +46,7 @@ void usage(const char *name)
{
fprintf(stderr,
"usage: %s [-r] [-v ...] [[rev:]file.lib ...] [rev:]file.sch\n"
-" %*s-- driver_spec\n"
+" %*s[-- driver_spec]\n"
" %s [-v ...] -C [rev:]file\n"
"\n"
" rev git revision\n"
@@ -77,7 +80,7 @@ void usage(const char *name)
}
-int main(int argc, char *const *argv)
+int main(int argc, char **argv)
{
struct lib lib;
struct sch_ctx sch_ctx;
@@ -86,13 +89,18 @@ int main(int argc, char *const *argv)
const char *cat = NULL;
char c;
int arg, dashdash;
+ bool have_dashdash = 0;
int gfx_argc;
char **gfx_argv;
const struct gfx_ops **ops = ops_list;
+ gtk_init(&argc, &argv);
+
for (dashdash = 1; dashdash != argc; dashdash++)
- if (!strcmp(argv[dashdash], "--"))
+ if (!strcmp(argv[dashdash], "--")) {
+ have_dashdash = 1;
break;
+ }
while ((c = getopt(dashdash, argv, "rvC:")) != EOF)
switch (c) {
@@ -158,6 +166,9 @@ found:
sch_parse(&sch_ctx, &sch_file, &lib);
file_close(&sch_file);
+ if (!have_dashdash)
+ return gui(&sch_ctx);
+
gfx_init(*ops, gfx_argc, gfx_argv);
if (recurse) {
const struct sheet *sheet;