1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-07-03 01:15:29 +03:00

eeshow/gui/: sel_split to select 2nd version; sel_only doesn't set old_hist

This commit is contained in:
Werner Almesberger 2016-08-19 17:58:03 -03:00
parent c612cd331b
commit 1805118940
3 changed files with 41 additions and 21 deletions

View File

@ -72,6 +72,7 @@ struct gui_ctx {
bool showing_history; bool showing_history;
enum selecting { enum selecting {
sel_only, /* select the only revision we show */ sel_only, /* select the only revision we show */
sel_split, /* select revision to compare with */
sel_new, /* select the new revision */ sel_new, /* select the new revision */
sel_old, /* select the old revision */ sel_old, /* select the old revision */
} selecting; } selecting;

View File

@ -49,6 +49,7 @@ static void set_history_style(struct gui_hist *h, bool current)
switch (ctx->selecting) { switch (ctx->selecting) {
case sel_only: case sel_only:
case sel_split:
style.frame = COLOR(FRAME_SEL_ONLY); style.frame = COLOR(FRAME_SEL_ONLY);
break; break;
case sel_old: case sel_old:
@ -120,6 +121,9 @@ static void click_history(void *user)
switch (ctx->selecting) { switch (ctx->selecting) {
case sel_only: case sel_only:
ctx->new_hist = h;
break;
case sel_split:
ctx->old_hist = ctx->new_hist; ctx->old_hist = ctx->new_hist;
ctx->new_hist = h; ctx->new_hist = h;
break; break;
@ -135,19 +139,21 @@ static void click_history(void *user)
ctx->diff_mode = diff_delta; ctx->diff_mode = diff_delta;
if (ctx->new_hist->age > ctx->old_hist->age) { if (ctx->old_hist) {
swap(ctx->new_hist, ctx->old_hist); if (ctx->new_hist->age > ctx->old_hist->age) {
if (ctx->selecting == sel_old) { swap(ctx->new_hist, ctx->old_hist);
go_to_sheet(ctx, sheet); if (ctx->selecting == sel_old) {
go_to_sheet(ctx, sheet);
} else {
go_to_sheet(ctx, old_sheet);
render_delta(ctx);
}
} else { } else {
go_to_sheet(ctx, old_sheet); if (ctx->selecting != sel_old)
render_delta(ctx); go_to_sheet(ctx, sheet);
else
render_delta(ctx);
} }
} else {
if (ctx->selecting != sel_old)
go_to_sheet(ctx, sheet);
else
render_delta(ctx);
} }
if (ctx->old_hist == ctx->new_hist) if (ctx->old_hist == ctx->new_hist)

View File

@ -173,8 +173,11 @@ static void show_diff_cb(void *user)
{ {
struct gui_ctx *ctx = user; struct gui_ctx *ctx = user;
set_diff_mode(ctx, if (ctx->old_hist)
ctx->diff_mode == diff_delta ? diff_new : diff_delta); set_diff_mode(ctx,
ctx->diff_mode == diff_delta ? diff_new : diff_delta);
else
show_history(ctx, sel_split);
} }
@ -184,11 +187,25 @@ static void toggle_old_new(struct gui_ctx *ctx)
} }
static void add_delta(struct gui_ctx *ctx)
{
struct overlay *over;
struct overlay_style style;
over = overlay_add(&ctx->hist_overlays, &ctx->aois,
NULL, show_diff_cb, ctx);
style = overlay_style_default;
if (ctx->old_hist && ctx->diff_mode == diff_delta)
style.frame = RGBA(0, 0, 0, 1);
overlay_style(over, &style);
overlay_text(over, "Δ");
}
static void revision_overlays_diff(struct gui_ctx *ctx) static void revision_overlays_diff(struct gui_ctx *ctx)
{ {
struct gui_hist *new = ctx->new_hist; struct gui_hist *new = ctx->new_hist;
struct gui_hist *old = ctx->old_hist; struct gui_hist *old = ctx->old_hist;
struct overlay *over;
struct overlay_style style; struct overlay_style style;
new->over = overlay_add(&ctx->hist_overlays, &ctx->aois, new->over = overlay_add(&ctx->hist_overlays, &ctx->aois,
@ -199,13 +216,7 @@ static void revision_overlays_diff(struct gui_ctx *ctx)
overlay_style(new->over, &style); overlay_style(new->over, &style);
show_history_details(new, 0); show_history_details(new, 0);
over = overlay_add(&ctx->hist_overlays, &ctx->aois, add_delta(ctx);
NULL, show_diff_cb, ctx);
style = overlay_style_default;
if (ctx->diff_mode == diff_delta)
style.frame = RGBA(0, 0, 0, 1);
overlay_style(over, &style);
overlay_text(over, "Δ");
old->over = overlay_add(&ctx->hist_overlays, &ctx->aois, old->over = overlay_add(&ctx->hist_overlays, &ctx->aois,
show_history_details, show_history_cb, old); show_history_details, show_history_cb, old);
@ -229,6 +240,8 @@ void do_revision_overlays(struct gui_ctx *ctx)
ctx->new_hist); ctx->new_hist);
overlay_style(ctx->new_hist->over, &overlay_style_default); overlay_style(ctx->new_hist->over, &overlay_style_default);
show_history_details(ctx->new_hist, 0); show_history_details(ctx->new_hist, 0);
add_delta(ctx);
} }
} }