summaryrefslogtreecommitdiff
path: root/gui/sheet.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 07:24:25 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 07:24:25 -0300
commit2a0090cae10ddef4a574e198c0fc0a9aa4ef2208 (patch)
tree22fb9e1f165817c62009f1b9a54260db9ea089f4 /gui/sheet.c
parent5361ab35f32aaaccf85aa0e6657cb92422be0f6a (diff)
downloadeeshow-2a0090cae10ddef4a574e198c0fc0a9aa4ef2208.tar.gz
eeshow-2a0090cae10ddef4a574e198c0fc0a9aa4ef2208.tar.bz2
eeshow-2a0090cae10ddef4a574e198c0fc0a9aa4ef2208.zip
eeshow/gui/sheet.c (revision_overlays_diff): support selection of diff mode
Diffstat (limited to 'gui/sheet.c')
-rw-r--r--gui/sheet.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gui/sheet.c b/gui/sheet.c
index 359348d..a25e3f8 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -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, "&#916;");
+
old->over = overlay_add(&ctx->hist_overlays, &ctx->aois,
show_history_details, show_history_cb, old);
overlay_style(old->over, &overlay_style_diff_old);