diff options
-rw-r--r-- | pttbbs/include/config.h | 21 | ||||
-rw-r--r-- | pttbbs/mbbsd/mail.c | 11 | ||||
-rw-r--r-- | pttbbs/mbbsd/more.c | 42 | ||||
-rw-r--r-- | pttbbs/mbbsd/pmore.c | 108 | ||||
-rw-r--r-- | pttbbs/mbbsd/talk.c | 6 |
5 files changed, 111 insertions, 77 deletions
diff --git a/pttbbs/include/config.h b/pttbbs/include/config.h index 5175014f..c191380c 100644 --- a/pttbbs/include/config.h +++ b/pttbbs/include/config.h @@ -29,6 +29,23 @@ #define AID_HOSTNAME MYHOSTNAME #endif +/* 主題配色 */ + +#ifndef TITLE_COLOR +#define TITLE_COLOR ANSI_COLOR(0;1;37;46) /* 主畫面上方標題列 */ +#endif + +#ifndef HLP_CATEGORY_COLOR +#define HLP_CATEGORY_COLOR ANSI_COLOR(0;1;32) /* 說明表格內分類項 */ +#endif +#ifndef HLP_DESCRIPTION_COLOR +#define HLP_DESCRIPTION_COLOR ANSI_COLOR(0) /* 說明表格內說明項 */ +#endif +#ifndef HLP_KEYLIST_COLOR +#define HLP_KEYLIST_COLOR ANSI_COLOR(0;1;36) /* 說明表格內按鍵項 */ +#endif + +/* 系統帳號相關設定 */ #ifndef BBSUSER #define BBSUSER "bbs" #endif @@ -171,10 +188,6 @@ #define FORCE_PROCESS_REGISTER_FORM 0 #endif -#ifndef TITLE_COLOR -#define TITLE_COLOR ANSI_COLOR(0;1;37;46) -#endif - #ifndef SYSLOG_FACILITY #define SYSLOG_FACILITY LOG_LOCAL0 #endif diff --git a/pttbbs/mbbsd/mail.c b/pttbbs/mbbsd/mail.c index ac7f10f8..4ab5bdcc 100644 --- a/pttbbs/mbbsd/mail.c +++ b/pttbbs/mbbsd/mail.c @@ -1505,18 +1505,17 @@ m_help(void) #else const char ** p1[3] = { hlp_mailmove, hlp_mailbasic, hlp_mailconf }, ** p2[3] = { hlp_mailadv, hlp_mailempty, hlp_mailman }; - const int cols[3] = { 31, 22, 24 }, // columns, to fit pmore built-ins + const int cols[3] = { 31, 22, 24 }, // column width desc[3] = { 12, 14, 18 }; // desc width - const int cols2[3]= { 36, 17, 24 }, // columns, to fit pmore built-ins + const int cols2[3]= { 36, 17, 24 }, // columns width desc2[3]= { 18, 14, 18 }; // desc width clear(); showtitle("電子信箱", "使用說明"); outs("\n"); vs_multi_T_table_simple(p1, 3, cols, desc, - ANSI_COLOR(1;32), ANSI_COLOR(0), ANSI_COLOR(1;36) ); - vs_multi_T_table_simple(p2, HasUserPerm(PERM_MAILLIMIT)?3:2, - cols2, desc2, - ANSI_COLOR(1;32), ANSI_COLOR(0), ANSI_COLOR(1;36) ); + HLP_CATEGORY_COLOR, HLP_DESCRIPTION_COLOR, HLP_KEYLIST_COLOR); + vs_multi_T_table_simple(p2, HasUserPerm(PERM_MAILLIMIT)?3:2, cols2, desc2, + HLP_CATEGORY_COLOR, HLP_DESCRIPTION_COLOR, HLP_KEYLIST_COLOR); PRESSANYKEY(); #endif return FULLUPDATE; diff --git a/pttbbs/mbbsd/more.c b/pttbbs/mbbsd/more.c index b732a387..2dec50b8 100644 --- a/pttbbs/mbbsd/more.c +++ b/pttbbs/mbbsd/more.c @@ -261,31 +261,31 @@ common_pmore_key_handler(int ch, void *ctx) static const char *hlp_nav [] = { "【瀏覽指令】", NULL, - " 下篇文章 ", "f", - " 前篇文章 ", "b", - " 同主題下篇", "] +", - " 同主題前篇", "[ -", - " 同主題首篇", "=", - " 同主題循序", "t", - " 同作者前篇", "A", - " 同作者下篇", "a", + " 下篇文章 ", "f", + " 前篇文章 ", "b", + " 同主題下篇", "] +", + " 同主題前篇", "[ -", + " 同主題首篇", "=", + " 同主題循序", "t", + " 同作者前篇", "A", + " 同作者下篇", "a", NULL, }, *hlp_reply [] = { "【回應指令】", NULL, - " 推薦文章", "% X", - " 回信回文", "r", - " 全部回覆", "y", + " 推薦文章", "% X", + " 回信回文", "r", + " 全部回覆", "y", NULL, }, *hlp_spc [] = { "【特殊指令】", NULL, - " 查詢資訊 ", "Q", - " 存入暫存檔", "^T", - " 切換看板 ", "s", - " 棋局打譜 ", "z", + " 查詢資訊 ", "Q", + " 存入暫存檔", "^T", + " 切換看板 ", "s", + " 棋局打譜 ", "z", #if defined(USE_BBSLUA) && !defined(DISABLE_BBSLUA_IN_PAGER) - " 執行BBSLua", "L l", + " 執行BBSLua", "L l", #endif NULL, }; @@ -293,13 +293,12 @@ static const char static int common_pmore_help_handler(int y, void *ctx) { - // simply show ptt special function keys const char ** p[3] = { hlp_nav, hlp_reply, hlp_spc }; - const int cols[3] = { 29, 29, 20 }, // columns, to fit pmore built-ins - desc[3] = { 15, 12, 14 }; // desc width - move(y+1, 0); + const int cols[3] = { 29, 27, 20 }, // columns, to fit pmore built-ins + desc[3] = { 15, 13, 15 }; // desc width + move(y, 0); vs_multi_T_table_simple(p, 3, cols, desc, - ANSI_COLOR(1;32), ANSI_COLOR(0), ANSI_COLOR(1;36) ); + HLP_CATEGORY_COLOR, HLP_DESCRIPTION_COLOR, HLP_KEYLIST_COLOR); PRESSANYKEY(); return 0; } @@ -316,7 +315,6 @@ more(const char *fpath, int promptend) // post processing switch(r) { - case RET_DOSYSOPEDIT: r = FULLUPDATE; if (!check_sysop_edit_perm(fpath)) diff --git a/pttbbs/mbbsd/pmore.c b/pttbbs/mbbsd/pmore.c index 075f886a..c14deb0a 100644 --- a/pttbbs/mbbsd/pmore.c +++ b/pttbbs/mbbsd/pmore.c @@ -2953,73 +2953,97 @@ pmore_Preference() } #ifdef PMORE_USE_INTERNAL_HELP + +// apply system colors if defined +#ifndef HLP_CATEGORY_COLOR +#define HLP_CATEGORY_COLOR PMHLPATTR_HEADER +#endif +#ifndef HLP_DESCRIPTION_COLOR +#define HLP_DESCRIPTION_COLOR PMHLPATTR_NORMAL +#endif +#ifndef HLP_KEYLIST_COLOR +#define HLP_KEYLIST_COLOR PMHLPATTR_NORMAL_KEY +#endif + static const char *hlp_basic[] = { "【基本移動】", NULL, - "下翻一頁", "^F → PgUp Space", - "上翻一頁", "^B ^H PgDn BS", - "下捲一行", " j ↓", - "上捲一行", " k ↑", - "檔案結尾", " $ G End", - "檔案開頭", " 0 g Home", - "離開 ", " q ←", + " 下翻一頁", "^F → PgUp Space", + " 上翻一頁", "^B ^H PgDn BS", + " 下捲一行", " j ↓", + " 上捲一行", " k ↑", + " 檔案結尾", " $ G End", + " 檔案開頭", " 0 g Home", + " 離開 ", " q ←", NULL, }, *hlp_adv[] = { - "【進階移動】", NULL, - "搜尋關鍵字", "/", - "往後搜尋 ", "n", - "往前搜尋 ", "N", - "指定頁數 ", "; 0-9數字鍵", - "指定行數 ", ":", - "向右捲動 ", ". > TAB", - "向左捲動 ", ", < Shift-TAB", + "【進階瀏覽】", NULL, + " 搜尋關鍵字", "/", + " 往後搜尋 ", "n", + " 往前搜尋 ", "N", + " 指定頁數 ", "; 0-9數字鍵", + " 指定行數 ", ":", + " 向右捲動 ", ". > TAB", + " 向左捲動 ", ", < Shift-TAB", NULL, }, *hlp_sys[] = { "【其它】", NULL, #ifdef PMORE_USE_ASCII_MOVIE - "播放動畫 ", "p", + " 播放動畫 ", "p", #endif - "選項設定 ", "o", - "色彩顯示模式", "\\", - "說明 ", "h ? F1", + " 選項設定 ", "o", + " 色彩顯示模式", "\\", + " 說明 ", "h ? F1", #ifdef DEBUG - "DBG 除錯模式", "d", + " DBG 除錯模式", "d", #endif NULL, }; +#define PMHLP_BLOCKS (3) + MFPROTO void pmore_Help(void *ctx, int (*help_handler)(int y, void *ctx)) { - const char ** p[3] = { hlp_basic, hlp_adv, hlp_sys}; - const int cols[3] = { 29, 29, 20 }, // columns - desc[3] = { 10, 11, 13 }; // desc width - int y = 0, i; + const char **t_tables[PMHLP_BLOCKS] = { hlp_basic, hlp_adv, hlp_sys}; + const int col_widths[PMHLP_BLOCKS] = { 29, 27, 20 }, + l_widths [PMHLP_BLOCKS] = { 12, 13, 15 }; + const int n_t_tables =PMHLP_BLOCKS; + int i, incomplete; + int y = 2; // height of prompt bar clear(); pmore_PromptBar(PMORE_MSG_HELP_TITLE, PMORE_SHADOW_BELOW); - y = 2; - // render help page - while (*p[0] || *p[1] || *p[2]) + do { + incomplete = n_t_tables; y++; - for ( i = 0; i < 3; i++ ) - { - const char *dstr = "", *kstr = ""; - if (*p[i]) { - dstr = *p[i]++; kstr = *p[i]++; - } - if (!kstr) - prints( PMHLPATTR_HEADER "%-*s", cols[i], dstr); - else - prints( PMHLPATTR_NORMAL " %-*s" - PMHLPATTR_NORMAL_KEY "%-*s", - desc[i], dstr, cols[i]-desc[i]-1, kstr); - } - outs("\n"); - } + for (i = 0; i < n_t_tables; i++) + { + const char *lvar = NULL, *rvar = ""; + if (*t_tables[i]) + { + lvar = *t_tables[i]++; + rvar = *t_tables[i]++; + } + if (!rvar) { // draw category + prints(HLP_CATEGORY_COLOR "%-*s", col_widths[i], lvar); + continue; + } + if (!lvar) { // table is complete... + incomplete --; + lvar = ""; + } + // draw table body + prints( HLP_DESCRIPTION_COLOR "%-*s" + HLP_KEYLIST_COLOR "%-*s", + l_widths[i], lvar, + col_widths[i]-l_widths[i], rvar); + } + outc('\n'); + } while (incomplete); // show additional help information if (help_handler) diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c index eae3ac58..0ae35200 100644 --- a/pttbbs/mbbsd/talk.c +++ b/pttbbs/mbbsd/talk.c @@ -1995,16 +1995,16 @@ t_showhelp(void) const char ** p1[3] = { hlp_talkbasic, hlp_talkdisp, hlp_talkcfg }, ** p2[3] = { hlp_talktalk, hlp_talkmisc, hlp_talkadmin }; - const int cols[3] = { 31, 25, 22 }, // columns, to fit pmore built-ins + const int cols[3] = { 31, 25, 22 }, // column witdh desc[3] = { 12, 18, 16 }; // desc width clear(); showtitle("休閒聊天", "使用說明"); outs("\n"); vs_multi_T_table_simple(p1, 3, cols, desc, - ANSI_COLOR(1;32), ANSI_COLOR(0), ANSI_COLOR(1;36) ); + HLP_CATEGORY_COLOR, HLP_DESCRIPTION_COLOR, HLP_KEYLIST_COLOR); if (HasUserPerm(PERM_PAGE)) vs_multi_T_table_simple(p2, HasUserPerm(PERM_SYSOP)?3:2, cols, desc, - ANSI_COLOR(1;32), ANSI_COLOR(0), ANSI_COLOR(1;36) ); + HLP_CATEGORY_COLOR, HLP_DESCRIPTION_COLOR, HLP_KEYLIST_COLOR); #else // USE_OLD_HELP |