From 2515c3b96487d95f25c3fbb57b2917009f44d439 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 22 Aug 2016 04:01:19 -0300 Subject: [PATCH] eeshow/kicad/sch.h, sch-parse.c: also retrieve sheet width and height --- eeshow/kicad/sch-parse.c | 5 +++++ eeshow/kicad/sch.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/eeshow/kicad/sch-parse.c b/eeshow/kicad/sch-parse.c index 3cdebb4..4d60da5 100644 --- a/eeshow/kicad/sch-parse.c +++ b/eeshow/kicad/sch-parse.c @@ -310,6 +310,8 @@ static struct sheet *new_sheet(struct sch_ctx *ctx) sheet->next_obj = &sheet->objs; sheet->next = NULL; + sheet->w = sheet->h = 0; + sheet->has_children = 0; sheet->oid = NULL; @@ -490,6 +492,9 @@ static bool parse_line(const struct file *file, void *user, const char *line) } break; case sch_descr: + if (sscanf(line, "$Descr %*s %d %d", + &ctx->curr_sheet->w, &ctx->curr_sheet->h) == 2) + return 1; if (sscanf(line, "Title \"%m[^\"]\"", &s) == 1) { ctx->curr_sheet->title = s; return 1; diff --git a/eeshow/kicad/sch.h b/eeshow/kicad/sch.h index 29ecc83..117ce16 100644 --- a/eeshow/kicad/sch.h +++ b/eeshow/kicad/sch.h @@ -103,6 +103,8 @@ struct sheet { struct sch_obj **next_obj; struct sheet *next; + int w, h; + bool has_children; /* aka sub-sheets */ /* caching */