1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 08:15:31 +02:00

eeshow/gui/sheet.c (revision_overlays_diff): support selection of diff mode

This commit is contained in:
Werner Almesberger 2016-08-19 07:24:25 -03:00
parent 4f9a9f1d0d
commit c012addf4a

View File

@ -145,22 +145,48 @@ static void show_history_cb(void *user)
struct gui_ctx *ctx = h->ctx;
enum selecting sel = sel_only;
if (ctx->old_hist)
if (ctx->old_hist) {
if (h == ctx->new_hist && ctx->diff_mode != diff_new) {
ctx->diff_mode = diff_new;
redraw(ctx);
return;
}
if (h == ctx->old_hist && ctx->diff_mode != diff_old) {
ctx->diff_mode = diff_old;
redraw(ctx);
return;
}
sel = h == ctx->new_hist ? sel_new : sel_old;
}
show_history(ctx, sel);
}
static void show_diff_cb(void *user)
{
struct gui_ctx *ctx = user;
ctx->diff_mode = diff_delta;
redraw(ctx);
}
static void revision_overlays_diff(struct gui_ctx *ctx)
{
struct gui_hist *new = ctx->new_hist;
struct gui_hist *old = ctx->old_hist;
struct overlay *over;
new->over = overlay_add(&ctx->hist_overlays, &ctx->aois,
show_history_details, show_history_cb, new);
overlay_style(new->over, &overlay_style_diff_new);
show_history_details(new, 0);
over = overlay_add(&ctx->hist_overlays, &ctx->aois,
NULL, show_diff_cb, ctx);
overlay_style(over, &overlay_style_default);
overlay_text(over, "Δ");
old->over = overlay_add(&ctx->hist_overlays, &ctx->aois,
show_history_details, show_history_cb, old);
overlay_style(old->over, &overlay_style_diff_old);