From 146b37e8e56088416fca2cb58f73ee77a649701f Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 19 Jan 2010 02:03:23 +0000 Subject: [PATCH] 2010-01-18 17:52 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_base.cpp * contrib/hbqt/hbqt_hbevents.cpp * contrib/hbqt/hbqt_hbslots.cpp ! HB_TRUE/FALSE <=> true/false. * contrib/hbide/hbide.prg * contrib/hbide/ideeditor.prg ! Updated to manage split windows properly. Presently the behavior is as such: Horizontal Split - Top row is columns are splitted Vertical Split - More row is added at the bottom. Delete Splitted Window - Focus is always shifted to main edit window. i.e., parent of all. Please comment. --- harbour/ChangeLog | 16 ++++++ harbour/contrib/hbide/hbide.prg | 4 ++ harbour/contrib/hbide/ideeditor.prg | 77 ++++++++++++++++++++------ harbour/contrib/hbqt/hbqt_base.cpp | 8 +-- harbour/contrib/hbqt/hbqt_hbevents.cpp | 10 ++-- harbour/contrib/hbqt/hbqt_hbslots.cpp | 18 +++--- 6 files changed, 99 insertions(+), 34 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9152a5a214..80dada1a47 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,22 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-18 17:52 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt_base.cpp + * contrib/hbqt/hbqt_hbevents.cpp + * contrib/hbqt/hbqt_hbslots.cpp + ! HB_TRUE/FALSE <=> true/false. + + * contrib/hbide/hbide.prg + * contrib/hbide/ideeditor.prg + ! Updated to manage split windows properly. + Presently the behavior is as such: + Horizontal Split - Top row is columns are splitted + Vertical Split - More row is added at the bottom. + Delete Splitted Window - Focus is always shifted to + main edit window. i.e., parent of all. + Please comment. + 2010-01-19 00:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwvt/gtwvt.c * contrib/gtwvg/gtwvg.c diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 13b95d2745..948fc39cdf 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -365,6 +365,10 @@ METHOD HbIde:create( cProjIni ) ENDIF ENDCASE + + ELSEIF ::nEvent == xbeM_Wheel + ::oEM:zoom( iif( ::mp2[ 2 ] < 0, 1, 0 ) ) + ENDIF ::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 87dbcd8812..6d4355855e 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -579,11 +579,12 @@ METHOD IdeEditsManager:insertText( cKey ) /*----------------------------------------------------------------------*/ METHOD IdeEditsManager:zoom( nKey ) - LOCAL nPointSize, oEdit, qFont + LOCAL nPointSize, qFont, oEdit, oEditor - IF empty( oEdit := ::getEditObjectCurrent() ) + IF empty( oEditor := ::getEditorCurrent() ) RETURN Self ENDIF + oEdit := oEditor:oEdit qFont := QFont():configure( oEdit:qEdit:font() ) qFont:setFamily( "Courier New" ) @@ -593,10 +594,15 @@ METHOD IdeEditsManager:zoom( nKey ) IF nPointSize > 4 .AND. nPointSize < 37 qFont:setPointSize( nPointSize ) + oEdit:qEdit:setFont( qFont ) oEdit:qLineNos:setFont( qFont ) - ENDIF + FOR EACH oEdit IN oEditor:aEdits + oEdit:qEdit:setFont( qFont ) + oEdit:qLineNos:setFont( qFont ) + NEXT + ENDIF RETURN Self /*----------------------------------------------------------------------*/ @@ -739,6 +745,7 @@ CLASS IdeEditor INHERIT IdeObject METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) METHOD split( nOrient, oEditP ) + METHOD relay( oEdit ) METHOD destroy() METHOD exeEvent( nMode, o, p, p1, p2 ) METHOD setDocumentProperties() @@ -860,25 +867,56 @@ METHOD IdeEditor:exeEvent( nMode, o, p, p1, p2 ) /*----------------------------------------------------------------------*/ +METHOD IdeEditor:relay( oEdit ) + LOCAL nCols, oEdt, nR, nC + + ::qLayout:removeItem( ::oEdit:qHLayout ) + FOR EACH oEdt IN ::aEdits + ::qLayout:removeItem( oEdt:qHLayout ) + // + oEdt:qHLayout:removeWidget( oEdt:qLineNos ) + oEdt:qHLayout:removeWidget( oEdt:qEdit ) + oEdt:qHLayout := QHBoxLayout():new() + oEdt:qHLayout:addWidget( oEdt:qLineNos ) + oEdt:qHLayout:addWidget( oEdt:qEdit ) + NEXT + + IF hb_isObject( oEdit ) + aadd( ::aEdits, oEdit ) + ENDIF + ::qLayout:addLayout( ::oEdit:qHLayout, 0, 0 ) + + // Now we know how many rows and columns + // + nR := 0 ; nC := 0 + FOR EACH oEdt IN ::aEdits + IF oEdt:nOrient == 1 // Horiz + nC++ + ::qLayout:addLayout_1( oEdt:qHLayout, 0, nC, 1, 1, Qt_Vertical ) + ENDIF + NEXT + nCols := ::qLayout:columnCount() + FOR EACH oEdt IN ::aEdits + IF oEdt:nOrient == 2 // Verti + nR++ + ::qLayout:addLayout_1( oEdt:qHLayout, nR, 0, 1, nCols, Qt_Horizontal ) + ENDIF + NEXT + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditor:split( nOrient, oEditP ) - LOCAL oEdit, nRows, nCols + LOCAL oEdit HB_SYMBOL_UNUSED( oEditP ) - HB_SYMBOL_UNUSED( nOrient ) oEdit := IdeEdit():new( Self, 1 ):create() oEdit:qEdit:setDocument( ::qDocument ) + oEdit:nOrient := nOrient - aadd( ::aEdits, oEdit ) - - nRows := ::qLayout:rowCount() - nCols := ::qLayout:columnCount() - - IF nOrient == 1 - ::qLayout:addLayout( oEdit:qHLayout, nRows -1 , nCols ) - ELSEIF nOrient == 2 - ::qLayout:addLayout( oEdit:qHLayout, nRows, nCols - 1 ) - ENDIF + ::relay( oEdit ) RETURN Self @@ -1078,6 +1116,7 @@ CLASS IdeEdit INHERIT IdeObject DATA qEdit DATA qHLayout DATA qLineNos + DATA nOrient INIT 0 DATA nMode INIT 0 DATA nLineNo INIT -99 @@ -1177,6 +1216,8 @@ METHOD IdeEdit:destroy() ::disConnectEditSlots( Self ) + ::oEditor:qLayout:removeItem( ::qHLayout ) + // ::qHLayout:removeWidget( ::qEdit ) ::qHLayout:removeWidget( ::qLineNos ) @@ -1186,7 +1227,7 @@ METHOD IdeEdit:destroy() //::qEdit:pPtr := 0 ::qEdit := NIL - ::qHLayout:pPtr := 0 + //::qHLayout:pPtr := 0 ::qHLayout := NIL RETURN Self @@ -1250,6 +1291,10 @@ METHOD IdeEdit:exeEvent( nMode, oEdit, o, p, p1 ) oo := ::oEditor:aEdits[ n ] hb_adel( ::oEditor:aEdits, n, .t. ) oo:destroy() + ::oEditor:relay() + ::oEditor:qCqEdit := ::oEditor:qEdit + ::oEditor:qCoEdit := ::oEditor:oEdit + ::oIde:manageFocusInEditor() ENDIF CASE qAct:text() == "Apply Theme" ::oEditor:applyTheme() diff --git a/harbour/contrib/hbqt/hbqt_base.cpp b/harbour/contrib/hbqt/hbqt_base.cpp index 3cc8cec9fe..cbf100ae27 100644 --- a/harbour/contrib/hbqt/hbqt_base.cpp +++ b/harbour/contrib/hbqt/hbqt_base.cpp @@ -83,9 +83,9 @@ HB_FUNC( HBQT_ISEMPTYQTPOINTER ) QGC_POINTER * p = ( QGC_POINTER * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); if( p && p->ph ) - hb_retl( false ); + hb_retl( HB_FALSE ); else - hb_retl( true ); + hb_retl( HB_TRUE ); } HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) @@ -98,14 +98,14 @@ HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) if( p->ph && q->ph ) hb_retl( p->ph == q->ph ); else - hb_retl( false ); + hb_retl( HB_FALSE ); } else { if( p && p->ph ) hb_retl( p->ph == hb_parptr( 2 ) ); else - hb_retl( false ); + hb_retl( HB_FALSE ); } } diff --git a/harbour/contrib/hbqt/hbqt_hbevents.cpp b/harbour/contrib/hbqt/hbqt_hbevents.cpp index b2f000c0a5..aa5f45b7f5 100644 --- a/harbour/contrib/hbqt/hbqt_hbevents.cpp +++ b/harbour/contrib/hbqt/hbqt_hbevents.cpp @@ -110,9 +110,9 @@ bool HBEvents::hbConnect( PHB_ITEM pObj, int iEvent, PHB_ITEM bBlock ) object->setProperty( prop, ( int ) listBlock.size() ); - return HB_TRUE; + return true; } - return HB_FALSE; + return false; } bool HBEvents::hbDisconnect( PHB_ITEM pObj, int iEvent ) @@ -135,10 +135,10 @@ bool HBEvents::hbDisconnect( PHB_ITEM pObj, int iEvent ) object->setProperty( prop, QVariant() ); HB_TRACE( HB_TR_DEBUG, ( " QT_EVENTS_DISCONNECT: %i", iEvent ) ); - return HB_TRUE; + return true; } } - return HB_FALSE; + return false; } bool HBEvents::hbClear() @@ -156,7 +156,7 @@ bool HBEvents::hbClear() } } listBlock.clear(); - return HB_TRUE; + return true; } bool HBEvents::eventFilter( QObject * object, QEvent * event ) diff --git a/harbour/contrib/hbqt/hbqt_hbslots.cpp b/harbour/contrib/hbqt/hbqt_hbslots.cpp index ee55b88bc3..35247fc6a8 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.cpp +++ b/harbour/contrib/hbqt/hbqt_hbslots.cpp @@ -678,11 +678,11 @@ bool HBSlots::isConnected( QObject * object, const char * slot ) { if( object->property( slot ).toInt() == i + 1 ) { - return HB_TRUE; + return true; } } } - return HB_FALSE; + return false; } bool HBSlots::hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ) @@ -690,7 +690,8 @@ bool HBSlots::hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ) HB_SYMBOL_UNUSED( pObj ); HB_SYMBOL_UNUSED( bBlock ); - QObject * object = ( QObject * ) hbqt_pPtrFromItem( pObj ); /* get sender */ + //QObject * object = ( QObject * ) hbqt_pPtrFromItem( pObj ); /* get sender */ + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); /* get sender */ if( object ) { @@ -701,19 +702,18 @@ HB_TRACE( HB_TR_ALWAYS, ( "AAA 3 %s %p", slot, object ) ); HB_TRACE( HB_TR_ALWAYS, ( "AAA 4" ) ); if( bConnected ) { - //PHB_ITEM pBlock = hb_itemNew( hb_param( 3, HB_IT_BLOCK ) ); /* get codeblock */ PHB_ITEM pBlock = hb_itemNew( bBlock ); /* get codeblock */ HB_TRACE( HB_TR_ALWAYS, ( "AAA 5" ) ); listBlock << pBlock; listObj << object; - object->setProperty( hb_parcx( 2 ), ( int ) listBlock.size() ); + object->setProperty( slot, ( int ) listBlock.size() ); - return HB_TRUE; + return true; } } } - return HB_FALSE; + return false; } bool HBSlots::hbDisconnect( PHB_ITEM pObj, const char * signal ) @@ -739,7 +739,7 @@ bool HBSlots::hbDisconnect( PHB_ITEM pObj, const char * signal ) return bRet; } } - return HB_FALSE; + return false; } bool HBSlots::hbClear() @@ -755,7 +755,7 @@ bool HBSlots::hbClear() } } listBlock.clear(); - return HB_TRUE; + return true; } /* Generic Key and Mouse Events emitted by subclass objects */ void HBSlots::customContextMenuRequested( const QPoint & pos ) { hbqt_SlotsExecQPoint( this, qobject_cast( sender() ), "customContextMenuRequested(QPoint)", pos ); }