mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 11:56:15 +02:00
eeshow/gui/history.c: provide complete set of input functions
This commit is contained in:
parent
9792a22799
commit
8d3b642fb2
@ -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 */
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user