diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a9ef46bfac..24f795df55 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,47 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-12 18:41 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/generator/qt45.qtp + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_garbage.h + * contrib/hbqt/hbqt_hbslots.cpp + * contrib/hbqt/qtgui/filelist.mk + + contrib/hbqt/qtgui/QPlainTextDocumentLayout.cpp + + contrib/hbqt/qtgui/TQPlainTextDocumentLayout.prg + + contrib/hbqt/qth/QPlainTextDocumentLayout.qth + + Added one more class. + + + contrib/hbide/resources/skeletons.ui + + contrib/hbide/resources/skeletons.uic + + Added widget definition to hold user input for "code skeletons". + + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idesources.prg + * contrib/hbide/idethemes.prg + + Prepared to fetch "Code Skeletons" from the user which will be + made available to be inserted into the source being edited. + To have a preview as to what will go inside the implementation, + click on "{}" icon on the toolbar. + + ! Fixed not to load whole document and highlight when hbIDE is + terminated. This reduces termination time to bare minimum. + + + Implemented "Convert Single Quotes to Double" and its reverse, + accessible from main-menu options. First select the + part of the source you want to apply these options, then click + on relevant menu option. A toolbar implementation will be better + which I am looking into how it can be presented in an aesthetic way. + + ! Fixed many more artifacts. + + ; NOTE: Regression is possible, please report issues, if any. + 2010-02-13 02:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbwin/hbwin.ch + added WIN_OFN_* constants diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 0a615a5b7d..1e30f29dca 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -122,6 +122,8 @@ CLASS HbIde DATA oFindInFiles DATA oDockFind DATA oHelp + DATA oSkeltn + DATA oSkeltnUI DATA oUI @@ -229,6 +231,7 @@ CLASS HbIde DATA aProjects INIT {} DATA aMarkTBtns INIT array( 6 ) + DATA lClosing INIT .f. METHOD new( cProjIni ) METHOD create( cProjIni ) @@ -384,7 +387,9 @@ METHOD HbIde:create( cProjIni ) IF ::nEvent == xbeP_Close hbide_dbg( "================ xbeP_Close" ) hbide_saveINI( Self ) + hbide_dbg( "================ xbeP_Close", "after: hbide_saveINI( Self )" ) ::oSM:closeAllSources() + hbide_dbg( "================ xbeP_Close", "after: ::oSM:closeAllSources()" ) EXIT ELSEIF ::nEvent == xbeP_Keyboard @@ -494,6 +499,8 @@ METHOD HbIde:execAction( cKey ) CASE "StreamComment" CASE "BlockIndentR" CASE "BlockIndentL" + CASE "BlockSgl2Dbl" + CASE "BlockDbl2Sgl" CASE "switchReadOnly" CASE "Search" CASE "Find" @@ -583,6 +590,12 @@ METHOD HbIde:execEditorAction( cKey ) CASE "BlockIndentL" ::oEM:indent( -1 ) EXIT + CASE "BlockSgl2Dbl" + ::oEM:convertDQuotes() + EXIT + CASE "BlockDbl2Sgl" + ::oEM:convertQuotes() + EXIT CASE "switchReadOnly" ::oEM:switchToReadOnly() EXIT @@ -614,6 +627,7 @@ METHOD HbIde:execEditorAction( cKey ) EXIT CASE "MatchPairs" // + ::oSkeltn:show() EXIT CASE "InsertSeparator" ::oEM:insertSeparator() @@ -1144,7 +1158,7 @@ METHOD HbIde:updateProjectMenu() * 02/01/2010 - 16:30:06 - vailtom */ METHOD HbIde:updateTitleBar() - LOCAL cTitle := "Harbour-Qt IDE" + LOCAL cTitle := "Harbour IDE " + substr( HB_VERSION(), at( "(Rev.", HB_VERSION() ) ) LOCAL oEdit IF Empty( ::oDlg ) @@ -1178,7 +1192,6 @@ METHOD HbIde:setCodec( cCodec ) HbXbp_SetCodec( ::cWrkCodec ) - //::oSBar:getItem( SB_PNL_CODEC ):caption := ::cWrkCodec ::oDK:setStatusText( SB_PNL_CODEC, ::cWrkCodec ) RETURN Self diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 83a9f85441..8dc8f17492 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -289,11 +289,15 @@ METHOD IdeActions:loadActions() aadd( aAct, { "RemoveTabs" , "Replace Tabs with Spaces" , "removetabs" , "" , "No", "Yes" } ) aadd( aAct, { "RemoveTrailingSpaces" , "Remove Trailing Spaces" , "removetrailingspaces", "", "No", "Yes" } ) aadd( aAct, { "FormatBraces" , "Format Braces" , "ormatbraces" , "" , "No", "Yes" } ) - aadd( aAct, { "DuplicateLine" , "Duplicate Current Line" , "duplicateline" , "^D" , "No", "Yes" } ) + aadd( aAct, { "StreamComment" , "Stream Comment" , "streamcomment" , "Sh+^Q", "No", "Yes" } ) aadd( aAct, { "BlockComment" , "Block Comment" , "blockcomment" , "Sh+^/", "No", "Yes" } ) aadd( aAct, { "BlockIndentR" , "Indent Right" , "blockindentr" , "^Tab" , "No", "Yes" } ) aadd( aAct, { "BlockIndentL" , "Indent Left" , "blockindentl" , "Sh+^Tab", "No", "Yes" } ) + aadd( aAct, { "BlockDbl2Sgl" , "Double Quotes to Single" , "blockdbl2sgl" , "" , "No", "Yes" } ) + aadd( aAct, { "BlockSgl2Dbl" , "Single Quotes to Double" , "blocksgl2dbl" , "" , "No", "Yes" } ) + + aadd( aAct, { "DuplicateLine" , "Duplicate Current Line" , "duplicateline" , "^D" , "No", "Yes" } ) aadd( aAct, { "DeleteLine" , "Delete Line" , "deleteline" , "^Delete", "No", "Yes" } ) aadd( aAct, { "MoveLineUp" , "Move Line Up" , "movelineup" , "Sh+^Up", "No", "Yes" } ) aadd( aAct, { "MoveLineDown" , "Move Line Down" , "movelinedown" , "Sh+^Down", "No", "Yes" } ) @@ -486,6 +490,9 @@ METHOD IdeActions:buildMainMenu() oSubMenu2:addItem( { ::getAction( "BlockComment" ), {|| oIde:execAction( "BlockComment" ) } } ) oSubMenu2:addItem( { ::getAction( "BlockIndentR" ), {|| oIde:execAction( "BlockIndentR" ) } } ) oSubMenu2:addItem( { ::getAction( "BlockIndentL" ), {|| oIde:execAction( "BlockIndentL" ) } } ) + hbide_menuAddSep( oSubMenu2 ) + oSubMenu2:addItem( { ::getAction( "BlockSgl2Dbl" ), {|| oIde:execAction( "BlockSgl2Dbl" ) } } ) + oSubMenu2:addItem( { ::getAction( "BlockDbl2Sgl" ), {|| oIde:execAction( "BlockDbl2Sgl" ) } } ) oMenuBar:addItem( { oSubMenu2, _T( "~Block..." ) } ) hbide_menuAddSep( oSubMenu ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index b1cb03c3bd..07190bcfa4 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -82,6 +82,7 @@ CLASS IdeDocks INHERIT IdeObject METHOD execEvent( nMode, p ) METHOD setView( cView ) METHOD buildHelpWidget() + METHOD buildSkeletonWidget() METHOD buildDialog() METHOD buildViewWidget() METHOD buildStackedWidget() @@ -101,6 +102,7 @@ CLASS IdeDocks INHERIT IdeObject METHOD setStatusText( nPart, xValue ) METHOD getMarkWidget( nIndex ) METHOD dispEnvironment( cEnviron ) + METHOD execSkeleton( nMode, p ) ENDCLASS @@ -183,8 +185,10 @@ METHOD IdeDocks:execEvent( nMode, p ) nIndex := ::oIde:qTabWidget:currentIndex() IF nIndex + 1 == ::oIde:qTabWidget:count() - ::oIde:qTabWidget:setCurrentIndex( 0 ) - ::oIde:qTabWidget:setCurrentIndex( nIndex ) /* TODO: Must be last saved */ + IF !( ::oIde:lClosing ) + ::oIde:qTabWidget:setCurrentIndex( 0 ) + ::oIde:qTabWidget:setCurrentIndex( nIndex ) /* TODO: Must be last saved */ + ENDIF ENDIF ::setStatusText( SB_PNL_VIEW, iif( p == 0, "Main", ::aINI[ INI_VIEWS, ::nCurView ] ) ) ENDIF @@ -228,7 +232,7 @@ METHOD IdeDocks:buildDialog() ::oIde:oDlg := XbpDialog():new() ::oDlg:icon := ::resPath + "vr.png" - ::oDlg:title := "Harbour-Qt IDE" + ::oDlg:title := "Harbour IDE" #ifdef HBIDE_USE_UIC ::oDlg:qtObject := HbQtUI():new( ::resPath + "mainwindow.uic" ):build() #else @@ -313,6 +317,7 @@ METHOD IdeDocks:buildDockWidgets() ::buildOutputResults() * ::buildFindInFiles() ::buildHelpWidget() + ::buildSkeletonWidget() ::oDlg:oWidget:tabifyDockWidget( ::oDockB:oWidget , ::oDockB1:oWidget ) ::oDlg:oWidget:tabifyDockWidget( ::oDockB1:oWidget, ::oDockB2:oWidget ) @@ -726,7 +731,7 @@ METHOD IdeDocks:toggleBottomDocks() METHOD IdeDocks:buildFindInFiles() LOCAL oXbp - ::oIde:oDockFind := XbpWindow():new( ::oDa ) + ::oIde:oDockFind := XbpWindow():new() ::oDockFind:oWidget := QDockWidget():new( ::oDlg:oWidget ) ::oDockFind:oWidget:setObjectName( "dockFindInFiles" ) ::oDlg:addChild( ::oDockFind ) @@ -758,3 +763,85 @@ METHOD IdeDocks:buildFindInFiles() /*----------------------------------------------------------------------*/ +METHOD IdeDocks:buildSkeletonWidget() + LOCAL oUI + + ::oIde:oSkeltn := XbpWindow():new() + ::oSkeltn:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oSkeltn:oWidget:setObjectName( "dockSkeleton" ) + ::oDlg:addChild( ::oSkeltn ) + ::oSkeltn:oWidget:setFeatures( QDockWidget_DockWidgetClosable + QDockWidget_DockWidgetFloatable ) + ::oSkeltn:oWidget:setAllowedAreas( Qt_RightDockWidgetArea ) + ::oSkeltn:oWidget:setWindowTitle( "Code Skeletons" ) + ::oSkeltn:oWidget:setFocusPolicy( Qt_NoFocus ) + + ::oIde:oSkeltnUI := HbQtUI():new( ::oIde:resPath + "skeletons.uic", ::oSkeltn:oWidget ):build() + + ::oSkeltn:oWidget:setWidget( ::oIde:oSkeltnUI:oWidget ) + + ::oDlg:oWidget:addDockWidget_1( Qt_RightDockWidgetArea, ::oSkeltn:oWidget, Qt_Horizontal ) + ::oSkeltn:hide() + + oUI := ::oIde:oSkeltnUI + + ::connect( oUI:q_buttonNew , "clicked()", {|| ::execSkeleton( 1 ) } ) + ::connect( oUI:q_buttonRename, "clicked()", {|| ::execSkeleton( 2 ) } ) + ::connect( oUI:q_buttonDelete, "clicked()", {|| ::execSkeleton( 3 ) } ) + ::connect( oUI:q_buttonClear , "clicked()", {|| ::execSkeleton( 4 ) } ) + ::connect( oUI:q_buttonGetSel, "clicked()", {|| ::execSkeleton( 5 ) } ) + ::connect( oUI:q_buttonUpdate, "clicked()", {|| ::execSkeleton( 6 ) } ) + ::connect( oUI:q_listNames , "itemSelectionChanged()", {|| ::execSkeleton( 7 ) } ) + + //::oSkeltnUI:q_editCode:setFontFamily( "Courier New" ) + //::oSkeltnUI:q_editCode:setFontPointSize( 10 ) + + //::oSkeltnUI:q_editCode:setFont( ::oFont:oWidget ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:execSkeleton( nMode, p ) + LOCAL cName, qItem, cCode + + HB_SYMBOL_UNUSED( p ) + + SWITCH nMode + + CASE 1 + IF !empty( cName := hbide_fetchAString( ::oSkeltnUI:q_listNames, "", "Name", "New Skeleton" ) ) + ::oSkeltnUI:q_listNames:addItem( cName ) + ENDIF + EXIT + CASE 2 + qItem := QListWidgetItem():configure( ::oSkeltnUI:q_listNames:currentItem() ) + cName := qItem:text() + IF !empty( cName := hbide_fetchAString( ::oSkeltnUI:q_listNames, cName, "Name", "New Skeleton" ) ) + qItem:setText( cName ) + ENDIF + EXIT + CASE 3 + qItem := QListWidgetItem():configure( ::oSkeltnUI:q_listNames:currentItem() ) + ::oSkeltnUI:q_listNames:removeItemWidget( qItem ) + EXIT + CASE 4 + ::oSkeltnUI:q_editCode:clear() + EXIT + CASE 5 + IF !empty( cCode := ::oEM:getSelectedText() ) + // TODO: Format cCode + ::oSkeltnUI:q_editCode:setPlainText( cCode ) + ENDIF + EXIT + CASE 6 + // Update the skeleton code and save the skeleton's buffer | file + + EXIT + CASE 7 + + EXIT + ENDSWITCH + + RETURN NIL + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 80bb8a4817..446c8646ac 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -141,6 +141,8 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD streamComment() METHOD blockComment() METHOD indent( nStep ) + METHOD convertQuotes() + METHOD convertDQuotes() METHOD toggleSelectionMode() ENDCLASS @@ -560,6 +562,24 @@ METHOD IdeEditsManager:indent( nStep ) /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:convertQuotes() + LOCAL qEdit + IF !empty( qEdit := ::getEditCurrent() ) + qEdit:convertQuotes() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:convertDQuotes() + LOCAL qEdit + IF !empty( qEdit := ::getEditCurrent() ) + qEdit:convertDQuotes() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:switchToReadOnly() IF !empty( ::qCurEdit ) ::qCurEdit:setReadOnly( !( ::qCurEdit:isReadOnly() ) ) @@ -907,6 +927,7 @@ CLASS IdeEditor INHERIT IdeObject DATA cTheme INIT "" DATA cView DATA qDocument + DATA qDocLayout DATA qHiliter DATA sourceFile INIT "" DATA pathNormalized @@ -921,8 +942,6 @@ CLASS IdeEditor INHERIT IdeObject DATA nBlock INIT -1 DATA nColumn INIT -1 - DATA nPrevBlocks INIT 0 - DATA nBlocks INIT 0 DATA nPos INIT 0 DATA nHPos INIT 0 @@ -946,7 +965,6 @@ CLASS IdeEditor INHERIT IdeObject METHOD split( nOrient, oEditP ) METHOD relay( oEdit ) METHOD destroy() - METHOD exeEvent( nMode, p, p1, p2 ) METHOD setDocumentProperties() METHOD activateTab( mp1, mp2, oXbp ) METHOD buildTabPage( cSource ) @@ -1037,13 +1055,9 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) ::qCoEdit := ::oEdit ::qDocument := QTextDocument():configure( ::qEdit:document() ) - #if 1 - ::connect( ::qDocument, "blockCountChanged(int)" , {|p | ::exeEvent( blockCountChanged, p ) } ) - ::connect( ::qDocument, "contentsChange(int,int,int)", {|p,p1,p2| ::exeEvent( contentsChange, p, p1, p2 ) } ) - #else -hbide_dbg( 2001, ::qSlots:hbConnect( ::qDocument, "blockCountChanged(int)" , {|o,p | ::exeEvent( 21, o, p ) } ) ) - ::qSlots:hbConnect( ::qDocument, "contentsChange(int,int,int)", {|o,p,p1,p2| ::exeEvent( 22, o, p, p1, p2 ) } ) - #endif + ::qDocLayout := QPlainTextDocumentLayout():new( ::qDocument ) + ::qDocument:setDocumentLayout( ::qDocLayout ) + IF ::cType != "U" ::qHiliter := ::oThemes:SetSyntaxHilighting( ::oEdit:qEdit, @::cTheme ) ENDIF @@ -1064,33 +1078,90 @@ hbide_dbg( 2001, ::qSlots:hbConnect( ::qDocument, "blockCountChanged(int)" /*----------------------------------------------------------------------*/ -METHOD IdeEditor:exeEvent( nMode, p, p1, p2 ) - LOCAL qChar +METHOD IdeEditor:destroy() + LOCAL n, oEdit - HB_SYMBOL_UNUSED( p1 ) +hbide_dbg( "IdeEditor:destroy()", 0, ::sourceFile ) - SWITCH nMode - CASE blockCountChanged - //hbide_dbg( "blockCountChanged(int)", p ) - ::nPrevBlocks := ::nBlocks - ::nBlocks := p - EXIT + ::qHiliter := NIL - CASE contentsChange - //hbide_dbg( "contentsChange()", p, p1, p2 ) - IF p2 == 1 /* Characters Added */ - qChar := QChar():configure( ::qDocument:characterAt( p ) ) - SWITCH qChar:toAscii() - CASE 32 /* Space Key */ - ::qCoEdit:lUpdatePrevWord := .t. - EXIT - ENDSWITCH + ::qCqEdit := NIL + ::qCoEdit := NIL + ::qEdit := NIL + DO WHILE len( ::aEdits ) > 0 + oEdit := ::aEdits[ 1 ] + hb_adel( ::aEdits, 1, .t. ) + oEdit:destroy() + ENDDO + ::oEdit:destroy() + + IF !Empty( ::qDocument ) + ::qDocument := NIL + ENDIF + + IF !Empty( ::qHiliter ) + ::qHiliter := NIL + ENDIF + + ::oEdit := NIL + + IF !Empty( ::qLayout ) + ::qLayout := NIL + ENDIF + + IF ( n := ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ] == Self } ) ) > 0 + hb_adel( ::oIde:aTabs, n, .T. ) + ENDIF + + ::oEM:removeSourceInTree( ::sourceFile ) + + ::qTabWidget:removeTab( ::qTabWidget:indexOf( ::oTab:oWidget ) ) + ::oTab := NIL + + IF ::qTabWidget:count() == 0 + IF ::lDockRVisible + ::oDockR:hide() + ::oIde:lDockRVisible := .f. ENDIF - EXIT + ENDIF +hbide_dbg( "IdeEditor:destroy()", 1, "-------------------------------------" ) + RETURN Self - ENDSWITCH +/*----------------------------------------------------------------------*/ - RETURN Nil +METHOD IdeEditor:setDocumentProperties() + LOCAL qCursor + + qCursor := QTextCursor():configure( ::qEdit:textCursor() ) + + IF !( ::lLoaded ) /* First Time */ +// ::qEdit:clear() + ::qEdit:setPlainText( hb_memoRead( ::sourceFile ) ) + qCursor:setPosition( ::nPos ) + ::qEdit:setTextCursor( qCursor ) + + QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos ) + QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos ) + + QTextDocument():configure( ::qEdit:document() ):setModified( .f. ) + + ::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ::resPath + "tabunmodified.png" ) + ::lLoaded := .T. + ENDIF + + ::nBlock := qCursor:blockNumber() + ::nColumn := qCursor:columnNumber() + + ::oIde:aSources := { ::sourceFile } + ::oIde:createTags() + ::oIde:updateFuncList() + ::oIde:updateTitleBar() + + ::dispEditInfo( ::qEdit ) + + ::oIde:manageFocusInEditor() + + RETURN Self /*----------------------------------------------------------------------*/ @@ -1145,93 +1216,6 @@ METHOD IdeEditor:split( nOrient, oEditP ) /*----------------------------------------------------------------------*/ -METHOD IdeEditor:destroy() - LOCAL n, oEdit - -hbide_dbg( "IdeEditor:destroy()", 0 ) - ::disconnect( ::qDocument, "blockCountChanged(int)" ) - ::disconnect( ::qDocument, "contentsChange(int,int,int)" ) - - ::qCqEdit := NIL - ::qCoEdit := NIL - ::qEdit := NIL - DO WHILE len( ::aEdits ) > 0 - oEdit := ::aEdits[ 1 ] - hb_adel( ::aEdits, 1, .t. ) - oEdit:destroy() - ENDDO - ::oEdit:destroy() - - IF !Empty( ::qDocument ) - ::qDocument := NIL - ENDIF - - IF !Empty( ::qHiliter ) - ::qHiliter := NIL - ENDIF - - ::oEdit := NIL - - IF !Empty( ::qLayout ) - ::qLayout := NIL - ENDIF - - IF ( n := ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ] == Self } ) ) > 0 - hb_adel( ::oIde:aTabs, n, .T. ) - ENDIF - - ::oEM:removeSourceInTree( ::sourceFile ) - - ::qTabWidget:removeTab( ::qTabWidget:indexOf( ::oTab:oWidget ) ) - ::oTab := NIL - - IF ::qTabWidget:count() == 0 - IF ::lDockRVisible - ::oDockR:hide() - ::oIde:lDockRVisible := .f. - ENDIF - ENDIF -hbide_dbg( "IdeEditor:destroy()", 1 ) - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEditor:setDocumentProperties() - LOCAL qCursor - - qCursor := QTextCursor():configure( ::qEdit:textCursor() ) - - IF !( ::lLoaded ) /* First Time */ - ::qEdit:clear() - ::qEdit:setPlainText( hb_memoRead( ::sourceFile ) ) - qCursor:setPosition( ::nPos ) - ::qEdit:setTextCursor( qCursor ) - - QScrollBar():configure( ::qEdit:horizontalScrollBar() ):setValue( ::nHPos ) - QScrollBar():configure( ::qEdit:verticalScrollBar() ):setValue( ::nVPos ) - - QTextDocument():configure( ::qEdit:document() ):setModified( .f. ) - - ::qTabWidget:setTabIcon( ::qTabWidget:indexOf( ::oTab:oWidget ), ::resPath + "tabunmodified.png" ) - ::lLoaded := .T. - ENDIF - - ::nBlock := qCursor:blockNumber() - ::nColumn := qCursor:columnNumber() - - ::oIde:aSources := { ::sourceFile } - ::oIde:createTags() - ::oIde:updateFuncList() - ::oIde:updateTitleBar() - - ::dispEditInfo( ::qEdit ) - - ::oIde:manageFocusInEditor() - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) LOCAL oEdit @@ -1249,7 +1233,6 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) METHOD IdeEditor:buildTabPage( cSource ) - //::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) ::oTab := XbpTabPage():new( ::oTabParent, , { 5,5 }, { 700,400 }, , .t. ) IF Empty( cSource ) @@ -1426,19 +1409,264 @@ METHOD IdeEdit:create( oEditor, nMode ) ::qEdit:installEventFilter( ::pEvents ) ::qEdit:highlightCurrentLine( .t. ) /* Via user-setup */ - Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_KeyPress, {|p| ::execKeyEvent( 101, QEvent_KeyPress, p ) } ) - Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_Wheel , {|p| ::execKeyEvent( 102, QEvent_Wheel , p ) } ) - ::qHLayout := QHBoxLayout():new() ::qHLayout:setSpacing( 0 ) ::qHLayout:addWidget( ::qEdit ) + ::connectEditSignals( Self ) + Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_KeyPress, {|p| ::execKeyEvent( 101, QEvent_KeyPress, p ) } ) + Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_Wheel , {|p| ::execKeyEvent( 102, QEvent_Wheel , p ) } ) + RETURN Self /*----------------------------------------------------------------------*/ +METHOD IdeEdit:destroy() + + Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_KeyPress ) + Qt_Events_DisConnect( ::pEvents, ::qEdit, QEvent_Wheel ) + + ::disconnectEditSignals( Self ) + + ::oEditor:qLayout:removeItem( ::qHLayout ) + // + ::qHLayout:removeWidget( ::qEdit ) + ::qEdit := NIL + ::qHLayout := NIL + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:disconnectEditSignals( oEdit ) + HB_SYMBOL_UNUSED( oEdit ) + + ::disConnect( oEdit:qEdit, "customContextMenuRequested(QPoint)" ) + ::disConnect( oEdit:qEdit, "textChanged()" ) + ::disConnect( oEdit:qEdit, "selectionChanged()" ) + ::disConnect( oEdit:qEdit, "cursorPositionChanged()" ) + + #if 0 + ::disConnect( oEdit:qEdit, "copyAvailable(bool)" ) + ::disConnect( oEdit:qEdit, "modificationChanged(bool)" ) + ::disConnect( oEdit:qEdit, "updateRequest(QRect,int)" ) + ::disConnect( oEdit:qEdit, "redoAvailable(bool)" ) + ::disConnect( oEdit:qEdit, "undoAvailable(bool)" ) + #endif + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:connectEditSignals( oEdit ) + HB_SYMBOL_UNUSED( oEdit ) + + ::connect( oEdit:qEdit, "customContextMenuRequested(QPoint)", {|p | ::execEvent( 1, oEdit, p ) } ) + ::Connect( oEdit:qEdit, "textChanged()" , {| | ::execEvent( 2, oEdit, ) } ) + ::Connect( oEdit:qEdit, "selectionChanged()" , {|p | ::execEvent( 6, oEdit, p ) } ) + ::Connect( oEdit:qEdit, "cursorPositionChanged()" , {| | ::execEvent( 9, oEdit, ) } ) + + #if 0 + ::Connect( oEdit:qEdit, "copyAvailable(bool)" , {|p | ::execEvent( 3, oEdit, p ) } ) + ::Connect( oEdit:qEdit, "modificationChanged(bool)" , {|p | ::execEvent( 4, oEdit, p ) } ) + ::Connect( oEdit:qEdit, "updateRequest(QRect,int)" , {|p,p1| ::execEvent( 8, oEdit, p, p1 ) } ) + ::Connect( oEdit:qEdit, "redoAvailable(bool)" , {|p | ::execEvent( 5, oEdit, p ) } ) + ::Connect( oEdit:qEdit, "undoAvailable(bool)" , {|p | ::execEvent( 7, oEdit, p ) } ) + #endif + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) + LOCAL pAct, qAct, n, qCursor, qEdit, oo, nSpaces + + HB_SYMBOL_UNUSED( p1 ) + + qEdit := oEdit:qEdit + qCursor := QTextCursor():configure( qEdit:textCursor() ) + oEdit:nCurLineNo := qCursor:blockNumber() + + SWITCH nMode + + CASE customContextMenuRequested + pAct := ::oEM:qContextMenu:exec_1( qEdit:mapToGlobal( p ) ) + IF !hbqt_isEmptyQtPointer( pAct ) + qAct := QAction():configure( pAct ) + DO CASE + CASE qAct:text() == "Split Horizontally" + ::oEditor:split( 1, oEdit ) + CASE qAct:text() == "Split Vertically" + ::oEditor:split( 2, oEdit ) + CASE qAct:text() == "Close Split Window" + IF ( n := ascan( ::oEditor:aEdits, {|o| o == oEdit } ) ) > 0 /* 1 == Main Edit */ + 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() + ENDCASE + ENDIF + EXIT + CASE textChanged + hbide_dbg( "textChanged()" ) + ::oEditor:setTabImage( qEdit ) + EXIT + CASE selectionChanged + hbide_dbg( "selectionChanged()" ) + ::oEditor:qCqEdit := qEdit + ::oEditor:qCoEdit := oEdit + + qCursor := QTextCursor():configure( qEdit:TextCursor() ) + + /* Book Marks reach-out buttons */ + ::relayMarkButtons() + + /* An experimental move but seems a lot is required to achieve column selection */ +* qEdit:highlightSelectedColumns( ::isColumnSelectionEnabled ) + + ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( qCursor:selectedText() ) ) + + EXIT + CASE cursorPositionChanged + hbide_dbg( "cursorPositionChanged()" ) + ::oEditor:dispEditInfo( qEdit ) + IF ::lUpdatePrevWord + ::lUpdatePrevWord := .f. + hbide_handlePreviousWord( ::qEdit ) + ENDIF + + IF ::lIndentIt + ::lIndentIt := .f. + IF ( nSpaces := ::findLastIndent() ) > 0 + qCursor := QTextCursor():configure( ::qEdit:textCursor() ) + qCursor:insertText( space( nSpaces ) ) + ENDIF + ENDIF + + EXIT + #if 0 + CASE copyAvailable + //hbide_dbg( "copyAvailable(bool)", p ) + EXIT + CASE modificationChanged + //hbide_dbg( "modificationChanged(bool)", p ) + EXIT + CASE redoAvailable + //hbide_dbg( "redoAvailable(bool)", p ) + EXIT + CASE undoAvailable + //hbide_dbg( "undoAvailable(bool)", p ) + EXIT + CASE updateRequest + EXIT + #endif + ENDSWITCH + + RETURN Nil + +/*----------------------------------------------------------------------*/ + +METHOD IdeEdit:execKeyEvent( nMode, nEvent, p ) + LOCAL key, kbm, txt, qEvent + LOCAL lAlt := .f. + LOCAL lCtrl := .f. + LOCAL lShift := .f. + + SWITCH nEvent + CASE QEvent_KeyPress + + qEvent := QKeyEvent():configure( p ) + + key := qEvent:key() + kbm := qEvent:modifiers() + txt := qEvent:text() + + IF hb_bitAnd( kbm, Qt_AltModifier ) == Qt_AltModifier + lAlt := .t. + ENDIF + IF hb_bitAnd( kbm, Qt_ControlModifier ) == Qt_ControlModifier + lCtrl := .t. + ENDIF + IF hb_bitAnd( kbm, Qt_ShiftModifier ) == Qt_ShiftModifier + lShift := .t. + ENDIF + + SWITCH ( key ) + CASE Qt_Key_Space + IF !lAlt .AND. !lShift .AND. !lCtrl + ::lUpdatePrevWord := .t. + ENDIF + EXIT + CASE Qt_Key_Return + CASE Qt_Key_Enter + ::lIndentIt := .t. + EXIT + CASE Qt_Key_Tab + IF lCtrl + ::blockIndent( 1 ) + RETURN .T. + ENDIF + EXIT + CASE Qt_Key_Backtab + IF lCtrl + ::blockIndent( -1 ) + RETURN .t. + ENDIF + EXIT + CASE Qt_Key_Q /* All these actions will be pulled from user-setup */ + IF lCtrl .AND. lShift + ::streamComment() + ENDIF + EXIT + CASE Qt_Key_Slash + IF lCtrl + ::blockComment() + ENDIF + EXIT + CASE Qt_Key_D + IF lCtrl + ::duplicateLine() + ENDIF + EXIT + CASE Qt_Key_Backspace + hbide_justACall( txt, lAlt, lShift, lCtrl, qEvent, nMode ) + EXIT + CASE Qt_Key_Delete + IF lCtrl + ::deleteLine() + RETURN .t. + ENDIF + EXIT + CASE Qt_Key_Up + IF lCtrl .AND. lShift + ::moveLine( -1 ) + RETURN .t. + ENDIF + CASE Qt_Key_Down + IF lCtrl .AND. lShift + ::moveLine( 1 ) + RETURN .t. + ENDIF + ENDSWITCH + + EXIT + CASE QEvent_Wheel + EXIT + + ENDSWITCH + + RETURN .F. /* Important */ + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:gotoMark( nIndex ) IF len( ::aBookMarks ) >= nIndex ::qEdit:gotoBookmark( ::aBookMarks[ nIndex ] ) @@ -1483,52 +1711,6 @@ METHOD IdeEdit:setNewMark() /*----------------------------------------------------------------------*/ -METHOD IdeEdit:destroy() - - ::disconnectEditSignals( Self ) - - ::oEditor:qLayout:removeItem( ::qHLayout ) - // - ::qHLayout:removeWidget( ::qEdit ) - ::qEdit := NIL - ::qHLayout := NIL - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEdit:disconnectEditSignals( oEdit ) - - ::disConnect( oEdit:qEdit, "customContextMenuRequested(QPoint)" ) - ::disConnect( oEdit:qEdit, "textChanged()" ) - ::disConnect( oEdit:qEdit, "copyAvailable(bool)" ) - ::disConnect( oEdit:qEdit, "modificationChanged(bool)" ) - ::disConnect( oEdit:qEdit, "redoAvailable(bool)" ) - ::disConnect( oEdit:qEdit, "selectionChanged()" ) - ::disConnect( oEdit:qEdit, "undoAvailable(bool)" ) - ::disConnect( oEdit:qEdit, "updateRequest(QRect,int)" ) - ::disConnect( oEdit:qEdit, "cursorPositionChanged()" ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEdit:connectEditSignals( oEdit ) - - ::Connect( oEdit:qEdit, "updateRequest(QRect,int)" , {|p,p1| ::execEvent( 8, oEdit, p, p1 ) } ) - ::connect( oEdit:qEdit, "customContextMenuRequested(QPoint)", {|p | ::execEvent( 1, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "textChanged()" , {| | ::execEvent( 2, oEdit, ) } ) - ::Connect( oEdit:qEdit, "copyAvailable(bool)" , {|p | ::execEvent( 3, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "modificationChanged(bool)" , {|p | ::execEvent( 4, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "redoAvailable(bool)" , {|p | ::execEvent( 5, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "selectionChanged()" , {|p | ::execEvent( 6, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "undoAvailable(bool)" , {|p | ::execEvent( 7, oEdit, p ) } ) - ::Connect( oEdit:qEdit, "cursorPositionChanged()" , {| | ::execEvent( 9, oEdit, ) } ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEdit:duplicateLine() ::qEdit:duplicateLine() RETURN Self @@ -1602,188 +1784,6 @@ hbide_dbg( s ) /*----------------------------------------------------------------------*/ -METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) - LOCAL pAct, qAct, n, qCursor, qEdit, oo, nSpaces - - HB_SYMBOL_UNUSED( p1 ) - - qEdit := oEdit:qEdit - qCursor := QTextCursor():configure( qEdit:textCursor() ) - oEdit:nCurLineNo := qCursor:blockNumber() - - SWITCH nMode - - CASE customContextMenuRequested - pAct := ::oEM:qContextMenu:exec_1( qEdit:mapToGlobal( p ) ) - IF !hbqt_isEmptyQtPointer( pAct ) - qAct := QAction():configure( pAct ) - DO CASE - CASE qAct:text() == "Split Horizontally" - ::oEditor:split( 1, oEdit ) - CASE qAct:text() == "Split Vertically" - ::oEditor:split( 2, oEdit ) - CASE qAct:text() == "Close Split Window" - IF ( n := ascan( ::oEditor:aEdits, {|o| o == oEdit } ) ) > 0 /* 1 == Main Edit */ - 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() - ENDCASE - ENDIF - EXIT - CASE textChanged - //hbide_dbg( "textChanged()" ) - ::oEditor:setTabImage( qEdit ) - EXIT - CASE copyAvailable - //hbide_dbg( "copyAvailable(bool)", p ) - EXIT - CASE modificationChanged - //hbide_dbg( "modificationChanged(bool)", p ) - EXIT - CASE redoAvailable - //hbide_dbg( "redoAvailable(bool)", p ) - EXIT - CASE selectionChanged - hbide_dbg( "selectionChanged()" ) - ::oEditor:qCqEdit := qEdit - ::oEditor:qCoEdit := oEdit - - qCursor := QTextCursor():configure( qEdit:TextCursor() ) - - /* Book Marks reach-out buttons */ - ::relayMarkButtons() - - /* An experimental move but seems a lot is required to achieve column selection */ -* qEdit:highlightSelectedColumns( ::isColumnSelectionEnabled ) - - ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( qCursor:selectedText() ) ) - - EXIT - CASE undoAvailable - //hbide_dbg( "undoAvailable(bool)", p ) - EXIT - CASE updateRequest - EXIT - CASE cursorPositionChanged - //hbide_dbg( "cursorPositionChanged()" ) - ::oEditor:dispEditInfo( qEdit ) - IF ::lUpdatePrevWord - ::lUpdatePrevWord := .f. - hbide_handlePreviousWord( ::qEdit ) - ENDIF - - IF ::lIndentIt - ::lIndentIt := .f. - IF ( nSpaces := ::findLastIndent() ) > 0 - qCursor := QTextCursor():configure( ::qEdit:textCursor() ) - qCursor:insertText( space( nSpaces ) ) - ENDIF - ENDIF - //hbide_dbg( "cursorPositionChanged() 1" ) - EXIT - - ENDSWITCH - - RETURN Nil - -/*----------------------------------------------------------------------*/ - -METHOD IdeEdit:execKeyEvent( nMode, nEvent, p ) - LOCAL key, kbm, txt, qEvent - LOCAL lAlt := .f. - LOCAL lCtrl := .f. - LOCAL lShift := .f. - - SWITCH nEvent - CASE QEvent_KeyPress - - qEvent := QKeyEvent():configure( p ) - - key := qEvent:key() - kbm := qEvent:modifiers() - txt := qEvent:text() - - IF hb_bitAnd( kbm, Qt_AltModifier ) == Qt_AltModifier - lAlt := .t. - ENDIF - IF hb_bitAnd( kbm, Qt_ControlModifier ) == Qt_ControlModifier - lCtrl := .t. - ENDIF - IF hb_bitAnd( kbm, Qt_ShiftModifier ) == Qt_ShiftModifier - lShift := .t. - ENDIF - - SWITCH ( key ) - - CASE Qt_Key_Q /* All these actions will be pulled from user-setup */ - IF lCtrl .AND. lShift - ::streamComment() - ENDIF - EXIT - CASE Qt_Key_Slash - IF lCtrl - ::blockComment() - ENDIF - EXIT - CASE Qt_Key_D - IF lCtrl - ::duplicateLine() - ENDIF - EXIT - CASE Qt_Key_Return - CASE Qt_Key_Enter - ::lIndentIt := .t. - EXIT - CASE Qt_Key_Tab - IF lCtrl - ::blockIndent( 1 ) - RETURN .T. - ENDIF - EXIT - CASE Qt_Key_Backtab - IF lCtrl - ::blockIndent( -1 ) - RETURN .t. - ENDIF - EXIT - CASE Qt_Key_Backspace - hbide_justACall( txt, lAlt, lShift, lCtrl, qEvent, nMode ) - EXIT - CASE Qt_Key_Delete - IF lCtrl - ::deleteLine() - RETURN .t. - ENDIF - EXIT - CASE Qt_Key_Up - IF lCtrl .AND. lShift - ::moveLine( -1 ) - RETURN .t. - ENDIF - CASE Qt_Key_Down - IF lCtrl .AND. lShift - ::moveLine( 1 ) - RETURN .t. - ENDIF - ENDSWITCH - - EXIT - CASE QEvent_Wheel - EXIT - - ENDSWITCH - - RETURN .F. /* Important */ - -/*----------------------------------------------------------------------*/ - METHOD IdeEdit:findLastIndent() LOCAL qCursor, qTextBlock, cText, cWord LOCAL nSpaces := 0 diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 3d3d10be86..e0507ef857 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -158,6 +158,8 @@ CLASS IdeObject ACCESS oStackedWidget INLINE ::oIde:oStackedWidget ACCESS oFrame INLINE ::oIde:oFrame ACCESS oHelp INLINE ::oIde:oHelp + ACCESS oSkeltn INLINE ::oIde:oSkeltn + ACCESS oSkeltnUI INLINE ::oIde:oSkeltnUI ACCESS lProjTreeVisible INLINE ::oIde:lProjTreeVisible ACCESS lDockRVisible INLINE ::oIde:lDockRVisible diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index b74c79bc34..56b15b9fb1 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -112,6 +112,7 @@ FUNCTION hbide_saveINI( oIde ) aadd( txt_, " " ) FOR j := 0 TO len( oIde:aINI[ INI_VIEWS ] ) + oIde:lClosing := .t. oIde:oStackedWidget:oWidget:setCurrentIndex( j ) nTabs := oIde:qTabWidget:count() @@ -121,17 +122,25 @@ FUNCTION hbide_saveINI( oIde ) oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ] IF !Empty( oEdit:sourceFile ) .and. !( ".ppo" == lower( oEdit:cExt ) ) + IF oEdit:lLoaded + qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) + qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) + qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) - qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) - qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) - qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) - - aadd( txt_, oEdit:sourceFile + "," + ; - hb_ntos( iif( oEdit:lLoaded, qCursor:position(), oEdit:nPos ) ) + "," + ; - hb_ntos( iif( oEdit:lLoaded, qHScr:value() , oEdit:nHPos ) ) + "," + ; - hb_ntos( iif( oEdit:lLoaded, qVScr:value() , oEdit:nVPos ) ) + "," + ; - oEdit:cTheme + "," + ; - oEdit:cView + "," ) + aadd( txt_, oEdit:sourceFile + "," + ; + hb_ntos( qCursor:position() ) + "," + ; + hb_ntos( qHScr:value() ) + "," + ; + hb_ntos( qVScr:value() ) + "," + ; + oEdit:cTheme + "," + ; + oEdit:cView + "," ) + ELSE + aadd( txt_, oEdit:sourceFile + "," + ; + hb_ntos( oEdit:nPos ) + "," + ; + hb_ntos( oEdit:nHPos ) + "," + ; + hb_ntos( oEdit:nVPos ) + "," + ; + oEdit:cTheme + "," + ; + oEdit:cView + "," ) + ENDIF ENDIF NEXT NEXT diff --git a/harbour/contrib/hbide/idesources.prg b/harbour/contrib/hbide/idesources.prg index 3e09e583d1..aa13c8db4d 100644 --- a/harbour/contrib/hbide/idesources.prg +++ b/harbour/contrib/hbide/idesources.prg @@ -275,9 +275,9 @@ hbide_dbg( "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", 0 ) RETURN .F. ENDIF ENDIF -hbide_dbg( "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", 1 ) +hbide_dbg( "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", 1, "before: oEditor:destroy()" ) oEditor:destroy() -hbide_dbg( "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", 21 ) +hbide_dbg( "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", 2, "after: oEditor:destroy()" ) ::oIde:updateTitleBar() ENDIF diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index 5363c0d465..b2fc35589e 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -370,7 +370,6 @@ METHOD IdeThemes:setSyntaxRule( qHiliter, cName, cPattern, aAttr ) METHOD IdeThemes:setSyntaxFormat( qHiliter, cName, aAttr ) qHiliter:hbSetFormat( cName, ::buildSyntaxFormat( aAttr ) ) -// qHiliter:rehighlight() RETURN Self @@ -391,7 +390,7 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew ) ::setForeBackGround( qEdit, cTheme ) - qHiliter := HBQSyntaxHighlighter():new( qEdit:document() ) + qHiliter := HBQSyntaxHighlighter():new()// qEdit:document() ) FOR EACH a_ IN ::aPatterns IF !empty( aAttr := ::getThemeAttribute( a_[ 1 ], cTheme ) ) @@ -402,6 +401,8 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew ) ::setSingleLineCommentRule( qHiliter, cTheme ) ::setQuotesRule( qHiliter, cTheme ) + qHiliter:setDocument( qEdit:document() ) + RETURN qHiliter /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/resources/skeletons.ui b/harbour/contrib/hbide/resources/skeletons.ui new file mode 100644 index 0000000000..087c29d03f --- /dev/null +++ b/harbour/contrib/hbide/resources/skeletons.ui @@ -0,0 +1,87 @@ + + + Form + + + + 0 + 0 + 290 + 508 + + + + Form + + + + + + Identity + + + + + + + + + + Delete + + + + + + + Rename + + + + + + + QPlainTextEdit::NoWrap + + + + + + + Clear + + + + + + + Code Snippet + + + + + + + Get Selection + + + + + + + Add New + + + + + + + Update + + + + + + + + diff --git a/harbour/contrib/hbide/resources/skeletons.uic b/harbour/contrib/hbide/resources/skeletons.uic new file mode 100644 index 0000000000..9943eb3444 --- /dev/null +++ b/harbour/contrib/hbide/resources/skeletons.uic @@ -0,0 +1,128 @@ +/******************************************************************************** +** Form generated from reading ui file 'skeletons.ui' +** +** Created: Fri Feb 12 18:01:10 2010 +** by: Qt User Interface Compiler version 4.5.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + +#ifndef SKELETONS_H +#define SKELETONS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + QGridLayout *gridLayout; + QLabel *labelIdentity; + QListWidget *listNames; + QPushButton *buttonDelete; + QPushButton *buttonRename; + QPlainTextEdit *editCode; + QPushButton *buttonClear; + QLabel *labelSnippets; + QPushButton *buttonGetSel; + QPushButton *buttonNew; + QPushButton *buttonUpdate; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QString::fromUtf8("Form")); + Form->resize(290, 508); + gridLayout = new QGridLayout(Form); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + labelIdentity = new QLabel(Form); + labelIdentity->setObjectName(QString::fromUtf8("labelIdentity")); + + gridLayout->addWidget(labelIdentity, 0, 0, 1, 2); + + listNames = new QListWidget(Form); + listNames->setObjectName(QString::fromUtf8("listNames")); + + gridLayout->addWidget(listNames, 1, 0, 3, 2); + + buttonDelete = new QPushButton(Form); + buttonDelete->setObjectName(QString::fromUtf8("buttonDelete")); + + gridLayout->addWidget(buttonDelete, 3, 2, 1, 1); + + buttonRename = new QPushButton(Form); + buttonRename->setObjectName(QString::fromUtf8("buttonRename")); + + gridLayout->addWidget(buttonRename, 2, 2, 1, 1); + + editCode = new QPlainTextEdit(Form); + editCode->setObjectName(QString::fromUtf8("editCode")); + editCode->setLineWrapMode(QPlainTextEdit::NoWrap); + + gridLayout->addWidget(editCode, 5, 0, 1, 3); + + buttonClear = new QPushButton(Form); + buttonClear->setObjectName(QString::fromUtf8("buttonClear")); + + gridLayout->addWidget(buttonClear, 6, 0, 1, 1); + + labelSnippets = new QLabel(Form); + labelSnippets->setObjectName(QString::fromUtf8("labelSnippets")); + + gridLayout->addWidget(labelSnippets, 4, 0, 1, 2); + + buttonGetSel = new QPushButton(Form); + buttonGetSel->setObjectName(QString::fromUtf8("buttonGetSel")); + + gridLayout->addWidget(buttonGetSel, 6, 1, 1, 1); + + buttonNew = new QPushButton(Form); + buttonNew->setObjectName(QString::fromUtf8("buttonNew")); + + gridLayout->addWidget(buttonNew, 1, 2, 1, 1); + + buttonUpdate = new QPushButton(Form); + buttonUpdate->setObjectName(QString::fromUtf8("buttonUpdate")); + + gridLayout->addWidget(buttonUpdate, 6, 2, 1, 1); + + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8)); + labelIdentity->setText(QApplication::translate("Form", "Identity", 0, QApplication::UnicodeUTF8)); + buttonDelete->setText(QApplication::translate("Form", "Delete", 0, QApplication::UnicodeUTF8)); + buttonRename->setText(QApplication::translate("Form", "Rename", 0, QApplication::UnicodeUTF8)); + buttonClear->setText(QApplication::translate("Form", "Clear", 0, QApplication::UnicodeUTF8)); + labelSnippets->setText(QApplication::translate("Form", "Code Snippet", 0, QApplication::UnicodeUTF8)); + buttonGetSel->setText(QApplication::translate("Form", "Get Selection", 0, QApplication::UnicodeUTF8)); + buttonNew->setText(QApplication::translate("Form", "Add New", 0, QApplication::UnicodeUTF8)); + buttonUpdate->setText(QApplication::translate("Form", "Update", 0, QApplication::UnicodeUTF8)); + Q_UNUSED(Form); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // SKELETONS_H diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 90197bf9e6..8bab60b1fb 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -157,6 +157,7 @@ QPalette.qth QPen.qth QPicture.qth QPixmap.qth +QPlainTextDocumentLayout.qth QPlainTextEdit.qth QPoint.qth QPointF.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 5983c4e6e2..84bec2ec9c 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -234,6 +234,7 @@ extern void * hbqt_pPtrFromItem( PHB_ITEM pObj ); #define hbqt_par_QPen( n ) ( ( QPen * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPicture( n ) ( ( QPicture * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPixmap( n ) ( ( QPixmap * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QPlainTextDocumentLayout( n ) ( ( QPlainTextDocumentLayout * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPlainTextEdit( n ) ( ( QPlainTextEdit * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPoint( n ) ( ( QPoint * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPointF( n ) ( ( QPointF * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_garbage.h b/harbour/contrib/hbqt/hbqt_garbage.h index 224808db51..5f3f7fea8e 100644 --- a/harbour/contrib/hbqt/hbqt_garbage.h +++ b/harbour/contrib/hbqt/hbqt_garbage.h @@ -150,6 +150,7 @@ extern QT_G_FUNC( hbqt_gcRelease_QPalette ); extern QT_G_FUNC( hbqt_gcRelease_QPen ); extern QT_G_FUNC( hbqt_gcRelease_QPicture ); extern QT_G_FUNC( hbqt_gcRelease_QPixmap ); +extern QT_G_FUNC( hbqt_gcRelease_QPlainTextDocumentLayout ); extern QT_G_FUNC( hbqt_gcRelease_QPlainTextEdit ); extern QT_G_FUNC( hbqt_gcRelease_QPoint ); extern QT_G_FUNC( hbqt_gcRelease_QPointF ); @@ -186,6 +187,7 @@ extern QT_G_FUNC( hbqt_gcRelease_QSpacerItem ); extern QT_G_FUNC( hbqt_gcRelease_QSpinBox ); extern QT_G_FUNC( hbqt_gcRelease_QSplashScreen ); extern QT_G_FUNC( hbqt_gcRelease_QSplitter ); +extern QT_G_FUNC( hbqt_gcRelease_QStackedWidget ); extern QT_G_FUNC( hbqt_gcRelease_QStandardItem ); extern QT_G_FUNC( hbqt_gcRelease_QStandardItemModel ); extern QT_G_FUNC( hbqt_gcRelease_QStatusBar ); @@ -295,7 +297,7 @@ extern QT_G_FUNC( hbqt_gcRelease_QWizardPage ); extern void * hbqt_gcAllocate_HBDbfModel( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_HBEvents( void * pObj, bool bNew ); -extern void * hbqt_gcAllocate_HbQMainWindow( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_HBQMainWindow( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_HBQPlainTextEdit( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_HBQSyntaxHighlighter( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_HBQTableView( void * pObj, bool bNew ); @@ -435,6 +437,7 @@ extern void * hbqt_gcAllocate_QPalette( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPen( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPicture( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPixmap( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPlainTextDocumentLayout( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPlainTextEdit( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPoint( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QPointF( void * pObj, bool bNew ); @@ -471,6 +474,7 @@ extern void * hbqt_gcAllocate_QSpacerItem( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QSpinBox( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QSplashScreen( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QSplitter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStackedWidget( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QStandardItem( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QStandardItemModel( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QStatusBar( void * pObj, bool bNew ); diff --git a/harbour/contrib/hbqt/hbqt_hbslots.cpp b/harbour/contrib/hbqt/hbqt_hbslots.cpp index f853f6ddd8..816c3be13c 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.cpp +++ b/harbour/contrib/hbqt/hbqt_hbslots.cpp @@ -113,6 +113,18 @@ static bool connect_signal( QString signal, QObject * object, HBSlots * t_slots else if( signal == ( QString ) "itemExpanded(QTWItem)" ) ret = object->connect( object, SIGNAL( itemExpanded( QTreeWidgetItem * ) ), t_slots, SLOT( itemExpanded( QTreeWidgetItem * ) ), Qt::AutoConnection ); else if( signal == ( QString ) "itemPressed(QTWItem)" ) ret = object->connect( object, SIGNAL( itemPressed( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemPressed( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); else if( signal == ( QString ) "itemSelectionChanged()" ) ret = object->connect( object, SIGNAL( itemSelectionChanged() ), t_slots, SLOT( itemSelectionChanged() ), Qt::AutoConnection ); + #if 0 + /* QListViewWidget */ + else if( signal == ( QString ) "currentItemChanged(QLWItem)" ) ret = object->connect( object, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), t_slots, SLOT( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemActivated(QLWItem)" ) ret = object->connect( object, SIGNAL( itemActivated( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemActivated( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemChanged(QLWItem)" ) ret = object->connect( object, SIGNAL( itemChanged( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemChanged( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemClicked(QLWItem)" ) ret = object->connect( object, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemClicked( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemCollapsed(QLWItem)" ) ret = object->connect( object, SIGNAL( itemCollapsed( QTreeWidgetItem * ) ), t_slots, SLOT( itemCollapsed( QTreeWidgetItem * ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemDoubleClicked(QLWItem)" ) ret = object->connect( object, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemDoubleClicked( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemEntered(QLWItem)" ) ret = object->connect( object, SIGNAL( itemEntered( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemEntered( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemExpanded(QLWItem)" ) ret = object->connect( object, SIGNAL( itemExpanded( QTreeWidgetItem * ) ), t_slots, SLOT( itemExpanded( QTreeWidgetItem * ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "itemPressed(QLWItem)" ) ret = object->connect( object, SIGNAL( itemPressed( QTreeWidgetItem *, int ) ), t_slots, SLOT( itemPressed( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + #endif /* QDialog (s) QFontDialog, QFileDialog */ else if( signal == ( QString ) "currentFontChanged(QFont)" ) ret = object->connect( object, SIGNAL( currentFontChanged( const QFont & ) ), t_slots, SLOT( currentFontChanged( const QFont & ) ), Qt::AutoConnection ); else if( signal == ( QString ) "fontSelected(QFont)" ) ret = object->connect( object, SIGNAL( fontSelected( const QFont & ) ), t_slots, SLOT( fontSelected( const QFont & ) ), Qt::AutoConnection ); diff --git a/harbour/contrib/hbqt/qtgui/QPlainTextDocumentLayout.cpp b/harbour/contrib/hbqt/qtgui/QPlainTextDocumentLayout.cpp new file mode 100644 index 0000000000..633a06610b --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QPlainTextDocumentLayout.cpp @@ -0,0 +1,183 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include + + +/* + * QPlainTextDocumentLayout ( QTextDocument * document ) + * ~QPlainTextDocumentLayout () + */ + +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QPlainTextDocumentLayout > pq; +} QGC_POINTER_QPlainTextDocumentLayout; + +QT_G_FUNC( hbqt_gcRelease_QPlainTextDocumentLayout ) +{ + QGC_POINTER_QPlainTextDocumentLayout * p = ( QGC_POINTER_QPlainTextDocumentLayout * ) Cargo; + + if( p && p->bNew ) + { + if( p->ph && p->pq ) + { + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) + { + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPlainTextDocumentLayout /.\\ ph=%p pq=%p", p->ph, (void *)(p->pq) ) ); + delete ( ( QPlainTextDocumentLayout * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPlainTextDocumentLayout \\./ ph=%p pq=%p", p->ph, (void *)(p->pq) ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPlainTextDocumentLayoutph=%p pq=%p", p->ph, (void *)(p->pq) ) ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPlainTextDocumentLayout : Object already deleted!" ) ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPlainTextDocumentLayout : Object not created with new()" ) ); + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_QPlainTextDocumentLayout( void * pObj, bool bNew ) +{ + QGC_POINTER_QPlainTextDocumentLayout * p = ( QGC_POINTER_QPlainTextDocumentLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QPlainTextDocumentLayout ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QPlainTextDocumentLayout; + + if( bNew ) + { + new( & p->pq ) QPointer< QPlainTextDocumentLayout >( ( QPlainTextDocumentLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPlainTextDocumentLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT ) +{ + void * pObj = NULL; + + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + pObj = new QPlainTextDocumentLayout( hbqt_par_QTextDocument( 1 ) ) ; + } + + hb_retptrGC( hbqt_gcAllocate_QPlainTextDocumentLayout( pObj, true ) ); +} + +/* + * int cursorWidth () const + */ +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT_CURSORWIDTH ) +{ + hb_retni( hbqt_par_QPlainTextDocumentLayout( 1 )->cursorWidth() ); +} + +/* + * void ensureBlockLayout ( const QTextBlock & block ) const + */ +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT_ENSUREBLOCKLAYOUT ) +{ + hbqt_par_QPlainTextDocumentLayout( 1 )->ensureBlockLayout( *hbqt_par_QTextBlock( 2 ) ); +} + +/* + * void requestUpdate () + */ +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT_REQUESTUPDATE ) +{ + hbqt_par_QPlainTextDocumentLayout( 1 )->requestUpdate(); +} + +/* + * void setCursorWidth ( int width ) + */ +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT_SETCURSORWIDTH ) +{ + hbqt_par_QPlainTextDocumentLayout( 1 )->setCursorWidth( hb_parni( 2 ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/TQPlainTextDocumentLayout.prg b/harbour/contrib/hbqt/qtgui/TQPlainTextDocumentLayout.prg new file mode 100644 index 0000000000..65a2330435 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQPlainTextDocumentLayout.prg @@ -0,0 +1,101 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QPlainTextDocumentLayout INHERIT HbQtObjectHandler, QAbstractTextDocumentLayout + + METHOD new( ... ) + + METHOD cursorWidth() + METHOD ensureBlockLayout( pBlock ) + METHOD requestUpdate() + METHOD setCursorWidth( nWidth ) + + ENDCLASS + + +METHOD QPlainTextDocumentLayout:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QPlainTextDocumentLayout( ... ) + RETURN Self + + +METHOD QPlainTextDocumentLayout:cursorWidth() + RETURN Qt_QPlainTextDocumentLayout_cursorWidth( ::pPtr ) + + +METHOD QPlainTextDocumentLayout:ensureBlockLayout( pBlock ) + RETURN Qt_QPlainTextDocumentLayout_ensureBlockLayout( ::pPtr, hbqt_ptr( pBlock ) ) + + +METHOD QPlainTextDocumentLayout:requestUpdate() + RETURN Qt_QPlainTextDocumentLayout_requestUpdate( ::pPtr ) + + +METHOD QPlainTextDocumentLayout:setCursorWidth( nWidth ) + RETURN Qt_QPlainTextDocumentLayout_setCursorWidth( ::pPtr, nWidth ) + diff --git a/harbour/contrib/hbqt/qtgui/filelist.mk b/harbour/contrib/hbqt/qtgui/filelist.mk index eef3b0b03a..b1e1c609e4 100644 --- a/harbour/contrib/hbqt/qtgui/filelist.mk +++ b/harbour/contrib/hbqt/qtgui/filelist.mk @@ -116,6 +116,7 @@ CPP_SOURCES := \ QPen.cpp \ QPicture.cpp \ QPixmap.cpp \ + QPlainTextDocumentLayout.cpp \ QPlainTextEdit.cpp \ QPolygon.cpp \ QPolygonF.cpp \ @@ -336,6 +337,7 @@ PRG_SOURCES := \ TQPen.prg \ TQPicture.prg \ TQPixmap.prg \ + TQPlainTextDocumentLayout.prg \ TQPlainTextEdit.prg \ TQPolygon.prg \ TQPolygonF.prg \ diff --git a/harbour/contrib/hbqt/qth/QPlainTextDocumentLayout.qth b/harbour/contrib/hbqt/qth/QPlainTextDocumentLayout.qth new file mode 100644 index 0000000000..df6f04c1d7 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QPlainTextDocumentLayout.qth @@ -0,0 +1,101 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = +Inherits = QAbstractTextDocumentLayout +Type = +New = + + + +#include + + +/* + * QPlainTextDocumentLayout ( QTextDocument * document ) + * ~QPlainTextDocumentLayout () + */ +HB_FUNC( QT_QPLAINTEXTDOCUMENTLAYOUT ) +{ + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + hb_retptr( new QPlainTextDocumentLayout( hbqt_par_QTextDocument( 1 ) ) ); + } +} + + + + + + +int cursorWidth () const +void ensureBlockLayout ( const QTextBlock & block ) const +void requestUpdate () +void setCursorWidth ( int width ) + + + + + + + + + + + + +