void Vid_FillPart(int row, int col, int width, int height, int fcolor, int bcolor, int smb) { BYTE Attr[2]; Attr[1]=MKATRB(bcolor,fcolor); Attr[0]=smb; VioScrollUp(row,col,row+height-1,col+width-1,height,(PBYTE)Attr,hvio); }
void Vid_Erase(int fcolor, int bcolor) { BYTE Attr[2]; Attr[1]=MKATRB(bcolor,fcolor); Attr[0]=0x20; VioScrollUp(0,0,0xFFFF,0xFFFF,0xFFFF,(PBYTE)Attr,hvio); VioSetCurPos(0,0,hvio); }
/*--------------------------------------------------------------------------* * PhysScrollUp * * * *--------------------------------------------------------------------------*/ void PhysScrollUp(unsigned int lines, struct window_parms *wp) { int rc; if (rc = VioScrollUp(wp->top_row, wp->left_col, wp->display_rows - 1, wp->display_cols - 1, (int)lines, (PBYTE)&wp->clearcell, (HVIO)0)) printf("Failed scrolling up %d. rc = %d\n", lines, rc); }
/* -------------------------------------------------------------------------- Clear the screen. - Parameters ------------------------------------------------------------- ULONG attribute : foreground/background colors attribute. - Return value ----------------------------------------------------------- BOOL : TRUE/FALSE (success/error). -------------------------------------------------------------------------- */ BOOL screenClear(ULONG attribute) { CHAR buf[4]; buf[0] = ' '; buf[1] = attribute; if (VioScrollUp(0, 0, 0xffff, 0xffff, 0xffff, buf, 0)) return FALSE; VioSetCurPos(0, 0, 0); return TRUE; }
void ClrPhyScr(uint top,uint bot,uint attr ) /* 1st line to clear (0..N) */ /* last line to clear (0..N) */ /* logical attr used to clr scrn */ { twoc fillchar = ( twoc )((VideoMap[attr] << 8) | ' ');/* cast 100*/ if( VioScrollUp((ushort)top, 0, (ushort)bot, /* cast 100*/ (ushort)(VideoCols-1), /* cast 100*/ (ushort)(bot - top + 1), /* cast 100*/ (char*) &fillchar, 0) ) panic(OOvioclr); }
/* insert or delete rows. qty is positive to insert, negative to delete */ static ELVBOOL vio_scroll (GUIWIN *gw, /* window to be scrolled */ int qty, /* rows to insert (may be negative to delete) */ ELVBOOL notlast) /* if ElvTrue, then leave last row unchanged */ { VWIN *vw = (VWIN *)gw; CHAR cell[2]; USHORT bottom_row; /* Mentally adjust the number of rows used for messages. This is only * significant immediately after running an external program, and is * used for hiding any premature attempts to redraw the window's text * but still show the window's messages. */ afterscrl -= qty; /* If this window isn't the only window, then fail. * Later, this function may be smart enough to use scrolling regions, * or do the idlok() kind of thing, but not yet. */ if (vwins->next) { return ElvFalse; } /* revert to the normal font */ vio_revert (vw); /* move the physical cursor to where the window thinks it should be */ movecurs (vw); /* This is what we'll fill the scrolled region with: */ cell[0] = ' '; cell[1] = vc_current; bottom_row = notlast ? o_ttyrows - 2 : o_ttyrows - 1; if (qty > 0) { VioScrollDn (c_row, 0, bottom_row, o_ttycolumns - 1, qty, cell, 0); } else { VioScrollUp (c_row, 0, bottom_row, o_ttycolumns - 1, -qty, cell, 0); } return ElvTrue; }
/* -------------------------------------------------------------------------- Display a menu of choices, returning the ordinal (0 based) of the selected choice. - Parameters ------------------------------------------------------------- INT iRow : line position (0 = top of screen, -1 = current position). PSZ pszPrompt : prompt message. PSZ choices : array of choice characters (max 5 characters). PMENUFN pfunc : optional callback function used when the menu has a 'retry' item. When pfunc() returns FALSE the loop is terminated. PVOID pparm : optional pfunc() parameters. - Return value ----------------------------------------------------------- ULONG : number of the selected choice. - Note: ------------------------------------------------------------------ If pszPrompt is NULL the area where the prompt message is printed is cleared and no other action is performed. -------------------------------------------------------------------------- */ ULONG showMenu(PSZ pszPrompt, PSZ choices) { CHAR achscr[1760]; CHAR achmenu[1760]; CHAR buf[4]; ULONG key; USHORT row, col, irow, cb; PSZ pChoice, pLine, pEnd; buf[0] = ' '; buf[1] = VIOB_GRAY | VIOF_DARKBLUE; DosBeep(220, 50); DosBeep(440, 50); DosBeep(880, 50); cb = sizeof(achscr); VioReadCellStr(achscr, &cb, 7, 0, 0); VioScrollUp(7, 0, 17, 80, 11, buf, 0); sprintf(achmenu, pszPrompt, choices[0], choices[1], choices[2], choices[3], choices[4]); VioGetCurPos(&row, &col, 0); for (pLine = pEnd = achmenu, irow = 8; pEnd; ++irow) { if (NULL != (pEnd = strchr(pLine, '\r'))) { *pEnd = '\0'; if (*++pEnd == '\n') ++pEnd; } // skip empty lines if (*pLine) VioWrtCharStrAtt(pLine, strlen(pLine), irow, 0, buf + 1, 0); pLine = pEnd; } VioSetCurPos(irow, 0, 0); // VioWrtCharStrAtt(pszPrompt, strlen(pszPrompt), 8, 0, buf + 1, 0); for (;;) { key = kbdKeyChar(kbdKey()) & ~0x20; if (NULL != (pChoice = strchr(choices, (INT)key))) break; DosBeep(440, 100); } VioWrtCellStr(achscr, cb, 7, 0, 0); VioSetCurPos(row, col, 0); return (ULONG)(pChoice - choices); }
/* -------------------------------------------------------------------------- Print a text message on the screen and on standard output. - Parameters ------------------------------------------------------------- LONG irow : row position of the message. If this is < 0 the cursor position is not changed. PSZ pszMsg : text message with formatting tags. ... : variable number of parameters. - Return value ----------------------------------------------------------- VOID -------------------------------------------------------------------------- */ VOID printMsg(ULONG irow, PSZ pszMsg, ...) { CHAR buf[CBMSG_BUF]; ULONG cb; va_list ap; va_start(ap, pszMsg); cb = vsprintf(buf, pszMsg, ap); va_end(ap); cb +=sprintf(buf + cb, "\r\n"); if (!(g.mode & FSJQUIET)) { if (irow > 0) { VioScrollUp(irow, 0, irow + 5, 80, 6, " \x00", 0); VioSetCurPos(irow, 0, 0); } DosPutMessage((HFILE)1, cb, buf); } if (g.hfLog) DosPutMessage(g.hfLog, cb, buf); }
int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { int MX, MY; int MouseHidden = 0; TCell FillCell = (TCell)(Fill << 8); if (MousePresent && MouseVisible) { ConQueryMousePos(&MX, &MY); if ((MX >= X) && (MX < X + W) && (MY >= Y) && (MY < Y + H)) { DrawMouse(0); MouseHidden = 1; } } switch (Way) { case csUp: VioScrollUp((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csDown: VioScrollDn((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csLeft: VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csRight: VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; } if (MouseHidden) DrawMouse(1); return 0; }
void ShowFullWindow (char *title) { int attr = ((7 << 4) << 8) | ' '; USHORT line; /* display empty "window" */ VioScrollUp(3,0,vio.row - 5,vio.col - 1,-1,(char *)&attr,0); attr = (((7 << 4) | 4) << 8) | ' '; VioWrtNCell((char *)&attr,vio.col,2,0,0); attr = (((7 << 4) | (7 | 8)) << 8) | 'Ä'; VioWrtNCell((char *)&attr,vio.col - 4,3,1,0); attr = (((7 << 4) | 8) << 8) | 'Ä'; VioWrtNCell((char *)&attr,vio.col - 4,vio.row - 6,1,0); attr = (((7 << 4) | (7 | 8)) << 8) | 'Ú'; VioWrtNCell((char *)&attr,1,3,1,0); attr = (((7 << 4) | (7 | 8)) << 8) | '¿'; VioWrtNCell((char *)&attr,1,3,vio.col - 3,0); attr = (((7 << 4) | (7 | 8)) << 8) | 'À'; VioWrtNCell((char *)&attr,1,vio.row - 6,1,0); attr = (((7 << 4) | 8) << 8) | 'Ù'; VioWrtNCell((char *)&attr,1,vio.row - 6,vio.col - 3,0); attr = (((7 << 4) | (7 | 8)) << 8) | '³'; for(line = 4;line < vio.row - 6;line++) VioWrtNCell((char *)&attr,1,line,1,0); attr = (((7 << 4) | 8) << 8) | '³'; for(line = 4;line < vio.row - 6;line++) VioWrtNCell((char *)&attr,1,line,vio.col - 3,0); attr = ' '; VioWrtNCell((char *)&attr,vio.col - 1,vio.row - 4,1,0); for(line = 3;line < vio.row - 4;line++) VioWrtNCell((char *)&attr,1,line,vio.col - 1,0); attr = ((8 << 4) << 8) | ' '; VioWrtNCell((char *)&attr,1,2,vio.col - 1,0); VioWrtNCell((char *)&attr,1,vio.row - 4,0,0); /* display title */ VioWrtCharStr(title,min(strlen(title),vio.col - 2),2, ((vio.col - 2) - min(strlen(title),vio.col - 2)) / 2,0); }
USHORT __pascal VIOSCROLLUP(const USHORT TopRow, const USHORT LeftCol, const USHORT BotRow, const USHORT RightCol, const USHORT Lines, const PBYTE Cell, const HVIO Handle) { return VioScrollUp(TopRow, LeftCol, BotRow, RightCol, Lines, Cell, Handle); }
void Run_Help() { PAREA parea; HELP2 *hTmp; int code, type; int renew; if (!HELP_SYSTEM->text) { DosBeep(500,200); DosBeep(500,300); return; } parea=Store_area(HELP_SYSTEM->luy, HELP_SYSTEM->lux, HELP_SYSTEM->width, HELP_SYSTEM->height); hTmp=HELP_SYSTEM; HELP_SYSTEM=NULL; renew=1; while (1) { if (renew) { Vid_ErasePart(hTmp->luy, hTmp->lux, hTmp->width, hTmp->height, hTmp->f_color, hTmp->b_color); Load_Help(hTmp); renew=0; } Kbd_Wait(); type=Kbd_GetType(); code=Kbd_GetCode(); if (type==KBD_ASCII) { DosBeep(400,400); continue; } else { switch(code) { case CUUP: if (hTmp->y_offset) { BYTE Attr[2]; Attr[0]=0x20; Attr[1]=MKATRB(hTmp->b_color,hTmp->f_color); hTmp->y_offset--; VioScrollDn(hTmp->luy, hTmp->lux,hTmp->luy+hTmp->height-1, hTmp->lux+hTmp->width-1 ,1,(PBYTE)Attr,hvio); VioWrtCharStr(hTmp->text[hTmp->y_offset]+hTmp->x_offset, min(strlen(hTmp->text[hTmp->y_offset]+hTmp->x_offset), hTmp->width),hTmp->luy,hTmp->lux,hvio); // renew=1; } continue; case CUDN: if (hTmp->y_offset + hTmp->height < hTmp->num_lines ) { BYTE Attr[2]; Attr[0]=0x20; Attr[1]=MKATRB(hTmp->b_color,hTmp->f_color); hTmp->y_offset++; VioScrollUp(hTmp->luy, hTmp->lux,hTmp->luy+hTmp->height-1, hTmp->lux+hTmp->width-1 ,1,(PBYTE)Attr,hvio); VioWrtCharStr(hTmp->text[hTmp->y_offset+hTmp->height-1]+hTmp->x_offset, min(strlen(hTmp->text[hTmp->y_offset+hTmp->height-1]+hTmp->x_offset),hTmp->width), hTmp->luy+hTmp->height-1,hTmp->lux,hvio); // renew=1; } continue; case PGUP: if (hTmp->y_offset - hTmp->height >=0 ) { hTmp->y_offset-=hTmp->height; renew=1; } continue; case PGDN: if (hTmp->y_offset + hTmp->height < hTmp->num_lines ) { hTmp->y_offset=min(hTmp->y_offset + hTmp->height, hTmp->num_lines - hTmp->height); renew=1; } continue; case HOME: if (hTmp->x_offset || hTmp->y_offset) { hTmp->x_offset=0; hTmp->y_offset=0; renew=1; } continue; case END: if (hTmp->y_offset != hTmp->num_lines - hTmp->height) { hTmp->y_offset=hTmp->num_lines - hTmp->height; renew=1; } continue; case CULT: if (hTmp->x_offset > 0) { hTmp->x_offset--; renew=1; } continue; case CURT: if (hTmp->x_offset + hTmp->width < hTmp->mw_lines) { hTmp->x_offset++; renew=1; } continue; case ESC: break; default: DosBeep(400,300); continue; } } break; } HELP_SYSTEM=hTmp; Restore_area(parea); }
void scroll_up(unsigned start, unsigned end, unsigned nlines) { curcell [0] = ' '; VioScrollUp(start, 0, end, Columns - 1, nlines, (PBYTE) curcell, 0); }