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

eeshow/gui.c (go_to_sheet): don't "render" (record) sheets before shown

This commit is contained in:
Werner Almesberger 2016-08-06 10:19:16 -03:00
parent acbce9a214
commit 3b5daecbd6

View File

@ -46,6 +46,8 @@ struct gui_sheet {
int w, h; int w, h;
int xmin, ymin; int xmin, ymin;
bool rendered; /* 0 if still have to render it */
struct aoi *aois; /* areas of interest; in schematics coord */ struct aoi *aois; /* areas of interest; in schematics coord */
struct gui_sheet *next; struct gui_sheet *next;
@ -128,7 +130,7 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
} }
static void render(struct gui_ctx *ctx, struct gui_sheet *sheet) static void render_sheet(struct gui_sheet *sheet)
{ {
char *argv[] = { "gui", NULL }; char *argv[] = { "gui", NULL };
@ -137,9 +139,7 @@ static void render(struct gui_ctx *ctx, struct gui_sheet *sheet)
cro_canvas_end(gfx_ctx, cro_canvas_end(gfx_ctx,
&sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin); &sheet->w, &sheet->h, &sheet->xmin, &sheet->ymin);
sheet->gfx_ctx = gfx_ctx; sheet->gfx_ctx = gfx_ctx;
sheet->rendered = 1;
ctx->x = sheet->w >> 1;
ctx->y = sheet->h >> 1;
// gfx_end(); // gfx_end();
} }
@ -327,6 +327,10 @@ static void show_history_cb(void *user)
/* ----- Navigate sheets --------------------------------------------------- */ /* ----- Navigate sheets --------------------------------------------------- */
/* @@@ find a better place for this forward declaration */
static void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet);
static void close_subsheet(void *user) static void close_subsheet(void *user)
{ {
struct gui_ctx *ctx = user; struct gui_ctx *ctx = user;
@ -337,6 +341,10 @@ static void close_subsheet(void *user)
static void go_to_sheet(struct gui_ctx *ctx, struct gui_sheet *sheet) static void go_to_sheet(struct gui_ctx *ctx, struct gui_sheet *sheet)
{ {
if (!sheet->rendered) {
render_sheet(sheet);
mark_aois(ctx, sheet);
}
ctx->curr_sheet = sheet; ctx->curr_sheet = sheet;
overlay_remove_all(&ctx->sheet_overlays); overlay_remove_all(&ctx->sheet_overlays);
if (ctx->hist) { if (ctx->hist) {
@ -616,9 +624,7 @@ static struct gui_sheet *get_sheets(struct gui_ctx *ctx,
for (sheet = sheets; sheet; sheet = sheet->next) { for (sheet = sheets; sheet; sheet = sheet->next) {
new = alloc_type(struct gui_sheet); new = alloc_type(struct gui_sheet);
new->sch = sheet; new->sch = sheet;
new->rendered = 0;
render(ctx, new);
mark_aois(ctx, new);
*next = new; *next = new;
next = &new->next; next = &new->next;