From 236d06e5f220319ebdea348e0a6edb603536b6bb Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 10 Sep 2010 14:10:35 +0000 Subject: [PATCH] 2010-09-10 07:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/g/QPrinter.cpp * Regenerated. * contrib/hbqt/qtgui/qth/QPrinter.qth ! Fixed: constructor, now it accepts QPrinterInfo also as a parameter. * contrib/hbide/ideedit.prg + Implemented: Alt+PageDown/PageUp keys to navigate to next/previous function. A request received at FWH forums. --- harbour/ChangeLog | 12 +++- harbour/contrib/hbide/ideedit.prg | 77 +++++++++++++++++---- harbour/contrib/hbqt/qtgui/g/QPrinter.cpp | 9 ++- harbour/contrib/hbqt/qtgui/qth/QPrinter.qth | 9 ++- 4 files changed, 90 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b70ae7b149..294a77df5a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-10 07:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/g/QPrinter.cpp + * Regenerated. + * contrib/hbqt/qtgui/qth/QPrinter.qth + ! Fixed: constructor, now it accepts QPrinterInfo also as a parameter. + + * contrib/hbide/ideedit.prg + + Implemented: Alt+PageDown/PageUp keys to navigate to next/previous function. + A request received at FWH forums. + 2010-09-10 11:34 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/hbide.hbp - contrib/hbide/hbide.prg @@ -36,7 +46,7 @@ * harbour/vm/classes.c * pacified compiler warning -2010-19-12 09:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) +2010-09-09 09:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/hbqreportsmanager.prg ! Few more steps gained on printing front. diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index fca9a83e60..88673bbf4e 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -219,6 +219,9 @@ CLASS IdeEdit INHERIT IdeObject METHOD blockConvert( cMode ) METHOD dispStatusInfo() METHOD toggleCurrentLineHighlightMode() + METHOD currentFunctionIndex() + METHOD toPreviousFunction() + METHOD toNextFunction() METHOD home() METHOD end() @@ -640,6 +643,16 @@ METHOD IdeEdit:execKeyEvent( nMode, nEvent, p, p1 ) ::hidePrototype() ENDIF EXIT + CASE Qt_Key_PageUp + IF lAlt + ::toPreviousFunction() + ENDIF + EXIT + CASE Qt_Key_PageDown + IF lAlt + ::toNextFunction() + ENDIF + EXIT ENDSWITCH EXIT @@ -1339,25 +1352,61 @@ METHOD IdeEdit:convertDQuotes() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:currentFunctionIndex() + LOCAL n := -1, nCurLine + + IF !empty( ::aTags ) + nCurLine := ::getLineNo() + IF len( ::aTags ) == 1 + n := 1 + ELSEIF ( n := ascan( ::aTags, {|e_| e_[ 3 ] >= nCurLine } ) ) == 0 + n := len( ::aTags ) + ELSEIF n > 0 + n-- + ENDIF + ENDIF + + RETURN n + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:toNextFunction() + LOCAL n + + IF ( n := ::currentFunctionIndex() ) >= 0 + IF n < len( ::aTags ) + IF ::find( ::aTags[ n+1, 8 ], QTextDocument_FindCaseSensitively ) + ::qEdit:centerCursor() + ENDIF + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:toPreviousFunction() + LOCAL n + + IF ( n := ::currentFunctionIndex() ) > 1 + IF ::find( ::aTags[ n-1, 8 ], QTextDocument_FindCaseSensitively ) + ::qEdit:centerCursor() + ENDIF + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:markCurrentFunction() - LOCAL n, nCurLine + LOCAL n IF ::nPrevLineNo1 != ::getLineNo() ::nPrevLineNo1 := ::getLineNo() - IF !empty( ::aTags ) - nCurLine := ::getLineNo() - IF len( ::aTags ) == 1 - n := 1 - ELSEIF ( n := ascan( ::aTags, {|e_| e_[ 3 ] >= nCurLine } ) ) == 0 - n := len( ::aTags ) - ELSEIF n > 0 - n-- - ENDIF - IF n > 0 - ::oIde:oFuncList:setItemColorFG( ::aTags[ n,7 ], { 255,0,0 } ) - ::oIde:oFuncList:setVisible( ::aTags[ n,7 ] ) - ENDIF + IF ( n := ::currentFunctionIndex() ) > 0 + ::oIde:oFuncList:setItemColorFG( ::aTags[ n,7 ], { 255,0,0 } ) + ::oIde:oFuncList:setVisible( ::aTags[ n,7 ] ) ENDIF ENDIF RETURN Self diff --git a/harbour/contrib/hbqt/qtgui/g/QPrinter.cpp b/harbour/contrib/hbqt/qtgui/g/QPrinter.cpp index 5ae48f39c9..df82e86b3e 100644 --- a/harbour/contrib/hbqt/qtgui/g/QPrinter.cpp +++ b/harbour/contrib/hbqt/qtgui/g/QPrinter.cpp @@ -149,7 +149,14 @@ HB_FUNC( QT_QPRINTER ) { QPrinter * pObj = NULL; - pObj = new QPrinter() ; + if( hb_pcount() >= 1 && HB_ISPOINTER( 1 ) ) + { + pObj = new QPrinter( *hbqt_par_QPrinterInfo( 1 ), ( QPrinter::PrinterMode ) ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : QPrinter::ScreenResolution ) ) ; + } + else + { + pObj = new QPrinter() ; + } hb_retptrGC( hbqt_gcAllocate_QPrinter( ( void * ) pObj, true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/qth/QPrinter.qth b/harbour/contrib/hbqt/qtgui/qth/QPrinter.qth index d7b602c3f6..ae64aa9139 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QPrinter.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QPrinter.qth @@ -72,7 +72,14 @@ New = */ HB_FUNC( QT_QPRINTER ) { - hb_retptr( ( QPrinter* ) new QPrinter() ); + if( hb_pcount() >= 1 && HB_ISPOINTER( 1 ) ) + { + hb_retptr( new QPrinter( *hbqt_par_QPrinterInfo( 1 ), ( QPrinter::PrinterMode ) ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : QPrinter::ScreenResolution ) ) ); + } + else + { + hb_retptr( new QPrinter() ); + } }