Esempio n. 1
0
HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize )
{
   HB_SIZE nLen = 0;

   HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) );

   if( HB_INKEY_ISUNICODE( iKey ) )
   {
      nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) );
   }
   else
   {
      if( HB_INKEY_ISCHAR( iKey ) )
         iKey = HB_INKEY_VALUE( iKey );
      else if( HB_INKEY_ISKEY( iKey ) )
      {
         int iFlags = HB_INKEY_FLAGS( iKey );

         iKey = HB_INKEY_VALUE( iKey );

         if( iKey > 0 && iKey <= ( int ) HB_SIZEOFARRAY( s_transKeyFun ) )
            iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyFun[ iKey - 1 ] );
         else if( iKey >= 32 && iKey <= 127 )
            iKey = s_inkeyTransChar( iKey, iFlags, &s_transKeyStd[ iKey - 32 ] );
      }
      if( iKey >= 32 && iKey <= 255 && iKey != 127 )
      {
         PHB_CODEPAGE cdp = hb_vmCDP();
         nLen = hb_cdpTextPutU16( cdp, buffer, nSize,
                                  hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) );
      }
   }
   return nLen;
}
Esempio n. 2
0
HB_SIZE hb_inkeyKeyString( int iKey, char * buffer, HB_SIZE nSize )
{
   HB_SIZE nLen = 0;

   HB_TRACE( HB_TR_DEBUG, ( "hb_inkeyKeyString(%d,%p, %" HB_PFS "u)", iKey, buffer, nSize ) );

   if( HB_INKEY_ISUNICODE( iKey ) )
   {
      nLen = hb_cdpTextPutU16( hb_vmCDP(), buffer, nSize, HB_INKEY_VALUE( iKey ) );
   }
   else
   {
      if( HB_INKEY_ISCHAR( iKey ) )
         iKey = HB_INKEY_VALUE( iKey );
      if( iKey >= 32 && iKey <= 255 && iKey != 127 )
      {
         PHB_CODEPAGE cdp = hb_vmCDP();
         nLen = hb_cdpTextPutU16( cdp, buffer, nSize,
                                  hb_cdpGetU16( cdp, ( HB_UCHAR ) iKey ) );
      }
   }
   return nLen;
}
Esempio n. 3
0
static void hb_gt_std_DispLine( PHB_GT pGT, int iRow, int iFrom, int iSize )
{
   int iColor;
   HB_BYTE bAttr;
   HB_USHORT usChar;
   int iCol, iLastCol, iAll;
   HB_SIZE nLen, nI;
   PHB_CODEPAGE cdpTerm = HB_GTSELF_TERMCP( pGT );
   PHB_GTSTD pGTSTD = HB_GTSTD_GET( pGT );

   if( iSize < 0 )
   {
      hb_gt_std_newLine( pGTSTD );
      pGTSTD->iLastCol = iAll = 0;
      iSize = pGTSTD->iWidth;
   }
   else
      iAll = iSize;

   for( iCol = iLastCol = iFrom, nLen = nI = 0; iSize > 0; --iSize )
   {
      if( ! HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol++, &iColor, &bAttr, &usChar ) )
         break;

      if( usChar < 32 || usChar == 127 )
         usChar = '.';
      nI += hb_cdpTextPutU16( cdpTerm, pGTSTD->sLineBuf + nI,
                                       pGTSTD->iLineBufSize - nI, usChar );
      if( iAll || usChar != ' ' )
      {
         nLen = nI;
         iLastCol = iCol;
      }
   }
   if( nLen > 0 )
      hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, nLen );
   pGTSTD->iRow = iRow;
   pGTSTD->iCol = iLastCol;
   if( pGTSTD->iCol > pGTSTD->iLastCol )
      pGTSTD->iLastCol = pGTSTD->iCol;
}
Esempio n. 4
0
File: gtcgi.c Progetto: emazv72/core
static void hb_gt_cgi_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
   int iColor;
   HB_BYTE bAttr;
   HB_USHORT usChar;
   int iLineFeed, iHeight, iWidth, iLen;
   PHB_GTCGI pGTCGI;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Redraw(%p,%d,%d,%d)", ( void * ) pGT, iRow, iCol, iSize ) );

   pGTCGI = HB_GTCGI_GET( pGT );
   HB_GTSELF_GETSIZE( pGT, &iHeight, &iWidth );
   iLineFeed = iLen = 0;

   if( pGTCGI->iRow != iRow )
   {
      iLineFeed = pGTCGI->iRow < iRow ? iRow - pGTCGI->iRow : 1;
      pGTCGI->iLastCol = pGTCGI->iCol = iCol = 0;
      iSize = iWidth;
   }
   else if( pGTCGI->iCol < iCol )
   {
      iSize += iCol - pGTCGI->iCol;
      iCol = pGTCGI->iCol;
   }
   else if( pGTCGI->iCol > iCol )
   {
      iLineFeed = 1;
      iCol = pGTCGI->iCol = pGTCGI->iLastCol = 0;
      iSize = iWidth;
   }

   while( iSize > 0 && iCol + iSize > pGTCGI->iLastCol &&
          HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol + iSize - 1, &iColor, &bAttr, &usChar ) )
   {
      if( usChar != ' ' )
         break;
      --iSize;
   }

   if( iSize > 0 )
   {
      PHB_CODEPAGE cdpTerm = HB_GTSELF_TERMCP( pGT );
      int iIndex = 0;

      while( --iLineFeed >= 0 )
         hb_gt_cgi_newLine( pGTCGI );
      pGTCGI->iRow = iRow;

      while( iLen < iSize )
      {
         if( ! HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol, &iColor, &bAttr, &usChar ) )
            break;
         iIndex += ( int ) hb_cdpTextPutU16( cdpTerm, pGTCGI->sLineBuf + iIndex,
                                                      pGTCGI->iLineBufSize - iIndex, usChar );
         ++iLen;
         ++iCol;
      }
      if( iIndex )
      {
         hb_gt_cgi_termOut( pGTCGI, pGTCGI->sLineBuf, iIndex );
         pGTCGI->iCol = iCol;
         if( pGTCGI->iCol > pGTCGI->iLastCol )
            pGTCGI->iLastCol = pGTCGI->iCol;
      }
   }
}