示例#1
0
static void hb_gt_std_Tone( PHB_GT pGT, double dFrequency, double dDuration )
{
   double dCurrentSeconds;
   PHB_GTSTD pGTSTD;

   HB_TRACE(HB_TR_DEBUG, ("hb_gt_std_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration));

   pGTSTD = HB_GTSTD_GET( pGT );

   /* Output an ASCII BEL character to cause a sound */
   /* but throttle to max once per second, in case of sound */
   /* effects prgs calling lots of short tone sequences in */
   /* succession leading to BEL hell on the terminal */

   dCurrentSeconds = hb_dateSeconds();
   if( dCurrentSeconds < pGTSTD->dToneSeconds ||
       dCurrentSeconds - pGTSTD->dToneSeconds > 0.5 )
   {
      hb_gt_std_termOut( pGTSTD, s_szBell, 1 );
      pGTSTD->dToneSeconds = dCurrentSeconds;
   }

   HB_SYMBOL_UNUSED( dFrequency );

   /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */
   hb_idleSleep( dDuration / 18.2 );
}
示例#2
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;
}
示例#3
0
static void hb_gt_std_DispLine( PHB_GT pGT, int iRow )
{
   BYTE bColor, bAttr;
   USHORT usChar;
   int iCol, iMin = 0;
   PHB_GTSTD pGTSTD = HB_GTSTD_GET( pGT );

   for( iCol = 0; iCol < pGTSTD->iLineBufSize; ++iCol )
   {
      if( !HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol, &bColor, &bAttr, &usChar ) )
         break;
      if( usChar < 32 || usChar == 127 )
         usChar = '.';
      pGTSTD->sLineBuf[ iCol ] = ( BYTE ) usChar;
      if( usChar != ' ' )
         iMin = iCol + 1;
   }
   hb_gt_std_newLine( pGTSTD );
   if( iMin > 0 )
      hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, iMin );
   pGTSTD->iLastCol = pGTSTD->iCol = iMin;
   pGTSTD->iRow = iRow;
}
示例#4
0
static void hb_gt_std_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
   BYTE bColor, bAttr;
   USHORT usChar;
   int iLineFeed, iBackSpace, iLen, iMin;
   PHB_GTSTD pGTSTD;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) );

   iLineFeed = iBackSpace = 0;
   pGTSTD = HB_GTSTD_GET( pGT );

   if( pGTSTD->iRow != iRow )
   {
      iLineFeed = pGTSTD->iRow < iRow ? iRow - pGTSTD->iRow : 1;
      iCol = 0;
      iSize = pGTSTD->iLineBufSize;
   }
   else if( pGTSTD->iCol < iCol )
   {
      iSize += iCol - pGTSTD->iCol;
      iCol = pGTSTD->iCol;
   }
   else if( pGTSTD->iCol > iCol )
   {
      if( pGTSTD->fStdoutConsole && pGTSTD->iCol <= pGTSTD->iLineBufSize )
      {
         iBackSpace = pGTSTD->iCol - iCol;
         if( iBackSpace > iSize )
            iSize = iBackSpace;
      }
      else
      {
         iLineFeed = 1;
         iCol = 0;
         iSize = pGTSTD->iLineBufSize;
      }
   }

   iMin = iLineFeed > 0 || pGTSTD->iLastCol <= iCol ? 0 : pGTSTD->iLastCol - iCol;

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

   if( iSize > 0 )
   {
      if( iLineFeed > 0 )
      {
         /*
          * If you want to disable full screen redrawing in console (TTY)
          * output then comment out the 'if' block below, Druzus
          */
         if( pGTSTD->fStdoutConsole )
         {
            int i;

            if( pGTSTD->iRow > iRow )
            {
               pGTSTD->iRow = -1;
               pGTSTD->fFullRedraw = TRUE;
            }
            for( i = pGTSTD->iRow + 1; i < iRow; ++i )
               hb_gt_std_DispLine( pGT, i );
            iLineFeed = 1;
         }

         do
            hb_gt_std_newLine( pGTSTD );
         while( --iLineFeed );
         pGTSTD->iLastCol = 0;
      }
      else if( iBackSpace > 0 )
      {
         memset( pGTSTD->sLineBuf, HB_CHAR_BS, iBackSpace );
         hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, iBackSpace );
      }

      for( iLen = 0; iLen < iSize; ++iLen )
      {
         if( !HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol, &bColor, &bAttr, &usChar ) )
            break;
         if( usChar < 32 || usChar == 127 )
            usChar = '.';
         pGTSTD->sLineBuf[ iLen ] = ( BYTE ) usChar;
         ++iCol;
      }

      if( iLen )
      {
#ifndef HB_CDP_SUPPORT_OFF
         if( pGTSTD->fDispTrans )
            hb_cdpnTranslate( ( char * ) pGTSTD->sLineBuf, pGTSTD->cdpHost, pGTSTD->cdpTerm, iLen );
#endif
         hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, iLen );
      }
      pGTSTD->iRow = iRow;
      pGTSTD->iCol = iCol;
      if( pGTSTD->iCol > pGTSTD->iLastCol )
         pGTSTD->iLastCol = pGTSTD->iCol;
   }
}
示例#5
0
static void hb_gt_std_Bell( PHB_GT pGT )
{
   HB_TRACE(HB_TR_DEBUG, ( "hb_gt_std_Bell(%p)", pGT ) );

   hb_gt_std_termOut( HB_GTSTD_GET( pGT ), s_szBell, 1 );
}
示例#6
0
static void hb_gt_std_newLine( PHB_GTSTD pGTSTD )
{
   hb_gt_std_termOut( pGTSTD, ( BYTE * ) pGTSTD->szCrLf, pGTSTD->ulCrLf );
}
示例#7
0
static void hb_gt_std_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
   int iColor;
   HB_BYTE bAttr;
   HB_USHORT usChar;
   int iLineFeed, iBackSpace, iMin;
   PHB_GTSTD pGTSTD;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_std_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) );

   iLineFeed = iBackSpace = 0;
   pGTSTD = HB_GTSTD_GET( pGT );

   if( pGTSTD->iRow != iRow )
   {
      iLineFeed = pGTSTD->iRow < iRow ? iRow - pGTSTD->iRow : 1;
      iCol = 0;
      iSize = pGTSTD->iWidth;
   }
   else if( pGTSTD->iCol < iCol )
   {
      iSize += iCol - pGTSTD->iCol;
      iCol = pGTSTD->iCol;
   }
   else if( pGTSTD->iCol > iCol )
   {
      if( pGTSTD->fStdoutConsole && pGTSTD->iCol <= pGTSTD->iWidth )
      {
         iBackSpace = pGTSTD->iCol - iCol;
         if( iBackSpace > iSize )
            iSize = iBackSpace;
      }
      else
      {
         iLineFeed = 1;
         iCol = 0;
         iSize = pGTSTD->iWidth;
      }
   }

   iMin = iLineFeed > 0 || pGTSTD->iLastCol <= iCol ? 0 : pGTSTD->iLastCol - iCol;

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

   if( iSize > 0 )
   {
      if( iLineFeed > 0 )
      {
         /*
          * If you want to disable full screen redrawing in console (TTY)
          * output then comment out the 'if' block below, Druzus
          */
         if( pGTSTD->fStdoutConsole )
         {
            int i;

            if( pGTSTD->iRow > iRow )
            {
               pGTSTD->iRow = -1;
               pGTSTD->fFullRedraw = HB_TRUE;
            }
            for( i = pGTSTD->iRow + 1; i < iRow; ++i )
               hb_gt_std_DispLine( pGT, i, 0, -1 );
            iLineFeed = 1;
         }

         do
         {
            hb_gt_std_newLine( pGTSTD );
         }
         while( --iLineFeed );
         pGTSTD->iLastCol = 0;
      }
      else if( iBackSpace > 0 )
      {
         memset( pGTSTD->sLineBuf, HB_CHAR_BS, iBackSpace );
         hb_gt_std_termOut( pGTSTD, pGTSTD->sLineBuf, iBackSpace );
      }

      hb_gt_std_DispLine( pGT, iRow, iCol, iSize );
   }
}
示例#8
0
static void hb_gt_std_newLine( PHB_GTSTD pGTSTD )
{
   hb_gt_std_termOut( pGTSTD, pGTSTD->szCrLf, pGTSTD->nCrLf );
}