summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-22 04:05:41 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-22 04:06:59 -0300
commit1776e011bad42b24905d5515f975bbd78641bff2 (patch)
tree57a9cd487d14d7cd2ac181d9c5b62ccdce966ab9 /main.c
parentaa7e2782b14e596e6ccb373e55bdd18eff3cf4c4 (diff)
downloadeeshow-1776e011bad42b24905d5515f975bbd78641bff2.tar.gz
eeshow-1776e011bad42b24905d5515f975bbd78641bff2.tar.bz2
eeshow-1776e011bad42b24905d5515f975bbd78641bff2.zip
eeshow/gui/: experimental support for page layout; option -P pl-file.kicad_wks
Unlike libraries and schematics, page layouts are not (yet) tracked through revision history.
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/main.c b/main.c
index 7823aae..61807ff 100644
--- a/main.c
+++ b/main.c
@@ -27,6 +27,7 @@
#include "gfx/gfx.h"
#include "file/file.h"
#include "kicad/sexpr.h"
+#include "kicad/pl.h"
#include "kicad/lib.h"
#include "kicad/sch.h"
#include "gui/fmt-pango.h"
@@ -120,6 +121,8 @@ int main(int argc, char **argv)
const char *cat = NULL;
const char *history = NULL;
const char *fmt = NULL;
+ const char *page_layout = NULL;
+ struct pl_ctx *pl = NULL;
int limit = 0;
char c;
int arg, dashdash;
@@ -150,7 +153,7 @@ int main(int argc, char **argv)
if (!have_dashdash)
gtk_init(&argc, &argv);
- while ((c = getopt(dashdash, argv, "rvC:F:H:N:SV")) != EOF)
+ while ((c = getopt(dashdash, argv, "P:rvC:F:H:N:SV")) != EOF)
switch (c) {
case 'r':
recurse = 1;
@@ -170,6 +173,9 @@ int main(int argc, char **argv)
case 'N':
limit = atoi(optarg);
break;
+ case 'P':
+ page_layout = optarg;
+ break;
case 'S':
sexpr();
return 0;
@@ -209,6 +215,17 @@ int main(int argc, char **argv)
return 0;
}
+ if (page_layout) {
+ struct file file;
+
+ if (!file_open(&file, page_layout, NULL))
+ return 1;
+ pl = pl_parse(&file);
+ file_close(&file);
+ if (!pl)
+ return 1;
+ }
+
if (dashdash - optind < 1)
usage(*argv);
@@ -220,7 +237,7 @@ int main(int argc, char **argv)
memcpy(args, argv + optind, sizeof(const char *) * n);
optind = 0; /* reset getopt */
- return gui(n, args, recurse, limit);
+ return gui(n, args, recurse, limit, pl);
}
sch_init(&sch_ctx, recurse);