summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/common.h2
-rw-r--r--gui/render.c20
-rw-r--r--gui/sheet.c5
3 files changed, 18 insertions, 9 deletions
diff --git a/gui/common.h b/gui/common.h
index bfe2f3e..dd2f1d3 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -145,6 +145,8 @@ void show_history(struct gui_ctx *ctx, enum selecting sel);
/* gui.c */
+extern bool use_delta;
+
struct gui_sheet *find_corresponding_sheet(struct gui_sheet *pick_from,
struct gui_sheet *ref_in, const struct gui_sheet *ref);
void mark_aois(struct gui_ctx *ctx, struct gui_sheet *sheet);
diff --git a/gui/render.c b/gui/render.c
index 3bf1db9..23363e0 100644
--- a/gui/render.c
+++ b/gui/render.c
@@ -18,11 +18,13 @@
#include <gtk/gtk.h>
#include "misc/util.h"
+#include "gfx/style.h"
#include "gfx/cro.h"
#include "gfx/gfx.h"
#include "kicad/sch.h"
#include "kicad/delta.h"
#include "gfx/diff.h"
+#include "gfx/diff.h"
#include "gui/aoi.h"
#include "gui/over.h"
#include "gui/common.h"
@@ -37,6 +39,9 @@
#define GLABEL_HIGHLIGHT_PAD 6
+bool use_delta = 0;
+
+
/* ----- Helper functions -------------------------------------------------- */
@@ -170,13 +175,12 @@ static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr,
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
+ } else if (use_delta) {
/* @@@ fix geometry later */
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_b.gfx_ctx, cr, x, y, f);
-#endif
+ } else {
hack(ctx, cr, x, y, f);
}
@@ -216,12 +220,12 @@ void render_sheet(struct gui_sheet *sheet)
void render_delta(struct gui_ctx *ctx)
{
-#if 0
+#if 1
/* @@@ needs updating for curr/last vs. new/old */
struct sheet *sch_a, *sch_b, *sch_ab;
- const struct gui_sheet *a = ctx->curr_sheet;
- const struct gui_sheet *b = find_corresponding_sheet(
- ctx->last_hist->sheets, ctx->curr_hist->sheets, ctx->curr_sheet);
+ struct gui_sheet *a = ctx->curr_sheet;
+ struct gui_sheet *b = find_corresponding_sheet(
+ ctx->old_hist->sheets, ctx->new_hist->sheets, ctx->curr_sheet);
sch_a = 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
#endif
- struct gui_sheet *b = find_corresponding_sheet(
- ctx->old_hist->sheets, ctx->new_hist->sheets, ctx->curr_sheet);
if (!b->rendered) {
render_sheet(b);
diff --git a/gui/sheet.c b/gui/sheet.c
index 74bb5be..6f77756 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -522,6 +522,11 @@ static void sheet_key(void *user, int x, int y, int keyval)
redraw(ctx);
break;
+ case GDK_KEY_a:
+ use_delta = !use_delta;
+ redraw(ctx);
+ break;
+
case GDK_KEY_n:
ctx->diff_mode = diff_new;
redraw(ctx);