diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ffd2e09a3b..4734b3992e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-12 08:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtqtc/gtqtc.cpp + * harbour/contrib/gtqtc/qtconsolearea.cpp + * harbour/contrib/gtqtc/tests/demoqtc.prg + ! Few more HACKS - I know there are better ways to organize them. + Now our inkey() loop is active and demoqtc exits properly. + Plus you may see some activity in console. + 2009-04-11 21:53 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtqtc/gtqtc.cpp * harbour/contrib/gtqtc/gtqtc.h diff --git a/harbour/contrib/gtqtc/gtqtc.cpp b/harbour/contrib/gtqtc/gtqtc.cpp index 4656f7117c..678ba5b8a5 100644 --- a/harbour/contrib/gtqtc/gtqtc.cpp +++ b/harbour/contrib/gtqtc/gtqtc.cpp @@ -1531,14 +1531,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara static DWORD hb_gt_wvt_ProcessMessages( void ) { - MSG msg; - - while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - return msg.wParam; + app->processEvents(); + return( 0 ); } static BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, QFont *qFont, int iWidth ) @@ -1648,18 +1642,14 @@ void hbqt_exit( PHB_GT pGT ) { PHB_GTWVT pWVT; - HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Exit(%p)", pGT)); + HB_TRACE(HB_TR_DEBUG, ("hbqt_exit(%p)", pGT)); pWVT = HB_GTWVT_GET( pGT ); - HB_GTSUPER_EXIT( pGT ); + + /* A HACK - must be constructed differently - Still looking for the ways to control it */ + hb_gt_wvt_AddCharToInputQueue( pWVT, 27 ); app->quit(); - - if( pWVT ) - hb_gt_wvt_Free( pWVT ); - - if( app ) - app->quit(); } static void hbqt_Init( void * cargo ) @@ -1727,6 +1717,58 @@ static void hb_gt_wvt_Exit( PHB_GT pGT ) /* ********************************************************************** */ +static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) +{ + PHB_GTWVT pWVT; + + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); + + pWVT = HB_GTWVT_GET( pGT ); + if( pWVT ) + { + if( pWVT->qWnd ) + { + RECT rect; + + rect.top = rect.bottom = ( SHORT ) iRow; + rect.left = ( SHORT ) iCol; + rect.right = ( SHORT ) ( iCol + iSize - 1 ); + + rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, rect ); + + /* Schedule a Repaint Event */ + pWVT->qWnd->update( QRect( iCol, iRow, iCol + iSize - 1, iRow ) ); + } + else + pWVT->fInit = TRUE; + } +} + +/* ********************************************************************** */ + +static void hb_gt_wvt_Refresh( PHB_GT pGT ) +{ + PHB_GTWVT pWVT; + + HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_Refresh(%p)", pGT) ); + + HB_GTSUPER_REFRESH( pGT ); + + pWVT = HB_GTWVT_GET( pGT ); + if( pWVT ) + { + if( !pWVT->qWnd && pWVT->fInit ) + hb_gt_wvt_CreateConsoleWindow( pWVT ); + + if( pWVT->qWnd ) + { + app->processEvents(); + } + } +} + +/* ********************************************************************** */ + static BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol ) { PHB_GTWVT pWVT; @@ -1795,7 +1837,7 @@ static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask ) pWVT = HB_GTWVT_GET( pGT ); - if( pWVT->hWnd ) /* Is the window already open */ + if( pWVT->qWnd ) /* Is the window already open */ hb_gt_wvt_ProcessMessages(); fKey = hb_gt_wvt_GetCharFromInputQueue( pWVT, &c ); @@ -1816,58 +1858,6 @@ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) /* ********************************************************************** */ -static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) -{ - PHB_GTWVT pWVT; - - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); - - pWVT = HB_GTWVT_GET( pGT ); - if( pWVT ) - { - if( pWVT->hWnd ) - { - RECT rect; - - rect.top = rect.bottom = ( SHORT ) iRow; - rect.left = ( SHORT ) iCol; - rect.right = ( SHORT ) ( iCol + iSize - 1 ); - - rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, rect ); - - /* Schedule a Repaint Event */ - pWVT->qWnd->update( QRect( iCol, iRow, iCol + iSize - 1, iRow ) ); - } - else - pWVT->fInit = TRUE; - } -} - -/* ********************************************************************** */ - -static void hb_gt_wvt_Refresh( PHB_GT pGT ) -{ - PHB_GTWVT pWVT; - - HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_Refresh(%p)", pGT) ); - - HB_GTSUPER_REFRESH( pGT ); - - pWVT = HB_GTWVT_GET( pGT ); - if( pWVT ) - { - if( !pWVT->qWnd && pWVT->fInit ) - hb_gt_wvt_CreateConsoleWindow( pWVT ); - - if( pWVT->qWnd ) - { - app->exec(); - } - } -} - -/* ********************************************************************** */ - static BOOL hb_gt_wvt_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char * pszHostCDP, BOOL fBox ) { HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox ); diff --git a/harbour/contrib/gtqtc/qtconsolearea.cpp b/harbour/contrib/gtqtc/qtconsolearea.cpp index 9f95795a8a..5aada873d7 100644 --- a/harbour/contrib/gtqtc/qtconsolearea.cpp +++ b/harbour/contrib/gtqtc/qtconsolearea.cpp @@ -167,7 +167,10 @@ void ConsoleArea::paintEvent(QPaintEvent * /* event */) QPainter painter(this); painter.drawImage(QPoint(0, 0), image); { - QFont font( tr( "Courier New" ), 12, -1, FALSE ); + int hgt = height(); + int fntHeight = (hgt/25); + fntHeight = 14; + QFont font( tr( "Courier New" ), fntHeight, 10, FALSE ); font = QFont(font, painter.device()); QFontMetrics fontMetrics( font ); int height = fontMetrics.height(); @@ -202,6 +205,7 @@ void ConsoleArea::paintEvent(QPaintEvent * /* event */) painter.setBackground( brush ); QPen pen( COLORS[ bOldColor ] ); painter.setPen( pen ); +OutputDebugString( "KKKK len=%i bOldColor=%i bColor=%i" ); painter.drawText( QPointF( startCol,iTop ), QString( text ) ); @@ -281,3 +285,4 @@ void ConsoleArea::print() } /*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/gtqtc/tests/demoqtc.prg b/harbour/contrib/gtqtc/tests/demoqtc.prg index 22bd67cbc8..4a4e1e6121 100644 --- a/harbour/contrib/gtqtc/tests/demoqtc.prg +++ b/harbour/contrib/gtqtc/tests/demoqtc.prg @@ -38,6 +38,8 @@ FUNCTION Main() Local nHeight := 20 Local nWidth := Int( nHeight/2 ) Local cFont + Local nn := 1 + Local cc := 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmn' Hb_GtInfo( HB_GTI_FONTNAME , cFont ) Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth ) @@ -46,16 +48,20 @@ FUNCTION Main() SetCursor( 0 ) SetColor( "n/w" ) - //HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| MyNotifier( nEvent, ... ) } ) - DispScreen() DO WHILE .T. nKey := Inkey(0.1) - + if nKey == K_ESC exit endif + + @ maxrow()-1, ( nn % 80 ) SAY substr( cc, nn, 1 ) + nn++ + if nn > 79 + nn := 1 + endif DO CASE CASE nKey == K_ENTER @@ -90,7 +96,7 @@ FUNCTION Main() ENDCASE ENDDO - + RETURN NIL //----------------------------------------------------------------------// STATIC FUNCTION MyNotifier( nEvent, ... ) @@ -148,7 +154,7 @@ STATIC FUNCTION DispScreen() DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" ) DispOutAt( MaxRow(), 0 , "BL", "N/G*" ) DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" ) - +hb_ToOutDebug( "113" ) DispEnd() RETURN NIL //----------------------------------------------------------------------//