summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-29 15:58:30 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-29 15:58:30 (GMT)
commitd6abf64c0aab528f732e99e266db2e645cfdde8e (patch)
treed98bd8fd8023a2435bd0102df3d6c791de955904 /kicad
parent766c52e7a582996fba1a89b4c15f6d74a1974c05 (diff)
downloadeeshow-d6abf64c0aab528f732e99e266db2e645cfdde8e.zip
eeshow-d6abf64c0aab528f732e99e266db2e645cfdde8e.tar.gz
eeshow-d6abf64c0aab528f732e99e266db2e645cfdde8e.tar.bz2
kicad/: don't discard invisible fields, just mark them; also record field number
Diffstat (limited to 'kicad')
-rw-r--r--kicad/sch-parse.c19
-rw-r--r--kicad/sch-render.c4
-rw-r--r--kicad/sch.h2
3 files changed, 10 insertions, 15 deletions
diff --git a/kicad/sch-parse.c b/kicad/sch-parse.c
index f1c42fc..e2de34f 100644
--- a/kicad/sch-parse.c
+++ b/kicad/sch-parse.c
@@ -135,7 +135,6 @@ void decode_alignment(struct text *txt, char hor, char vert)
static bool parse_field(struct sch_ctx *ctx, const char *line)
{
struct sch_comp *comp = &ctx->obj.u.comp;
- int n;
unsigned flags;
char hv, hor, vert, italic = 'N', bold = 'N';
struct comp_field *field;
@@ -149,14 +148,14 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
txt->s = NULL;
/* ignore fields with empty string as content */
- if (sscanf(line, "F %d \"\" %c %d %d %u %u %c %c%c%c",
- &n, &hv, &txt->x, &txt->y, &txt->size, &flags, &hor, &vert,
+ if (sscanf(line, "F %u \"\" %c %d %d %u %u %c %c%c%c",
+ &field->n, &hv, &txt->x, &txt->y, &txt->size, &flags, &hor, &vert,
&italic, &bold) >= 8) {
free(field);
return 1;
}
- if (sscanf(line, "F %d \"%n", &n, &pos) != 1 || !pos) {
+ if (sscanf(line, "F %u \"%n", &field->n, &pos) != 1 || !pos) {
free(field);
return 0;
}
@@ -182,17 +181,9 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
}
txt->s = s;
- if (flags) {
-/*
- * @@@ visibility settings in component only seem to be used only as default
- * for sheet and are ignored thereafter.
- */
- free((char *) txt->s);
- free(field);
- return 1;
- }
+ field->visible = !flags;
- if (n == 0 && comp->comp && comp->comp->units > 1) {
+ if (field->n == 0 && comp->comp && comp->comp->units > 1) {
len = strlen(txt->s);
s = realloc_size((void *) txt->s, len + 3);
if (comp->unit <= 26)
diff --git a/kicad/sch-render.c b/kicad/sch-render.c
index 2a4a9a0..81a97e4 100644
--- a/kicad/sch-render.c
+++ b/kicad/sch-render.c
@@ -11,6 +11,7 @@
*/
+#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
@@ -122,7 +123,8 @@ static void render_comp(const struct sch_comp *comp, struct gfx *gfx)
lib_render(comp->comp, gfx, comp->unit, comp->convert, comp->m);
for (field = comp->fields; field; field = field->next)
- dump_field(field, gfx, comp->m);
+ if (field->visible)
+ dump_field(field, gfx, comp->m);
}
diff --git a/kicad/sch.h b/kicad/sch.h
index 9bf7ffd..4dde552 100644
--- a/kicad/sch.h
+++ b/kicad/sch.h
@@ -72,6 +72,8 @@ struct sch_obj {
unsigned convert;/* "De Morgan" selection */
struct comp_field {
struct text txt;
+ unsigned n; /* field number */
+ bool visible;
struct comp_field *next;
} *fields;
int m[6];