summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-10-19 02:28:27 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-10-19 02:28:27 (GMT)
commit9bb732fcaa6db14aa7289169a4e6802cfb2a7853 (patch)
treea71bac6f4915f29d7a1b39f3bc6859567a9f493e /gui
parent31ebe5256442870459a35dce362d84d629aa9043 (diff)
downloadeeshow-9bb732fcaa6db14aa7289169a4e6802cfb2a7853.zip
eeshow-9bb732fcaa6db14aa7289169a4e6802cfb2a7853.tar.gz
eeshow-9bb732fcaa6db14aa7289169a4e6802cfb2a7853.tar.bz2
gui/sheet.c (sheet_click): if clicking on text, show on standard error (WIP)
Diffstat (limited to 'gui')
-rw-r--r--gui/sheet.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gui/sheet.c b/gui/sheet.c
index 09d41d3..0f2a63d 100644
--- a/gui/sheet.c
+++ b/gui/sheet.c
@@ -16,6 +16,7 @@
#include <gtk/gtk.h>
+#include "gfx/record.h"
#include "gfx/gfx.h"
#include "file/git-hist.h"
#include "kicad/sch.h"
@@ -417,8 +418,11 @@ static bool sheet_click(void *user, int x, int y)
struct gui *gui = user;
const struct gui_sheet *curr_sheet = gui->curr_sheet;
int ex, ey;
+ const char *s;
canvas_coord(gui, x, y, &ex, &ey);
+ ex += curr_sheet->xmin;
+ ey += curr_sheet->ymin;
if (gui->old_hist && gui->diff_mode == diff_old)
curr_sheet = find_corresponding_sheet(gui->old_hist->sheets,
@@ -426,13 +430,20 @@ static bool sheet_click(void *user, int x, int y)
if (aoi_click(&gui->aois, x, y))
return 1;
- if (aoi_click(&curr_sheet->aois,
- ex + curr_sheet->xmin, ey + curr_sheet->ymin))
+ if (aoi_click(&curr_sheet->aois, ex, ey))
return 1;
- overlay_remove_all(&gui->pop_overlays);
- overlay_remove_all(&gui->pop_underlays);
- redraw(gui);
+ if (gui->pop_overlays || gui->pop_underlays) {
+ overlay_remove_all(&gui->pop_overlays);
+ overlay_remove_all(&gui->pop_underlays);
+ redraw(gui);
+ return 1;
+ }
+
+ s = record_find_text(gfx_user(curr_sheet->gfx), show_extra, ex, ey);
+ if (s)
+ fprintf(stderr, "%s\n", s);
+
return 1;
}