diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-21 16:31:35 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-21 16:31:35 +0000 |
commit | 1248fa2911c932a71c0c70d0cc5b512df723acf2 (patch) | |
tree | da82f2a799df79bf1856fb6fd029d5ccdb52e54c /func.c | |
parent | * NEWS: func: NEXT, PREV (diff) | |
download | w3m-1248fa2911c932a71c0c70d0cc5b512df723acf2.tar.gz w3m-1248fa2911c932a71c0c70d0cc5b512df723acf2.zip |
[w3m-dev 03455] mouse menu
* configure (config.h): MOUSE_FILE
* display.c (displayBuffer): nTab -> nTab2, N_TAB -> nTabLine()
(redrawNLine): nTab -> nTab2, N_TAB -> nTabLine()
mouse_menu support
* fm.h (nTab2): added
(N_TAB): deleted
(NO_TABBUFFER): added
(struct _MouseMenu): added
(mouse_menu_map): added
(mouse_menu): added
* func.c (initMouseMenu): added
* main.c (main): initMouseMenu()
(posTab): mouse_menu support
(mouse_menu_action): added
(process_mouse): mouse_menu support
(reinit): initMouseMenu()
(nTabLine): added
(moveTab): check NO_TABBUFFER
* proto.h (nTabLine): added
(initMouseMenu): added
* rc.c (sync_with_option): initMouseMenu()
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'func.c')
-rw-r--r-- | func.c | 67 |
1 files changed, 66 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: func.c,v 1.10 2002/06/01 16:50:16 ukai Exp $ */ +/* $Id: func.c,v 1.11 2002/11/21 16:31:36 ukai Exp $ */ /* * w3m func.c */ @@ -320,3 +320,68 @@ getQWord(char **str) *str = p; return tmp->ptr; } + +#ifdef USE_MOUSE +void +initMouseMenu(void) +{ + FILE *mf; + Str line; + char *p, *s; + 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; + + while (!feof(mf)) { + line = Strfgets(mf); + Strchop(line); + Strremovefirstspaces(line); + if (line->length == 0) + continue; + p = 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 (strcmp(s, "button")) + continue; /* error */ + s = getWord(&p); + b = atoi(s); + if (!(b >= 1 && b <= 3)) + continue; /* error */ + s = getWord(&p); + x = atoi(s); + if (!(IS_DIGIT(*s) && x >= 0 && x <= 9)) + continue; /* error */ + s = getWord(&p); + x2 = atoi(s); + if (!(IS_DIGIT(*s) && x2 >= 0 && x2 <= 9)) + continue; /* error */ + s = getWord(&p); + f = getFuncList(s); + if (f < 0) + continue; /* error */ + s = getQWord(&p); + 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; + } + } + fclose(mf); +} +#endif |