From 1248fa2911c932a71c0c70d0cc5b512df723acf2 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Thu, 21 Nov 2002 16:31:35 +0000 Subject: [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 --- func.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'func.c') diff --git a/func.c b/func.c index 8afa0c2..6c4dee2 100644 --- a/func.c +++ b/func.c @@ -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 -- cgit v1.2.3