From 2b0640f15d628202b9c7c778069d361ab54e0a82 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 19 Aug 2016 12:24:05 -0300 Subject: [PATCH] eeshow/gui/: in diff_old, use sheet from old_hist for AoIs --- eeshow/gui/gui.c | 23 ++++++++++++++++++----- eeshow/gui/sheet.c | 8 ++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/eeshow/gui/gui.c b/eeshow/gui/gui.c index 49d2016..3a66c9a 100644 --- a/eeshow/gui/gui.c +++ b/eeshow/gui/gui.c @@ -85,12 +85,25 @@ static void select_subsheet(void *user) if (!obj->u.sheet.sheet) return; - for (sheet = ctx->new_hist->sheets; sheet; sheet = sheet->next) - if (sheet->sch == obj->u.sheet.sheet) { - go_to_sheet(ctx, sheet); - return; - } + + if (!ctx->old_hist || ctx->diff_mode != diff_old) { + for (sheet = ctx->new_hist->sheets; sheet; sheet = sheet->next) + if (sheet->sch == obj->u.sheet.sheet) { + go_to_sheet(ctx, sheet); + return; + } + abort(); + } + + for (sheet = ctx->old_hist->sheets; sheet; sheet = sheet->next) + if (sheet->sch == obj->u.sheet.sheet) + goto found; abort(); + +found: + sheet = find_corresponding_sheet(ctx->new_hist->sheets, + ctx->old_hist->sheets, sheet); + go_to_sheet(ctx, sheet); } diff --git a/eeshow/gui/sheet.c b/eeshow/gui/sheet.c index 5385850..9736bf4 100644 --- a/eeshow/gui/sheet.c +++ b/eeshow/gui/sheet.c @@ -367,6 +367,10 @@ static bool sheet_click(void *user, int x, int y) canvas_coord(ctx, x, y, &ex, &ey); + if (ctx->old_hist && ctx->diff_mode == diff_old) + curr_sheet = find_corresponding_sheet(ctx->old_hist->sheets, + ctx->new_hist->sheets, ctx->curr_sheet); + if (aoi_click(ctx->aois, x, y)) return 1; if (aoi_click(curr_sheet->aois, @@ -388,6 +392,10 @@ static bool sheet_hover_update(void *user, int x, int y) canvas_coord(ctx, x, y, &ex, &ey); + if (ctx->old_hist && ctx->diff_mode == diff_old) + curr_sheet = find_corresponding_sheet(ctx->old_hist->sheets, + ctx->new_hist->sheets, ctx->curr_sheet); + if (aoi_hover(ctx->aois, x, y)) return 1; return aoi_hover(curr_sheet->aois,