[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>
This commit is contained in:
@@ -1,3 +1,35 @@
|
||||
2002-11-20 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||
|
||||
* [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
|
||||
|
||||
2002-11-20 Yoshinobu Sakane <sakane@d4.bsd.nes.nec.co.jp>
|
||||
|
||||
* [w3m-dev 03450] Re: cygwin console on Win9X
|
||||
@@ -4893,4 +4925,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
||||
* release-0-2-1
|
||||
* import w3m-0.2.1
|
||||
|
||||
$Id: ChangeLog,v 1.536 2002/11/19 17:18:54 ukai Exp $
|
||||
$Id: ChangeLog,v 1.537 2002/11/19 17:40:30 ukai Exp $
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: display.c,v 1.33 2002/11/18 16:42:25 ukai Exp $ */
|
||||
/* $Id: display.c,v 1.34 2002/11/19 17:40:31 ukai Exp $ */
|
||||
#include <signal.h>
|
||||
#include "fm.h"
|
||||
|
||||
@@ -226,7 +226,7 @@ void
|
||||
displayBuffer(Buffer *buf, int mode)
|
||||
{
|
||||
Str msg;
|
||||
Anchor *aa = NULL;
|
||||
Str s = NULL;
|
||||
int ny = 0;
|
||||
|
||||
if (buf->topLine == NULL && readBufferCache(buf) == 0) { /* clear_buffer */
|
||||
@@ -341,14 +341,22 @@ displayBuffer(Buffer *buf, int mode)
|
||||
#endif
|
||||
Strcat_charp(msg, " <");
|
||||
Strcat_charp(msg, buf->buffername);
|
||||
if (displayLink)
|
||||
aa = retrieveCurrentAnchor(buf);
|
||||
if (aa) {
|
||||
ParsedURL url;
|
||||
Str s;
|
||||
if (displayLink) {
|
||||
#ifdef USE_IMAGE
|
||||
s = getCurrentMapLabel(buf);
|
||||
if (!s)
|
||||
#endif
|
||||
{
|
||||
Anchor *a = retrieveCurrentAnchor(buf);
|
||||
if (a) {
|
||||
ParsedURL pu;
|
||||
parseURL2(a->url, &pu, baseURL(buf));
|
||||
s = parsedURL2Str(&pu);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s) {
|
||||
int l;
|
||||
parseURL2(aa->url, &url, baseURL(buf));
|
||||
s = parsedURL2Str(&url);
|
||||
l = buf->width - 2;
|
||||
if (s->length > l) {
|
||||
if (l >= 4) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: fm.h,v 1.83 2002/11/18 17:26:06 ukai Exp $ */
|
||||
/* $Id: fm.h,v 1.84 2002/11/19 17:40:32 ukai Exp $ */
|
||||
/*
|
||||
* w3m: WWW wo Miru utility
|
||||
*
|
||||
@@ -290,7 +290,6 @@ typedef struct _MapArea {
|
||||
char *url;
|
||||
char *target;
|
||||
char *alt;
|
||||
#ifdef MENU_MAP
|
||||
#ifdef USE_IMAGE
|
||||
char shape;
|
||||
short *coords;
|
||||
@@ -298,7 +297,6 @@ typedef struct _MapArea {
|
||||
short center_x;
|
||||
short center_y;
|
||||
#endif
|
||||
#endif
|
||||
} MapArea;
|
||||
|
||||
typedef struct _MapList {
|
||||
@@ -878,6 +876,7 @@ global int displayImage init(TRUE);
|
||||
global int autoImage init(TRUE);
|
||||
global int useExtImageViewer init(TRUE);
|
||||
global int maxLoadImage init(4);
|
||||
global int image_map_list init(TRUE);
|
||||
#else
|
||||
global int displayImage init(FALSE); /* XXX: emacs-w3m use display_image=off */
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
/* $Id: map.c,v 1.13 2002/11/13 15:51:39 ukai Exp $ */
|
||||
/* $Id: map.c,v 1.14 2002/11/19 17:40:34 ukai Exp $ */
|
||||
/*
|
||||
* client-side image maps
|
||||
*/
|
||||
#include "fm.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef MENU_MAP
|
||||
static MapList *
|
||||
searchMapList(Buffer *buf, char *name)
|
||||
{
|
||||
MapList *ml;
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
for (ml = buf->maplist; ml != NULL; ml = ml->next) {
|
||||
if (!Strcmp_charp(ml->name, name))
|
||||
break;
|
||||
}
|
||||
return ml;
|
||||
}
|
||||
|
||||
#ifdef USE_IMAGE
|
||||
static int
|
||||
inMapArea(MapArea * a, int x, int y)
|
||||
@@ -63,7 +76,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
|
||||
int i, l, n = -1, min = -1, limit = pixel_per_char * pixel_per_char
|
||||
+ pixel_per_line * pixel_per_line;
|
||||
|
||||
if (!ml || !ml->area)
|
||||
@@ -81,127 +94,83 @@ nearestMapArea(MapList *ml, int x, int y)
|
||||
}
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
MapArea *
|
||||
follow_map_menu(Buffer *buf, struct parsed_tagarg * arg, Anchor *a_img, int x,
|
||||
int y)
|
||||
static int
|
||||
searchMapArea(Buffer *buf, MapList *ml, Anchor *a_img)
|
||||
{
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
int i, n;
|
||||
int px, py;
|
||||
|
||||
if (!(ml && ml->area && ml->area->nitem))
|
||||
return -1;
|
||||
if (! getMapXY(buf, a_img, &px, &py))
|
||||
return -1;
|
||||
n = - ml->area->nitem;
|
||||
for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (!a)
|
||||
continue;
|
||||
if (n < 0 && inMapArea(a, px, py)) {
|
||||
if (a->shape == SHAPE_DEFAULT) {
|
||||
if (n == - ml->area->nitem)
|
||||
n = -i;
|
||||
}
|
||||
else
|
||||
n = i;
|
||||
}
|
||||
}
|
||||
if (n == - ml->area->nitem)
|
||||
return nearestMapArea(ml, px, py);
|
||||
else if (n < 0)
|
||||
return -n;
|
||||
return n;
|
||||
}
|
||||
|
||||
Str
|
||||
getCurrentMapLabel(Buffer *buf)
|
||||
{
|
||||
Anchor *a_img, *a_form;
|
||||
FormItemList *fi;
|
||||
MapList *ml;
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
char *name;
|
||||
int i, n, selected = -1, initial;
|
||||
char **label;
|
||||
#ifdef USE_IMAGE
|
||||
int px, py, map = 0;
|
||||
#endif
|
||||
int i, n;
|
||||
Str s;
|
||||
|
||||
name = tag_get_value(arg, "link");
|
||||
if (name == NULL)
|
||||
a_img = retrieveCurrentImg(buf);
|
||||
if (!(a_img && a_img->image && a_img->image->map))
|
||||
return NULL;
|
||||
|
||||
for (ml = buf->maplist; ml != NULL; ml = ml->next) {
|
||||
if (!Strcmp_charp(ml->name, name))
|
||||
break;
|
||||
}
|
||||
if (ml == NULL || ml->area == NULL)
|
||||
a_form = retrieveCurrentForm(buf);
|
||||
if (!(a_form && a_form->url))
|
||||
return NULL;
|
||||
|
||||
n = ml->area->nitem;
|
||||
if (n == 0)
|
||||
fi = (FormItemList *)a_form->url;
|
||||
if (!(fi && fi->parent && fi->parent->item))
|
||||
return NULL;
|
||||
fi = fi->parent->item;
|
||||
ml = searchMapList(buf, fi->value ? fi->value->ptr : NULL);
|
||||
if (!ml)
|
||||
return NULL;
|
||||
n = searchMapArea(buf, ml, a_img);
|
||||
if (n < 0)
|
||||
return NULL;
|
||||
label = New_N(char *, n + 1);
|
||||
#ifdef USE_IMAGE
|
||||
if (getMapXY(buf, a_img, &px, &py))
|
||||
map = 1;
|
||||
#endif
|
||||
initial = -n;
|
||||
for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (a) {
|
||||
label[i] = *a->alt ? a->alt : a->url;
|
||||
#ifdef USE_IMAGE
|
||||
if (initial < 0 && map && inMapArea(a, px, py)) {
|
||||
if (a->shape == SHAPE_DEFAULT) {
|
||||
if (initial == -n)
|
||||
initial = -i;
|
||||
}
|
||||
else
|
||||
initial = i;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
label[i] = "";
|
||||
}
|
||||
label[n] = NULL;
|
||||
if (initial == -n)
|
||||
#ifdef USE_IMAGE
|
||||
initial = map ? nearestMapArea(ml, px, py) : 0;
|
||||
#else
|
||||
initial = 0;
|
||||
#endif
|
||||
else if (initial < 0)
|
||||
initial *= -1;
|
||||
|
||||
optionMenu(x, y, label, &selected, initial, NULL);
|
||||
|
||||
if (selected >= 0) {
|
||||
for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
|
||||
if (al->ptr && i == selected)
|
||||
return (MapArea *) al->ptr;
|
||||
if (!(a && i == n))
|
||||
continue;
|
||||
s = Sprintf("[%s]", a->alt);
|
||||
if (*a->alt) {
|
||||
ParsedURL pu;
|
||||
parseURL2(a->url, &pu, baseURL(buf));
|
||||
Strcat_char(s, ' ');
|
||||
Strcat(s, parsedURL2Str(&pu));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
char *map1 = "<HTML><HEAD><TITLE>Image map links</TITLE></HEAD>\
|
||||
<BODY><H1>Image map links</H1>";
|
||||
|
||||
Buffer *
|
||||
follow_map_panel(Buffer *buf, struct parsed_tagarg *arg)
|
||||
{
|
||||
Str mappage;
|
||||
MapList *ml;
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
char *name;
|
||||
ParsedURL pu;
|
||||
|
||||
name = tag_get_value(arg, "link");
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
for (ml = buf->maplist; ml != NULL; ml = ml->next) {
|
||||
if (!Strcmp_charp(ml->name, name))
|
||||
break;
|
||||
}
|
||||
if (ml == NULL)
|
||||
return NULL;
|
||||
|
||||
mappage = Strnew_charp(map1);
|
||||
for (al = ml->area->first; al != NULL; al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (!a)
|
||||
continue;
|
||||
parseURL2(a->url, &pu, baseURL(buf));
|
||||
Strcat_charp(mappage, "<a href=\"");
|
||||
Strcat_charp(mappage, html_quote(parsedURL2Str(&pu)->ptr));
|
||||
Strcat_charp(mappage, "\">");
|
||||
Strcat_charp(mappage, html_quote(a->alt));
|
||||
Strcat_charp(mappage, " ");
|
||||
Strcat_charp(mappage, html_quote(a->url));
|
||||
Strcat_charp(mappage, "</a><br>\n");
|
||||
}
|
||||
Strcat_charp(mappage, "</body></html>");
|
||||
|
||||
return loadHTMLString(mappage);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_IMAGE
|
||||
int
|
||||
getMapXY(Buffer *buf, Anchor *a, int *x, int *y)
|
||||
{
|
||||
@@ -220,21 +189,118 @@ getMapXY(Buffer *buf, Anchor *a, int *x, int *y)
|
||||
}
|
||||
#endif
|
||||
|
||||
Anchor *
|
||||
retrieveCurrentMap(Buffer *buf)
|
||||
{
|
||||
Anchor *a;
|
||||
FormItemList *fi;
|
||||
|
||||
a = retrieveCurrentForm(buf);
|
||||
if (!a || !a->url)
|
||||
return NULL;
|
||||
fi = (FormItemList *)a->url;
|
||||
if (fi->parent->method == FORM_METHOD_INTERNAL &&
|
||||
!Strcmp_charp(fi->parent->action, "map"))
|
||||
return a;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MapArea *
|
||||
follow_map_menu(Buffer *buf, char *name, Anchor *a_img, int x, int y)
|
||||
{
|
||||
MapList *ml;
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
int i, selected = -1, initial = 0;
|
||||
#ifdef MENU_MAP
|
||||
char **label;
|
||||
#endif
|
||||
|
||||
ml = searchMapList(buf, name);
|
||||
if (ml == NULL || ml->area == NULL || ml->area->nitem == 0)
|
||||
return NULL;
|
||||
|
||||
#ifdef USE_IMAGE
|
||||
initial = searchMapArea(buf, ml, a_img);
|
||||
if (initial < 0)
|
||||
initial = 0;
|
||||
else if (!image_map_list) {
|
||||
selected = initial;
|
||||
goto map_end;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MENU_MAP
|
||||
label = New_N(char *, ml->area->nitem + 1);
|
||||
for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (a)
|
||||
label[i] = *a->alt ? a->alt : a->url;
|
||||
else
|
||||
label[i] = "";
|
||||
}
|
||||
label[ml->area->nitem] = NULL;
|
||||
|
||||
optionMenu(x, y, label, &selected, initial, NULL);
|
||||
#endif
|
||||
|
||||
map_end:
|
||||
if (selected >= 0) {
|
||||
for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
|
||||
if (al->ptr && i == selected)
|
||||
return (MapArea *) al->ptr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef MENU_MAP
|
||||
char *map1 = "<HTML><HEAD><TITLE>Image map links</TITLE></HEAD>\
|
||||
<BODY><H1>Image map links</H1>\
|
||||
<table>";
|
||||
|
||||
Buffer *
|
||||
follow_map_panel(Buffer *buf, char *name)
|
||||
{
|
||||
Str mappage;
|
||||
MapList *ml;
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
ParsedURL pu;
|
||||
char *url;
|
||||
|
||||
ml = searchMapList(buf, name);
|
||||
if (ml == NULL)
|
||||
return NULL;
|
||||
|
||||
mappage = Strnew_charp(map1);
|
||||
for (al = ml->area->first; al != NULL; al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (!a)
|
||||
continue;
|
||||
parseURL2(a->url, &pu, baseURL(buf));
|
||||
url = html_quote(parsedURL2Str(&pu)->ptr);
|
||||
Strcat_m_charp(mappage, "<tr><td>", html_quote(a->alt),
|
||||
"<td><a href=\"", url, "\">", url, "</a>\n", NULL);
|
||||
}
|
||||
Strcat_charp(mappage, "</table></body></html>");
|
||||
|
||||
return loadHTMLString(mappage);
|
||||
}
|
||||
#endif
|
||||
|
||||
MapArea *
|
||||
newMapArea(char *url, char *target, char *alt, char *shape, char *coords)
|
||||
{
|
||||
MapArea *a = New(MapArea);
|
||||
#ifdef MENU_MAP
|
||||
#ifdef USE_IMAGE
|
||||
char *p;
|
||||
int i, max;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
a->url = url;
|
||||
a->target = target;
|
||||
a->alt = alt ? alt : "";
|
||||
#ifdef MENU_MAP
|
||||
#ifdef USE_IMAGE
|
||||
a->shape = SHAPE_RECT;
|
||||
if (shape) {
|
||||
@@ -316,11 +382,39 @@ newMapArea(char *url, char *target, char *alt, char *shape, char *coords)
|
||||
a->center_x /= a->ncoords / 2;
|
||||
a->center_y /= a->ncoords / 2;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
/* append image map links */
|
||||
static void
|
||||
append_map_info(Buffer *buf, Str tmp, FormItemList *fi)
|
||||
{
|
||||
MapList *ml;
|
||||
ListItem *al;
|
||||
MapArea *a;
|
||||
ParsedURL pu;
|
||||
char *url;
|
||||
|
||||
ml = searchMapList(buf, fi->value ? fi->value->ptr : NULL);
|
||||
if (ml == NULL)
|
||||
return;
|
||||
|
||||
Strcat_charp(tmp, "<tr><td colspan=2>Links of current image map");
|
||||
Strcat_charp(tmp, "<tr><td colspan=2><table>");
|
||||
for (al = ml->area->first; al != NULL; al = al->next) {
|
||||
a = (MapArea *) al->ptr;
|
||||
if (!a)
|
||||
continue;
|
||||
parseURL2(a->url, &pu, baseURL(buf));
|
||||
url = html_quote(parsedURL2Str(&pu)->ptr);
|
||||
Strcat_m_charp(tmp, "<tr><td> <td>",
|
||||
html_quote(a->alt), "<td><a href=\"", url, "\">", url,
|
||||
"</a>\n", NULL);
|
||||
}
|
||||
Strcat_charp(tmp, "</table>");
|
||||
}
|
||||
|
||||
/* append frame URL */
|
||||
static void
|
||||
append_frame_info(Buffer *buf, Str html, struct frameset *set, int level)
|
||||
@@ -436,9 +530,13 @@ page_info_panel(Buffer *buf)
|
||||
}
|
||||
a = retrieveCurrentForm(buf);
|
||||
if (a != NULL) {
|
||||
s = Strnew_charp(form2str((FormItemList *)a->url));
|
||||
FormItemList *fi = (FormItemList *)a->url;
|
||||
s = Strnew_charp(form2str(fi));
|
||||
Strcat_charp(tmp, "<tr><td nowrap>Method/type of current form<td>");
|
||||
Strcat_charp(tmp, html_quote(s->ptr));
|
||||
if (fi->parent->method == FORM_METHOD_INTERNAL &&
|
||||
!Strcmp_charp(fi->parent->action, "map"))
|
||||
append_map_info(buf, tmp, fi->parent->item);
|
||||
}
|
||||
Strcat_charp(tmp, "</table>\n");
|
||||
if (buf->document_header != NULL) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: proto.h,v 1.55 2002/11/15 15:19:46 ukai Exp $ */
|
||||
/* $Id: proto.h,v 1.56 2002/11/19 17:40:34 ukai Exp $ */
|
||||
/*
|
||||
* This file was automatically generated by version 1.7 of cextract.
|
||||
* Manual editing not recommended.
|
||||
@@ -360,15 +360,16 @@ extern void form_write_data(FILE * f, char *boundary, char *name, char *value);
|
||||
extern void form_write_from_file(FILE * f, char *boundary, char *name,
|
||||
char *filename, char *file);
|
||||
extern void follow_map(struct parsed_tagarg *arg);
|
||||
#ifdef MENU_MAP
|
||||
extern MapArea *follow_map_menu(Buffer *buf, struct parsed_tagarg *arg,
|
||||
Anchor *a_img, int x, int y);
|
||||
#else
|
||||
extern Buffer *follow_map_panel(Buffer *buf, struct parsed_tagarg *arg);
|
||||
extern MapArea *follow_map_menu(Buffer *buf, char *name, Anchor *a_img, int x,
|
||||
int y);
|
||||
#ifndef MENU_MAP
|
||||
extern Buffer *follow_map_panel(Buffer *buf, char *name);
|
||||
#endif
|
||||
#ifdef USE_IMAGE
|
||||
extern int getMapXY(Buffer *buf, Anchor *a, int *x, int *y);
|
||||
extern Str getCurrentMapLabel(Buffer *buf);
|
||||
#endif
|
||||
extern Anchor *retrieveCurrentMap(Buffer *buf);
|
||||
extern MapArea *newMapArea(char *url, char *target, char *alt, char *shape,
|
||||
char *coords);
|
||||
extern Buffer *page_info_panel(Buffer *buf);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: rc.c,v 1.64 2002/11/18 17:26:10 ukai Exp $ */
|
||||
/* $Id: rc.c,v 1.65 2002/11/19 17:40:34 ukai Exp $ */
|
||||
/*
|
||||
* Initialization file etc.
|
||||
*/
|
||||
@@ -76,6 +76,7 @@ static char *config_file = NULL;
|
||||
#define CMT_EXT_IMAGE_VIEWER "画像を外部ビューワで表示"
|
||||
#define CMT_IMAGE_SCALE "画像のスケール(%)"
|
||||
#define CMT_IMGDISPLAY "画像を表示するためのコマンド"
|
||||
#define CMT_IMAGE_MAP_LIST "イメージマップのリンク先一覧を表示"
|
||||
#endif
|
||||
#define CMT_MULTICOL "ファイル名のマルチカラム表示"
|
||||
#define CMT_ALT_ENTITY "エンティティを ASCII の代替表現で表す"
|
||||
@@ -229,6 +230,7 @@ static char *config_file = NULL;
|
||||
#define CMT_EXT_IMAGE_VIEWER "Use external image viewer"
|
||||
#define CMT_IMAGE_SCALE "Scale of image (%)"
|
||||
#define CMT_IMGDISPLAY "External command to display image"
|
||||
#define CMT_IMAGE_MAP_LIST "Use link list of image map"
|
||||
#endif
|
||||
#define CMT_MULTICOL "Display file names in multi-column format"
|
||||
#define CMT_ALT_ENTITY "Use ASCII equivalents to display entities"
|
||||
@@ -539,6 +541,8 @@ struct param_ptr params1[] = {
|
||||
NULL},
|
||||
{"imgdisplay", P_STRING, PI_TEXT, (void *)&Imgdisplay, CMT_IMGDISPLAY,
|
||||
NULL},
|
||||
{"image_map_list", P_INT, PI_ONOFF, (void *)&image_map_list,
|
||||
CMT_IMAGE_MAP_LIST, NULL},
|
||||
#endif
|
||||
{"show_lnum", P_INT, PI_ONOFF, (void *)&showLineNum, CMT_SHOW_NUM, NULL},
|
||||
{"show_srch_str", P_INT, PI_ONOFF, (void *)&show_srch_str,
|
||||
|
||||
Reference in New Issue
Block a user