summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-08 03:52:30 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-08 03:55:21 (GMT)
commit9b22ef7b4c58d36ae0ea01847323a691d7a7e192 (patch)
tree5d116fdb70ed3580a87f84f096cfd05347c24e0f /kicad
parent57a490584151ecf75ce1273ffd6e9413e3b85835 (diff)
downloadeeshow-9b22ef7b4c58d36ae0ea01847323a691d7a7e192.zip
eeshow-9b22ef7b4c58d36ae0ea01847323a691d7a7e192.tar.gz
eeshow-9b22ef7b4c58d36ae0ea01847323a691d7a7e192.tar.bz2
kicad/: support page layout options page1only and notonpage1
Diffstat (limited to 'kicad')
-rw-r--r--kicad/pl-common.h7
-rw-r--r--kicad/pl-parse.c23
-rw-r--r--kicad/pl-render.c4
3 files changed, 33 insertions, 1 deletions
diff --git a/kicad/pl-common.h b/kicad/pl-common.h
index 1c454d6..44aa5e0 100644
--- a/kicad/pl-common.h
+++ b/kicad/pl-common.h
@@ -23,6 +23,12 @@ enum font_flag {
font_italic = 1 << 1,
};
+enum page_constraint {
+ pc_none,
+ pc_only_one,
+ pc_except_one,
+};
+
struct pl_obj {
enum pl_obj_type {
@@ -31,6 +37,7 @@ struct pl_obj {
pl_obj_text,
} type;
+ enum page_constraint pc;
const char *s; /* tbtext */
int repeat; /* line, rect, tbtext */
float x, y; /* line, rect, tbtext */
diff --git a/kicad/pl-parse.c b/kicad/pl-parse.c
index 7863466..b9eab73 100644
--- a/kicad/pl-parse.c
+++ b/kicad/pl-parse.c
@@ -264,6 +264,25 @@ static bool process_justify(struct pl_obj *obj, const struct expr *e)
}
+static bool process_option(struct pl_obj *obj, const struct expr *e)
+{
+ for (; e; e = e->next) {
+ if (e->e) {
+ warning("option: ignoring list");
+ continue;
+ }
+
+ if (!strcmp(e->s, "page1only"))
+ obj->pc = pc_only_one;
+ else if (!strcmp(e->s, "notonpage1"))
+ obj->pc = pc_except_one;
+ else
+ warning("option: ignoring \"%s\"", e->s);
+ }
+ return 1;
+}
+
+
static bool process_obj(struct pl_ctx *pl, const struct expr *e,
enum pl_obj_type type)
{
@@ -273,6 +292,7 @@ static bool process_obj(struct pl_ctx *pl, const struct expr *e,
obj = alloc_type(struct pl_obj);
obj->type = type;
+ obj->pc = pc_none;
obj->s = NULL;
obj->repeat = 1;
obj->x = obj->y = obj->ex = obj->ey = 0;
@@ -338,6 +358,9 @@ static bool process_obj(struct pl_ctx *pl, const struct expr *e,
} else if (!strcmp(s, "rotate")) {
if (!get_float(next, &obj->rotate))
return 0;
+ } else if (!strcmp(s, "option")) {
+ if (!process_option(obj, next))
+ return 0;
} else
warning("pl_obj: ignoring \"%s\"", s);
}
diff --git a/kicad/pl-render.c b/kicad/pl-render.c
index 8f4b940..592ced4 100644
--- a/kicad/pl-render.c
+++ b/kicad/pl-render.c
@@ -251,5 +251,7 @@ void pl_render(struct pl_ctx *pl, struct gfx *gfx, const struct sheet *sheets,
return;
for (obj = pl->objs; obj; obj = obj->next)
for (i = 0; i != obj->repeat; i++)
- render_obj(pl, obj, gfx, i, sheets, sheet);
+ if (obj->pc == pc_none ||
+ (obj->pc == pc_only_one) == (sheets == sheet))
+ render_obj(pl, obj, gfx, i, sheets, sheet);
}