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

eeshow/gui/render.c: resurrect delta mode (A toggles between delta and diff)

This commit is contained in:
Werner Almesberger 2016-08-20 09:01:59 -03:00
parent b5d2b05757
commit 23a2340ca8
3 changed files with 18 additions and 9 deletions

View File

@ -145,6 +145,8 @@ void show_history(struct gui_ctx *ctx, enum selecting sel);
/* gui.c */ /* gui.c */
extern bool use_delta;
struct gui_sheet *find_corresponding_sheet(struct gui_sheet *pick_from, struct gui_sheet *find_corresponding_sheet(struct gui_sheet *pick_from,
struct gui_sheet *ref_in, const struct gui_sheet *ref); struct gui_sheet *ref_in, const struct gui_sheet *ref);
void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet); void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet);

View File

@ -18,11 +18,13 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "misc/util.h" #include "misc/util.h"
#include "gfx/style.h"
#include "gfx/cro.h" #include "gfx/cro.h"
#include "gfx/gfx.h" #include "gfx/gfx.h"
#include "kicad/sch.h" #include "kicad/sch.h"
#include "kicad/delta.h" #include "kicad/delta.h"
#include "gfx/diff.h" #include "gfx/diff.h"
#include "gfx/diff.h"
#include "gui/aoi.h" #include "gui/aoi.h"
#include "gui/over.h" #include "gui/over.h"
#include "gui/common.h" #include "gui/common.h"
@ -37,6 +39,9 @@
#define GLABEL_HIGHLIGHT_PAD 6 #define GLABEL_HIGHLIGHT_PAD 6
bool use_delta = 0;
/* ----- Helper functions -------------------------------------------------- */ /* ----- Helper functions -------------------------------------------------- */
@ -170,13 +175,12 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
ctx->new_hist->sheets, ctx->curr_sheet); ctx->new_hist->sheets, ctx->curr_sheet);
highlight_glabel(ctx, sheet, cr, x, y, f); highlight_glabel(ctx, sheet, cr, x, y, f);
cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f); cro_canvas_draw(sheet->gfx_ctx, cr, x, y, f);
} else { } else if (use_delta) {
#if 0
/* @@@ fix geometry later */ /* @@@ fix geometry later */
cro_canvas_draw(ctx->delta_ab.gfx_ctx, cr, x, y, f); cro_canvas_draw(ctx->delta_ab.gfx_ctx, cr, x, y, f);
cro_canvas_draw(ctx->delta_a.gfx_ctx, cr, x, y, f); cro_canvas_draw(ctx->delta_a.gfx_ctx, cr, x, y, f);
cro_canvas_draw(ctx->delta_b.gfx_ctx, cr, x, y, f); cro_canvas_draw(ctx->delta_b.gfx_ctx, cr, x, y, f);
#endif } else {
hack(ctx, cr, x, y, f); hack(ctx, cr, x, y, f);
} }
@ -216,12 +220,12 @@ void render_sheet(struct gui_sheet *sheet)
void render_delta(struct gui_ctx *ctx) void render_delta(struct gui_ctx *ctx)
{ {
#if 0 #if 1
/* @@@ needs updating for curr/last vs. new/old */ /* @@@ needs updating for curr/last vs. new/old */
struct sheet *sch_a, *sch_b, *sch_ab; struct sheet *sch_a, *sch_b, *sch_ab;
const struct gui_sheet *a = ctx->curr_sheet; struct gui_sheet *a = ctx->curr_sheet;
const struct gui_sheet *b = find_corresponding_sheet( struct gui_sheet *b = find_corresponding_sheet(
ctx->last_hist->sheets, ctx->curr_hist->sheets, ctx->curr_sheet); ctx->old_hist->sheets, ctx->new_hist->sheets, ctx->curr_sheet);
sch_a = alloc_type(struct sheet); sch_a = alloc_type(struct sheet);
sch_b = alloc_type(struct sheet); sch_b = alloc_type(struct sheet);
@ -242,8 +246,6 @@ void render_delta(struct gui_ctx *ctx)
// @@@ clean up when leaving sheet // @@@ clean up when leaving sheet
#endif #endif
struct gui_sheet *b = find_corresponding_sheet(
ctx->old_hist->sheets, ctx->new_hist->sheets, ctx->curr_sheet);
if (!b->rendered) { if (!b->rendered) {
render_sheet(b); render_sheet(b);

View File

@ -522,6 +522,11 @@ static void sheet_key(void *user, int x, int y, int keyval)
redraw(ctx); redraw(ctx);
break; break;
case GDK_KEY_a:
use_delta = !use_delta;
redraw(ctx);
break;
case GDK_KEY_n: case GDK_KEY_n:
ctx->diff_mode = diff_new; ctx->diff_mode = diff_new;
redraw(ctx); redraw(ctx);