From 7652f3a88f50d3780fafe7ca3e890e14ac6c84d7 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 21 Aug 2016 11:32:13 -0300 Subject: [PATCH] eeshow/gfx/gfx.c (gfx_sheet_name): pass sheet name (title) to driver --- eeshow/gfx/gfx.c | 7 +++++++ eeshow/gfx/gfx.h | 2 ++ eeshow/main.c | 1 + 3 files changed, 10 insertions(+) diff --git a/eeshow/gfx/gfx.c b/eeshow/gfx/gfx.c index a0ac9bd..6236888 100644 --- a/eeshow/gfx/gfx.c +++ b/eeshow/gfx/gfx.c @@ -101,6 +101,13 @@ void gfx_init(const struct gfx_ops *ops, int argc, char *const *argv) } +void gfx_sheet_name(const char *name) +{ + if (gfx_ops->sheet_name) + gfx_ops->sheet_name(gfx_ctx, name); +} + + void gfx_new_sheet(void) { if (gfx_ops->new_sheet) diff --git a/eeshow/gfx/gfx.h b/eeshow/gfx/gfx.h index 327a963..bdd5225 100644 --- a/eeshow/gfx/gfx.h +++ b/eeshow/gfx/gfx.h @@ -38,6 +38,7 @@ struct gfx_ops { int points, const int x[points], const int y[points]); unsigned (*text_width)(void *ctx, const char *s, unsigned size); void *(*init)(int argc, char *const *argv); + void (*sheet_name)(void *ctx, const char *name); void (*new_sheet)(void *ctx); void (*end)(void *ctx); }; @@ -65,6 +66,7 @@ unsigned gfx_text_width(const char *s, unsigned size); /* inititalization and termination */ void gfx_init(const struct gfx_ops *ops, int argc, char *const *argv); +void gfx_sheet_name(const char *name); void gfx_new_sheet(void); bool gfx_multi_sheet(void); void gfx_end(void); diff --git a/eeshow/main.c b/eeshow/main.c index 7f2256e..a178a57 100644 --- a/eeshow/main.c +++ b/eeshow/main.c @@ -243,6 +243,7 @@ found: if (!gfx_multi_sheet()) fatal("graphics backend only supports single sheet\n"); for (sheet = sch_ctx.sheets; sheet; sheet = sheet->next) { + gfx_sheet_name(sheet->title); sch_render(sheet); if (sheet->next) gfx_new_sheet();