From 3e320b56d273bd591dc67f09adaf5cb83b27302a Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 26 Apr 2023 18:50:39 +0200 Subject: [PATCH] fix wrong pdfmarks in hierarchical pdf export, after changes to handle generated sch/sym --- src/actions.c | 2 +- src/psprint.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/actions.c b/src/actions.c index 7dc69e76..c045b270 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1211,8 +1211,8 @@ const char *get_sym_name(int inst, int ext) { const char *sym, *sch; + /* instance based symbol selection */ sch = get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 0); - if(!sch[0]) sch = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "schematic", 0); if(xctx->tok_size) { /* token exists */ if(ext) sym = get_cell_w_ext(add_ext(rel_sym_path(sch), ".sym"), 0); else sym = skip_dir(add_ext(rel_sym_path(sch), ".sym")); diff --git a/src/psprint.c b/src/psprint.c index d85ef41c..1607a761 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -795,7 +795,9 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, /* pdfmarks, only if doing hierarchy print and if symbol has a subcircuit */ if(what != 7) { + char fname[PATH_MAX]; if(!strcmp(get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "type", 0), "subcircuit")) { + get_sch_from_sym(fname, xctx->inst[n].ptr+ xctx->sym, n); fprintf(fd, "[ " "/Rect [ %g %g %g %g ] " @@ -804,7 +806,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, "/Subtype /Link " "/ANN pdfmark\n", x1, y1, x2, y2, - sanitize(get_sym_name(n, 0))); + sanitize(get_cell_w_ext(fname, 0))); } } }