[w3m-dev 01227] Re: buffer selection menu

From: Hironori Sakamoto (h-saka@lsi.nec.co.jp)
Date: Mon Oct 23 2000 - 01:21:12 CDT

  • Next message: $B2,ED: "[w3m-dev 01228] Re: buffer selection menu"

    $B:dK\$G$9!#(B

    >> $B2,ED$G$9!#(B
    >> $B%P%C%U%!A*Br%b!<%I$r!"%a%K%e!<$r;H$C$F<BAu$7$F$_$^$7$?!#%a%K%e!<$HF1$8(B
    >> $B%-!<A`:n!"%^%&%9A`:n$,$G$-$k$N$G!"0JA0$h$j;H$$$d$9$/$J$C$?$H;W$&$N$G$9(B
    >> $B$,!"$I$&$G$7$g$&$+!)(B

    $B$"$A$c$!(B(X_X)$B!#(B
    $B0JA0$+$i$"$k$s$G$9$,!D(B

     keymap s MENU Select

    $B$C$F$d$C$F$_$F$/$@$5$$!#(B
    'd' $B$G$N>C5n$OL$<BAu$J$s$G$9$,!"(Bmenu.c $B$N(B initSelectMenu() $B$G(B
    SelectMenu.keymap['d'] = smDelBuf;
    $B$H$+$d$C$F$*$$$F(B smDelBuf $B$rE,Ev$K<BAu$9$l$P$$$$$O$:!#(B
    $BF0:n%A%'%C%/$r$"$^$j$7$F$$$J$$(B patch $B$G$9$,!"0l1~$D$1$F$*$-$^$9!#(B
    -----------------------------------
    $B:dK\(B $B9@B'(B <hsaka@mth.biglobe.ne.jp>
     http://www2u.biglobe.ne.jp/~hsaka/

    --- menu.c.orig Wed Oct 11 13:23:27 2000
    +++ menu.c Mon Oct 23 15:13:26 2000
    @@ -268,6 +268,7 @@
     static int SelectV = 0;
     static void initSelectMenu(void);
     static void smChBuf(void);
    +static int smDelBuf(char c);
     
     /* --- SelectMenu (END) --- */
     
    @@ -1122,6 +1123,7 @@
     
         new_option_menu(&SelectMenu, label, &SelectV, smChBuf);
         SelectMenu.initial = SelectV;
    + SelectMenu.keymap['d'] = (void *)smDelBuf;
         SelectMenu.cursorX = Currentbuf->cursorX;
         SelectMenu.cursorY = Currentbuf->cursorY;
     }
    @@ -1140,6 +1142,42 @@
             for (buf = Firstbuf; buf != NULL; buf = buf->nextBuffer)
                 tmpClearBuffer(buf);
         }
    +}
    +
    +static int
    +smDelBuf(char c) {
    + int i;
    + Buffer *buf;
    + Menu tmp;
    +
    + if (CurrentMenu->select < 0 || CurrentMenu->select >= SelectMenu.nitem)
    + return;
    + for (i = 0, buf = Firstbuf; i < CurrentMenu->select; i++, buf = buf->nextBuffer);
    + if (Currentbuf == buf)
    + Currentbuf = buf->nextBuffer;
    + Firstbuf = deleteBuffer(Firstbuf, buf);
    + if (!Currentbuf)
    + Currentbuf = Firstbuf;
    + if (Firstbuf == NULL) {
    + Firstbuf = nullBuffer();
    + Currentbuf = Firstbuf;
    + }
    + tmp.cursorX = CurrentMenu->cursorX;
    + tmp.cursorX = CurrentMenu->cursorY;
    + tmp.x = CurrentMenu->x;
    + tmp.y = CurrentMenu->y;
    + initSelectMenu();
    + CurrentMenu->cursorX = tmp.cursorX;
    + CurrentMenu->cursorY = tmp.cursorY;
    + CurrentMenu->x = tmp.x;
    + CurrentMenu->y = tmp.y;
    + if (CurrentMenu->select >= SelectMenu.nitem)
    + CurrentMenu->select = SelectMenu.nitem - 1;
    + geom_menu(CurrentMenu, CurrentMenu->x, CurrentMenu->y, CurrentMenu->select);
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
    + draw_all_menu(CurrentMenu);
    + select_menu(CurrentMenu, CurrentMenu->select);
    + return (MENU_NOTHING);
     }
     
     /* --- SelectMenu (END) --- */



    This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 01:37:43 CDT