作者itoc, 信區: itoc
標題[功能] xover.c board.c post.c 看板說明
時間03/08/17
作者: itoc (風調雨順,國泰民安) 看板: plan
標題: [功能] 看板說明
時間: Sun Jun 1 11:56:03 2003 Updated: 2006/04/17
1. 給予每個看板簡單的說明簡介
2. 若要改變看板說明的行數請更改 xover.c:xover()
3. 弄成Habit選項,因為這東西有人喜歡有討厭
4. 在我的最愛中也可以正常顯示
: include/config.h
+ #define HAVE_BRD_EXPLAIN /* kenshieh.010114: 看板說明 */
: include/global.h
+ #define FN_EXPLAIN "explain"
+ VAR char *fn_explain INI(FN_EXPLAIN);
: include/modes.h
#define XO_RSIZ 256
+ #ifndef HAVE_BRD_EXPLAIN
#define XO_TALL (b_lines - 3)
+ #endif
: global.h
+ #ifdef HAVE_BRD_EXPLAIN
+ VAR int XO_TALL;
+ #endif
: include/ufo.h
#define UFO_KIMONEWS BFLAG(18) /* itoc.020130: 上站看 Kimo News */
+ #define UFO_BRDEXP BFLAG(19) /* amaki.030524: 看板說明的標籤 */
...
...
- #define NUMUFOS_USER 19 /* 一般使用者 可以用前 19 個 ufo */
+ #define NUMUFOS_USER 20 /* 一般使用者 可以用前 20 個 ufo */
- #define STR_UFO "-mpsnemPBQFANbwtSHK-----CHA"
+ #define STR_UFO "-mpsnemPBQFANbwtSHKE----CHA"
改一下ufo_tbl[],記得要對齊上面的STR_UFO位置。
+#ifdef HAVE_BRD_EXPLAIN /* UFO_BRDEXP */
+ "看板說明 (顯示/隱藏)",
+#else
"保留",
+#endif
: bbsd.c:term_init()
else
{
b_lines = 23;
b_cols = 79;
}
d_cols = b_cols - 79;
+ #ifdef HAVE_BRD_EXPLAIN
+ /* initial XO_TALL */
+ XO_TALL = b_lines - 3;
+ #endif
}
: maple/board.c:class_body()
- } while (++n < b_lines);
+ } while (++n < XO_TALL + 3);
: so/manage.c:post_explain_edit() 新增這函式於 post_memo_edit() 後面
/* ----------------------------------------------------- */
/* 板主功能 : 修改看板說明 */
/* ----------------------------------------------------- */
#ifdef HAVE_BRD_EXPLAIN
static int
post_explain_edit(xo)
XO *xo;
{
int mode;
char fpath[64];
mode = vans("看板說明 (D)刪除 (E)修改 (Q)取消?[E] ");
if (mode != 'q')
{
brd_fpath(fpath, currboard, fn_explain);
if (mode == 'd')
unlink(fpath);
else
{
if (vedit(fpath, 0)) /* Thor.981020: 注意被talk的問題 */
vmsg(msg_cancel);
return XO_HEAD;
}
}
return XO_FOOT;
}
#endif
: so/manage.c:post_manage()
"WMemo 編輯進板畫面",
+#ifdef HAVE_BRD_EXPLAIN
+ "Explain 編輯看板說明",
+#endif
...
...
+#ifdef HAVE_BRD_EXPLAIN
+ char *menu = "◎ 板主選單 (B)主題 (W)進板 (E)說明 (M)副板"
+#else
char *menu = "◎ 板主選單 (B)主題 (W)進板 (M)副板"
+#endif
...
...
case 'w':
ret = post_memo_edit(xo);
break;
+ case 'e':
+ ret = post_explain_edit(xo);
+ break;
: maple/xover.c:XoBoard() 新增這函式於 xover() 前面
#ifdef HAVE_BRD_EXPLAIN
static void
XoBoard(xo, zone) /* 看板說明 */
XO *xo;
int zone;
{
int bno;
short *chp;
char buf[ANSILINELEN];
BRD *brd;
MF *mf;
FILE *fp;
if (!(cuser.ufo & UFO_BRDEXP))
return;
if (zone == XZ_CLASS)
{
chp = (short *) xo->xyz + xo->pos;
bno = *chp;
}
else if (zone == XZ_MF)
{
mf = (MF *) xo_pool + (xo->pos - xo->top);
if (mf->mftype & MF_BOARD)
bno = brd_bno(mf->xname);
else
return;
}
else
{
return;
}
move(XO_TALL + 3, 0);
clrtobot();
outs(msg_seperator);
if (bno >= 0)
{
brd = bshm->bcache + bno;
brd_fpath(buf, brd->brdname, "explain");
if (fp = fopen(buf, "r"))
{
for (bno = XO_TALL + 4; bno < b_lines; bno++) /* 借用 bno */
{
if (!(fgets(buf, ANSILINELEN, fp)))
break;
buf[79] = '\0';
move(bno, 0);
outx(buf);
}
fclose(fp);
}
}
outf(xz[zone].feeter);
}
#endif
: xover.c:xover() 進入看板列表/我的最愛時,將 XO_TALL 改為 b_lines-7
int pos, num, zone, sysmode;
XO *xo;
KeyFunc *xcmd, *cb;
+#ifdef HAVE_BRD_EXPLAIN
+ zone = cmd;
+#endif
for (;;)
{
while (cmd != XO_NONE)
{
+#ifdef HAVE_BRD_EXPLAIN
+ /* 三行看板說明、一行分隔線,共四行 */
+ /* 7 - 3 = 4,若要改看板說明的行數,改 7 這個數字 */
+ XO_TALL = ((cuser.ufo&UFO_BRDEXP) && (zone==XZ_CLASS || zone==XZ_MF)) ?
+ b_lines - 7 : b_lines - 3;
+#endif
if (cmd == XO_FOOT)
...
...
xcmd = xz[cmd].cb;
sysmode = xz[cmd].mode;
+#ifdef HAVE_BRD_EXPLAIN
+ /* 三行看板說明、一行分隔線,共四行 */
+ /* 7 - 3 = 4,若要改看板說明的行數,改 7 這個數字 */
+ XO_TALL = ((cuser.ufo&UFO_BRDEXP) && (zone==XZ_CLASS || zone==XZ_MF)) ?
+ b_lines - 7 : b_lines - 3;
+#endif
...
...
if (xo->max > 0) /* Thor: 若是無東西就不show了 */
{
num = 3 + pos - xo->top;
move(num, 0);
outc('>');
+#ifdef HAVE_BRD_EXPLAIN
+ XoBoard(xo, zone);
+#endif
}
: xover.c:xover() 離開時,將 XO_TALL 還原
if (cmd == XO_QUIT)
+ {
+ XO_TALL = b_lines - 7;
return;
+ }
...
...
if (cmd == KEY_LEFT || cmd == 'e')
{
/* cmd = XO_LAST; *//* try to load the last XO in future */
+ XO_TALL = b_lines - 7;
return;
}
: board.c:class_head()
static int
class_head(xo)
XO *xo;
{
+#ifdef HAVE_BRD_EXPLAIN
+ /* 三行看板說明、一行分隔線,共四行 */
+ /* 7 - 3 = 4,若要改看板說明的行數,改 7 這個數字 */
+ XO_TALL = (cuser.ufo & UFO_BRDEXP) ? b_lines - 7 : b_lines - 3;
+#endif
vs_head("看板列表", str_site);
return class_neck(xo);
}
: favor.c:mf_init()
static int
mf_init(xo)
XO *xo;
{
+#ifdef HAVE_BRD_EXPLAIN
+ /* 三行看板說明、一行分隔線,共四行 */
+ /* 7 - 3 = 4,若要改看板說明的行數,改 7 這個數字 */
+ XO_TALL = (cuser.ufo & UFO_BRDEXP) ? b_lines - 7 : b_lines - 3;
+#endif
xo_load(xo, sizeof(MF));
return mf_head(xo);
}
--
□ 本文章由 itoc 從 itoc.Dorm-GD2.NCTU.edu.tw 發表精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻