Пример #1
0
void MLE_reload(PMLE pmle)
{
int i, j, len;
int x,y;

   j=max(0,pmle->cursor-1);
   x=j % pmle->width;         // положение курсора
   y=j / pmle->width;         // в окне
   i=j-x;                     // позиция начало строки в буфере
   len=strlen(pmle->buf+i);

   while (len > pmle->width)
      {
      VioWrtCharStr(pmle->buf + i,pmle->width,pmle->luy+y,pmle->lux,hvio);
      i+=pmle->width;
      len-=pmle->width;
      y++;
      }
   if (len > 0)
      {
      Vid_EraseLine(pmle->luy + y,pmle->lux,pmle->width);
      VioWrtCharStr(pmle->buf + i,len,pmle->luy+y,pmle->lux,hvio);
      y++;
      }

   while(y < pmle->height)
      Vid_EraseLine(pmle->luy + y++,pmle->lux,pmle->width);

//   if (y >= pmle->height -1)
      MLE_lastline(pmle);
}
Пример #2
0
/*-----------------------------------------------------------------------*/
void file_has_disappeared(char *bline, char *AnyKey, struct window_parms *wp)
{
   VioWrtCharStr("File no longer exists       ", 28, wp->window_rows - 1,
                 0, (HVIO)0);
   VioWrtCharStr(AnyKey, strlen(AnyKey), wp->window_rows - 1, 28, (HVIO)0);
   getch();
   put_bline(bline, BLSIZE, wp);
}
Пример #3
0
static LONG APIENTRY MixHandler(ULONG ulStatus, PMCI_MIX_BUFFER  pBuffer,
                                      ULONG ulFlags)
#ifdef __WATCOMC__
 #pragma on (unreferenced)
#endif
{
ULONG Wrote;
char tmptxt[12];

      //Transfer buffer to DART
      if(pBuffer->pBuffer) {
     Wrote = wavfile.writeData((char*)pBuffer->pBuffer, pBuffer->ulBufferLength);
//     DosWrite(modin, pBuffer->pBuffer, pBuffer->ulBufferLength, &Wrote);

	  BytesRecorded += Wrote;
	  sprintf(tmptxt, "%9d ", BytesRecorded); 
	  VioWrtCharStr(&tmptxt[0], (USHORT)strlen(tmptxt), CurPosX, CurPosY, 0);
      }

      MixSetupParms.pmixRead( MixSetupParms.ulMixHandle,
                              &MixBuffers[BufNr],
                              1);
      if(BufNr == NUM_BUFFERS-1) BufNr = 0;
      else           	         BufNr++;
      return(TRUE);
}
Пример #4
0
void Vid_PutText(char **text,int row, int col, int yoffset, int xoffset, int width, int num_string)
{
int i, len;
char *str;
   for (i=0; i< num_string; i++)
      {
      str=text[i+yoffset];
      if (!str)
         return;
      len=strlen(str);
      if (len > xoffset)
         VioWrtCharStr(str+xoffset,min(width,len-xoffset),row+i,col,hvio);
      }
}
Пример #5
0
/* --------------------------------------------------------------------------
 Print the progress bar.
- Parameters -------------------------------------------------------------
 ULONG cbData : amount of data processed in the current step.
- Return value -----------------------------------------------------------
 VOID
-------------------------------------------------------------------------- */
VOID printProgress(ULONG cbData) {
   ULONG curstep;
   CHAR buf[80];
   CHAR bar[] = "Û°±²";
   INT len;

   if (g.mode & FSJPROGRESS)
   {
      g.cbProcData += cbData;
      curstep = (ULONG)(g.cbProcData * 160LL / g.cbWholeFile);
      if (curstep > g.prevstep)
      {
         while (g.prevstep < curstep)
         {
            g.prevstep++;
            VioWrtCharStr(bar + (g.prevstep % 4), 1,
                          IROW_BAR, (g.prevstep - 1) / 4, 0);
         }
         len = sprintf(buf, SZ_PROGRESS, ((curstep * 5.0) / 16.0));
         VioWrtCharStr(buf, len, IROW_PERCENT, 1, 0);
      }
   }
}
Пример #6
0
/*-----------------------------------------------------------------------*/
void display_help(char *HelpLines[], char *AnyKey, struct window_parms *wp)
{
   int i, scrnline;
   char mybl[BLSIZE+1];

   for (i = scrnline = 0; strcmp(HelpLines[i], ""); i++)
     {
       VioWrtCharStr(HelpLines[i], strlen(HelpLines[i]), scrnline++, 0, (HVIO)0);
       if (scrnline == wp->display_rows)
         {
           VioWrtCharStr(AnyKey, strlen(AnyKey), wp->window_rows - 1, 0, (HVIO)0);
           getch();
           clear_window(wp);
           scrnline = 0;
         }
      }
   if (scrnline > 0)
     {
       for (i = 0; i < BLSIZE; mybl[i++] = SPACE);
       strncpy(mybl, AnyKey, strlen(AnyKey));
       VioWrtCharStr(mybl, BLSIZE, wp->window_rows - 1, 0, (HVIO)0);
       getch();
     }
}
Пример #7
0
void vm_putch(char x, char y, char ch)
{
    if (_osmode == DOS_MODE)
    {
        char cell[2];
        vi_init();
        v_getline(cell, (int)(x - 1), (int)(y - 1), 1);
        *cell = ch;
        v_putline(cell, (int)(x - 1), (int)(y - 1), 1);
    }
    else
    {
        VioWrtCharStr(&ch, 1, (USHORT) (y - 1), (USHORT) (x - 1), 0);
    }
}
Пример #8
0
void vm_puts(char x, char y, char *str)
{
    if (_osmode == DOS_MODE)
    {
        vi_init();
        while (*str)
        {
            vm_putch(x, y, *str);
            str++;
            x++;
        }
    }
    else
    {
        VioWrtCharStr(str, (USHORT) strlen(str), (USHORT) (y - 1), (USHORT) (x - 1), 0);
    }
}
Пример #9
0
void MLE_load(int row, int col, PMLE pmle, int fcol, int bcol)
{
int i, len;
   pmle->lux=col;
   pmle->luy=row;
   pmle->b_color=bcol;
   pmle->f_color=fcol;
   len=strlen(pmle->buf);
   Vid_ErasePart(row,col,pmle->width,pmle->height,fcol,bcol);
   i=0;
   while (len > 0)
      {
      VioWrtCharStr(pmle->buf + i*pmle->width,min(pmle->width,len),row+i,col,hvio);
      i++;
      len-=pmle->width;
      }
   MLE_lastline(pmle);
}
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);
}
Пример #11
0
void vm_puts(char x, char y, char *str)
{
    VioWrtCharStr(str, (USHORT) strlen(str), (USHORT) (y - 1), (USHORT) (x - 1), 0);
}
Пример #12
0
void vm_putch(char x, char y, char ch)
{
    VioWrtCharStr(&ch, 1, (USHORT) (y - 1), (USHORT) (x - 1), 0);
}
Пример #13
0
USHORT __pascal VIOWRTCHARSTR(const PCHAR Str, const USHORT Count, const USHORT Row, const USHORT Column, const HVIO Handle)
{
  return VioWrtCharStr(Str, Count, Row, Column, Handle);
}
int EditAttributes (FILES *f) {

  char  *buf;
  USHORT len = (vio.col * 7) * 2,curpos = 0;
  char   nattr = (1 << 4) | (7 | 8);
  char   sattr = 8;
  int    ret = 0,x,key;
  BOOL   okay = TRUE;
  char   attrs[5] = "----";

  if(!f)
    return -1;
  buf = malloc(len);
  if(!buf)
    return -1;

  ThreadMsg(" ");

  VioReadCellStr(buf,&len,(vio.row / 2) - 1,0,0);

  VioWrtCharStrAtt("ÚÄ Attributes: Ä¿",17,(vio.row / 2) - 1,
                   34,&nattr,0);
  VioWrtCharStrAtt("³ Readonly: [ ] ³",17,vio.row / 2,
                   34,&nattr,0);
  VioWrtCharStrAtt("³ Hidden:   [ ] ³",17,(vio.row / 2) + 1,
                   34,&nattr,0);
  VioWrtCharStrAtt("³ System:   [ ] ³",17,(vio.row / 2) + 2,
                   34,&nattr,0);
  VioWrtCharStrAtt("³ Archived: [ ] ³",17,(vio.row / 2) + 3,
                   34,&nattr,0);
  VioWrtCharStrAtt("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ",17,(vio.row / 2) + 4,
                   34,&nattr,0);
  VioWrtNAttr(&sattr,1,vio.row / 2,51,0);
  VioWrtNAttr(&sattr,1,(vio.row / 2) + 1,51,0);
  VioWrtNAttr(&sattr,1,(vio.row / 2) + 2,51,0);
  VioWrtNAttr(&sattr,1,(vio.row / 2) + 3,51,0);
  VioWrtNAttr(&sattr,1,(vio.row / 2) + 4,51,0);
  VioWrtNAttr(&sattr,16,(vio.row / 2) + 5,36,0);
  if(f->attrFile & FILE_READONLY)
    attrs[0] = 'x';
  if(f->attrFile & FILE_HIDDEN)
    attrs[1] = 'x';
  if(f->attrFile & FILE_SYSTEM)
    attrs[2] = 'x';
  if(f->attrFile & FILE_ARCHIVED)
    attrs[3] = 'x';
  for(x = 0;x < 4;x++)
    VioWrtCharStr(attrs + x,1,x + (vio.row / 2),47,0);
  VioSetCurPos(curpos + (vio.row / 2),47,0);
  ShowCursor(FALSE);
  while(okay) {
    VioWrtCharStr(attrs + curpos,1,curpos + (vio.row / 2),47,0);
    VioSetCurPos(curpos + (vio.row / 2),47,0);
    key = get_ch(-1);
    switch(key) {
      case 256:
        break;

      case 45 | 256:
      case 61 | 256:
      case '\x1b':  /* abort */
        okay = FALSE;
        ret = -1;
        break;

      case '\r':      /* process */
        okay = FALSE;
        {
          FILESTATUS3 fs3;

          if(!DosQueryPathInfo(f->filename,FIL_STANDARD,&fs3,sizeof(fs3))) {
            fs3.attrFile &= (~FILE_DIRECTORY);
            if(attrs[0] == 'x')
              fs3.attrFile |= FILE_READONLY;
            else
              fs3.attrFile &= (~FILE_READONLY);
            if(attrs[1] == 'x')
              fs3.attrFile |= FILE_HIDDEN;
            else
              fs3.attrFile &= (~FILE_HIDDEN);
            if(attrs[2] == 'x')
              fs3.attrFile |= FILE_SYSTEM;
            else
              fs3.attrFile &= (~FILE_SYSTEM);
            if(attrs[3] == 'x')
              fs3.attrFile |= FILE_ARCHIVED;
            else
              fs3.attrFile &= (~FILE_ARCHIVED);
            if(DosSetPathInfo(f->filename,FIL_STANDARD,&fs3,sizeof(fs3),
                              DSPI_WRTTHRU))
              DosBeep(50,100);
            else
              ret = 1;
          }
          else
            DosBeep(50,100);
        }
        break;

      case 72 | 256:  /* up */
        curpos--;
        if(curpos > 3)
          curpos = 3;
        break;

      case 'x':
      case 'X':
      case '+':
        attrs[curpos] = 'x';
        break;

      case '-':
        attrs[curpos] = '-';
        break;

      case ' ':       /* toggle */
        attrs[curpos] = (attrs[curpos] == 'x') ? '-' : 'x';
        VioWrtCharStr(attrs + curpos,1,curpos + (vio.row / 2),47,0);
        /* intentional fallthru */
      case 80 | 256:  /* down */
        curpos++;
        if(curpos > 3)
          curpos = 0;
        break;
    }
  }

  ShowCursor(TRUE);
  VioWrtCellStr(buf,len,(vio.row / 2) - 1,0,0);
  free(buf);
  SetupConsole();
  ThreadMsg(NULL);
  return ret;
}
int EnterLine (char *buf,ULONG len,USHORT y,char *filename,
               char **choices,int numc,int start) {

  ULONG         pos = 0,c,nm,numchars = 0,tpos,wl;
  APIRET        rc;
  int           key,attr = ((7 << 4) << 8) | ' ',ret = 0;
  BOOL          okay = TRUE,insert = TRUE,lasttab = FALSE;
  char         *sav,*k = NULL,*p;
  static char   keybuf[1026];
  USHORT        t;
  FILEFINDBUF3  fb3;
  HDIR          hdir = HDIR_CREATE;

  wl = 0;

  sav = malloc(vio.col * 2);
  if(!sav) {
    DosBeep(50,100);
    *buf = 0;
    return -1;
  }

  ThreadMsg(" ");

  t = vio.col * 2;
  VioReadCellStr(sav,&t,y,0,0);
  VioWrtNCell((char *)&attr,vio.col,y,0,0);
  ShowCursor(FALSE);
  VioSetCurPos(y,0,0);

  for(c = 0;c < len - 1;c++) {          /* find end of default string */
    if(!buf[c])
      break;
  }
  pos = c;
  for(;c < len - 1;c++)                 /* space-pad remainder of buf */
    buf[c] = ' ';

  while(okay) {
    /* assure buffer is null terminated (cluck, cluck) */
    buf[len - 1] = 0;

    /* assure pos hasn't gone past our limit */
    if(pos > len - 1)
      pos = len - 1;

    /* set left side of entry field */
    if(pos < wl)
      wl = pos;
    if(pos >= wl + vio.col)
      wl = (pos - vio.col) + 1;

    /* set cursor position */
    VioSetCurPos(y,pos - wl,0);

    /* display buf */
    tpos = min(vio.col,len - wl); /* max length of displayable text */
    VioWrtCharStr(buf + wl,tpos,y,0,0); /* show text */
    if(tpos < vio.col)                  /* space-pad? */
      VioWrtNChar(" ",vio.col - tpos,y,tpos,0);

    if(k && *k)   /* "macros" waiting to be entered? */
      key = *k++; /* yep, skip keyboard input */
    else {        /* nope, go to the keyboard */
      k = NULL;   /* clear macro pointer */
      key = get_ch(-1);
    }

    switch(key) {
      case 256:       /* shiftstate changed -- ignore */
        break;

      case '\r':      /* accept input */
        okay = FALSE;
        break;

      case 45 | 256:
      case 61 | 256:
      case '\x1b':    /* Escape -- exit editor */
        memset(buf,' ',len - 1);
        buf[len - 1] = 0;
        okay = FALSE;
        ret = -1;
        break;

      case '\b':
        if(pos) {
          pos--;
          memmove(buf + pos,buf + (pos + 1),len - (pos + 1));
          buf[len - 2] = ' ';
        }
        lasttab = FALSE;
        break;

      case 25:          /* ctrl+y -- clear input */
        VioWrtNCell((char *)&attr,vio.col,y,0,0);
        memset(buf,' ',len - 1);
        buf[len - 1] = 0;
        wl = pos = 0;
        lasttab = FALSE;
        break;

      case 59 | 256:    /* F1 -- insert directory */
        k = directory;
        lasttab = FALSE;
        break;

      case 60 | 256:    /* F2 -- insert filename */
        if(filename)
          k = filename;
        lasttab = FALSE;
        break;

      case 62 | 256:    /* F4 -- insert target */
        k = target;
        lasttab = FALSE;
        break;

      case 15:          /* shift+tab */
        if(hdir != (HDIR)HDIR_CREATE) {
          DosFindClose(hdir);
          hdir = HDIR_CREATE;
          lasttab = FALSE;
        }
        /* intentional fallthru */
      case 9:           /* tab -- auto-complete */
        if(!pos || pos >= len - 1)
          break;
        if(lasttab && numchars) {
          lasttab = FALSE;
          for(tpos = 0;tpos < numchars;tpos++)
            keybuf[tpos] = '\b';
          keybuf[tpos++] = '\01';
          keybuf[tpos] = 0;
          numchars = 0;
          k = keybuf;
          break;
        }
        else {
          if(hdir != (HDIR)HDIR_CREATE)
            DosFindClose(hdir);
          hdir = HDIR_CREATE;
        }
        /* intentional fallthru */
      case 1:           /* cheat! */
        k = NULL;
        if(!pos || pos >= len - 1)
          break;
        tpos = pos - 1;
        while(tpos && buf[tpos] != ' ')
          tpos--;
        if(buf[tpos] == ' ')
          tpos++;
        strcpy(keybuf,buf + tpos);
        tpos = 0;
        while(keybuf[tpos] && keybuf[tpos] != ' ')
          tpos++;
        keybuf[tpos] = 0;
        lstrip(rstrip(keybuf));
        if(*keybuf) {
          strcat(keybuf,"*");
          nm = 1;
          if(hdir == (HDIR)HDIR_CREATE)
            rc = DosFindFirst(keybuf,
                              &hdir,
                              FILE_NORMAL    | FILE_HIDDEN   | FILE_SYSTEM |
                              FILE_DIRECTORY | FILE_ARCHIVED | FILE_READONLY,
                              &fb3,
                              sizeof(fb3),
                              &nm,
                              FIL_STANDARD);
          else
            rc = DosFindNext(hdir,&fb3,sizeof(fb3),&nm);
          if(!rc) {
            while((fb3.attrFile & FILE_DIRECTORY) &&
                  (*fb3.achName == '.' && (!fb3.achName[1] ||
                                           (fb3.achName[1] == '.' &&
                                            !fb3.achName[2])))) {
              nm = 1;
              if(DosFindNext(hdir,&fb3,sizeof(fb3),&nm)) {
                DosFindClose(hdir);
                hdir = HDIR_CREATE;
                *fb3.achName = 0;
                break;
              }
            }
            if(*fb3.achName) {
              keybuf[strlen(keybuf) - 1] = 0;
              p = strchr(keybuf,'\\');
              if(p)
                p++;
              else
                p = keybuf;
              tpos = 0;
              while(*p && fb3.achName[tpos] &&
                    toupper(*p) == toupper(fb3.achName[tpos])) {
                p++;
                tpos++;
              }
              if(fb3.achName[tpos]) {
                strcpy(keybuf,fb3.achName + tpos);
                numchars = strlen(keybuf);
                lasttab = TRUE;
                k = keybuf;
              }
              else if(hdir != (HDIR)HDIR_CREATE) {
                DosFindClose(hdir);
                hdir = HDIR_CREATE;
              }
            }
          }
          else if(hdir != (HDIR)HDIR_CREATE) {
            DosBeep(50,50);
            DosFindClose(hdir);
            hdir = HDIR_CREATE;
          }
        }
        break;

      case 83 | 256:    /* delete */
        memmove(buf + pos,buf + (pos + 1),len - (pos + 1));
        buf[len - 2] = ' ';
        lasttab = FALSE;
        break;

      case 82 | 256:    /* insert */
        insert = (insert) ? FALSE : TRUE;
        break;

      case 71 | 256:    /* home */
        wl = pos = 0;
        lasttab = FALSE;
        break;

      case 79 | 256:    /* end */
        pos = len - 2;
        while(pos && buf[pos] == ' ')
          pos--;
        if(pos && buf[pos] != ' ')
          pos++;
        lasttab = FALSE;
        break;

      case 75 | 256:    /* left */
        if(pos)
          pos--;
        lasttab = FALSE;
        break;

      case 77 | 256:    /* right */
        if(pos < len - 1)
          pos++;
        lasttab = FALSE;
        break;

      case 72 | 256:    /* up */
        lasttab = FALSE;
        if(choices) {
          if(choices[start]) {
            VioWrtNCell((char *)&attr,vio.col,y,0,0);
            memset(buf,' ',len - 1);
            buf[len - 1] = 0;
            wl = pos = 0;
            k = choices[start];
            start++;
            while(start < numc && !choices[start])
              start++;
            if(start > (numc - 1))
              start = 0;
            if(!choices[start]) {
              while(start < numc && !choices[start])
                start++;
            }
            if(start > (numc - 1))
              start = 0;
          }
        }
        break;

      case 80 | 256:    /* down */
        lasttab = FALSE;
        if(choices) {
          if(choices[start]) {
            VioWrtNCell((char *)&attr,vio.col,y,0,0);
            memset(buf,' ',len - 1);
            buf[len - 1] = 0;
            wl = pos = 0;
            k = choices[start];
            start--;
            while(start >= 0 && !choices[start])
              start--;
            if(start < 0)
              start = numc - 1;
            if(!choices[start]) {
              while(start >= 0 && !choices[start])
                start--;
            }
            if(start < 0)
              start = numc - 1;
          }
        }
        break;

      case 115 | 256:   /* ctrl+left */
        while(pos && buf[pos] == ' ')
          pos--;
        while(pos && buf[pos] != ' ')
          pos--;
        lasttab = FALSE;
        break;

      case 116 | 256:   /* ctrl + right */
        while(pos < len - 1 && buf[pos] == ' ')
          pos++;
        while(pos < len - 1 && buf[pos] != ' ')
          pos++;
        lasttab = FALSE;
        break;

      default:
        if(pos < len - 1 && !(key & 256) && !iscntrl(key)) {
          if(insert) {
            if(pos < len - 2) {
              memmove(buf + (pos + 1),buf + pos,len - (pos + 2));
              buf[len - 2] = ' ';
            }
            buf[pos] = (char)key;
          }
          else
            buf[pos] = (char)key;
          pos++;
        }
        else if(pos >= len - 1)
          DosBeep(250,25);
        break;
    }
  }

  if(hdir != (HDIR)HDIR_CREATE)
    DosFindClose(hdir);

  ShowCursor(TRUE);
  VioWrtCellStr(sav,vio.col * 2,y,0,0);
  free(sav);
  SetupConsole();

  ThreadMsg(NULL);

  buf[len - 1] = 0;
  lstrip(rstrip(buf));
  return (ret) ? ret : strlen(buf);
}
Пример #16
0
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);
}
Пример #17
0
/*-----------------------------------------------------------------------*/
void put_bline(char *bline, int blsize, struct window_parms *wp )
{
   VioWrtCharStr(bline, blsize, wp->window_rows - 1, 0, (HVIO)0);
}
Пример #18
0
/*-----------------------------------------------------------------------*/
void putline(int scrnline, struct window_parms *wp)
{
   VioWrtCharStr(wp->linebuff, wp->linelen, scrnline, 0, (HVIO)0);
}
int SimpleInput (char *title,char *text,ULONG beep,ULONG dur,ULONG wait,
                 int *responses) {

  char  *buf;
  int    xlen,key = 0,x;
  USHORT len = (vio.col * 7) * 2,start,mlen,cell;
  char   sattr = 8;
  BOOL   okay = TRUE;

  if(!title)
    title = "";
  if(!text)
    return key;
  xlen = min(max(strlen(title),strlen(text)),vio.col - 6);
  mlen = xlen + 6;
  start = (vio.col - xlen) / 2;

  buf = malloc(len);
  if(buf) {
    /* save screen under */
    VioReadCellStr(buf,&len,(vio.row / 2) - 2,0,0);
    /* draw borders */
    /* first, bright white left and top */
    cell = ((((7 | 8) << 4) | 7) << 8) | ' ';
    VioWrtNCell((char *)&cell,mlen,(vio.row / 2) - 2,start,0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) - 1,start,0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2),start,0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 1,start,0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 2,start,0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 3,start,0);
    /* now dark grey right and bottom */
    cell = (((8 << 4) | 7) << 8) | ' ';
    VioWrtNCell((char *)&cell,1,(vio.row / 2) - 1,start + (mlen - 1),0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2),start + (mlen - 1),0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 1,start + (mlen - 1),0);
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 2,start + (mlen - 1),0);
    VioWrtNCell((char *)&cell,mlen - 1,(vio.row / 2) + 3,start + 1,0);
    /* fill title area with light grey foreground, red background */
    cell = (((7 << 4) | 4) << 8) | ' ';
    VioWrtNCell((char *)&cell,mlen - 2,(vio.row / 2) - 1,start + 1,0);
    /* fill text area with light grey foreground, black background */
    cell = (((7 << 4) | 0) << 8) | ' ';
    VioWrtNCell((char *)&cell,mlen - 4,(vio.row / 2) + 1,start + 2,0);
    /* make interior border -- first white on light grey */
    cell = (((7 << 4) | (7 | 8)) << 8) | 'Ú';
    VioWrtNCell((char *)&cell,1,(vio.row / 2),start + 1,0);
    cell = (((7 << 4) | (7 | 8)) << 8) | '¿';
    VioWrtNCell((char *)&cell,1,(vio.row / 2),start + (mlen - 2),0);
    cell = (((7 << 4) | (7 | 8)) << 8) | 'Ä';
    VioWrtNCell((char *)&cell,mlen - 4,(vio.row / 2),start + 2,0);
    cell = (((7 << 4) | (7 | 8)) << 8) | '³';
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 1,start + 1,0);
    cell = (((7 << 4) | (7 | 8)) << 8) | 'À';
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 2,start + 1,0);
    /* now dark grey on light grey */
    cell = (((7 << 4) | 8) << 8) | 'Ä';
    VioWrtNCell((char *)&cell,mlen - 4,(vio.row / 2) + 2,start + 2,0);
    cell = (((7 << 4) | 8) << 8) | 'Ù';
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 2,start + (mlen - 2),0);
    cell = (((7 << 4) | 8) << 8) | '³';
    VioWrtNCell((char *)&cell,1,(vio.row / 2) + 1,start + (mlen - 2),0);

    /* insert title */
    VioWrtCharStr(title,
                  min(xlen,strlen(title)),
                  (vio.row / 2) - 1,
                  (start + (mlen / 2)) - (min(xlen,strlen(title)) / 2),
                  0);
    /* insert text */
    VioWrtCharStr(text,
                  min(xlen,strlen(text)),
                  (vio.row / 2) + 1,
                  (start + (mlen / 2)) - (min(xlen,strlen(text)) / 2),
                  0);
    /* draw shadow */
    VioWrtNAttr(&sattr,1,(vio.row / 2) - 1,start + mlen,0);
    VioWrtNAttr(&sattr,1,(vio.row / 2),start + mlen,0);
    VioWrtNAttr(&sattr,1,(vio.row / 2) + 1,start + mlen,0);
    VioWrtNAttr(&sattr,1,(vio.row / 2) + 2,start + mlen,0);
    VioWrtNAttr(&sattr,1,(vio.row / 2) + 3,start + mlen,0);
    VioWrtNAttr(&sattr,mlen,(vio.row / 2) + 4,start + 1,0);
    VioSetCurPos((vio.row / 2) + 1,start + (mlen - 3),0);
    if(responses)
      ShowCursor(FALSE);
    if(beep)
      DosBeep(beep,dur);
    if(!responses)
      DosSleep(wait);
    else {
      KbdFlushBuffer(0);
      while(okay) {
        key = get_ch(-1);
        if(!*responses)
          break;
        for(x = 0;responses[x];x++) {
          if(key == responses[x]) {
            okay = FALSE;
            break;
          }
        }
      }
    }
    ShowCursor(TRUE);
    VioWrtCellStr(buf,len,(vio.row / 2) - 2,0,0);
    free(buf);
    KbdFlushBuffer(0);
    ThreadMsg(NULL);
  }
  return key;
}