diff --git a/eeshow/gui/common.h b/eeshow/gui/common.h index cb86c73..8c1bf4b 100644 --- a/eeshow/gui/common.h +++ b/eeshow/gui/common.h @@ -113,17 +113,12 @@ void add_glabel_aoi(struct gui_sheet *sheet, const struct sch_obj *obj); /* sheet.c */ -bool sheet_click(void *user, int x, int y); -bool sheet_hover_update(void *user, int x, int y); -void sheet_key(void *user, int x, int y, int keyval); - void go_to_sheet(struct gui_ctx *ctx, struct gui_sheet *sheet); void do_revision_overlays(struct gui_ctx *ctx); void sheet_setup(struct gui_ctx *ctx); /* history */ -void hide_history(struct gui_ctx *ctx); void show_history(struct gui_ctx *ctx, enum selecting sel); /* gui.c */ diff --git a/eeshow/gui/history.c b/eeshow/gui/history.c index 441b849..506b4a8 100644 --- a/eeshow/gui/history.c +++ b/eeshow/gui/history.c @@ -26,7 +26,7 @@ #include "gui/common.h" -void hide_history(struct gui_ctx *ctx) +static void hide_history(struct gui_ctx *ctx) { input_pop(); @@ -217,6 +217,25 @@ void show_history(struct gui_ctx *ctx, enum selecting sel) /* ----- Input ------------------------------------------------------------- */ +static bool history_click(void *user, int x, int y) +{ + struct gui_ctx *ctx = user; + + if (aoi_click(ctx->aois, x, y)) + return 1; + hide_history(ctx); + return 1; +} + + +static bool history_hover_update(void *user, int x, int y) +{ + struct gui_ctx *ctx = user; + + return aoi_hover(ctx->aois, x, y); +} + + static void history_drag_move(void *user, int dx, int dy) { struct gui_ctx *ctx = user; @@ -226,15 +245,21 @@ static void history_drag_move(void *user, int dx, int dy) } -/* @@@ under construction */ +static void history_key(void *user, int x, int y, int keyval) +{ + switch (keyval) { + case GDK_KEY_q: + gtk_main_quit(); + } +} static const struct input_ops history_input_ops = { - .click = sheet_click, - .hover_begin = sheet_hover_update, - .hover_update = sheet_hover_update, - .hover_click = sheet_click, + .click = history_click, + .hover_begin = history_hover_update, + .hover_update = history_hover_update, + .hover_click = history_click, .drag_begin = input_accept, .drag_move = history_drag_move, - .key = sheet_key, + .key = history_key, }; diff --git a/eeshow/gui/sheet.c b/eeshow/gui/sheet.c index ca21cc0..f581cdc 100644 --- a/eeshow/gui/sheet.c +++ b/eeshow/gui/sheet.c @@ -308,7 +308,7 @@ static bool go_next_sheet(struct gui_ctx *ctx) /* ----- Input ------------------------------------------------------------- */ -bool sheet_click(void *user, int x, int y) +static bool sheet_click(void *user, int x, int y) { struct gui_ctx *ctx = user; const struct gui_sheet *curr_sheet = ctx->curr_sheet; @@ -322,15 +322,13 @@ bool sheet_click(void *user, int x, int y) ex + curr_sheet->xmin, ey + curr_sheet->ymin)) return 1; - if (ctx->showing_history) - hide_history(ctx); overlay_remove_all(&ctx->pop_overlays); redraw(ctx); return 1; } -bool sheet_hover_update(void *user, int x, int y) +static bool sheet_hover_update(void *user, int x, int y) { struct gui_ctx *ctx = user; const struct gui_sheet *curr_sheet = ctx->curr_sheet; @@ -375,7 +373,7 @@ static void sheet_scroll(void *user, int x, int y, int dy) } -void sheet_key(void *user, int x, int y, int keyval) +static void sheet_key(void *user, int x, int y, int keyval) { struct gui_ctx *ctx = user; struct gui_sheet *sheet = ctx->curr_sheet;