aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-11-19 17:40:30 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-11-19 17:40:30 +0000
commita17f5fe8175ccab8f52513f0b8141f7fd6ef393a (patch)
tree37251032522383ab060e7a9faad9afcced46b353 /main.c
parent[w3m-dev 03450] Re: cygwin console on Win9X (diff)
downloadw3m-a17f5fe8175ccab8f52513f0b8141f7fd6ef393a.tar.gz
w3m-a17f5fe8175ccab8f52513f0b8141f7fd6ef393a.zip
[w3m-dev 03452] image map
* display.c (displayBuffer): use getCurrentMapLabel() * fm.h (MapArea): delete ifdef MENU_MAP (image_map_list): added * main.c (followA): don't call retrieveCurrentImg() ifdef USE_IMAGE use retrieveCurrentMap() ifndef USE_IMAGE (_followForm): indent (drawAnchorCursor0): add AnchorList (drawAnchorCuror): pass AnchorList to drawAnchorCursor0 (follow_map): follow_map_panel * map.c (searchMapList): added (nearestMapArea): n, min default value to -1 (searchMapArea): added (getCurrentMapLabel): added (getMapXY): moved (retrieveCurrentMap): added (follow_map_menu): parsed_tagarg -> name rewrite to search map list/area (follow_map_panel): parsed_tagarg -> name rewrite to search map list/area (newMapArea): delete ifdef MENU_MAP (append_map_info): added (page_info_panel): append_map_info * proto.h (follow_map_menu): parsed_tagarg -> name (follow_map_panel): parsed_tagarg -> name (getCurrentMapLabel): added (retrieveCurrentMap): added * rc.c (CMT_IMAGE_MAP_LIST): added (image_map_list): added From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--main.c67
1 files changed, 46 insertions, 21 deletions
diff --git a/main.c b/main.c
index e38f0d4..98af583 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.143 2002/11/18 17:29:32 ukai Exp $ */
+/* $Id: main.c,v 1.144 2002/11/19 17:40:32 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -2757,9 +2757,15 @@ followA(void)
return;
}
if (a && a->image && a->image->ismap) {
- getMapXY(Currentbuf, retrieveCurrentImg(Currentbuf), &x, &y);
+ getMapXY(Currentbuf, a, &x, &y);
map = 1;
}
+#else
+ a = retrieveCurrentMap(Currentbuf);
+ if (a) {
+ _followForm(FALSE);
+ return;
+ }
#endif
a = retrieveCurrentAnchor(Currentbuf);
if (a == NULL) {
@@ -3240,7 +3246,10 @@ _followForm(int submit)
buf->form_submit = save_submit_formlist(fi);
}
}
- else if ((fi->parent->method == FORM_METHOD_INTERNAL && (!Strcmp_charp(fi->parent->action, "map") || !Strcmp_charp(fi->parent->action, "none"))) || Currentbuf->bufferprop & BP_INTERNAL) { /* internal */
+ else if ((fi->parent->method == FORM_METHOD_INTERNAL &&
+ (!Strcmp_charp(fi->parent->action, "map") ||
+ !Strcmp_charp(fi->parent->action, "none"))) ||
+ Currentbuf->bufferprop & BP_INTERNAL) { /* internal */
do_internal(tmp2->ptr, tmp->ptr);
}
else {
@@ -3275,16 +3284,16 @@ _followForm(int submit)
}
static void
-drawAnchorCursor0(Buffer *buf, int hseq, int prevhseq, int tline, int eline,
- int active)
+drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq,
+ int tline, int eline, int active)
{
int i, j;
Line *l;
Anchor *an;
l = buf->topLine;
- for (j = 0; j < buf->href->nanchor; j++) {
- an = &buf->href->anchors[j];
+ for (j = 0; j < al->nanchor; j++) {
+ an = &al->anchors[j];
if (an->start.line < tline)
continue;
if (an->start.line >= eline)
@@ -3324,13 +3333,15 @@ drawAnchorCursor(Buffer *buf)
int hseq, prevhseq;
int tline, eline;
- if (buf->firstLine == NULL)
+ if (!buf->firstLine || !buf->hmarklist)
return;
- if (buf->href == NULL)
+ if (!buf->href && !buf->formitem)
return;
an = retrieveCurrentAnchor(buf);
- if (an != NULL)
+ if (!an)
+ an = retrieveCurrentMap(buf);
+ if (an)
hseq = an->hseq;
else
hseq = -1;
@@ -3338,8 +3349,14 @@ drawAnchorCursor(Buffer *buf)
eline = tline + buf->LINES;
prevhseq = buf->hmarklist->prevhseq;
- drawAnchorCursor0(buf, hseq, prevhseq, tline, eline, 1);
- drawAnchorCursor0(buf, hseq, -1, tline, eline, 0);
+ if (buf->href) {
+ drawAnchorCursor0(buf, buf->href, hseq, prevhseq, tline, eline, 1);
+ drawAnchorCursor0(buf, buf->href, hseq, -1, tline, eline, 0);
+ }
+ if (buf->formitem) {
+ drawAnchorCursor0(buf, buf->formitem, hseq, prevhseq, tline, eline, 1);
+ drawAnchorCursor0(buf, buf->formitem, hseq, -1, tline, eline, 0);
+ }
buf->hmarklist->prevhseq = hseq;
}
@@ -4002,7 +4019,8 @@ pginfo(void)
void
follow_map(struct parsed_tagarg *arg)
{
-#ifdef MENU_MAP
+ char *name = tag_get_value(arg, "link");
+#if defined(MENU_MAP) || defined(USE_IMAGE)
Anchor *an;
MapArea *a;
int x, y;
@@ -4011,9 +4029,22 @@ follow_map(struct parsed_tagarg *arg)
an = retrieveCurrentImg(Currentbuf);
x = Currentbuf->cursorX + Currentbuf->rootX;
y = Currentbuf->cursorY + Currentbuf->rootY;
- a = follow_map_menu(Currentbuf, arg, an, x, y);
- if (a == NULL || a->url == NULL || *(a->url) == '\0')
+ a = follow_map_menu(Currentbuf, name, an, x, y);
+ if (a == NULL || a->url == NULL || *(a->url) == '\0') {
+#endif
+#ifndef MENU_MAP
+ Buffer *buf = follow_map_panel(Currentbuf, name);
+
+ if (buf != NULL) {
+#ifdef JP_CHARSET
+ buf->document_code = Currentbuf->document_code;
+#endif /* JP_CHARSET */
+ cmd_loadBuffer(buf, BP_NORMAL, LB_NOLINK);
+ }
+#endif
+#if defined(MENU_MAP) || defined(USE_IMAGE)
return;
+ }
if (*(a->url) == '#') {
gotoLabel(a->url + 1);
return;
@@ -4037,12 +4068,6 @@ follow_map(struct parsed_tagarg *arg)
}
cmd_loadURL(a->url, baseURL(Currentbuf),
parsedURL2Str(&Currentbuf->currentURL)->ptr);
-#else
- Buffer *buf;
-
- buf = follow_map_panel(Currentbuf, arg);
- if (buf != NULL)
- cmd_loadBuffer(buf, BP_NORMAL, LB_NOLINK);
#endif
}