commit 0f839a10b8240dacab7a96aaecd57d059e6024fa
parent d95a6e2b225155f2efb727affcfe7c7356c34d2d
Author: ukai <ukai>
Date: Wed, 6 Nov 2002 15:07:40 +0000
[w3m-dev 03383] Select the nearest map area as default.
* fm.h (MapArea): add center_x, center_y
* map.c (nearestMapArea): added
(follow_map_menu): initial by nearestMapArea()
(newMapArea): set center_x, center_y
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,13 @@
2002-11-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03383] Select the nearest map area as default.
+ * fm.h (MapArea): add center_x, center_y
+ * map.c (nearestMapArea): added
+ (follow_map_menu): initial by nearestMapArea()
+ (newMapArea): set center_x, center_y
+
+2002-11-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03382] Interrupt in no_proxy_check()
* url.c (check_no_proxy): SIGINT trap by KeyAbort
diff --git a/fm.h b/fm.h
@@ -292,6 +292,8 @@ typedef struct _MapArea {
char shape;
short *coords;
int ncoords;
+ short center_x;
+ short center_y;
#endif
#endif
} MapArea;
diff --git a/map.c b/map.c
@@ -64,7 +64,7 @@ nearestMapArea(MapList *ml, int x, int y)
ListItem *al;
MapArea *a;
int i, l, n = 0, min = -1, limit = pixel_per_char * pixel_per_char
- + pixel_per_line * pixel_per_line;
+ + pixel_per_line * pixel_per_line;
if (!ml || !ml->area)
return n;
@@ -72,7 +72,7 @@ nearestMapArea(MapList *ml, int x, int y)
a = (MapArea *) al->ptr;
if (a) {
l = (a->center_x - x) * (a->center_x - x)
- + (a->center_y - y) * (a->center_y - y);
+ + (a->center_y - y) * (a->center_y - y);
if ((min < 0 || l < min) && l < limit) {
n = i;
min = l;