summaryrefslogtreecommitdiffstats
path: root/mbbsd/screen.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-19 23:39:37 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-19 23:39:37 +0800
commit60c7059c312f02d1dd5738d7e9c2872a1a123657 (patch)
treea1e4ec9e7c788fcbfaf22882e7629823faeb4067 /mbbsd/screen.c
parentacf58ca18005d3ed917cbc80a33baeec9d44335f (diff)
downloadpttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar.gz
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar.bz2
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar.lz
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar.xz
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.tar.zst
pttbbs-60c7059c312f02d1dd5738d7e9c2872a1a123657.zip
- isolate low level termial i/o api calls, prepare for pfterm
(piaip's flat terminal system) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3710 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r--mbbsd/screen.c141
1 files changed, 25 insertions, 116 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 941ad015..7bc61e54 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -24,6 +24,30 @@ initscr(void)
}
}
+int
+resizescr(int w, int h)
+{
+ screenline_t *new_picture;
+
+ /* make sure reasonable size */
+ h = MAX(24, MIN(100, h));
+ w = MAX(80, MIN(200, w));
+
+ if (h > t_lines && big_picture) {
+ new_picture = (screenline_t *)
+ calloc(h, sizeof(screenline_t));
+ if (new_picture == NULL) {
+ syslog(LOG_ERR, "calloc(): %m");
+ return 0;
+ }
+ memcpy(new_picture, big_picture, t_lines * sizeof(screenline_t));
+ free(big_picture);
+ big_picture = new_picture;
+ return 1;
+ }
+ return 0;
+}
+
void
move(int y, int x)
{
@@ -170,34 +194,6 @@ redoscr(void)
oflush();
}
-// deprecated?
-#if 0
-void
-redoln(void)
-{
- screenline_t *slp = GetCurrentLine();
- int len, mode;
-
- len = slp->len;
- rel_move(tc_col, tc_line, 0, cur_ln);
- if (len)
- {
- if ((mode = slp->mode) & STANDOUT)
- standoutput((char*)slp->data, 0, len, slp->sso, slp->eso);
- else
- output((char*)slp->data, len);
-
- slp->mode = mode & ~(MODIFIED);
-
- slp->oldlen = tc_col = len;
- }
- else
- clrtoeol();
- rel_move(tc_col, tc_line, cur_col, cur_ln);
- oflush();
-}
-#endif
-
void
refresh(void)
{
@@ -449,94 +445,6 @@ outs(const char *str)
}
void
-outs_n(const char *str, int n)
-{
- while (*str && n--) {
- outc(*str++);
- }
-}
-
-// XXX left-right (for large term)
-// TODO someday please add ANSI detection version
-void
-outslr(const char *left, int leftlen, const char *right, int rightlen)
-{
- if (left == NULL)
- left = "";
- if (right == NULL)
- right = "";
- if(*left && leftlen < 0)
- leftlen = strlen(left);
- if(*right && rightlen < 0)
- rightlen = strlen(right);
- // now calculate padding
- rightlen = t_columns - leftlen - rightlen;
- outs(left);
-
- // ignore right msg if we need to.
- if(rightlen >= 0)
- {
- while(--rightlen > 0)
- outc(' ');
- outs(right);
- } else {
- rightlen = t_columns - leftlen;
- while(--rightlen > 0)
- outc(' ');
- }
-}
-
-
-/* Jaky */
-void
-out_lines(const char *str, int line)
-{
- while (*str && line) {
- outc(*str);
- if (*str == '\n')
- line--;
- str++;
- }
-}
-
-void
-outmsg(const char *msg)
-{
- move(b_lines - msg_occupied, 0);
- clrtoeol();
- outs(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;
- char buff[1024];
-
- va_start(args, fmt);
- vsnprintf(buff, sizeof(buff), fmt, args);
- va_end(args);
- outs(buff);
-}
-
-void
-mouts(int y, int x, const char *str)
-{
- move(y, x);
- clrtoeol();
- outs(str);
-}
-
-void
scroll(void)
{
scrollcnt++;
@@ -622,6 +530,7 @@ grayout_lines(int y, int end, int level)
if (y < 0) y = 0;
if (end > b_lines) end = b_lines;
+ // TODO change to y <= end someday
// loop lines
for (; y < end; y ++)
{