summaryrefslogtreecommitdiffstats
path: root/mbbsd/screen.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-05 17:42:10 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-05 17:42:10 +0800
commitfad6d5dd743843705e3a42da7a80b5bebc009bcb (patch)
treefdcacd3087e37394e47999298538eaf3a0db3da3 /mbbsd/screen.c
parentc7a85922f032c2b1913761f0530c2a53e9f2aebd (diff)
downloadpttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar.gz
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar.bz2
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar.lz
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar.xz
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.tar.zst
pttbbs-fad6d5dd743843705e3a42da7a80b5bebc009bcb.zip
screen: add grayout system
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3637 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r--mbbsd/screen.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index e508ece2..4d9159ba 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -553,6 +553,69 @@ standend(void)
}
}
+// level:
+// -1 - black (not implemented)
+// 0 - dark text
+// 1 - text
+// 2 - no highlight (not implemented)
+void
+grayout_lines(int y, int end, int level)
+{
+ register screenline_t *slp = NULL;
+ char buf[ANSILINELEN];
+ int i = 0;
+
+ if (y < 0) y = 0;
+ if (end > b_lines) end = b_lines;
+
+ for (; y < end; y ++)
+ {
+ slp = &big_picture[y];
+
+ if (slp->len < 1)
+ continue;
+
+ // tweak slp
+ slp->data[slp->len] = 0;
+ slp->mode &= ~STANDOUT;
+ slp->mode |= MODIFIED;
+ slp->oldlen = 0;
+ slp->sso = slp->eso = 0;
+ slp->smod = 0;
+
+ // make slp->data a pure string
+ for (i=0; i<slp->len; i++)
+ {
+ if (!slp->data[i])
+ slp->data[i] = ' ';
+ }
+
+ slp->len = strip_ansi(buf, (char*)slp->data, STRIP_ALL);
+ buf[slp->len] = 0;
+
+ switch(level)
+ {
+ case 0: // dark text
+ strcpy((char*)slp->data, ANSI_COLOR(1;30;40));
+ strcat((char*)slp->data, buf);
+ strcat((char*)slp->data, ANSI_RESET ANSI_CLRTOEND);
+ slp->len = strlen((char*)slp->data);
+ break;
+
+ case 1: // Plain text
+ memcpy(slp->data, buf, slp->len + 1);
+ break;
+ }
+ slp->emod = slp->len -1;
+ }
+}
+
+void grayout_line(int y, int level)
+{
+ return grayout_lines(y, y+1, level);
+}
+
+
static size_t screen_backupsize(int len, const screenline_t *bp)
{
int i;