diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-12 23:19:35 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-12 23:19:35 +0800 |
commit | 30b08ca27e39588cde705a96381a9643d534351e (patch) | |
tree | 1bedbe59d526d855b73aae6200cebb33ea7da561 /mbbsd | |
parent | 728e27e6f357fa2e00177f949ffed0d830fd004d (diff) | |
download | pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar.gz pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar.bz2 pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar.lz pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar.xz pttbbs-30b08ca27e39588cde705a96381a9643d534351e.tar.zst pttbbs-30b08ca27e39588cde705a96381a9643d534351e.zip |
(internal code refine)
- drop deprecated EDIT_ITEM, standout(), standend()
- replace outmsglr() with vfooter().
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4147 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 1 | ||||
-rw-r--r-- | mbbsd/kaede.c | 9 | ||||
-rw-r--r-- | mbbsd/mail.c | 4 | ||||
-rw-r--r-- | mbbsd/pfterm.c | 14 | ||||
-rw-r--r-- | mbbsd/read.c | 5 | ||||
-rw-r--r-- | mbbsd/screen.c | 71 | ||||
-rw-r--r-- | mbbsd/talk.c | 13 | ||||
-rw-r--r-- | mbbsd/term.c | 40 | ||||
-rw-r--r-- | mbbsd/visio.c | 6 |
9 files changed, 53 insertions, 110 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index b50a1be2..f7e3d49f 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1018,7 +1018,6 @@ do_general(int isbid) return FULLUPDATE; curredit &= ~EDIT_MAIL; - curredit &= ~EDIT_ITEM; setutmpmode(POSTING); /* 未具備 Internet 權限者,只能在站內發表文章 */ /* 板主預設站內存檔 */ diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c index e2f99758..321d52e8 100644 --- a/mbbsd/kaede.c +++ b/mbbsd/kaede.c @@ -140,15 +140,6 @@ outmsg(const char *msg) } void -outmsglr(const char *msg, int llen, const char *rmsg, int rlen) -{ - move(b_lines - msg_occupied, 0); - clrtoeol(); - outslr(msg, llen, rmsg, rlen); - outs(ANSI_RESET ANSI_CLRTOEND); -} - -void prints(const char *fmt,...) { va_list args; diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 6edb68db..2f3ff920 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -385,7 +385,6 @@ do_send(const char *userid, const char *title) return -3; curredit |= EDIT_MAIL; - curredit &= ~EDIT_ITEM; } /* process title */ if (title) @@ -748,7 +747,6 @@ mail_all(void) *quote_file = 0; curredit |= EDIT_MAIL; - curredit &= ~EDIT_ITEM; if (vedit(fpath, YEA, NULL) == -1) { curredit = 0; unlink(fpath); @@ -966,7 +964,6 @@ m_new(void) memset(&arg, 0, sizeof(arg)); clear(); curredit |= EDIT_MAIL; - curredit &= ~EDIT_ITEM; if (apply_record(currmaildir, read_new_mail, sizeof(fileheader_t), &arg) == -1) { if(arg.delmsgs) free(arg.delmsgs); @@ -1798,7 +1795,6 @@ m_read(void) if (get_num_records(currmaildir, sizeof(fileheader_t))) { curredit = EDIT_MAIL; - curredit &= ~EDIT_ITEM; back_bid = currbid; currbid = 0; i_read(RMAIL, currmaildir, mailtitle, maildoent, mail_comms, -1); diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c index 65a09a62..e77259a4 100644 --- a/mbbsd/pfterm.c +++ b/mbbsd/pfterm.c @@ -2228,21 +2228,9 @@ grayout(int y, int end, int level) } ////////////////////////////////////////////////////////////////////////// -// deprecated api +// environment specific ////////////////////////////////////////////////////////////////////////// -void -standout(void) -{ - outs(ANSI_COLOR(7)); -} - -void -standend(void) -{ - outs(ANSI_RESET); -} - #ifndef _PFTERM_TEST_MAIN void diff --git a/mbbsd/read.c b/mbbsd/read.c index ec321314..ea3ebd41 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -1350,10 +1350,7 @@ i_read(int cmdmode, const char *direct, void (*dotitle) (), } /* no break */ case READ_REDRAW: - if(curredit & EDIT_ITEM) - outmsglr(ANSI_COLOR(44) " 私人收藏 " ANSI_COLOR(30;47), 10, - " 繼續? ", 7); - else if (curredit & EDIT_MAIL) + if (curredit & EDIT_MAIL) vfooter(" 鴻雁往返 ", " (R)回信 (x)站內轉寄 (y)回群組信 (d/D)刪信 (m)保留標記\t(←/q)離開"); else diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 8b518070..fabef4b2 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -19,6 +19,48 @@ static unsigned char _typeahead = 1; #define STANDOUT (2) /* if this line has a standout region */ void +change_scroll_range(int top, int bottom) +{ + char buf[16], *p; + + snprintf(buf, sizeof(buf), ESC_STR "[%d;%dr", top + 1, bottom + 1); + for (p = buf; *p; p++) + ochar(*p); +} + +void +scroll_forward(void) +{ + ochar(ESC_CHR); + ochar('D'); +} + +void +do_move(int destcol, int destline) +{ + char buf[16], *p; + + snprintf(buf, sizeof(buf), ANSI_MOVETO(%d,%d), destline + 1, destcol + 1); + for (p = buf; *p; p++) + ochar(*p); +} + +void +do_save_cursor(void) +{ + ochar(ESC_CHR); + ochar('7'); +} + +void +do_restore_cursor(void) +{ + ochar(ESC_CHR); + ochar('8'); +} + + +void initscr(void) { if (!big_picture) { @@ -606,40 +648,15 @@ region_scroll_up(int top, int bottom) big_picture[i] = big_picture[i + 1]; memset(big_picture + i, 0, sizeof(*big_picture)); memset(big_picture[i].data, ' ', scr_cols); - save_cursor(); + do_save_cursor(); change_scroll_range(top, bottom); do_move(0, bottom); scroll_forward(); change_scroll_range(0, scr_lns - 1); - restore_cursor(); + do_restore_cursor(); refresh(); } -void -standout(void) -{ - if (!standing && strtstandoutlen) { - register screenline_t *slp; - - slp = GetCurrentLine(); - standing = YEA; - slp->sso = slp->eso = cur_col; - slp->mode |= STANDOUT; - } -} - -void -standend(void) -{ - if (standing && strtstandoutlen) { - register screenline_t *slp; - - slp = GetCurrentLine(); - standing = NA; - slp->eso = MAX(slp->eso, cur_col); - } -} - // readback int instr(char *str) diff --git a/mbbsd/talk.c b/mbbsd/talk.c index b4c92915..72cc581e 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1417,13 +1417,11 @@ do_talk(int fd) while (1) { ch = igetch(); if (ch == I_OTHERDATA) { - // getyx(&y, &x); datac = recv(fd, data, sizeof(data), 0); if (datac <= 0) break; for (i = 0; i < datac; i++) do_talk_char(&itswin, data[i], flog); - // move(y, x); } else if (ch == KEY_UNKNOWN) { // skip } else { @@ -2313,15 +2311,8 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, 18); } else #endif - outslr( - ANSI_COLOR(34;46) " 休閒聊天 " - ANSI_COLOR(31;47) " (TAB/f)" ANSI_COLOR(30) "排序/好友 " - ANSI_COLOR(31) "(a/o)" ANSI_COLOR(30) "交友 " - ANSI_COLOR(31) "(q/w)" ANSI_COLOR(30) "查詢/丟水球 " - ANSI_COLOR(31) "(t/m)" ANSI_COLOR(30) "聊天/寫信 ", - 80-10, - ANSI_COLOR(31) "(h)" ANSI_COLOR(30) "說明 " ANSI_RESET, - 8); + vfooter(" 休閒聊天 ", + " (TAB/f)排序/好友 (a/o)交友 (q/w)查詢/丟水球 (t/m)聊天/寫信\t(h)說明"); } move(1, 0); prints(" 排序:[%s] 上站人數:%-4d " diff --git a/mbbsd/term.c b/mbbsd/term.c index 4868415a..dffe7d79 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -76,43 +76,3 @@ term_init(void) return YEA; } -void -do_move(int destcol, int destline) -{ - char buf[16], *p; - - snprintf(buf, sizeof(buf), ANSI_MOVETO(%d,%d), destline + 1, destcol + 1); - for (p = buf; *p; p++) - ochar(*p); -} - -void -save_cursor(void) -{ - ochar(ESC_CHR); - ochar('7'); -} - -void -restore_cursor(void) -{ - ochar(ESC_CHR); - ochar('8'); -} - -void -change_scroll_range(int top, int bottom) -{ - char buf[16], *p; - - snprintf(buf, sizeof(buf), ESC_STR "[%d;%dr", top + 1, bottom + 1); - for (p = buf; *p; p++) - ochar(*p); -} - -void -scroll_forward(void) -{ - ochar(ESC_CHR); - ochar('D'); -} diff --git a/mbbsd/visio.c b/mbbsd/visio.c index 3c8114d1..b12b037b 100644 --- a/mbbsd/visio.c +++ b/mbbsd/visio.c @@ -36,10 +36,14 @@ nblank(int n) } // ---- HIGH LEVEL API ----------------------------------------------- +void +vfprints() +{ +} /** * 在最底部印出 caption msg 的形式 - * msg 中若有 () 則會變色為, \t 後的文字會靠右。 + * msg 中若有 () 則會變色, \t 後的文字會靠右。 * 最後面會自動留一個空白 (以避免自動偵測中文字的問題)。 */ void |