[w3m-dev 03529] Support of title, accesskey of anchor

* anchor.c (putAnchor): arg title, key
			initialize slave
	(registerHref): arg title, key
	(registerName): title = NULL, key = '\0'
	(registerForm): title = NULL, key = '\0'
	(_put_anchor_news): title = NULL, key = '\0'
	(_put_anchor_all): title = NULL, key = '\0'
	(addMultirowsImg): register title, accesskey
	(addMultirowsForm): title = NULL, key = '\0'
	(getAnchorText): added
* display.c (displayBuffer): show title if any
* file.c (set_breakpoint): use bcopy
	(back_to_breakpoint): use bcopy
	(flushline): s/anchor/anchor.url/
		     s/anchor_hseq/anchor.hseq/
		     s/anchor_target/anchor.target/
		     add anchor.*
	(close_effect0): s/anchor/anchor.url/
			s/anchor_hseq/anchor.hseq/
	(close_anchor): use bzero
	(process_img): ATTR_TITLE,
	(HTMLtagproc1): s/anchor/anchor.url/
			target, referer, title, accesskey, hseq
	(HTMLlineproc2body): ATTR_TITLE, ATTR_ACCESSKEY
	(init_henv): use bzero
* fm.h (Anchor): add title, accesskey, slave
	(Breakpoint): use Anchor
	(struct readbuffer): use Anchor
* funcname.tab (ACCESSKEY): added
	(LINK_MENU): added
* html.c (ALST_A): add ATTR_TITLE, ATTR_ACCESSKEY
	(ALST_IMG): add ATTR_TITLE
	(ALST_IMG_ALT): add ATTR_TITLE
	(AttrMAP): add accesskey, renum
* html.h (ATTR_ACCESSKEY): added
	(ATTR_*): renum 50->60
* main.c (linkMn): added
	(accessKey): added
* menu.c (LinkMenu): deleted
	(LinkV): deleted
	(initLinkMenu): deleted
	(lmGoURL): deleted
	(popupMenu): delete initLinkMenu()
	(initMenu): delete Link
	(link_menu): added
	(accesskey_menu): added
* proto.h (linkMn): added
	(link_menu): added
	(accessKey): added
	(accesskey_menu): added
	(putAnchor): arg title, key
	(registerHref): arg title, key
	(registerImg): arg title
	(getAnchorText): added
* doc/README.func (ACCESSKEY): added
		(LINK_MENU): added
* doc-jp/README.func (ACCESSKEY): added
		(LINK_MENU): added
* scripts/w3mhelp.cgi.in (Hyperlink operation): add linkMn accessKey
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2002-12-05 16:29:02 +00:00
parent dd4e9f38d1
commit d02a0802cd
14 changed files with 460 additions and 193 deletions
+64 -1
View File
@@ -1,3 +1,66 @@
2002-12-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03529] Support of title, accesskey of anchor
* anchor.c (putAnchor): arg title, key
initialize slave
(registerHref): arg title, key
(registerName): title = NULL, key = '\0'
(registerForm): title = NULL, key = '\0'
(_put_anchor_news): title = NULL, key = '\0'
(_put_anchor_all): title = NULL, key = '\0'
(addMultirowsImg): register title, accesskey
(addMultirowsForm): title = NULL, key = '\0'
(getAnchorText): added
* display.c (displayBuffer): show title if any
* file.c (set_breakpoint): use bcopy
(back_to_breakpoint): use bcopy
(flushline): s/anchor/anchor.url/
s/anchor_hseq/anchor.hseq/
s/anchor_target/anchor.target/
add anchor.*
(close_effect0): s/anchor/anchor.url/
s/anchor_hseq/anchor.hseq/
(close_anchor): use bzero
(process_img): ATTR_TITLE,
(HTMLtagproc1): s/anchor/anchor.url/
target, referer, title, accesskey, hseq
(HTMLlineproc2body): ATTR_TITLE, ATTR_ACCESSKEY
(init_henv): use bzero
* fm.h (Anchor): add title, accesskey, slave
(Breakpoint): use Anchor
(struct readbuffer): use Anchor
* funcname.tab (ACCESSKEY): added
(LINK_MENU): added
* html.c (ALST_A): add ATTR_TITLE, ATTR_ACCESSKEY
(ALST_IMG): add ATTR_TITLE
(ALST_IMG_ALT): add ATTR_TITLE
(AttrMAP): add accesskey, renum
* html.h (ATTR_ACCESSKEY): added
(ATTR_*): renum 50->60
* main.c (linkMn): added
(accessKey): added
* menu.c (LinkMenu): deleted
(LinkV): deleted
(initLinkMenu): deleted
(lmGoURL): deleted
(popupMenu): delete initLinkMenu()
(initMenu): delete Link
(link_menu): added
(accesskey_menu): added
* proto.h (linkMn): added
(link_menu): added
(accessKey): added
(accesskey_menu): added
(putAnchor): arg title, key
(registerHref): arg title, key
(registerImg): arg title
(getAnchorText): added
* doc/README.func (ACCESSKEY): added
(LINK_MENU): added
* doc-jp/README.func (ACCESSKEY): added
(LINK_MENU): added
* scripts/w3mhelp.cgi.in (Hyperlink operation): add linkMn accessKey
2002-12-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> 2002-12-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03528] area without alt * [w3m-dev 03528] area without alt
@@ -5470,4 +5533,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.592 2002/12/05 16:08:34 ukai Exp $ $Id: ChangeLog,v 1.593 2002/12/05 16:29:02 ukai Exp $
+59 -18
View File
@@ -1,4 +1,4 @@
/* $Id: anchor.c,v 1.11 2002/09/05 15:43:21 ukai Exp $ */ /* $Id: anchor.c,v 1.12 2002/12/05 16:29:04 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "myctype.h" #include "myctype.h"
#include "regex.h" #include "regex.h"
@@ -7,7 +7,7 @@
AnchorList * AnchorList *
putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return, putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return,
char *referer, int line, int pos) char *referer, char *title, unsigned char key, int line, int pos)
{ {
int n, i, j; int n, i, j;
Anchor *a; Anchor *a;
@@ -44,6 +44,9 @@ putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return,
a->url = url; a->url = url;
a->target = target; a->target = target;
a->referer = referer; a->referer = referer;
a->title = title;
a->accesskey = key;
a->slave = FALSE;
a->start = bp; a->start = bp;
a->end = bp; a->end = bp;
al->nanchor++; al->nanchor++;
@@ -54,11 +57,12 @@ putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return,
Anchor * Anchor *
registerHref(Buffer *buf, char *url, char *target, char *referer, int line, registerHref(Buffer *buf, char *url, char *target, char *referer, char *title,
int pos) unsigned char key, int line, int pos)
{ {
Anchor *a; Anchor *a;
buf->href = putAnchor(buf->href, url, target, &a, referer, line, pos); buf->href = putAnchor(buf->href, url, target, &a, referer, title, key,
line, pos);
return a; return a;
} }
@@ -66,15 +70,17 @@ Anchor *
registerName(Buffer *buf, char *url, int line, int pos) registerName(Buffer *buf, char *url, int line, int pos)
{ {
Anchor *a; Anchor *a;
buf->name = putAnchor(buf->name, url, NULL, &a, NULL, line, pos); buf->name = putAnchor(buf->name, url, NULL, &a, NULL, NULL, '\0', line,
pos);
return a; return a;
} }
Anchor * Anchor *
registerImg(Buffer *buf, char *url, int line, int pos) registerImg(Buffer *buf, char *url, char *title, int line, int pos)
{ {
Anchor *a; Anchor *a;
buf->img = putAnchor(buf->img, url, NULL, &a, NULL, line, pos); buf->img = putAnchor(buf->img, url, NULL, &a, NULL, title, '\0', line,
pos);
return a; return a;
} }
@@ -88,8 +94,8 @@ registerForm(Buffer *buf, FormList *flist, struct parsed_tag *tag, int line,
fi = formList_addInput(flist, tag); fi = formList_addInput(flist, tag);
if (fi == NULL) if (fi == NULL)
return NULL; return NULL;
buf->formitem = putAnchor(buf->formitem, buf->formitem = putAnchor(buf->formitem, (char *)fi, flist->target, &a,
(char *)fi, flist->target, &a, NULL, line, pos); NULL, NULL, '\0', line, pos);
return a; return a;
} }
@@ -193,15 +199,16 @@ _put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos)
tmp = Strnew_size(sizeof("news:") - 1 + (p2 - p1)); tmp = Strnew_size(sizeof("news:") - 1 + (p2 - p1));
Strcat_charp_n(tmp, "news:", sizeof("news:") - 1); Strcat_charp_n(tmp, "news:", sizeof("news:") - 1);
Strcat_charp_n(tmp, p1, p2 - p1); Strcat_charp_n(tmp, p1, p2 - p1);
return registerHref(buf, tmp->ptr, NULL, NO_REFERER, line, pos); return registerHref(buf, tmp->ptr, NULL, NO_REFERER, NULL, '\0', line,
pos);
} }
#endif /* USE_NNTP */ #endif /* USE_NNTP */
static Anchor * static Anchor *
_put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos) _put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos)
{ {
return registerHref(buf, allocStr(p1, p2 - p1), NULL, NO_REFERER, line, return registerHref(buf, allocStr(p1, p2 - p1), NULL, NO_REFERER, NULL,
pos); '\0', line, pos);
} }
static void static void
@@ -471,7 +478,7 @@ addMultirowsImg(Buffer *buf, AnchorList *al)
if (a_img.start.line == l->linenumber) if (a_img.start.line == l->linenumber)
continue; continue;
pos = columnPos(l, col); pos = columnPos(l, col);
a = registerImg(buf, a_img.url, l->linenumber, pos); a = registerImg(buf, a_img.url, a_img.title, l->linenumber, pos);
a->hseq = -a_img.hseq; a->hseq = -a_img.hseq;
a->image = img; a->image = img;
a->end.pos = pos + ecol - col; a->end.pos = pos + ecol - col;
@@ -479,15 +486,17 @@ addMultirowsImg(Buffer *buf, AnchorList *al)
l->propBuf[k] |= PE_IMAGE; l->propBuf[k] |= PE_IMAGE;
if (a_href.url) { if (a_href.url) {
a = registerHref(buf, a_href.url, a_href.target, a = registerHref(buf, a_href.url, a_href.target,
a_href.referer, l->linenumber, pos); a_href.referer, a_href.title,
a_href.accesskey, l->linenumber, pos);
a->hseq = a_href.hseq; a->hseq = a_href.hseq;
a->slave = TRUE;
a->end.pos = pos + ecol - col; a->end.pos = pos + ecol - col;
for (k = pos; k < a->end.pos; k++) for (k = pos; k < a->end.pos; k++)
l->propBuf[k] |= PE_ANCHOR; l->propBuf[k] |= PE_ANCHOR;
} }
if (a_form.url) { if (a_form.url) {
buf->formitem = putAnchor(buf->formitem, a_form.url, buf->formitem = putAnchor(buf->formitem, a_form.url,
a_form.target, &a, NULL, a_form.target, &a, NULL, NULL, '\0',
l->linenumber, pos); l->linenumber, pos);
a->hseq = a_form.hseq; a->hseq = a_form.hseq;
a->end.pos = pos + ecol - col; a->end.pos = pos + ecol - col;
@@ -542,8 +551,8 @@ addMultirowsForm(Buffer *buf, AnchorList *al)
if (a_form.start.line == l->linenumber) if (a_form.start.line == l->linenumber)
continue; continue;
buf->formitem = putAnchor(buf->formitem, a_form.url, buf->formitem = putAnchor(buf->formitem, a_form.url,
a_form.target, &a, NULL, l->linenumber, a_form.target, &a, NULL, NULL, '\0',
pos); l->linenumber, pos);
a->hseq = a_form.hseq; a->hseq = a_form.hseq;
a->y = a_form.y; a->y = a_form.y;
a->end.pos = pos + ecol - col; a->end.pos = pos + ecol - col;
@@ -554,3 +563,35 @@ addMultirowsForm(Buffer *buf, AnchorList *al)
} }
} }
} }
char *
getAnchorText(Buffer *buf, Anchor *a)
{
AnchorList *al = buf->href;
int hseq, i;
Line *l;
Str tmp = NULL;
if (!a || a->hseq < 0)
return NULL;
hseq = a->hseq;
l = buf->firstLine;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
if (a->hseq != hseq)
continue;
for (; l; l = l->next) {
if (l->linenumber == a->start.line)
break;
}
if (!l)
break;
if (!tmp)
tmp = Strnew_size(a->end.pos - a->start.pos);
else
Strcat_char(tmp, ' ');
Strcat_charp_n(tmp, &l->lineBuf[a->start.pos],
a->end.pos - a->start.pos);
}
return tmp ? tmp->ptr : NULL;
}
+11 -2
View File
@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.43 2002/12/04 16:45:41 ukai Exp $ */ /* $Id: display.c,v 1.44 2002/12/05 16:29:04 ukai Exp $ */
#include <signal.h> #include <signal.h>
#include "fm.h" #include "fm.h"
@@ -348,10 +348,19 @@ displayBuffer(Buffer *buf, int mode)
#endif #endif
{ {
Anchor *a = retrieveCurrentAnchor(buf); Anchor *a = retrieveCurrentAnchor(buf);
if (a && a->title && *a->title)
s = Sprintf("[%s] ", a->title);
else {
Anchor *a_img = retrieveCurrentImg(buf);
if (a_img && a_img->title && *a_img->title)
s = Sprintf("[%s]%s", a_img->title, a ? " " : "");
}
if (a) { if (a) {
ParsedURL pu; ParsedURL pu;
parseURL2(a->url, &pu, baseURL(buf)); parseURL2(a->url, &pu, baseURL(buf));
s = parsedURL2Str(&pu); if (!s)
s = Strnew();
Strcat(s, parsedURL2Str(&pu));
} }
} }
} }
+2
View File
@@ -1,4 +1,5 @@
ABORT 確認せずにw3mを終了します ABORT 確認せずにw3mを終了します
ACCESSKEY Accesskey メニューを立ち上げます
ALARM アラームを設定します ALARM アラームを設定します
ADD_BOOKMARK 現在見ているページをブックマークに追加します ADD_BOOKMARK 現在見ているページをブックマークに追加します
BACK 一つ前のバッファを表示します BACK 一つ前のバッファを表示します
@@ -43,6 +44,7 @@ LINE_END
LINE_INFO ページ中での現在位置を表示します LINE_INFO ページ中での現在位置を表示します
LINK_BEGIN 最初のリンクに移動します LINK_BEGIN 最初のリンクに移動します
LINK_END 最後のリンクに移動します LINK_END 最後のリンクに移動します
LINK_MENU Link メニューを立ち上げます
LOAD ローカルファイルを指定して開きます LOAD ローカルファイルを指定して開きます
MAIN_MENU メニューを立ち上げます MAIN_MENU メニューを立ち上げます
MARK マークを設定/解除します MARK マークを設定/解除します
+2
View File
@@ -1,4 +1,5 @@
ABORT Quit w3m without confirmation ABORT Quit w3m without confirmation
ACCESSSKEY Popup acceskey menu
ADD_BOOKMARK Add current page to bookmark ADD_BOOKMARK Add current page to bookmark
ALARM Set alarm ALARM Set alarm
BACK Back to previous buffer BACK Back to previous buffer
@@ -43,6 +44,7 @@ LINE_END Go to the end of line
LINE_INFO Show current line number LINE_INFO Show current line number
LINK_BEGIN Go to the first link LINK_BEGIN Go to the first link
LINK_END Go to the last link LINK_END Go to the last link
LINK_MENU Popup link element menu
LOAD Load local file LOAD Load local file
MAIN_MENU Popup menu MAIN_MENU Popup menu
MARK Set/unset mark MARK Set/unset mark
+72 -46
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.145 2002/12/04 17:00:48 ukai Exp $ */ /* $Id: file.c,v 1.146 2002/12/05 16:29:05 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -2243,9 +2243,8 @@ set_breakpoint(struct readbuffer *obuf, int tag_length)
if (!obuf->bp.init_flag) if (!obuf->bp.init_flag)
return; return;
obuf->bp.anchor = obuf->anchor; bcopy((void *)&obuf->anchor, (void *)&obuf->bp.anchor,
obuf->bp.anchor_target = obuf->anchor_target; sizeof(obuf->anchor));
obuf->bp.anchor_hseq = obuf->anchor_hseq;
obuf->bp.img_alt = obuf->img_alt; obuf->bp.img_alt = obuf->img_alt;
obuf->bp.in_bold = obuf->in_bold; obuf->bp.in_bold = obuf->in_bold;
obuf->bp.in_under = obuf->in_under; obuf->bp.in_under = obuf->in_under;
@@ -2258,9 +2257,8 @@ static void
back_to_breakpoint(struct readbuffer *obuf) back_to_breakpoint(struct readbuffer *obuf)
{ {
obuf->flag = obuf->bp.flag; obuf->flag = obuf->bp.flag;
obuf->anchor = obuf->bp.anchor; bcopy((void *)&obuf->bp.anchor, (void *)&obuf->anchor,
obuf->anchor_target = obuf->bp.anchor_target; sizeof(obuf->anchor));
obuf->anchor_hseq = obuf->bp.anchor_hseq;
obuf->img_alt = obuf->bp.img_alt; obuf->img_alt = obuf->bp.img_alt;
obuf->in_bold = obuf->bp.in_bold; obuf->in_bold = obuf->bp.in_bold;
obuf->in_under = obuf->bp.in_under; obuf->in_under = obuf->bp.in_under;
@@ -2529,7 +2527,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
append_tags(obuf); append_tags(obuf);
if (obuf->anchor) if (obuf->anchor.url)
hidden = hidden_anchor = has_hidden_link(obuf, HTML_A); hidden = hidden_anchor = has_hidden_link(obuf, HTML_A);
if (obuf->img_alt) { if (obuf->img_alt) {
if ((hidden_img = has_hidden_link(obuf, HTML_IMG_ALT)) != NULL) { if ((hidden_img = has_hidden_link(obuf, HTML_IMG_ALT)) != NULL) {
@@ -2566,7 +2564,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
} }
} }
if (obuf->anchor && !hidden_anchor) if (obuf->anchor.url && !hidden_anchor)
Strcat_charp(line, "</a>"); Strcat_charp(line, "</a>");
if (obuf->img_alt && !hidden_img) if (obuf->img_alt && !hidden_img)
Strcat_charp(line, "</img_alt>"); Strcat_charp(line, "</img_alt>");
@@ -2739,15 +2737,31 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
fillline(obuf, indent); fillline(obuf, indent);
if (pass) if (pass)
passthrough(obuf, pass->ptr, 0); passthrough(obuf, pass->ptr, 0);
if (!hidden_anchor && obuf->anchor) { if (!hidden_anchor && obuf->anchor.url) {
Str tmp; Str tmp;
if (obuf->anchor_hseq > 0) if (obuf->anchor.hseq > 0)
obuf->anchor_hseq = -obuf->anchor_hseq; obuf->anchor.hseq = -obuf->anchor.hseq;
tmp = Sprintf("<A HSEQ=\"%d\" HREF=\"", obuf->anchor_hseq); tmp = Sprintf("<A HSEQ=\"%d\" HREF=\"", obuf->anchor.hseq);
Strcat_charp(tmp, html_quote(obuf->anchor->ptr)); Strcat_charp(tmp, html_quote(obuf->anchor.url));
if (obuf->anchor_target) { if (obuf->anchor.target) {
Strcat_charp(tmp, "\" TARGET=\""); Strcat_charp(tmp, "\" TARGET=\"");
Strcat_charp(tmp, html_quote(obuf->anchor_target->ptr)); Strcat_charp(tmp, html_quote(obuf->anchor.target));
}
if (obuf->anchor.referer) {
Strcat_charp(tmp, "\" REFERER=\"");
Strcat_charp(tmp, html_quote(obuf->anchor.referer));
}
if (obuf->anchor.title) {
Strcat_charp(tmp, "\" TITLE=\"");
Strcat_charp(tmp, html_quote(obuf->anchor.title));
}
if (obuf->anchor.accesskey) {
char *c = html_quote_char(obuf->anchor.accesskey);
Strcat_charp(tmp, "\" ACCESSKEY=\"");
if (c)
Strcat_charp(tmp, c);
else
Strcat_char(tmp, obuf->anchor.accesskey);
} }
Strcat_charp(tmp, "\">"); Strcat_charp(tmp, "\">");
push_tag(obuf, tmp->ptr, HTML_A); push_tag(obuf, tmp->ptr, HTML_A);
@@ -2832,7 +2846,7 @@ close_effect0(struct readbuffer *obuf, int cmd)
static void static void
close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf) close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf)
{ {
if (obuf->anchor) { if (obuf->anchor.url) {
int i; int i;
char *p = NULL; char *p = NULL;
int is_erased = 0; int is_erased = 0;
@@ -2841,14 +2855,14 @@ close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf)
if (obuf->tag_stack[i]->cmd == HTML_A) if (obuf->tag_stack[i]->cmd == HTML_A)
break; break;
} }
if (i < 0 && obuf->anchor_hseq > 0 && Strlastchar(obuf->line) == ' ') { if (i < 0 && obuf->anchor.hseq > 0 && Strlastchar(obuf->line) == ' ') {
Strshrink(obuf->line, 1); Strshrink(obuf->line, 1);
obuf->pos--; obuf->pos--;
is_erased = 1; is_erased = 1;
} }
if (i >= 0 || (p = has_hidden_link(obuf, HTML_A))) { if (i >= 0 || (p = has_hidden_link(obuf, HTML_A))) {
if (obuf->anchor_hseq > 0) { if (obuf->anchor.hseq > 0) {
HTMLlineproc1(ANSP, h_env); HTMLlineproc1(ANSP, h_env);
obuf->prevchar = ' '; obuf->prevchar = ' ';
} }
@@ -2861,8 +2875,7 @@ close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf)
else { else {
passthrough(obuf, p, 1); passthrough(obuf, p, 1);
} }
obuf->anchor = NULL; bzero((void *)&obuf->anchor, sizeof(obuf->anchor));
obuf->anchor_target = NULL;
return; return;
} }
is_erased = 0; is_erased = 0;
@@ -2873,9 +2886,8 @@ close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf)
} }
push_tag(obuf, "</a>", HTML_N_A); push_tag(obuf, "</a>", HTML_N_A);
obuf->anchor = NULL;
} }
obuf->anchor_target = NULL; bzero((void *)&obuf->anchor, sizeof(obuf->anchor));
} }
void void
@@ -2909,7 +2921,7 @@ restore_fonteffect(struct html_feed_environ *h_env, struct readbuffer *obuf)
Str Str
process_img(struct parsed_tag *tag, int width) process_img(struct parsed_tag *tag, int width)
{ {
char *p, *q, *r, *r2 = NULL, *s; char *p, *q, *r, *r2 = NULL, *s, *t;
#ifdef USE_IMAGE #ifdef USE_IMAGE
int w, i, nw, ni = 1, n, w0 = -1, i0 = -1; int w, i, nw, ni = 1, n, w0 = -1, i0 = -1;
int align, xoffset, yoffset, top, bottom, ismap = 0; int align, xoffset, yoffset, top, bottom, ismap = 0;
@@ -2925,6 +2937,8 @@ process_img(struct parsed_tag *tag, int width)
p = remove_space(p); p = remove_space(p);
q = NULL; q = NULL;
parsedtag_get_value(tag, ATTR_ALT, &q); parsedtag_get_value(tag, ATTR_ALT, &q);
t = q;
parsedtag_get_value(tag, ATTR_TITLE, &t);
w = -1; w = -1;
if (parsedtag_get_value(tag, ATTR_WIDTH, &w)) { if (parsedtag_get_value(tag, ATTR_WIDTH, &w)) {
if (w < 0) { if (w < 0) {
@@ -3053,6 +3067,11 @@ process_img(struct parsed_tag *tag, int width)
} }
Strcat_charp(tmp, html_quote(p)); Strcat_charp(tmp, html_quote(p));
Strcat_charp(tmp, "\""); Strcat_charp(tmp, "\"");
if (t) {
Strcat_charp(tmp, " title=\"");
Strcat_charp(tmp, html_quote(t));
Strcat_charp(tmp, "\"");
}
#ifdef USE_IMAGE #ifdef USE_IMAGE
if (use_image) { if (use_image) {
if (w0 >= 0) if (w0 >= 0)
@@ -4441,20 +4460,26 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->end_tag = 0; obuf->end_tag = 0;
return 1; return 1;
case HTML_A: case HTML_A:
if (obuf->anchor) if (obuf->anchor.url)
close_anchor(h_env, obuf); close_anchor(h_env, obuf);
hseq = 0; hseq = 0;
if (parsedtag_get_value(tag, ATTR_HREF, &p)) if (parsedtag_get_value(tag, ATTR_HREF, &p))
obuf->anchor = Strnew_charp(p); obuf->anchor.url = Strnew_charp(p)->ptr;
if (parsedtag_get_value(tag, ATTR_TARGET, &p)) if (parsedtag_get_value(tag, ATTR_TARGET, &p))
obuf->anchor_target = Strnew_charp(p); obuf->anchor.target = Strnew_charp(p)->ptr;
if (parsedtag_get_value(tag, ATTR_REFERER, &p))
obuf->anchor.referer = Strnew_charp(p)->ptr;
if (parsedtag_get_value(tag, ATTR_TITLE, &p))
obuf->anchor.title = Strnew_charp(p)->ptr;
if (parsedtag_get_value(tag, ATTR_ACCESSKEY, &p))
obuf->anchor.accesskey = (unsigned char)*p;
if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq)) if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq))
obuf->anchor_hseq = hseq; obuf->anchor.hseq = hseq;
if (hseq == 0 && obuf->anchor) { if (hseq == 0 && obuf->anchor.url) {
obuf->anchor_hseq = cur_hseq; obuf->anchor.hseq = cur_hseq;
tmp = process_anchor(tag, h_env->tagbuf->ptr); tmp = process_anchor(tag, h_env->tagbuf->ptr);
push_tag(obuf, tmp->ptr, HTML_A); push_tag(obuf, tmp->ptr, HTML_A);
return 1; return 1;
@@ -4951,8 +4976,9 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
idFrame = NULL; idFrame = NULL;
} }
} }
p = r = NULL; p = r = s = NULL;
q = buf->baseTarget; q = buf->baseTarget;
t = "";
hseq = 0; hseq = 0;
id = NULL; id = NULL;
if (parsedtag_get_value(tag, ATTR_NAME, &id)) { if (parsedtag_get_value(tag, ATTR_NAME, &id)) {
@@ -4967,6 +4993,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
q = url_quote_conv(q, buf->document_code); q = url_quote_conv(q, buf->document_code);
if (parsedtag_get_value(tag, ATTR_REFERER, &r)) if (parsedtag_get_value(tag, ATTR_REFERER, &r))
r = url_quote_conv(r, buf->document_code); r = url_quote_conv(r, buf->document_code);
parsedtag_get_value(tag, ATTR_TITLE, &s);
parsedtag_get_value(tag, ATTR_ACCESSKEY, &t);
parsedtag_get_value(tag, ATTR_HSEQ, &hseq); parsedtag_get_value(tag, ATTR_HSEQ, &hseq);
if (hseq > 0) if (hseq > 0)
buf->hmarklist = buf->hmarklist =
@@ -4974,16 +5002,15 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
pos, hseq - 1); pos, hseq - 1);
if (id && idFrame) if (id && idFrame)
idFrame->body->nameList = idFrame->body->nameList =
putAnchor(idFrame->body->nameList, putAnchor(idFrame->body->nameList, id, NULL,
id, (Anchor **)NULL, NULL, NULL, '\0',
NULL, currentLn(buf), pos);
(Anchor **)NULL,
NULL, currentLn(buf), pos);
if (p) { if (p) {
effect |= PE_ANCHOR; effect |= PE_ANCHOR;
a_href = registerHref(buf, remove_space(p), q, a_href = registerHref(buf, remove_space(p), q, r, s,
r, currentLn(buf), pos); *t, currentLn(buf), pos);
a_href->hseq = ((hseq > 0) ? hseq : -hseq) - 1; a_href->hseq = ((hseq > 0) ? hseq : -hseq) - 1;
a_href->slave = (hseq > 0) ? FALSE : TRUE;
} }
break; break;
case HTML_N_A: case HTML_N_A:
@@ -5024,9 +5051,11 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
iseq - 1); iseq - 1);
} }
#endif #endif
s = NULL;
parsedtag_get_value(tag, ATTR_TITLE, &s);
p = remove_space(p); p = remove_space(p);
p = url_quote_conv(p, buf->document_code); p = url_quote_conv(p, buf->document_code);
a_img = registerImg(buf, p, currentLn(buf), pos); a_img = registerImg(buf, p, s, currentLn(buf), pos);
#ifdef USE_IMAGE #ifdef USE_IMAGE
a_img->hseq = iseq; a_img->hseq = iseq;
a_img->image = NULL; a_img->image = NULL;
@@ -5330,10 +5359,9 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
} }
if (id && idFrame) if (id && idFrame)
idFrame->body->nameList = idFrame->body->nameList =
putAnchor(idFrame->body->nameList, putAnchor(idFrame->body->nameList, id, NULL,
id, (Anchor **)NULL, NULL, NULL, '\0',
NULL, currentLn(buf), pos);
(Anchor **)NULL, NULL, currentLn(buf), pos);
#endif /* ID_EXT */ #endif /* ID_EXT */
} }
} }
@@ -6069,9 +6097,7 @@ init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf,
obuf->status = R_ST_NORMAL; obuf->status = R_ST_NORMAL;
obuf->table_level = -1; obuf->table_level = -1;
obuf->nobr_level = 0; obuf->nobr_level = 0;
obuf->anchor = 0; bzero((void *)&obuf->anchor, sizeof(obuf->anchor));
obuf->anchor_target = 0;
obuf->anchor_hseq = 0;
obuf->img_alt = 0; obuf->img_alt = 0;
obuf->in_bold = 0; obuf->in_bold = 0;
obuf->in_under = 0; obuf->in_under = 0;
+6 -7
View File
@@ -1,4 +1,4 @@
/* $Id: fm.h,v 1.92 2002/12/04 17:00:50 ukai Exp $ */ /* $Id: fm.h,v 1.93 2002/12/05 16:29:06 ukai Exp $ */
/* /*
* w3m: WWW wo Miru utility * w3m: WWW wo Miru utility
* *
@@ -358,9 +358,12 @@ typedef struct _anchor {
char *url; char *url;
char *target; char *target;
char *referer; char *referer;
char *title;
unsigned char accesskey;
BufferPoint start; BufferPoint start;
BufferPoint end; BufferPoint end;
int hseq; int hseq;
char slave;
short y; short y;
short rows; short rows;
#ifdef USE_IMAGE #ifdef USE_IMAGE
@@ -513,9 +516,7 @@ typedef struct {
int len; int len;
int tlen; int tlen;
long flag; long flag;
Str anchor; Anchor anchor;
Str anchor_target;
short anchor_hseq;
Str img_alt; Str img_alt;
char fontstat[FONTSTAT_SIZE]; char fontstat[FONTSTAT_SIZE];
short nobr_level; short nobr_level;
@@ -537,9 +538,7 @@ struct readbuffer {
unsigned char end_tag; unsigned char end_tag;
short table_level; short table_level;
short nobr_level; short nobr_level;
Str anchor; Anchor anchor;
Str anchor_target;
short anchor_hseq;
Str img_alt; Str img_alt;
char fontstat[FONTSTAT_SIZE]; char fontstat[FONTSTAT_SIZE];
char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE]; char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE];
+3 -1
View File
@@ -1,8 +1,9 @@
# $Id: funcname.tab,v 1.16 2002/12/03 16:01:35 ukai Exp $ # $Id: funcname.tab,v 1.17 2002/12/05 16:29:07 ukai Exp $
# macro name function name # macro name function name
#---------------------------- #----------------------------
@@@ nulcmd @@@ nulcmd
ABORT quitfm ABORT quitfm
ACCESSKEY accessKey
ADD_BOOKMARK adBmark ADD_BOOKMARK adBmark
ALARM setAlarm ALARM setAlarm
BACK backBf BACK backBf
@@ -48,6 +49,7 @@ LINE_END linend
LINE_INFO curlno LINE_INFO curlno
LINK_BEGIN topA LINK_BEGIN topA
LINK_END lastA LINK_END lastA
LINK_MENU linkMn
LOAD ldfile LOAD ldfile
MAIN_MENU mainMn MAIN_MENU mainMn
MARK _mark MARK _mark
+32 -21
View File
@@ -1,4 +1,4 @@
/* $Id: html.c,v 1.18 2002/12/03 15:35:10 ukai Exp $ */ /* $Id: html.c,v 1.19 2002/12/05 16:29:07 ukai Exp $ */
#include "html.h" #include "html.h"
/* Define HTML Tag Infomation Table */ /* Define HTML Tag Infomation Table */
@@ -7,9 +7,9 @@
#define MAXA_CORE 1 #define MAXA_CORE 1
unsigned char ALST_A[] = { unsigned char ALST_A[] = {
ATTR_NAME, ATTR_HREF, ATTR_TARGET, ATTR_HSEQ, ATTR_REFERER, ATTR_NAME, ATTR_HREF, ATTR_TARGET, ATTR_HSEQ, ATTR_REFERER,
ATTR_FRAMENAME, ATTR_CORE ATTR_FRAMENAME, ATTR_TITLE, ATTR_ACCESSKEY, ATTR_CORE
}; };
#define MAXA_A MAXA_CORE + 6 #define MAXA_A MAXA_CORE + 8
unsigned char ALST_P[] = { ATTR_ALIGN, ATTR_CORE }; unsigned char ALST_P[] = { ATTR_ALIGN, ATTR_CORE };
#define MAXA_P MAXA_CORE + 1 #define MAXA_P MAXA_CORE + 1
unsigned char ALST_UL[] = { ATTR_START, ATTR_TYPE, ATTR_CORE }; unsigned char ALST_UL[] = { ATTR_START, ATTR_TYPE, ATTR_CORE };
@@ -28,9 +28,9 @@ unsigned char ALST_PRE[] = { ATTR_FOR_TABLE, ATTR_CORE };
#define MAXA_PRE MAXA_CORE + 1 #define MAXA_PRE MAXA_CORE + 1
unsigned char ALST_IMG[] = unsigned char ALST_IMG[] =
{ ATTR_SRC, ATTR_ALT, ATTR_WIDTH, ATTR_HEIGHT, ATTR_ALIGN, ATTR_USEMAP, { ATTR_SRC, ATTR_ALT, ATTR_WIDTH, ATTR_HEIGHT, ATTR_ALIGN, ATTR_USEMAP,
ATTR_ISMAP, ATTR_CORE ATTR_ISMAP, ATTR_TITLE, ATTR_CORE
}; };
#define MAXA_IMG MAXA_CORE + 7 #define MAXA_IMG MAXA_CORE + 8
unsigned char ALST_TABLE[] = unsigned char ALST_TABLE[] =
{ ATTR_BORDER, ATTR_WIDTH, ATTR_HBORDER, ATTR_CELLSPACING, { ATTR_BORDER, ATTR_WIDTH, ATTR_HBORDER, ATTR_CELLSPACING,
ATTR_CELLPADDING, ATTR_VSPACE, ATTR_CORE ATTR_CELLPADDING, ATTR_VSPACE, ATTR_CORE
@@ -112,9 +112,10 @@ unsigned char ALST_INPUT_ALT[] =
#define MAXA_INPUT_ALT 16 #define MAXA_INPUT_ALT 16
unsigned char ALST_IMG_ALT[] = unsigned char ALST_IMG_ALT[] =
{ ATTR_SRC, ATTR_WIDTH, ATTR_HEIGHT, ATTR_USEMAP, ATTR_ISMAP, ATTR_HSEQ, { ATTR_SRC, ATTR_WIDTH, ATTR_HEIGHT, ATTR_USEMAP, ATTR_ISMAP, ATTR_HSEQ,
ATTR_XOFFSET, ATTR_YOFFSET, ATTR_TOP_MARGIN, ATTR_BOTTOM_MARGIN ATTR_XOFFSET, ATTR_YOFFSET, ATTR_TOP_MARGIN, ATTR_BOTTOM_MARGIN,
ATTR_TITLE
}; };
#define MAXA_IMG_ALT 10 #define MAXA_IMG_ALT 11
unsigned char ALST_NOP[] = { ATTR_CORE }; unsigned char ALST_NOP[] = { ATTR_CORE };
#define MAXA_NOP MAXA_CORE #define MAXA_NOP MAXA_CORE
@@ -304,20 +305,30 @@ TagAttrInfo AttrMAP[MAX_TAGATTR] = {
{"rel", VTYPE_STR, 0}, /* 47 ATTR_REL */ {"rel", VTYPE_STR, 0}, /* 47 ATTR_REL */
{"rev", VTYPE_STR, 0}, /* 48 ATTR_REV */ {"rev", VTYPE_STR, 0}, /* 48 ATTR_REV */
{"title", VTYPE_STR, 0}, /* 49 ATTR_TITLE */ {"title", VTYPE_STR, 0}, /* 49 ATTR_TITLE */
{"accesskey", VTYPE_STR, 0}, /* 50 ATTR_ACCESSKEY */
{NULL, VTYPE_NONE, 0}, /* 51 Undefined */
{NULL, VTYPE_NONE, 0}, /* 52 Undefined */
{NULL, VTYPE_NONE, 0}, /* 53 Undefined */
{NULL, VTYPE_NONE, 0}, /* 54 Undefined */
{NULL, VTYPE_NONE, 0}, /* 55 Undefined */
{NULL, VTYPE_NONE, 0}, /* 56 Undefined */
{NULL, VTYPE_NONE, 0}, /* 57 Undefined */
{NULL, VTYPE_NONE, 0}, /* 58 Undefined */
{NULL, VTYPE_NONE, 0}, /* 59 Undefined */
/* Internal attribute */ /* Internal attribute */
{"xoffset", VTYPE_NUMBER, AFLG_INT}, /* 50 ATTR_XOFFSET */ {"xoffset", VTYPE_NUMBER, AFLG_INT}, /* 60 ATTR_XOFFSET */
{"yoffset", VTYPE_NUMBER, AFLG_INT}, /* 51 ATTR_YOFFSET */ {"yoffset", VTYPE_NUMBER, AFLG_INT}, /* 61 ATTR_YOFFSET */
{"top_margin", VTYPE_NUMBER, AFLG_INT}, /* 52 ATTR_TOP_MARGIN, */ {"top_margin", VTYPE_NUMBER, AFLG_INT}, /* 62 ATTR_TOP_MARGIN, */
{"bottom_margin", VTYPE_NUMBER, AFLG_INT}, /* 53 ATTR_BOTTOM_MARGIN, */ {"bottom_margin", VTYPE_NUMBER, AFLG_INT}, /* 63 ATTR_BOTTOM_MARGIN, */
{"tid", VTYPE_NUMBER, AFLG_INT}, /* 54 ATTR_TID */ {"tid", VTYPE_NUMBER, AFLG_INT}, /* 64 ATTR_TID */
{"fid", VTYPE_NUMBER, AFLG_INT}, /* 55 ATTR_FID */ {"fid", VTYPE_NUMBER, AFLG_INT}, /* 65 ATTR_FID */
{"for_table", VTYPE_NONE, AFLG_INT}, /* 56 ATTR_FOR_TABLE */ {"for_table", VTYPE_NONE, AFLG_INT}, /* 66 ATTR_FOR_TABLE */
{"framename", VTYPE_STR, AFLG_INT}, /* 57 ATTR_FRAMENAME */ {"framename", VTYPE_STR, AFLG_INT}, /* 67 ATTR_FRAMENAME */
{"hborder", VTYPE_NONE, 0}, /* 58 ATTR_HBORDER */ {"hborder", VTYPE_NONE, 0}, /* 68 ATTR_HBORDER */
{"hseq", VTYPE_NUMBER, AFLG_INT}, /* 59 ATTR_HSEQ */ {"hseq", VTYPE_NUMBER, AFLG_INT}, /* 69 ATTR_HSEQ */
{"no_effect", VTYPE_NONE, AFLG_INT}, /* 60 ATTR_NO_EFFECT */ {"no_effect", VTYPE_NONE, AFLG_INT}, /* 70 ATTR_NO_EFFECT */
{"referer", VTYPE_STR, AFLG_INT}, /* 61 ATTR_REFERER */ {"referer", VTYPE_STR, AFLG_INT}, /* 71 ATTR_REFERER */
{"selectnumber", VTYPE_NUMBER, AFLG_INT}, /* 62 ATTR_SELECTNUMBER */ {"selectnumber", VTYPE_NUMBER, AFLG_INT}, /* 72 ATTR_SELECTNUMBER */
{"textareanumber", VTYPE_NUMBER, AFLG_INT}, /* 63 ATTR_TEXTAREANUMBER */ {"textareanumber", VTYPE_NUMBER, AFLG_INT}, /* 73 ATTR_TEXTAREANUMBER */
}; };
+17 -16
View File
@@ -1,4 +1,4 @@
/* $Id: html.h,v 1.12 2002/12/03 15:35:11 ukai Exp $ */ /* $Id: html.h,v 1.13 2002/12/05 16:29:08 ukai Exp $ */
#ifndef _HTML_H #ifndef _HTML_H
#define _HTML_H #define _HTML_H
#ifdef USE_SSL #ifdef USE_SSL
@@ -271,24 +271,25 @@ typedef struct {
#define ATTR_REL 47 #define ATTR_REL 47
#define ATTR_REV 48 #define ATTR_REV 48
#define ATTR_TITLE 49 #define ATTR_TITLE 49
#define ATTR_ACCESSKEY 50
/* Internal attribute */ /* Internal attribute */
#define ATTR_XOFFSET 50 #define ATTR_XOFFSET 60
#define ATTR_YOFFSET 51 #define ATTR_YOFFSET 61
#define ATTR_TOP_MARGIN 52 #define ATTR_TOP_MARGIN 62
#define ATTR_BOTTOM_MARGIN 53 #define ATTR_BOTTOM_MARGIN 63
#define ATTR_TID 54 #define ATTR_TID 64
#define ATTR_FID 55 #define ATTR_FID 65
#define ATTR_FOR_TABLE 56 #define ATTR_FOR_TABLE 66
#define ATTR_FRAMENAME 57 #define ATTR_FRAMENAME 67
#define ATTR_HBORDER 58 #define ATTR_HBORDER 68
#define ATTR_HSEQ 59 #define ATTR_HSEQ 69
#define ATTR_NO_EFFECT 60 #define ATTR_NO_EFFECT 70
#define ATTR_REFERER 61 #define ATTR_REFERER 71
#define ATTR_SELECTNUMBER 62 #define ATTR_SELECTNUMBER 72
#define ATTR_TEXTAREANUMBER 63 #define ATTR_TEXTAREANUMBER 73
#define MAX_TAGATTR 64 #define MAX_TAGATTR 74
/* HTML Tag Information Table */ /* HTML Tag Information Table */
+42 -1
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.159 2002/12/04 16:45:41 ukai Exp $ */ /* $Id: main.c,v 1.160 2002/12/05 16:29:08 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -4153,6 +4153,47 @@ follow_map(struct parsed_tagarg *arg)
#endif #endif
} }
#ifdef USE_MENU
/* link menu */
void
linkMn(void)
{
LinkList *l = link_menu(Currentbuf);
ParsedURL p_url;
if (!l || !l->url)
return;
if (*(l->url) == '#') {
gotoLabel(l->url + 1);
return;
}
parseURL2(l->url, &p_url, baseURL(Currentbuf));
pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr);
cmd_loadURL(l->url, baseURL(Currentbuf),
parsedURL2Str(&Currentbuf->currentURL)->ptr);
}
/* accesskey */
void
accessKey(void)
{
Anchor *a;
BufferPoint *po;
if (!Currentbuf->href || !Currentbuf->hmarklist)
return;
a = accesskey_menu(Currentbuf);
if (!a || a->hseq < 0)
return;
po = &Currentbuf->hmarklist->marks[a->hseq];
gotoLine(Currentbuf, po->line);
Currentbuf->pos = po->pos;
arrangeCursor(Currentbuf);
onA();
followA();
}
#endif
#ifdef USE_COOKIE #ifdef USE_COOKIE
/* cookie list */ /* cookie list */
void void
+131 -74
View File
@@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.24 2002/12/02 17:39:16 ukai Exp $ */ /* $Id: menu.c,v 1.25 2002/12/05 16:29:10 ukai Exp $ */
/* /*
* w3m menu.c * w3m menu.c
*/ */
@@ -288,11 +288,6 @@ static int smDelTab(char c);
/* --- SelTabMenu (END) --- */ /* --- SelTabMenu (END) --- */
static Menu LinkMenu;
static int LinkV = 0;
static void initLinkMenu(void);
static void lmGoURL(void);
/* --- MainMenu --- */ /* --- MainMenu --- */
static Menu MainMenu; static Menu MainMenu;
@@ -1318,7 +1313,6 @@ popupMenu(int x, int y, Menu *menu)
{ {
initSelectMenu(); initSelectMenu();
initSelTabMenu(); initSelTabMenu();
initLinkMenu();
menu->cursorX = Currentbuf->cursorX + Currentbuf->rootX; menu->cursorX = Currentbuf->cursorX + Currentbuf->rootX;
menu->cursorY = Currentbuf->cursorY + Currentbuf->rootY; menu->cursorY = Currentbuf->cursorY + Currentbuf->rootY;
@@ -1648,68 +1642,6 @@ smDelTab(char c)
/* --- SelectMenu (END) --- */ /* --- SelectMenu (END) --- */
/* --- LinkMenu --- */
static void
initLinkMenu(void)
{
LinkList *l;
int i, nitem, len = 0;
char **label;
Str str;
if (!Currentbuf->linklist) {
LinkMenu.item = NULL;
LinkMenu.nitem = 0;
return;
}
for (i = 0, l = Currentbuf->linklist; l; i++, l = l->next) ;
nitem = i;
label = New_N(char *, nitem + 1);
for (i = 0, l = Currentbuf->linklist; l; i++, l = l->next) {
str = Strnew_charp(l->title ? l->title : "(empty)");
if (l->type == LINK_TYPE_REL)
Strcat_charp(str, " [Rel] ");
else if (l->type == LINK_TYPE_REV)
Strcat_charp(str, " [Rev] ");
else
Strcat_charp(str, " ");
Strcat_charp(str, l->url ? l->url : "");
label[i] = str->ptr;
if (len < str->length)
len = str->length;
}
label[nitem + 1] = NULL;
LinkV = 0;
new_option_menu(&LinkMenu, label, &LinkV, lmGoURL);
LinkMenu.initial = LinkV;
LinkMenu.cursorX = Currentbuf->cursorX + Currentbuf->rootX;
LinkMenu.cursorY = Currentbuf->cursorY + Currentbuf->rootY;
}
static void
lmGoURL(void)
{
LinkList *l;
int i;
for (i = 0, l = Currentbuf->linklist; l; i++, l = l->next) {
if (i == LinkV)
break;
}
if (l == NULL || l->url == NULL)
return;
CurrentKey = -1;
CurrentKeyData = NULL;
CurrentCmdData = l->url;
gorURL();
CurrentCmdData = NULL;
}
/* --- LinkMenu (END) --- */
/* --- OptionMenu --- */ /* --- OptionMenu --- */
void void
@@ -1742,7 +1674,7 @@ initMenu(void)
MenuItem *item = NULL; MenuItem *item = NULL;
MenuList *list; MenuList *list;
w3mMenuList = New_N(MenuList, 4); w3mMenuList = New_N(MenuList, 3);
w3mMenuList[0].id = "Main"; w3mMenuList[0].id = "Main";
w3mMenuList[0].menu = &MainMenu; w3mMenuList[0].menu = &MainMenu;
w3mMenuList[0].item = MainMenuItem; w3mMenuList[0].item = MainMenuItem;
@@ -1752,10 +1684,7 @@ initMenu(void)
w3mMenuList[2].id = "SelectTab"; w3mMenuList[2].id = "SelectTab";
w3mMenuList[2].menu = &SelTabMenu; w3mMenuList[2].menu = &SelTabMenu;
w3mMenuList[2].item = NULL; w3mMenuList[2].item = NULL;
w3mMenuList[3].id = "Link"; w3mMenuList[3].id = NULL;
w3mMenuList[3].menu = &LinkMenu;
w3mMenuList[3].item = NULL;
w3mMenuList[4].id = NULL;
if ((mf = fopen(rcFile(MENU_FILE), "rt")) == NULL) if ((mf = fopen(rcFile(MENU_FILE), "rt")) == NULL)
goto create_menu; goto create_menu;
@@ -1890,4 +1819,132 @@ getMenuN(MenuList *list, char *id)
/* --- InitMenu (END) --- */ /* --- InitMenu (END) --- */
LinkList *
link_menu(Buffer *buf)
{
Menu menu;
LinkList *l;
int i, nitem, len = 0, linkV = -1;
char **label;
Str str;
if (!buf->linklist)
return NULL;
for (i = 0, l = buf->linklist; l; i++, l = l->next) ;
nitem = i;
label = New_N(char *, nitem + 1);
for (i = 0, l = buf->linklist; l; i++, l = l->next) {
str = Strnew_charp(l->title ? l->title : "(empty)");
if (l->type == LINK_TYPE_REL)
Strcat_charp(str, " [Rel] ");
else if (l->type == LINK_TYPE_REV)
Strcat_charp(str, " [Rev] ");
else
Strcat_charp(str, " ");
Strcat_charp(str, l->url ? l->url : "");
label[i] = str->ptr;
if (len < str->length)
len = str->length;
}
label[nitem] = NULL;
new_option_menu(&menu, label, &linkV, NULL);
menu.initial = 0;
menu.cursorX = buf->cursorX + buf->rootX;
menu.cursorY = buf->cursorY + buf->rootY;
menu.x = menu.cursorX + FRAME_WIDTH + 1;
menu.y = menu.cursorY + 2;
popup_menu(NULL, &menu);
if (linkV < 0)
return NULL;
for (i = 0, l = buf->linklist; l; i++, l = l->next) {
if (i == linkV)
return l;
}
return NULL;
}
/* --- LinkMenu (END) --- */
Anchor *
accesskey_menu(Buffer *buf)
{
Menu menu;
AnchorList *al = buf->href;
Anchor *a;
Anchor **ap;
int i, n, nitem = 0, key = -1;
char **label;
char *t;
unsigned char c;
if (!al)
return NULL;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
if (!a->slave && a->accesskey && IS_ASCII(a->accesskey))
nitem++;
}
if (!nitem)
return NULL;
label = New_N(char *, nitem + 1);
ap = New_N(Anchor *, nitem);
for (i = 0, n = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
if (!a->slave && a->accesskey && IS_ASCII(a->accesskey)) {
t = getAnchorText(buf, a);
label[n] = Sprintf("%c: %s", a->accesskey, t ? t : "")->ptr;
ap[n] = a;
n++;
}
}
label[nitem] = NULL;
new_option_menu(&menu, label, &key, NULL);
menu.initial = 0;
menu.cursorX = buf->cursorX + buf->rootX;
menu.cursorY = buf->cursorY + buf->rootY;
menu.x = menu.cursorX + FRAME_WIDTH + 1;
menu.y = menu.cursorY + 2;
for (i = 0; i < 128; i++)
menu.keyselect[i] = -1;
for (i = 0; i < nitem; i++) {
c = ap[i]->accesskey;
menu.keymap[(int)c] = mSelect;
menu.keyselect[(int)c] = i;
}
for (i = 0; i < nitem; i++) {
c = ap[i]->accesskey;
if (!IS_ALPHA(c) || menu.keyselect[n] >= 0)
continue;
c = tolower(c);
menu.keymap[(int)c] = mSelect;
menu.keyselect[(int)c] = i;
c = toupper(c);
menu.keymap[(int)c] = mSelect;
menu.keyselect[(int)c] = i;
}
a = retrieveCurrentAnchor(buf);
if (a && a->accesskey && IS_ASCII(a->accesskey)) {
for (i = 0; i < nitem; i++) {
if (a == ap[i]) {
menu.initial = i;
break;
}
}
}
popup_menu(NULL, &menu);
return (key >= 0) ? ap[key] : NULL;
}
#endif /* USE_MENU */ #endif /* USE_MENU */
+17 -4
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.65 2002/12/04 16:45:41 ukai Exp $ */ /* $Id: proto.h,v 1.66 2002/12/05 16:29:10 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -131,6 +131,15 @@ extern void tabrURL(void);
extern void tabR(void); extern void tabR(void);
extern void tabL(void); extern void tabL(void);
extern void ldDL(void); extern void ldDL(void);
#ifdef USE_MENU
extern void linkMn(void);
extern LinkList *link_menu(Buffer *buf);
extern void accessKey(void);
extern Anchor *accesskey_menu(Buffer *buf);
#else
#define linkMn nulcmd
#define accessKey nulcmd
#endif
extern int currentLn(Buffer *buf); extern int currentLn(Buffer *buf);
extern void tmpClearBuffer(Buffer *buf); extern void tmpClearBuffer(Buffer *buf);
@@ -500,12 +509,15 @@ extern Str readFTPDir(ParsedURL *pu);
extern void closeFTP(FILE * f); extern void closeFTP(FILE * f);
extern int Ftpfclose(FILE * f); extern int Ftpfclose(FILE * f);
extern AnchorList *putAnchor(AnchorList *al, char *url, char *target, extern AnchorList *putAnchor(AnchorList *al, char *url, char *target,
Anchor **anchor_return, char *referer, int line, Anchor **anchor_return, char *referer,
char *title, unsigned char key, int line,
int pos); int pos);
extern Anchor *registerHref(Buffer *buf, char *url, char *target, extern Anchor *registerHref(Buffer *buf, char *url, char *target,
char *referer, int line, int pos); char *referer, char *title, unsigned char key,
int line, int pos);
extern Anchor *registerName(Buffer *buf, char *url, int line, int pos); extern Anchor *registerName(Buffer *buf, char *url, int line, int pos);
extern Anchor *registerImg(Buffer *buf, char *url, int line, int pos); extern Anchor *registerImg(Buffer *buf, char *url, char *title, int line,
int pos);
extern Anchor *registerForm(Buffer *buf, FormList *flist, extern Anchor *registerForm(Buffer *buf, FormList *flist,
struct parsed_tag *tag, int line, int pos); struct parsed_tag *tag, int line, int pos);
extern int onAnchor(Anchor *a, int line, int pos); extern int onAnchor(Anchor *a, int line, int pos);
@@ -527,6 +539,7 @@ extern Anchor *closest_prev_anchor(AnchorList *a, Anchor *an, int x, int y);
void addMultirowsImg(Buffer *buf, AnchorList *al); void addMultirowsImg(Buffer *buf, AnchorList *al);
#endif #endif
extern HmarkerList *putHmarker(HmarkerList *ml, int line, int pos, int seq); extern HmarkerList *putHmarker(HmarkerList *ml, int line, int pos, int seq);
extern char *getAnchorText(Buffer *buf, Anchor *a);
extern Str decodeB(char **ww); extern Str decodeB(char **ww);
extern Str decodeQ(char **ww); extern Str decodeQ(char **ww);
extern Str decodeQP(char **ww); extern Str decodeQP(char **ww);
+2 -2
View File
@@ -1,5 +1,5 @@
#!@PERL@ #!@PERL@
# $Id: w3mhelp.cgi.in,v 1.19 2002/12/05 16:02:00 ukai Exp $ # $Id: w3mhelp.cgi.in,v 1.20 2002/12/05 16:29:17 ukai Exp $
if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) { if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) {
$CYGPATH = 1; $CYGPATH = 1;
@@ -140,7 +140,7 @@ for $otherlang (@docdirs) {
&show_keymap("Hyperlink operation", &show_keymap("Hyperlink operation",
split(" ", "followA tabA svA followI svI submitForm split(" ", "followA tabA svA followI svI submitForm
curURL peekURL peekIMG pginfo curlno chkURL chkWORD chkNMID curURL peekURL peekIMG pginfo curlno chkURL chkWORD chkNMID
rFrame extbrz linkbrz")); rFrame extbrz linkbrz linkMn accessKey"));
&show_keymap("File/Stream operation", &show_keymap("File/Stream operation",
split(" ", "goURL gorURL tabURL tabrURL ldfile readsh pipesh split(" ", "goURL gorURL tabURL tabrURL ldfile readsh pipesh