diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-19 20:29:22 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-19 20:29:22 +0800 |
commit | 1c3f11034b11cb841f6188841d4b1222314d5757 (patch) | |
tree | 29cfc11ee809d008223dd4bfe46463073d97cfeb /mbbsd | |
parent | a0644143f445ad0103809814f3b4e75356dadcc3 (diff) | |
download | pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar.gz pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar.bz2 pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar.lz pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar.xz pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.tar.zst pttbbs-1c3f11034b11cb841f6188841d4b1222314d5757.zip |
- make ZA system complete.
- elimiate minor warning
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4205 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/board.c | 12 | ||||
-rw-r--r-- | mbbsd/menu.c | 105 | ||||
-rw-r--r-- | mbbsd/read.c | 12 | ||||
-rw-r--r-- | mbbsd/talk.c | 10 |
4 files changed, 106 insertions, 33 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index 801d29c6..ad1bc0e6 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1391,7 +1391,6 @@ choose_board(int newflag) ch = cursor_key(3 + num - head, 0); switch (ch) { - /////////////////////////////////////////////////////// // General Hotkeys /////////////////////////////////////////////////////// @@ -1413,6 +1412,15 @@ choose_board(int newflag) show_brdlist(head, 1, newflag); break; + // ZA + case Ctrl('Z'): + head = -1; + if (ZA_Select()) + ch = 'q'; + else + break; + // if selected, follow q. + case 'e': case KEY_LEFT: case EOF: @@ -1937,7 +1945,7 @@ choose_board(int newflag) break; } - } while (ch != 'q'); + } while (ch != 'q' && !ZA_Waiting()); free(nbrd); nbrd = NULL; nbrdsize = 0; diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 06d840ad..fe59ac33 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -128,6 +128,70 @@ showtitle(const char *title, const char *mid) } +/* Ctrl-Z Anywhere Fast Switch, not ZG. */ +static char zacmd = 0; + +// ZA is waiting, hurry to the meeting stone! +int +ZA_Waiting(void) +{ + return (zacmd != 0); +} + +// Promp user our ZA bar and return for selection. +int +ZA_Select(void) +{ + int k; + + // TODO refresh status bar? + vs_footer(" 快速切換 ", + " (b)文章列表 (c)分類看板 (f)我的最愛 (m)信箱 (u)使用者名單"); + k = vkey(); + + if (k < ' ' || k >= 'z') return 0; + k = tolower(k); + + if(strchr("bcfmu", k) == NULL) + return 0; + + zacmd = k; + return 1; +} + +// The ZA processor, only invoked in menu. +void +ZA_Enter(void) +{ + char cmd = zacmd; + while (zacmd) + { + cmd = zacmd; + zacmd = 0; + + // All ZA applets must check ZA_Waiting() at every stack of event loop. + switch(cmd) { + case 'b': + Read(); + break; + case 'c': + Class(); + break; + case 'f': + Favorite(); + break; + case 'm': + m_read(); + break; + case 'u': + t_users(); + break; + } + // if user exit with new ZA assignment, + // direct enter in next loop. + } +} + /* 動畫處理 */ #define FILMROW 11 static unsigned short menu_row = 12; @@ -242,7 +306,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) { int lastcmdptr, moviemode; int n, pos, total, i; - int err, laststat; + int err; moviemode = cmdmode; assert(cmdmode < M_XMAX); @@ -260,33 +324,9 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) do { i = -1; switch (cmd) { - case Ctrl('Z'): // simple quick nav - vs_footer(" 快速切換 ", - " (b)文章列表 (c)分類看板 (f)我的最愛 (m)信箱 (u)使用者名單"); + case Ctrl('Z'): + ZA_Select(); // we'll have za loop later. refscreen = YEA; - laststat = currstat; - switch(vkey()) { - case 'b': case 'B': - Read(); - break; - case 'c': case 'C': - Class(); - break; - case 'f': case 'F': - Favorite(); - break; - case 'm': case 'M': - m_read(); - break; - case 'u': case 'U': - t_users(); - break; - default: - show_status(); - refscreen = 0; - break; - } - currstat = laststat; i = lastcmdptr; break; case Ctrl('I'): @@ -335,13 +375,14 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) return; default: if ((cmd == 's' || cmd == 'r') && - (currstat == MMENU || currstat == TMENU || currstat == XMENU)) { + (cmdmode == MMENU || cmdmode == TMENU || cmdmode == XMENU)) { if (cmd == 's') ReadSelect(); else Read(); refscreen = YEA; i = lastcmdptr; + currstat = cmdmode; break; } if (cmd == '\n' || cmd == '\r' || cmd == KEY_RIGHT) { @@ -384,6 +425,14 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) } } + // end of all commands + if (ZA_Waiting()) + { + ZA_Enter(); + refscreen = 1; + currstat = cmdmode; + } + if (i > total || !CheckMenuPerm(cmdtable[i].level)) continue; diff --git a/mbbsd/read.c b/mbbsd/read.c index 257d8a3d..7c3b2ff0 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -664,6 +664,11 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem, new_top = 10; // default 10 switch (ch) { + case Ctrl('Z'): + mode = FULLUPDATE; + if (ZA_Select()) + mode = DOQUIT; + break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if( (num = search_num(ch, last_line)) != -1 ) @@ -1104,6 +1109,11 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem, } // ch > 0 && ch <= onekey_size break; } // end switch + + // ZA support + if (ZA_Waiting()) + mode = DOQUIT; + } while (mode == DONOTHING); return mode; } @@ -1318,7 +1328,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (), break; } //end switch mode = i_read_key(rcmdlist, locmem, currbid, bottom_line); - } while (mode != DOQUIT); + } while (mode != DOQUIT && !ZA_Waiting()); #undef FHSZ free(headers); diff --git a/mbbsd/talk.c b/mbbsd/talk.c index ccff6634..f07965fd 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -2500,7 +2500,7 @@ userlist(void) * redrawall: 全部重畫 (含標題列等等, 須再指定 redraw 才會有效) * leave: 離開使用者名單 */ - while (!leave) { + while (!leave && !ZA_Waiting()) { if( !skippickup ) pickup(currpickup, pickup_way, &page, &nfriend, &myfriend, &friendme, &bfriend, &badfriend); @@ -2527,12 +2527,18 @@ userlist(void) } skippickup = redraw = redrawall = 0; lastupdate = now; - while (!redraw) { + while (!redraw && !ZA_Waiting()) { ch = cursor_key(offset + 3, 0); uentp = currpickup[offset].ui; fri_stat = currpickup[offset].friend; switch (ch) { + case Ctrl('Z'): + redrawall = redraw = 1; + if (ZA_Select()) + leave = 1; + break; + case KEY_LEFT: case 'e': case 'E': |