2009-12-17 22:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/hbqt_misc.prg
  * contrib/hbide/hbide.prg
    - Deleted hack which moved HBXBP specific functionality
      into the core of HBQT.
      I had to restore QT_PTROFXBP() macros inside hbide.
      QT_PTROFXBP() has not much to do with QT_PTROF() as the
      former serves to access oWidget member of passed class.
      I see no need to move such logic into HBQT core code.
      I restored QT_PTROF() also, but it's redefined as a dummy
      in hbide.prg. I don't understand now why QT_PTROF() works
      as dummy in hbide, but it doesn't when used as dummy in
      HBXBP.
      All in all, this means the .prg level :pPtr trick is still 
      needed in some places, while it's not needed in some others.
    ; TOFIX: HBQT has no pointer checking at all before accessing
             C++ level objects, which means the simplest .prg level
             error is instantly resulting in a GPF. All hb_par_*()
             results must be checked for NULL before accessing them,
             or better yet, and RTE should be generated right from
             the hb_par_*() function.

  * src/vm/classes.c
    * Minor formatting.
This commit is contained in:
Viktor Szakats
2009-12-17 21:22:26 +00:00
parent 0b59fa2b49
commit c4ea4ea436
4 changed files with 79 additions and 56 deletions

View File

@@ -17,6 +17,31 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-17 22:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt_misc.prg
* contrib/hbide/hbide.prg
- Deleted hack which moved HBXBP specific functionality
into the core of HBQT.
I had to restore QT_PTROFXBP() macros inside hbide.
QT_PTROFXBP() has not much to do with QT_PTROF() as the
former serves to access oWidget member of passed class.
I see no need to move such logic into HBQT core code.
I restored QT_PTROF() also, but it's redefined as a dummy
in hbide.prg. I don't understand now why QT_PTROF() works
as dummy in hbide, but it doesn't when used as dummy in
HBXBP.
All in all, this means the .prg level :pPtr trick is still
needed in some places, while it's not needed in some others.
; TOFIX: HBQT has no pointer checking at all before accessing
C++ level objects, which means the simplest .prg level
error is instantly resulting in a GPF. All hb_par_*()
results must be checked for NULL before accessing them,
or better yet, and RTE should be generated right from
the hb_par_*() function.
* src/vm/classes.c
* Minor formatting.
2009-12-17 12:46 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtxwc/gtxwc.c
+ added hack for accessing selections marked by FireFox which does not
@@ -291,12 +316,12 @@
+ Implemented to avoid use of QT_PTROF() and QT_PTROFXBP() macros.
The functionality is transparent and accepts HBQT and HBXBP objects
as is.
as is.
TODO: Method SomeQtClass:new( ... )
TODO: Method SomeQtClass:new( ... )
::pPtr := QSomeClass( ... )
In above construct it is not known how many parameters
are of type pointer and otherwise and how, if resolved,
are of type pointer and otherwise and how, if resolved,
be forwarded to Qt wrapper with (...) syntax.
2009-12-17 11:54 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
@@ -317,7 +342,6 @@
It fixes national character translations in selections (clipboard)
broken during recent modifications for new CDP API.
>>>>>>> .r13274
2009-12-17 03:45 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/gtxwc/gtxwc.c
! fixed timeout checking in function taking text from clipboard.
@@ -333,12 +357,12 @@
* contrib/hbwin/tests/testmapi.prg
* contrib/hbwin/mapi.c
+ Added HB_WIN_MAPI_* constants for recipient types.
+ WIN_MAPISENDMAIL() now accept 8th (sender) as simple string,
+ WIN_MAPISENDMAIL() now accepts 8th (sender) as simple string,
this will be passed as sender name to Windows.
+ WIN_MAPISENDMAIL() now accept 9th (recipient) parameter
+ WIN_MAPISENDMAIL() now accepts 9th (recipient) parameter
as simple list of strings. Values will be passed as
'TO' recipient names to Windows.
+ WIN_MAPISENDMAIL() now accept 10th (attachment) parameter
+ WIN_MAPISENDMAIL() now accepts 10th (attachment) parameter
as simple list of strings. Values will be passed as
pathname to Windows.
% One minor optimization in WIN_MAPISENDMAIL().

View File

@@ -83,6 +83,15 @@ REQUEST HB_QT
STATIC s_resPath
STATIC s_pathSep
// HACK HACK HACK
#undef QT_PTROF
#define QT_PTROF( oObj ) ( oObj )
// HACK HACK HACK
#undef QT_PTROFXBP
#define QT_PTROFXBP( oXbp ) ( oXbp:oWidget )
/*----------------------------------------------------------------------*/
PROCEDURE Main( cProjIni )
@@ -288,14 +297,14 @@ METHOD HbIde:create( cProjIni )
::qLayout:setHorizontalSpacing( 0 )
::qLayout:setVerticalSpacing( 0 )
::oDa:oWidget:setLayout( ::qLayout )
::oDa:oWidget:setLayout( QT_PTROF( ::qLayout ) )
::qSplitter := QSplitter():new( ::oDa )
::qSplitter := QSplitter():new( QT_PTROF( ::oDa:oWidget ) )
::qLayout:addWidget_1( ::qSplitter, 0, 0, 1, 1 )
::qLayout:addWidget_1( QT_PTROF( ::qSplitter ), 0, 0, 1, 1 )
::qSplitter:addWidget( ::oProjTree )
::qSplitter:addWidget( ::oDa:oTabWidget )
::qSplitter:addWidget( QT_PTROFXBP( ::oProjTree ) )
::qSplitter:addWidget( QT_PTROFXBP( ::oDa:oTabWidget ) )
::qSplitter:show()
@@ -543,7 +552,7 @@ METHOD HbIde:convertSelection( cKey )
::qCursor:insertText( cBuffer )
::qCursor:setPosition( nB )
::qCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, nL )
::qCurEdit:setTextCursor( ::qCursor )
::qCurEdit:setTextCursor( QT_PTROF( ::qCursor ) )
::qCursor:endEditBlock()
ENDIF
ENDIF
@@ -605,10 +614,10 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos )
oTab := ::buildTabPage( ::oDa, cSourceFile )
qEdit := QPlainTextEdit():new( oTab )
qEdit := QPlainTextEdit():new( QT_PTROFXBP( oTab ) )
qEdit:setPlainText( memoread( cSourceFile ) )
qEdit:setLineWrapMode( QTextEdit_NoWrap )
qEdit:setFont( ::oFont )
qEdit:setFont( QT_PTROFXBP( ::oFont ) )
qEdit:ensureCursorVisible()
qDocument := QTextDocument():configure( qEdit:document() )
@@ -616,9 +625,9 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos )
qLayout := QBoxLayout():new()
qLayout:setDirection( 0 )
qLayout:setContentsMargins( 0,0,0,0 )
qLayout:addWidget( qEdit )
qLayout:addWidget( QT_PTROF( qEdit ) )
oTab:oWidget:setLayout( qLayout )
oTab:oWidget:setLayout( QT_PTROF( qLayout ) )
qHiliter := QSyntaxHighlighter():new( qEdit:document() )
@@ -664,8 +673,8 @@ METHOD HbIde:buildTabPage( oWnd, cSource )
oTab:create()
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( oTab ) )
::qTabWidget:setTabTooltip( ::qTabWidget:indexOf( oTab ), cSource )
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( QT_PTROFXBP( oTab ) ) )
::qTabWidget:setTabTooltip( ::qTabWidget:indexOf( QT_PTROFXBP( oTab ) ), cSource )
oTab:tabActivate := {|mp1,mp2,oXbp| ::activateTab( mp1, mp2, oXbp ) }
oTab:closeRequested := {|mp1,mp2,oXbp| ::closeTab( mp1, mp2, oXbp ) }
@@ -675,7 +684,7 @@ METHOD HbIde:buildTabPage( oWnd, cSource )
/*----------------------------------------------------------------------*/
METHOD HbIde:setTabImage( oTab, qEdit, nPos, lFirst, qDocument )
LOCAL nIndex := ::qTabWidget:indexOf( oTab )
LOCAL nIndex := ::qTabWidget:indexOf( QT_PTROFXBP( oTab ) )
LOCAL lModified := qDocument:isModified()
::qTabWidget:setTabIcon( nIndex, s_resPath + iif( lModified, "tabmodified.png", "tabunmodified.png" ) )
@@ -686,7 +695,7 @@ METHOD HbIde:setTabImage( oTab, qEdit, nPos, lFirst, qDocument )
lFirst := .f.
::qCursor:configure( qEdit:textCursor() )
::qCursor:setPosition( nPos, QTextCursor_MoveAnchor )
qEdit:setTextCursor( ::qCursor )
qEdit:setTextCursor( QT_PTROF( ::qCursor ) )
ENDIF
RETURN Self
@@ -715,7 +724,7 @@ METHOD HbIde:closeSource( nTab )
IF !empty( nTab )
::oFuncList:clear()
::saveSource( nTab )
::qTabWidget:removeTab( ::qTabWidget:indexOf( ::aTabs[ nTab,1 ] ) )
::qTabWidget:removeTab( ::qTabWidget:indexOf( QT_PTROFXBP( ::aTabs[ nTab,1 ] ) ) )
cSource := ::aTabs[ nTab, 5 ]
@@ -785,7 +794,7 @@ METHOD HbIde:saveSource( nTab, lConfirm )
ENDIF
ENDIF
nIndex := ::qTabWidget:indexOf( ::aTabs[ nTab, 1 ] )
nIndex := ::qTabWidget:indexOf( QT_PTROFXBP( ::aTabs[ nTab, 1 ] ) )
::qTabWidget:setTabIcon( nIndex, s_resPath + "tabunmodified.png" )
::oSBar:getItem( 7 ):caption := " "
ENDIF
@@ -1008,13 +1017,13 @@ METHOD HbIde:manageItemSelected( oXbpTreeItem )
IF ( n := ascan( ::aTabs, {|e_| PathNormalized( e_[ 5 ] ) == cSource } ) ) == 0
::editSource( cSource )
ELSE
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( ::aTabs[ n,1 ] ) )
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( QT_PTROFXBP( ::aTabs[ n,1 ] ) ) )
ENDIF
CASE ::aProjData[ n, 2 ] == "Opened Source"
cSource := ::aProjData[ n, 5 ]
IF ( n := ascan( ::aTabs, {|e_| PathNormalized( e_[ 5 ] ) == cSource } ) ) > 0
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( ::aTabs[ n,1 ] ) )
::qTabWidget:setCurrentIndex( ::qTabWidget:indexOf( QT_PTROFXBP( ::aTabs[ n,1 ] ) ) )
ENDIF
CASE ::aProjData[ n, 2 ] == "Path"
@@ -1189,7 +1198,7 @@ METHOD HbIde:buildDialog()
METHOD HbIde:buildFuncList()
::oDockR := XbpWindow():new( ::oDa )
::oDockR:oWidget := QDockWidget():new( ::oDlg )
::oDockR:oWidget := QDockWidget():new( QT_PTROFXBP( ::oDlg ) )
::oDlg:addChild( ::oDockR )
::oDockR:oWidget:setFeatures( QDockWidget_DockWidgetClosable + QDockWidget_DockWidgetMovable )
::oDockR:oWidget:setAllowedAreas( Qt_RightDockWidgetArea )
@@ -1208,14 +1217,13 @@ METHOD HbIde:buildFuncList()
::oFuncList:oWidget:setEditTriggers( QAbstractItemView_NoEditTriggers )
::oDockR:oWidget:setWidget( ::oFuncList )
::oDockR:oWidget:setWidget( QT_PTROFXBP( ::oFuncList ) )
::oDlg:oWidget:addDockWidget_1( Qt_RightDockWidgetArea, ::oDockR, Qt_Horizontal )
::oDlg:oWidget:addDockWidget_1( Qt_RightDockWidgetArea, QT_PTROFXBP( ::oDockR ), Qt_Horizontal )
IF ::aIni[ INI_HBIDE, FunctionListVisible ] == "YES"
::lDockRVisible := .t.
::oDockR:show()
//::setPosAndSizeByIni( ::oDockR:oWidget, FunctionListGeometry )
//::setSizeAndPosByIni( ::oDockR:oWidget, FunctionListGeometry )
ELSE
::lDockRVisible := .f.
::oDockR:hide()
@@ -1317,8 +1325,8 @@ METHOD HbIde:buildBottomArea()
::buildLinkResults()
::buildOutputResults()
::oDlg:oWidget:tabifyDockWidget( ::oDockB, ::oDockB1 )
::oDlg:oWidget:tabifyDockWidget( ::oDockB1, ::oDockB2 )
::oDlg:oWidget:tabifyDockWidget( QT_PTROFXBP( ::oDockB ), QT_PTROFXBP( ::oDockB1 ) )
::oDlg:oWidget:tabifyDockWidget( QT_PTROFXBP( ::oDockB1 ), QT_PTROFXBP( ::oDockB2 ) )
RETURN Self
@@ -1327,7 +1335,7 @@ METHOD HbIde:buildBottomArea()
METHOD HbIde:buildCompileResults()
::oDockB := XbpWindow():new( ::oDa )
::oDockB:oWidget := QDockWidget():new( ::oDlg )
::oDockB:oWidget := QDockWidget():new( QT_PTROFXBP( ::oDlg ) )
::oDlg:addChild( ::oDockB )
::oDockB:oWidget:setFeatures( QDockWidget_DockWidgetClosable )
::oDockB:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea )
@@ -1337,9 +1345,9 @@ METHOD HbIde:buildCompileResults()
::oDockB:oWidget:setFocusPolicy( Qt_NoFocus )
::oCompileResult := XbpMLE():new( ::oDockB ):create( , , { 0,0 }, { 100,400 }, , .t. )
::oDockB:oWidget:setWidget( ::oCompileResult )
::oDockB:oWidget:setWidget( QT_PTROFXBP( ::oCompileResult ) )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, ::oDockB, Qt_Vertical )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, QT_PTROFXBP( ::oDockB ), Qt_Vertical )
::oDockB:hide()
RETURN Self
@@ -1349,7 +1357,7 @@ METHOD HbIde:buildCompileResults()
METHOD HbIde:buildLinkResults()
::oDockB1 := XbpWindow():new( ::oDa )
::oDockB1:oWidget := QDockWidget():new( ::oDlg )
::oDockB1:oWidget := QDockWidget():new( QT_PTROFXBP( ::oDlg ) )
::oDlg:addChild( ::oDockB1 )
::oDockB1:oWidget:setFeatures( QDockWidget_DockWidgetClosable )
::oDockB1:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea )
@@ -1359,9 +1367,9 @@ METHOD HbIde:buildLinkResults()
::oDockB1:oWidget:setFocusPolicy( Qt_NoFocus )
::oLinkResult := XbpMLE():new( ::oDockB1 ):create( , , { 0,0 }, { 100, 400 }, , .t. )
::oDockB1:oWidget:setWidget( ::oLinkResult )
::oDockB1:oWidget:setWidget( QT_PTROFXBP( ::oLinkResult ) )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, ::oDockB1, Qt_Vertical )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, QT_PTROFXBP( ::oDockB1 ), Qt_Vertical )
::oDockB1:hide()
RETURN Self
@@ -1371,7 +1379,7 @@ METHOD HbIde:buildLinkResults()
METHOD HbIde:buildOutputResults()
::oDockB2 := XbpWindow():new( ::oDa )
::oDockB2:oWidget := QDockWidget():new( ::oDlg )
::oDockB2:oWidget := QDockWidget():new( QT_PTROFXBP( ::oDlg ) )
::oDlg:addChild( ::oDockB2 )
::oDockB2:oWidget:setFeatures( QDockWidget_DockWidgetClosable )
::oDockB2:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea )
@@ -1384,9 +1392,9 @@ METHOD HbIde:buildOutputResults()
::oOutputResult:wordWrap := .f.
//::oOutputResult:dataLink := {|x| IIf( x==NIL, cText, cText := x ) }
::oDockB2:oWidget:setWidget( ::oOutputResult )
::oDockB2:oWidget:setWidget( QT_PTROFXBP( ::oOutputResult ) )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, ::oDockB2, Qt_Vertical )
::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, QT_PTROFXBP( ::oDockB2 ), Qt_Vertical )
::oDockB2:hide()
RETURN Self
@@ -1398,7 +1406,7 @@ METHOD HbIde:buildOutputResults()
METHOD HbIde:printPreview()
LOCAL qDlg
qDlg := QPrintPreviewDialog():new( ::oDlg )
qDlg := QPrintPreviewDialog():new( QT_PTROFXBP( ::oDlg ) )
qDlg:setWindowTitle( "Harbour-QT Preview Dialog" )
Qt_Connect_Signal( qDlg:pPtr, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } )
qDlg:exec()
@@ -1413,7 +1421,7 @@ METHOD HbIde:paintRequested( pPrinter )
qPrinter := QPrinter():configure( pPrinter )
::qCurEdit:print( qPrinter )
::qCurEdit:print( QT_PTROF( qPrinter ) )
RETURN Self
@@ -1530,7 +1538,7 @@ METHOD HbIde:loadUI( cUi )
qFile := QFile():new( cUiFull )
IF qFile:open( 1 )
qUiLoader := QUiLoader():new()
qDialog := QDialog():configure( qUiLoader:load( qFile, ::oDlg ) )
qDialog := QDialog():configure( qUiLoader:load( QT_PTROF( qFile ), QT_PTROFXBP( ::oDlg ) ) )
qFile:close()
ENDIF
ENDIF
@@ -1547,7 +1555,7 @@ METHOD HbIde:findReplace( cUi )
qFile := QFile():new( cUiFull )
IF qFile:open( 1 )
qUiLoader := QUiLoader():new()
::qFindDlg := QDialog():configure( qUiLoader:load( qFile, ::oDlg ) )
::qFindDlg := QDialog():configure( qUiLoader:load( QT_PTROF( qFile ), QT_PTROFXBP( ::oDlg ) ) )
qFile:close()
//
::qFindDlg:setWindowFlags( Qt_Sheet )
@@ -1893,7 +1901,7 @@ METHOD HbIde:buildProjectViaQt( cProject )
Qt_Connect_Signal( QT_PTROF( ::qProcess ), "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 3, i, o ) } )
Qt_Connect_Signal( QT_PTROF( ::qProcess ), "finished(int,int)" , {|o,i| ::readProcessInfo( 2, i, o ) } )
::qProcess:start( "hbmk2.exe", qStringList )
::qProcess:start( "hbmk2.exe", QT_PTROF( qStringList ) )
RETURN Self
@@ -1927,5 +1935,3 @@ METHOD HbIde:readProcessInfo( nMode, iBytes )
RETURN nil
/*----------------------------------------------------------------------*/

View File

@@ -62,9 +62,6 @@ FUNCTION hbqt_ptr( xParam )
ELSEIF left( cClsName, 2 ) == "HB"
RETURN xParam:pPtr
ELSEIF left( cClsName, 3 ) == "XBP"
RETURN xParam:oWidget:pPtr
ELSE /* we don't care, programmer is at a fault */
ENDIF
@@ -73,4 +70,3 @@ FUNCTION hbqt_ptr( xParam )
RETURN xParam
/*----------------------------------------------------------------------*/

View File

@@ -3720,15 +3720,12 @@ HB_FUNC( __OBJSENDMSG )
hb_vmPush( hb_param( 1, HB_IT_ANY ) ); /* Push object */
for( uiParam = 3; uiParam <= uiPCount; ++uiParam ) /* Push arguments on stack */
{
hb_vmPush( hb_stackItemFromBase( uiParam ) );
}
hb_vmSend( ( USHORT ) ( uiPCount - 2 ) ); /* Execute message */
}
else
{
hb_errRT_BASE( EG_ARG, 3000, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
}
/*