mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 20:53:55 +02:00
eeshow/: selection of 2nd history entry (for comparisons, WIP)
This commit is contained in:
parent
15deee6955
commit
c2c58f6892
@ -69,13 +69,29 @@ struct overlay {
|
||||
#define DENSE_SKIP 5
|
||||
#define DENSE_WIDTH 1
|
||||
|
||||
#define BG_STANDARD { 0.8, 0.9, 1.0, 0.8 }
|
||||
#define FG_STANDARD { 0.0, 0.0, 0.0, 1.0 }
|
||||
#define FRAME_STANDARD { 0.5, 0.5, 1.0, 0.7 }
|
||||
#define BG_STANDARD { 0.8, 0.9, 1.0, 0.8 }
|
||||
#define FG_STANDARD { 0.0, 0.0, 0.0, 1.0 }
|
||||
#define FRAME_STANDARD { 0.5, 0.5, 1.0, 0.7 }
|
||||
|
||||
#define BG_SELECTED BG_STANDARD
|
||||
#define FG_SELECTED FG_STANDARD
|
||||
#define FRAME_SELECTED { 0.0, 0.0, 1.0, 0.8 }
|
||||
#define BG_SELECTED BG_STANDARD
|
||||
#define FG_SELECTED FG_STANDARD
|
||||
#define FRAME_SELECTED { 0.0, 0.0, 1.0, 0.8 }
|
||||
|
||||
#define BG_DIFF_NEW BG_STANDARD
|
||||
#define FG_DIFF_NEW { 0.0, 0.6, 0.0, 1.0 }
|
||||
#define FRAME_DIFF_NEW FRAME_STANDARD
|
||||
|
||||
#define BG_DIFF_NEW_SELECTED BG_DIFF_NEW
|
||||
#define FG_DIFF_NEW_SELECTED FG_DIFF_NEW
|
||||
#define FRAME_DIFF_NEW_SELECTED FRAME_SELECTED
|
||||
|
||||
#define BG_DIFF_OLD BG_STANDARD
|
||||
#define FG_DIFF_OLD { 0.8, 0.0, 0.0, 1.0 }
|
||||
#define FRAME_DIFF_OLD FRAME_STANDARD
|
||||
|
||||
#define BG_DIFF_OLD_SELECTED BG_DIFF_OLD
|
||||
#define FG_DIFF_OLD_SELECTED FG_DIFF_OLD
|
||||
#define FRAME_DIFF_OLD_SELECTED FRAME_SELECTED
|
||||
|
||||
|
||||
#define BOX_ATTRS(style) \
|
||||
@ -92,22 +108,42 @@ struct overlay {
|
||||
.fg = FG_##style, \
|
||||
.frame = FRAME_##style
|
||||
|
||||
#define STANDARD COLOR_ATTRS(STANDARD)
|
||||
#define SELECTED COLOR_ATTRS(SELECTED)
|
||||
#define STANDARD COLOR_ATTRS(STANDARD)
|
||||
#define SELECTED COLOR_ATTRS(SELECTED)
|
||||
#define DIFF_NEW COLOR_ATTRS(DIFF_NEW)
|
||||
#define DIFF_NEW_SELECTED COLOR_ATTRS(DIFF_NEW_SELECTED)
|
||||
#define DIFF_OLD COLOR_ATTRS(DIFF_OLD)
|
||||
#define DIFF_OLD_SELECTED COLOR_ATTRS(DIFF_OLD_SELECTED)
|
||||
|
||||
|
||||
struct overlay_style overlay_style_default = {
|
||||
.font = "Helvetica 10",
|
||||
.font = NORMAL_FONT,
|
||||
NORMAL,
|
||||
STANDARD,
|
||||
}, overlay_style_dense = {
|
||||
.font = "Helvetiva 10",
|
||||
.font = NORMAL_FONT,
|
||||
DENSE,
|
||||
STANDARD,
|
||||
}, overlay_style_dense_selected = {
|
||||
.font = "Helvetica Bold 10",
|
||||
.font = BOLD_FONT,
|
||||
DENSE,
|
||||
SELECTED,
|
||||
}, overlay_style_diff_new = {
|
||||
.font = NORMAL_FONT,
|
||||
NORMAL,
|
||||
DIFF_NEW,
|
||||
}, overlay_style_diff_old = {
|
||||
.font = NORMAL_FONT,
|
||||
NORMAL,
|
||||
DIFF_OLD,
|
||||
}, overlay_style_dense_diff_new = {
|
||||
.font = BOLD_FONT,
|
||||
DENSE,
|
||||
DIFF_NEW_SELECTED,
|
||||
}, overlay_style_dense_diff_old = {
|
||||
.font = BOLD_FONT,
|
||||
DENSE,
|
||||
DIFF_OLD_SELECTED,
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,6 +39,10 @@ struct overlay;
|
||||
extern struct overlay_style overlay_style_default;
|
||||
extern struct overlay_style overlay_style_dense;
|
||||
extern struct overlay_style overlay_style_dense_selected;
|
||||
extern struct overlay_style overlay_style_diff_new;
|
||||
extern struct overlay_style overlay_style_diff_old;
|
||||
extern struct overlay_style overlay_style_dense_diff_new;
|
||||
extern struct overlay_style overlay_style_dense_diff_old;
|
||||
|
||||
struct overlay *overlay_draw(struct overlay *over, cairo_t *cr, int *x, int *y);
|
||||
void overlay_draw_all(struct overlay *overlays, cairo_t *cr, int x, int y);
|
||||
|
84
eeshow/gui.c
84
eeshow/gui.c
@ -84,6 +84,7 @@ struct gui_ctx {
|
||||
struct gui_sheet *curr_sheet;
|
||||
/* current sheet */
|
||||
struct gui_hist *curr_hist;
|
||||
struct gui_hist *last_hist;
|
||||
};
|
||||
|
||||
|
||||
@ -251,13 +252,18 @@ static bool go_up_sheet(struct gui_ctx *ctx);
|
||||
|
||||
static struct overlay_style style_dense;
|
||||
static struct overlay_style style_dense_selected;
|
||||
static struct overlay_style style_dense_diff_new;
|
||||
static struct overlay_style style_dense_diff_old;
|
||||
|
||||
|
||||
static void setup_styles(void)
|
||||
{
|
||||
style_dense = overlay_style_dense;
|
||||
style_dense_selected = overlay_style_dense_selected;
|
||||
style_dense.wmax = style_dense_selected.wmax = 400;
|
||||
style_dense_diff_new = overlay_style_diff_new;
|
||||
style_dense_diff_old = overlay_style_diff_old;
|
||||
style_dense.wmax = style_dense_selected.wmax =
|
||||
style_dense_diff_new.wmax = style_dense_diff_old.wmax = 400;
|
||||
}
|
||||
|
||||
|
||||
@ -318,18 +324,39 @@ static bool hover_history(void *user, bool on)
|
||||
}
|
||||
|
||||
|
||||
static void do_sheet_overlays(struct gui_ctx *ctx);
|
||||
|
||||
|
||||
static void go_to_history(struct gui_hist *h)
|
||||
{
|
||||
struct gui_ctx *ctx = h->ctx;
|
||||
struct gui_sheet *sheet;
|
||||
|
||||
if (h == ctx->curr_hist) {
|
||||
ctx->last_hist = NULL;
|
||||
do_sheet_overlays(ctx);
|
||||
} else {
|
||||
/*
|
||||
* Look up sheet BEFORE changing history (we need various
|
||||
* items from ctx for this).
|
||||
*
|
||||
* Set sheet AFTER changing history.
|
||||
*/
|
||||
sheet = find_corresponding_sheet(ctx, h->sheets);
|
||||
ctx->last_hist = ctx->curr_hist;
|
||||
ctx->curr_hist = h;
|
||||
go_to_sheet(ctx, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void click_history(void *user)
|
||||
{
|
||||
struct gui_hist *h = user;
|
||||
struct gui_ctx *ctx = h->ctx;
|
||||
|
||||
if (h->sheets && h != ctx->curr_hist) {
|
||||
struct gui_sheet *sheet;
|
||||
|
||||
sheet = find_corresponding_sheet(ctx, h->sheets);
|
||||
ctx->curr_hist = h;
|
||||
go_to_sheet(ctx, sheet);
|
||||
}
|
||||
if (h->sheets)
|
||||
go_to_history(h);
|
||||
hide_history(ctx);
|
||||
}
|
||||
|
||||
@ -344,8 +371,10 @@ static void show_history(struct gui_ctx *ctx)
|
||||
hover_history, click_history, h);
|
||||
hover_history(h, 0);
|
||||
overlay_style(h->history_over,
|
||||
h == ctx->curr_hist ? &style_dense_selected :
|
||||
&style_dense);
|
||||
h == ctx->curr_hist ?
|
||||
ctx->last_hist ?
|
||||
&style_dense_diff_new : &style_dense_selected :
|
||||
h == ctx->last_hist ? &style_dense_diff_old : &style_dense);
|
||||
}
|
||||
redraw(ctx);
|
||||
}
|
||||
@ -393,27 +422,45 @@ static bool show_history_details(void *user, bool on)
|
||||
}
|
||||
|
||||
|
||||
static void go_to_sheet(struct gui_ctx *ctx, struct gui_sheet *sheet)
|
||||
static void do_sheet_overlays(struct gui_ctx *ctx)
|
||||
{
|
||||
struct overlay *over;
|
||||
|
||||
if (!sheet->rendered) {
|
||||
render_sheet(sheet);
|
||||
mark_aois(ctx, sheet);
|
||||
}
|
||||
ctx->curr_sheet = sheet;
|
||||
overlay_remove_all(&ctx->sheet_overlays);
|
||||
if (ctx->curr_hist) {
|
||||
ctx->curr_hist->sheet_over = overlay_add(&ctx->sheet_overlays,
|
||||
&ctx->aois, show_history_details, show_history_cb,
|
||||
ctx->curr_hist);
|
||||
overlay_style(ctx->curr_hist->sheet_over,
|
||||
&overlay_style_default);
|
||||
show_history_details(ctx->curr_hist, 0);
|
||||
}
|
||||
if (sheet->sch->title) {
|
||||
if (ctx->last_hist) {
|
||||
ctx->last_hist->sheet_over = overlay_add(&ctx->sheet_overlays,
|
||||
&ctx->aois, show_history_details, show_history_cb,
|
||||
ctx->last_hist);
|
||||
overlay_style(ctx->curr_hist->sheet_over,
|
||||
&overlay_style_diff_new);
|
||||
overlay_style(ctx->last_hist->sheet_over,
|
||||
&overlay_style_diff_old);
|
||||
show_history_details(ctx->last_hist, 0);
|
||||
}
|
||||
if (ctx->curr_sheet->sch->title) {
|
||||
over = overlay_add(&ctx->sheet_overlays, &ctx->aois,
|
||||
NULL, close_subsheet, ctx);
|
||||
overlay_text(over, "<b>%s</b>", sheet->sch->title);
|
||||
overlay_text(over, "<b>%s</b>", ctx->curr_sheet->sch->title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void go_to_sheet(struct gui_ctx *ctx, struct gui_sheet *sheet)
|
||||
{
|
||||
if (!sheet->rendered) {
|
||||
render_sheet(sheet);
|
||||
mark_aois(ctx, sheet);
|
||||
}
|
||||
ctx->curr_sheet = sheet;
|
||||
do_sheet_overlays(ctx);
|
||||
zoom_to_extents(ctx);
|
||||
}
|
||||
|
||||
@ -802,6 +849,7 @@ int gui(unsigned n_args, char **args, bool recurse)
|
||||
.sheet_overlays = NULL,
|
||||
.hist_overlays = NULL,
|
||||
.aois = NULL,
|
||||
.last_hist = NULL,
|
||||
};
|
||||
|
||||
get_revisions(&ctx, n_args, args, recurse);
|
||||
|
Loading…
Reference in New Issue
Block a user