Ejemplo n.º 1
0
void UIAPI uigetcursor( ORD *row, ORD *col, CURSOR_TYPE *type, int *attr )
/************************************************************************/
{

    USHORT              length;
    CHAR                CharCellPair[2];
    VIOCURSORINFO       vioCursor;

    /* read cursor position */
    VioGetCurType(&vioCursor,0);
    VioGetCurPos( &r, &c, 0 );
    *row = r;
    *col = c;
    if( vioCursor.cEnd - vioCursor.yStart > 5 ) {
        *type = C_INSERT;
    } else {
        *type = C_NORMAL;
    }
    if( !UIData->cursor_on ) {
        *type = C_OFF;
    }
    /* read character and attribute */
    length = sizeof(CharCellPair);
    VioReadCellStr( &CharCellPair[0], &length, r, c, 0);
    *attr = CharCellPair[1];
}
Ejemplo n.º 2
0
/*--------------------------------------------------------------------------*
 *  getcursorpos                                                            *
 *                                                                          *
 *--------------------------------------------------------------------------*/
void getcursorpos(int *row, int *col)
{
   int rc;

   if (rc = VioGetCurPos((unsigned short *)row, (unsigned short *)col, (HVIO)0))
     printf("Failed getting cursor position. rc = %d", rc);
}
Ejemplo n.º 3
0
static void savecursor( void )
/****************************/
{
    CHAR                CharCellPair[2];
    USHORT              length;
    VIOCURSORINFO       vioCursor;

    /* read cursor position */

    VioGetCurType(&vioCursor,0);
    VioGetCurPos(&r, &c, 0);
         OldCursorRow = r;
         OldCursorCol = c;
    if( vioCursor.cEnd - vioCursor.yStart > 5 ) {
         OldCursorType = C_INSERT;
    }
     else {
         OldCursorType = C_NORMAL;
    }
    UIData->cursor_on = (  vioCursor.attr != (USHORT) -1 );
    if( !UIData->cursor_on ) {
         OldCursorType = C_OFF;
    }
    /* read character and attribute */
    length = sizeof(CharCellPair);
    VioReadCellStr( &CharCellPair[0], &length, r, c, 0);
    OldCursorAttr = CharCellPair[1];
}
Ejemplo n.º 4
0
//******************************************************************************
//******************************************************************************
int StartRecording()
{
  cout << "Record mode: " << RecSettings.rate << " hz "<< RecSettings.bits << " bits";
  if(RecSettings.numchan == 1) cout << " mono" << endl;
  else 			       cout << " stereo" << endl;
  cout << "Data Format: ";
  switch(RecSettings.format) {
  	case MCI_WAVE_FORMAT_IBM_MULAW:
		cout << "uLaw" << endl;
		break;
	case MCI_WAVE_FORMAT_IBM_ALAW:
		cout << "aLaw" << endl;
		break;
	case MCI_WAVE_FORMAT_AVC_ADPCM:
		cout << "IMA ADPCM" << endl;
		break;
	case MCI_WAVE_FORMAT_PCM:
		cout << "PCM" << endl;
		break;
  }
//  cout << "Recorded bytes: ";
  cout << "Recorded bytes: "<<endl;
  VioGetCurPos(&CurPosX, &CurPosY, 0);

  CurPosX--;
  CurPosY = 16;

  MixSetupParms.pmixRead( MixSetupParms.ulMixHandle,
                          &MixBuffers[0],
                          ulNumBuffers);
  return(TRUE);
}
Ejemplo n.º 5
0
int ConQueryCursorPos(int *X, int *Y) {
  USHORT AX, AY;

  VioGetCurPos(&AY, &AX, 0);

  if (X) *X = AX;

  if (Y) *Y = AY;
  return 0;
}
Ejemplo n.º 6
0
/* Put the terminal in RAW mode.  Send any required strings */
static void
vio_resume (ELVBOOL sendstr)    /* send strings? */
{
  /* Determine the present whereabouts of the cursor. */
  VioGetCurPos (&c_row, &c_col, 0);
  raw_mode = TRUE;

  /* reset, so we don't try any suspicious optimizations */
  vio_reset ();
}
Ejemplo n.º 7
0
static void hb_gt_os2_GetCursorPosition( int * piRow, int * piCol )
{
   USHORT y, x;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetCursorPosition(%p, %p)", ( void * ) piRow, ( void * ) piCol ) );

   VioGetCurPos( &y, &x, 0 );

   *piRow = y;
   *piCol = x;
}
Ejemplo n.º 8
0
static VCOLOR
vio_get_default_color (void)
{
  USHORT row, col;
  CHAR cell[2];
  USHORT len = sizeof (cell);

  VioGetCurPos (&row, &col, 0);
  VioReadCellStr (cell, &len, row, col, 0);
  return cell[1];
}
Ejemplo n.º 9
0
static void to_first_column()
{
 USHORT Row, Column;

 if (interactive_shell)
 {
  VioGetCurPos(&Row, &Column, 0);
  if (Column > 0)
  {
   putchar('\n');
   fflush(stdout);
  }
 }
}
Ejemplo n.º 10
0
int PDC_get_cursor_pos(int *row, int *col)
/***********************************************************************/
{
#ifdef PDCDEBUG
   if (trace_on) PDC_debug("PDC_get_cursor_pos() - called\n");
#endif

#ifdef EMXVIDEO
   v_getxy (col, row);
#else
   VioGetCurPos((PUSHORT)row,(PUSHORT)col,0);
#endif
   return( OK );
}
Ejemplo n.º 11
0
char vm_wherex(void)
{
    if (_osmode == DOS_MODE)
    {
        int row, col;
        vi_init();
        v_getxy(&col, &row);
        return (char)(col + 1);
    }
    else
    {
        USHORT row, col;
        VioGetCurPos(&row, &col, 0);
        return (char)(col + 1);
    }
}
Ejemplo n.º 12
0
void UIAPI uioncursor( void )
/****************************/
{
    CHAR                CharCellPair[2];
    VIOCURSORINFO       vioCursor;


    VioGetCurType( &vioCursor, 0 );
    if( UIData->cursor_type == C_INSERT ) {
        vioCursor.yStart = vioCursor.cEnd / 2;
    } else {
        vioCursor.yStart = (vioCursor.cEnd * 7) / 8;
    }
    vioCursor.cx = 1;
    vioCursor.attr = 1;

    VioSetCurType(&vioCursor, 0);


    /* set cursor position */

    VioSetCurPos( UIData->cursor_row, UIData->cursor_col, 0);

    if( UIData->cursor_attr != -2 ) {
    /* get current character and attribute */

        VioGetCurPos( &r, &c, 0 );
        length = sizeof(CharCellPair);
        VioReadCellStr(&CharCellPair[0],
                       &length,
                       UIData->cursor_row,
                       UIData->cursor_col,
                       0);

        /* write out the character and the new attribute */
        CharCellPair[1] = UIData->cursor_attr;
        VioWrtNCell((PBYTE)&CharCellPair[0],
                    24,
                    UIData->cursor_row,
                    UIData->cursor_col,
                    0);

    }
    UIData->cursor_on = true;
}
Ejemplo n.º 13
0
int tty_setsize (struct winsize *ws)
{
  USHORT cx, cy;
  VIOMODEINFO vi;
  vi.cb = sizeof (vi);
  VioGetMode(&vi, 0);

  VioGetCurPos (&cx, &cy, 0);

  vi.col = ws->ws_col;
  vi.row = ws->ws_row;
  vi.cb = sizeof (vi.cb) + sizeof (vi.fbType) + sizeof (vi.color) +
          sizeof (vi.col) + sizeof (vi.row);
  VioSetMode (&vi, 0);

  VioSetCurPos (cx, cy, 0);
  return 0;
}
Ejemplo n.º 14
0
/* --------------------------------------------------------------------------
 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);
}
Ejemplo n.º 15
0
static void 
vio_CM (int row, int col)
{
  USHORT o_row, o_col;

  c_row = row;
  c_col = col;

  /*
   * Don't move the cursor if it's already in the right place.  We
   * want to avoid any weird flickering that might result if moving 
   * the cursor resets its blink timer.
   */
  VioGetCurPos (&o_row, &o_col, 0);
  if (o_row != c_row || o_col != c_col)
    {
      VioSetCurPos (c_row, c_col, 0);
    }
}
Ejemplo n.º 16
0
int PDC_get_cur_col(void)
/***********************************************************************/
{
#ifdef EMXVIDEO
   int curCol=0, curRow=0;
#else
   USHORT curCol=0, curRow=0;
#endif
#ifdef PDCDEBUG
   if (trace_on) PDC_debug("PDC_get_cur_col() - called\n");
#endif

   /* find the current cursor position */
#ifdef EMXVIDEO
   v_getxy (&curCol, &curRow);
#else
   VioGetCurPos ((PUSHORT) &curRow, (PUSHORT) &curCol, 0);
#endif
   return (curCol);
}
Ejemplo n.º 17
0
VOID SetScreenColors(THREAD *pstThd)
  {
  VIOCELL Cell;
  VIOPS *pVio = &pstThd->stVio;
  WORD wRow;
  WORD wColumn;
  BYTE byBackground;
  BYTE byForeground;


  byBackground = ClrTable[pVio->wBackground].PSClr;
  byForeground = ClrTable[pVio->wForeground].PSClr;

  Cell.ExtAttr = Cell.Spare = 0;
  Cell.Attr    =  (byBackground << 4) | byForeground;

  DosEnterCritSec();
  VioGetCurPos(&wRow,&wColumn,pVio->hpsVio);
  VioWrtNAttr((PBYTE)&Cell.Attr,pVio->usPsWidth * pVio->usPsDepth,0,0,pVio->hpsVio);
  VioSetCurPos(wRow,wColumn,pVio->hpsVio);
  DosExitCritSec();
  }
Ejemplo n.º 18
0
char vm_wherey(void)
{
    USHORT row, col;
    VioGetCurPos(&row, &col, 0);
    return (char)(row + 1);
}
Ejemplo n.º 19
0
USHORT __pascal VIOGETCURPOS(USHORT * Row, USHORT * Column, const HVIO Handle)
{
  return VioGetCurPos(Row, Column, Handle);
}