diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-22 15:43:13 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-22 15:43:13 +0000 |
commit | 82901953d32cc52a688be47d0594e2df0395b2cc (patch) | |
tree | 6db2941dee3c2d7410eed8b20b57626649d474a3 /func.c | |
parent | NEWS: options: -N (diff) | |
download | w3m-82901953d32cc52a688be47d0594e2df0395b2cc.tar.gz w3m-82901953d32cc52a688be47d0594e2df0395b2cc.zip |
[w3m-dev 03458] Re: mouse menu
* display.c (displayBuffer): nTab2 -> nTab, mouse_menu
* fm.h (nTab2): deleted
(MouseMenuMap): added
(MouseMenu): added
(LIMIT_MOUSE_MENU): added
* func.c (initMouseMenu): delete mouse_menu_map initialization
conv_from_system
mouse_menu->width
* main.c (main): mouse_menu->in_action = FALSE
(posTab): check mouse_menu
(mouse_menu_action): add y arg
mouse_menu_width check
(process_mouse): nTab2 -> nTab, mouse_menu
(nTabLine): deleted
(calcTabPos): check mouse_menu
* menu.c (mainMn): x, y
(selMn): mouse_menu check
(tabMn): mosue_menu check
* proto.h (nTabLine): deleted
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | func.c | 40 |
1 files changed, 24 insertions, 16 deletions
@@ -1,4 +1,4 @@ -/* $Id: func.c,v 1.12 2002/11/21 16:32:29 ukai Exp $ */ +/* $Id: func.c,v 1.13 2002/11/22 15:43:14 ukai Exp $ */ /* * w3m func.c */ @@ -331,12 +331,6 @@ initMouseMenu(void) int f, b, x, x2; mouse_menu = NULL; - for (b = 1; b <= 3; b++) { - for (x = 0; x < 10; x++) { - mouse_menu_map[b - 1][x].func = NULL; - mouse_menu_map[b - 1][x].data = NULL; - } - } if ((mf = fopen(rcFile(MOUSE_FILE), "rt")) == NULL) return; @@ -346,17 +340,31 @@ initMouseMenu(void) Strremovefirstspaces(line); if (line->length == 0) continue; - p = line->ptr; + p = conv_from_system(line->ptr); s = getWord(&p); if (*s == '#') /* comment */ continue; if (!strcmp(s, "menu")) { s = getQWord(&p); - if (*s) - mouse_menu = Strnew_charp(s)->ptr; - continue; + if (!*s) + continue; /* error */ + mouse_menu = New(MouseMenu); + mouse_menu->str = s; + mouse_menu->width = strlen(s); + mouse_menu->in_action = FALSE; + if (mouse_menu->width >= LIMIT_MOUSE_MENU) + mouse_menu->width = LIMIT_MOUSE_MENU; + for (b = 0; b < 3; b++) { + mouse_menu->map[b] = New_N(MouseMenuMap, mouse_menu->width); + for (x = 0; x < mouse_menu->width; x++) { + mouse_menu->map[b][x].func = NULL; + mouse_menu->map[b][x].data = NULL; + } + } } - if (strcmp(s, "button")) + if (!mouse_menu) + continue; /* "menu" is not set */ + if (strcmp(s, "button")) continue; /* error */ s = getWord(&p); b = atoi(s); @@ -364,11 +372,11 @@ initMouseMenu(void) continue; /* error */ s = getWord(&p); x = atoi(s); - if (!(IS_DIGIT(*s) && x >= 0 && x <= 9)) + if (!(IS_DIGIT(*s) && x >= 0 && x < mouse_menu->width)) continue; /* error */ s = getWord(&p); x2 = atoi(s); - if (!(IS_DIGIT(*s) && x2 >= 0 && x2 <= 9)) + if (!(IS_DIGIT(*s) && x2 >= 0 && x2 < mouse_menu->width)) continue; /* error */ s = getWord(&p); f = getFuncList(s); @@ -378,8 +386,8 @@ initMouseMenu(void) if (!*s) s = NULL; for (; x <= x2; x++) { - mouse_menu_map[b - 1][x].func = w3mFuncList[f].func; - mouse_menu_map[b - 1][x].data = s; + mouse_menu->map[b - 1][x].func = w3mFuncList[f].func; + mouse_menu->map[b - 1][x].data = s; } } fclose(mf); |