1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 15:32:47 +02:00

eeshow/gui/: difference display can now be switched with New/Old/Diff

Still need a GUI way to do the same.
This commit is contained in:
Werner Almesberger 2016-08-19 07:05:50 -03:00
parent 6ff7d63312
commit 006d83057b
6 changed files with 38 additions and 6 deletions

View File

@ -174,4 +174,7 @@ Delete or Backspace go to the next higher sheet in hierarchy
PgUp go to the previous sheet in sequence
PgDn go to the next sheet in sequence
Up or Down invoke the revision history (WIP)
D when comparing revisions, show difference (default)
N show newer sheet
O show older sheet
Q quit the viewer

View File

@ -94,8 +94,14 @@ struct gui_ctx {
struct gui_sheet *curr_sheet;
/* current sheet, always on new_hist */
enum {
diff_new, /* show only new sheet */
diff_old, /* show only old sheet */
diff_delta, /* show delta */
} diff_mode;
struct gui_hist *new_hist;
struct gui_hist *old_hist; /* NULL if not comparing */
struct gui_hist *old_hist; /* NULL if not comparing */
int hist_y_offset; /* history list y offset */

View File

@ -378,6 +378,7 @@ int gui(unsigned n_args, char **args, bool recurse, int limit)
.pop_origin = NULL,
.glabel = NULL,
.aois = NULL,
.diff_mode = diff_delta,
.old_hist = NULL,
.hist_y_offset = 0,
.hist_size = 0,

View File

@ -130,6 +130,8 @@ static void click_history(void *user)
abort();
}
ctx->diff_mode = diff_delta;
if (ctx->new_hist->age > ctx->old_hist->age) {
swap(ctx->new_hist, ctx->old_hist);
if (ctx->selecting == sel_old)

View File

@ -72,15 +72,15 @@ static inline int cy(int y, int yo, float scale)
}
static void highlight_glabel(const struct gui_ctx *ctx, cairo_t *cr,
int x, int y, float f)
static void highlight_glabel(const struct gui_ctx *ctx,
const struct gui_sheet *sheet, cairo_t *cr, int x, int y, float f)
{
const struct sch_obj *obj;
if (!ctx->glabel)
return;
for (obj = ctx->curr_sheet->sch->objs; obj; obj = obj->next) {
for (obj = sheet->sch->objs; obj; obj = obj->next) {
const struct dwg_bbox *bbox = &obj->u.text.bbox;
if (obj->type != sch_obj_glabel)
@ -127,8 +127,13 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
y = -(sheet->ymin + ctx->y) * f + alloc.height / 2;
cro_canvas_prepare(cr);
if (!ctx->old_hist) {
highlight_glabel(ctx, cr, x, y, f);
if (!ctx->old_hist || ctx->diff_mode == diff_new) {
highlight_glabel(ctx, sheet, cr, x, y, f);
cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f);
} else if (ctx->diff_mode == diff_old) {
sheet = find_corresponding_sheet(ctx->old_hist->sheets,
ctx->new_hist->sheets, ctx->curr_sheet);
highlight_glabel(ctx, sheet, cr, x, y, f);
cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f);
} else {
#if 0

View File

@ -414,6 +414,7 @@ static void sheet_key(void *user, int x, int y, int keyval)
case '*':
zoom_to_extents(ctx);
break;
case GDK_KEY_Home:
if (sheet != ctx->new_hist->sheets)
go_to_sheet(ctx, ctx->new_hist->sheets);
@ -438,6 +439,20 @@ static void sheet_key(void *user, int x, int y, int keyval)
case GDK_KEY_KP_Down:
show_history(ctx, sel_old);
break;
case GDK_KEY_n:
ctx->diff_mode = diff_new;
redraw(ctx);
break;
case GDK_KEY_o:
ctx->diff_mode = diff_old;
redraw(ctx);
break;
case GDK_KEY_d:
ctx->diff_mode = diff_delta;
redraw(ctx);
break;
case GDK_KEY_q:
gtk_main_quit();
}