1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 02:05:00 +02:00

eeshow/: retrieve title from *.sch; prefer over subsheet name when displaying

This commit is contained in:
Werner Almesberger 2016-08-04 08:42:36 -03:00
parent 1057f2640b
commit 258876ef2c
3 changed files with 11 additions and 1 deletions

View File

@ -389,9 +389,13 @@ static void select_subsheet(void *user)
for (sheet = ctx->sheets; sheet; sheet = sheet->next) for (sheet = ctx->sheets; sheet; sheet = sheet->next)
if (sheet->sch == obj->u.sheet.sheet) { if (sheet->sch == obj->u.sheet.sheet) {
const char *name;
sheet->prev = ctx->curr_sheet; sheet->prev = ctx->curr_sheet;
set_sheet(ctx, sheet); set_sheet(ctx, sheet);
overlay_add(&ctx->overlays, obj->u.sheet.name, name = sheet->sch->title ? sheet->sch->title :
obj->u.sheet.name;
overlay_add(&ctx->overlays, name,
&ctx->aois, NULL, close_subsheet, ctx); &ctx->aois, NULL, close_subsheet, ctx);
return; return;
} }

View File

@ -283,6 +283,7 @@ static struct sheet *new_sheet(struct sch_ctx *ctx)
struct sheet *sheet; struct sheet *sheet;
sheet = alloc_type(struct sheet); sheet = alloc_type(struct sheet);
sheet->title = NULL;
sheet->objs = NULL; sheet->objs = NULL;
sheet->next_obj = &sheet->objs; sheet->next_obj = &sheet->objs;
sheet->next = NULL; sheet->next = NULL;
@ -441,6 +442,10 @@ static bool parse_line(const struct file *file, void *user, const char *line)
return 0; return 0;
break; break;
case sch_descr: case sch_descr:
if (sscanf(line, "Title \"%m[^\"]\"", &s) == 1) {
ctx->curr_sheet->title = s;
return 1;
}
if (sscanf(line, "$EndDescr%n", &n) || !n) if (sscanf(line, "$EndDescr%n", &n) || !n)
return 1; return 1;
ctx->state = sch_basic; ctx->state = sch_basic;

View File

@ -91,6 +91,7 @@ struct sch_obj {
}; };
struct sheet { struct sheet {
const char *title;
struct sch_obj *objs; struct sch_obj *objs;
struct sch_obj **next_obj; struct sch_obj **next_obj;
struct sheet *parent; struct sheet *parent;