2010-01-11 16:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/hbide.ch
  * contrib/hbide/hbide.prg
  * contrib/hbide/ideactions.prg
  * contrib/hbide/ideeditor.prg
  * contrib/hbide/idefindreplace.prg
  * contrib/hbide/ideobject.prg
  * contrib/hbide/ideprojmanager.prg
  * contrib/hbide/idesources.prg
    + Implemented various actions on current editing window 
      honoring splitted windows indivisually, i.e., Find/Replace,
      Goto, Function activated via Function List, etc., etc.
      Though I have attempted resonable debugging but still
      for sure I must have left undesirable, please report.

    + Thoroughly overhauled "Editor Tab" management, more elegant
      and encapsulated.
This commit is contained in:
Pritpal Bedi
2010-01-13 01:02:57 +00:00
parent f28e124cab
commit 91b1c271f5
9 changed files with 255 additions and 225 deletions

View File

@@ -17,6 +17,24 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-11 16:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.ch
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/idefindreplace.prg
* contrib/hbide/ideobject.prg
* contrib/hbide/ideprojmanager.prg
* contrib/hbide/idesources.prg
+ Implemented various actions on current editing window
honoring splitted windows indivisually, i.e., Find/Replace,
Goto, Function activated via Function List, etc., etc.
Though I have attempted resonable debugging but still
for sure I must have left undesirable, please report.
+ Thoroughly overhauled "Editor Tab" management, more elegant
and encapsulated.
2010-01-12 19:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbsqlit3/hbsqlit3.c
* contrib/hbfimage/fi_wrp.c

View File

@@ -133,12 +133,7 @@
#define SB_PNL_PROJECT 13
#define TAB_OTAB 1
#define TAB_QEDIT 2
#define TAB_QHILIGHTER 3
#define TAB_QLAYOUT 4
#define TAB_SOURCEFILE 5
#define TAB_QDOCUMENT 6
#define TAB_OEDITOR 7
#define TAB_OEDITOR 2
#define TRE_OITEM 1
#define TRE_TYPE 2 // Path | Source File | Project | Opened File

View File

@@ -135,10 +135,9 @@ CLASS HbIde
DATA qTabWidget
DATA qFindDlg
ACCESS oCurEditor INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), TAB_OEDITOR ], NIL )
ACCESS qCurEdit INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), TAB_QEDIT ], NIL )
ACCESS qCurDocument INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), TAB_QDOCUMENT ], NIL )
ACCESS qCurCursor INLINE ::getCurCursor()
ACCESS oCurEditor INLINE ::oEM:getEditorCurrent()
ACCESS qCurEdit INLINE ::oEM:getEditCurrent()
ACCESS qCurDocument INLINE ::oEM:getDocumentCurrent()
DATA qCursor
DATA qFontWrkProject
@@ -223,8 +222,6 @@ CLASS HbIde
METHOD updateProjectMenu()
METHOD updateProjectTree()
METHOD manageItemSelected()
METHOD getCurrentTab()
METHOD getCurCursor()
METHOD createTags()
METHOD manageFocusInEditor()
METHOD loadUI()
@@ -452,9 +449,9 @@ METHOD HbIde:execAction( cKey )
CASE cKey == "Open"
::oSM:openSource()
CASE cKey == "Save"
::oSM:saveSource( ::getCurrentTab(), .f., .f. )
::oSM:saveSource( ::oEM:getTabCurrent(), .f., .f. )
CASE cKey == "SaveAs"
::oSM:saveSource( ::getCurrentTab(), .t., .t. )
::oSM:saveSource( ::oEM:getTabCurrent(), .t., .t. )
CASE cKey == "SaveAll"
::oSM:saveAllSources()
CASE cKey == "SaveExit"
@@ -571,36 +568,16 @@ METHOD HbIde:setSizeByIni( qWidget, nPart )
/*----------------------------------------------------------------------*/
METHOD HbIde:manageFocusInEditor()
LOCAL qEdit
IF ::getCurrentTab() > 0
::aTabs[ ::getCurrentTab(), TAB_QEDIT ]:setFocus()
IF !empty( qEdit := ::oEM:getEditCurrent() )
qEdit:setFocus()
ENDIF
RETURN self
/*----------------------------------------------------------------------*/
METHOD HbIde:getCurCursor()
LOCAL iTab
IF ( iTab := ::getCurrentTab() ) > 0
::qCursor:configure( ::aTabs[ iTab, TAB_OTAB ]:textCutsor() )
ENDIF
RETURN ::qCursor
/*----------------------------------------------------------------------*/
METHOD HbIde:getCurrentTab()
LOCAL qTab, nTab
qTab := ::qTabWidget:currentWidget()
nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, qTab ) } )
RETURN nTab
/*----------------------------------------------------------------------*/
METHOD HbIde:updateProjectTree( aPrj, lRemove )
LOCAL cType, oParent, oP, aSrc, j, cProject, nPath
LOCAL aPath, aInUse, cPath, cFile, cExt, oPP, cPathA, nPos
@@ -780,7 +757,7 @@ METHOD HbIde:manageItemSelected( oXbpTreeItem )
/*----------------------------------------------------------------------*/
METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem )
LOCAL n, cHbi, aPrj, cSource
LOCAL n, cHbi, aPrj
LOCAL aPops := {}
HB_SYMBOL_UNUSED( mp2 )
@@ -830,16 +807,15 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem )
//
CASE ::aProjData[ n, TRE_TYPE ] == "Opened Source"
cSource := ::aProjData[ n, 5 ]
n := ascan( ::aTabs, {|e_| hbide_pathNormalized( e_[ 5 ] ) == cSource } )
n := ::oEM:getTabBySource( ::aProjData[ n, 5 ] )
//
aadd( aPops, { "Save" , {|| ::oSM:saveSource( n ) } } )
aadd( aPops, { "Save As" , {|| ::oSM:saveSource( n, , .t. ) } } )
aadd( aPops, { "Save" , {|| ::oSM:saveSource( n ) } } )
aadd( aPops, { "Save As" , {|| ::oSM:saveSource( n, , .t. ) } } )
aadd( aPops, { "" } )
aadd( aPops, { "Close" , {|| ::oSM:closeSource( n ) } } )
aadd( aPops, { "Close Others" , {|| ::oSM:closeAllOthers( n ) } } )
aadd( aPops, { "Close" , {|| ::oSM:closeSource( n ) } } )
aadd( aPops, { "Close Others" , {|| ::oSM:closeAllOthers( n ) } } )
aadd( aPops, { "" } )
aadd( aPops, { "Apply Theme" , {|| ::aTabs[ n, TAB_OEDITOR ]:applyTheme() } } )
aadd( aPops, { "Apply Theme" , {|| ::oEM:getEditorCurrent():applyTheme() } } )
//
hbide_ExecPopup( aPops, mp1, ::oProjTree:oWidget )
@@ -872,9 +848,9 @@ METHOD HbIde:gotoFunction( mp1, mp2, oListBox )
IF ( n := ascan( ::aTags, {|e_| mp2 == e_[ 7 ] } ) ) > 0
cAnchor := trim( ::aText[ ::aTags[ n,3 ] ] )
IF !empty( oEdit := ::oEM:getEditorCurrent() )
IF !( oEdit:qEdit:find( cAnchor, QTextDocument_FindCaseSensitively ) )
oEdit:qEdit:find( cAnchor, QTextDocument_FindBackward + QTextDocument_FindCaseSensitively )
IF !empty( oEdit := ::oEM:getEditCurrent() )
IF !( oEdit:find( cAnchor, QTextDocument_FindCaseSensitively ) )
oEdit:find( cAnchor, QTextDocument_FindBackward + QTextDocument_FindCaseSensitively )
ENDIF
ENDIF
ENDIF

View File

@@ -375,7 +375,7 @@ METHOD IdeActions:buildMainMenu()
oSubMenu2 := XbpMenu():new( oSubMenu ):create()
oSubMenu2:itemSelected := {| nIndex, cFile | cFile := oIde:aIni[ INI_RECENTFILES, nIndex ], ;
oIde:editSource( cFile ) }
oIde:oEM:editSource( cFile ) }
IF !empty( oIde:aIni[ INI_RECENTFILES ] )
FOR n := 1 TO Len( oIde:aIni[ INI_RECENTFILES ] )
f := hbide_pathNormalized( oIde:aIni[ INI_RECENTFILES, n ], .F. )

View File

@@ -66,13 +66,26 @@
#include "common.ch"
#include "hbclass.ch"
#include "hbqt.ch"
#include "hbide.ch"
/*----------------------------------------------------------------------*/
#define customContextMenuRequested 1
#define textChanged 2
#define copyAvailable 3
#define modificationChanged 4
#define redoAvailable 5
#define selectionChanged 6
#define undoAvailable 7
#define updateRequest 8
#define cursorPositionChanged 9
#define blockCountChanged 21
#define contentsChanged 22
/*----------------------------------------------------------------------*/
CLASS IdeEditsManager INHERIT IdeObject
DATA qContextMenu
@@ -108,6 +121,13 @@ CLASS IdeEditsManager INHERIT IdeObject
METHOD setSourceVisible()
METHOD setSourceVisibleByIndex()
METHOD getDocumentCurrent()
METHOD getTabCurrent()
METHOD getTabBySource()
METHOD getEditCurrent()
METHOD getEditorCurrent()
METHOD getEditorBySource()
METHOD getEditorByTabPosition()
@@ -118,7 +138,6 @@ CLASS IdeEditsManager INHERIT IdeObject
METHOD exeBlock()
METHOD addSourceInTree()
METHOD removeSourceInTree()
METHOD splitEdit()
ENDCLASS
@@ -158,9 +177,10 @@ METHOD IdeEditsManager:create( oIde )
oSub := QMenu():configure( ::qContextMenu:addMenu_1( "Split" ) )
//
aadd( ::aActions, { "Split H" , oSub:addAction( "Split Horiz..." ) } )
aadd( ::aActions, { "Split V" , oSub:addAction( "Split Verti..." ) } )
aadd( ::aActions, { "Close Split" , oSub:addAction( "Close Split" ) } )
aadd( ::aActions, { "Split H" , oSub:addAction( "Split Horizontally" ) } )
aadd( ::aActions, { "Split V" , oSub:addAction( "Split Vertically" ) } )
aadd( ::aActions, { "" , oSub:addSeparator() } )
aadd( ::aActions, { "Close Split" , oSub:addAction( "Close Split Window" ) } )
RETURN Self
@@ -237,22 +257,10 @@ METHOD IdeEditsManager:exeBlock( nMode, p )
CASE nMode == 3
ENDCASE
RETURN Nil
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:splitEdit()
LOCAL oEdit
IF !empty( oEdit := ::getEditorCurrent() )
oEdit:split()
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme )
aadd( ::aEdits, IdeEditor():new():create( ::oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) )
@@ -261,6 +269,52 @@ METHOD IdeEditsManager:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme )
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:getTabBySource( cSource )
cSource := hbide_pathNormalized( cSource, .t. )
RETURN ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ]:pathNormalized == cSource } )
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:getTabCurrent()
LOCAL qTab, nTab
qTab := ::qTabWidget:currentWidget()
nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ TAB_OTAB ]:oWidget:pPtr, qTab ) } )
RETURN nTab
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:getDocumentCurrent()
LOCAL qTab, nTab
IF ::qTabWidget:count() > 0
qTab := ::qTabWidget:currentWidget()
IF ( nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ TAB_OTAB ]:oWidget:pPtr, qTab ) } ) ) > 0
RETURN QTextDocument():configure( ::aTabs[ nTab, TAB_OEDITOR ]:document() )
ENDIF
ENDIF
RETURN Nil
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:getEditCurrent()
LOCAL qTab, nTab
IF ::qTabWidget:count() > 0
qTab := ::qTabWidget:currentWidget()
IF ( nTab := ascan( ::aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ TAB_OTAB ]:oWidget:pPtr, qTab ) } ) ) > 0
RETURN ::aTabs[ nTab, TAB_OEDITOR ]:qCurEditSplit
ENDIF
ENDIF
RETURN Nil
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:getEditorCurrent()
LOCAL qTab, nTab
@@ -562,20 +616,20 @@ METHOD IdeEditsManager:paintRequested( pPrinter )
/*----------------------------------------------------------------------*/
METHOD IdeEditsManager:goto()
LOCAL qGo, nLine, qCursor
LOCAL qGo, nLine, qCursor, oEdit
IF empty( ::qCurEdit )
IF empty( oEdit := ::oEM:getEditCurrent() )
RETURN Self
ENDIF
qCursor := QTextCursor():configure( ::qCurEdit:textCursor() )
qCursor := QTextCursor():configure( oEdit:textCursor() )
nLine := qCursor:blockNumber()
qGo := QInputDialog():new( ::oDlg:oWidget )
qGo:setIntMinimum( 1 )
qGo:setIntMaximum( ::qCurDocument:blockCount() )
qGo:setIntMaximum( oEdit:blockCount() )
qGo:setIntValue( nLine + 1 )
qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( ::qCurDocument:blockCount() ) + "]" )
qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( oEdit:blockCount() ) + "]" )
qGo:setWindowTitle( "Harbour-Qt" )
::setPosByIni( qGo, GotoDialogGeometry )
@@ -591,7 +645,7 @@ METHOD IdeEditsManager:goto()
ELSEIF nLine > 0
qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine - 1 )
ENDIF
::qCurEdit:setTextCursor( qCursor )
oEdit:setTextCursor( qCursor )
RETURN nLine
@@ -665,10 +719,12 @@ CLASS IdeEditor INHERIT IdeObject
DATA nVPos INIT 0
DATA nID
DATA aTab INIT {}
// DATA aTab INIT {}
DATA qCursor
DATA aSplits INIT {}
DATA qCurEditSplit
METHOD new()
METHOD create()
METHOD destroy()
@@ -677,7 +733,6 @@ CLASS IdeEditor INHERIT IdeObject
METHOD buildEditor()
METHOD removeTabPage()
METHOD activateTab()
METHOD closeTab()
METHOD dispEditInfo()
METHOD setTabImage()
METHOD applyTheme()
@@ -710,6 +765,109 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:buildEditor( nMode )
LOCAL qEdit
qEdit := QPlainTextEdit():new()
//
qEdit:setLineWrapMode( QTextEdit_NoWrap )
qEdit:setFont( ::oFont:oWidget )
qEdit:ensureCursorVisible()
qEdit:setContextMenuPolicy( Qt_CustomContextMenu )
qEdit:setProperty( "SPLITTED", QVariant():new( iif( nMode == 0, "NO", "YES" ) ) )
::connect( qEdit, "customContextMenuRequested(QPoint)", {|o,p | ::exeBlock( 1, o, p ) } )
::Connect( qEdit, "textChanged()" , {|o | ::exeBlock( 2, o ) } )
::Connect( qEdit, "copyAvailable(bool)" , {|o,p | ::exeBlock( 3, o, p ) } )
::Connect( qEdit, "modificationChanged(bool)" , {|o,p | ::exeBlock( 4, o, p ) } )
::Connect( qEdit, "redoAvailable(bool)" , {|o,p | ::exeBlock( 5, o, p ) } )
::Connect( qEdit, "selectionChanged()" , {|o,p | ::exeBlock( 6, o, p ) } )
::Connect( qEdit, "undoAvailable(bool)" , {|o,p | ::exeBlock( 7, o, p ) } )
::Connect( qEdit, "updateRequest(QRect,int)" , {|o,p,p1| ::exeBlock( 8, o, p, p1 ) } )
::Connect( qEdit, "cursorPositionChanged()" , {|o | ::exeBlock( 9, o ) } )
RETURN qEdit
/*----------------------------------------------------------------------*/
METHOD IdeEditor:exeBlock( nMode, o, p, p1 )
LOCAL pAct, qAct, n, qEdit
//LOCAL qRect
HB_SYMBOL_UNUSED( p1 )
IF nMode <= 9
qEdit := QPlainTextEdit():configure( o )
ENDIF
SWITCH nMode
/* QPlainTextEdit */
CASE customContextMenuRequested
IF !empty( pAct := ::oEM:qContextMenu:exec_1( qEdit:mapToGlobal( p ) ) )
qAct := QAction():configure( pAct )
DO CASE
CASE qAct:text() == "Split Horizontally"
::split( 1, qEdit )
CASE qAct:text() == "Split Vertically"
::split( 2, qEdit )
CASE qAct:text() == "Close Split Window"
IF ( n := ascan( ::aSplits, {|oo| hbqt_IsEqualGcQtPointer( oo:pPtr, o ) } ) ) > 0
::qLayout:removeWidget( qEdit )
::aSplits[ n ]:close()
::aSplits[ n ]:pPtr := 0
qEdit:pPtr := 0
hb_adel( ::aSplits, n, .t. )
ENDIF
CASE qAct:text() == "Apply Theme"
::applyTheme()
ENDCASE
ENDIF
EXIT
CASE textChanged
::setTabImage( qEdit )
EXIT
CASE copyAvailable
hbide_dbg( "copyAvailable(bool)" )
EXIT
CASE modificationChanged
hbide_dbg( "modificationChanged(bool)" )
EXIT
CASE redoAvailable
hbide_dbg( "redoAvailable(bool)" )
EXIT
CASE selectionChanged
::qCurEditSplit := qEdit
hbide_dbg( "selectionChanged()" )
EXIT
CASE undoAvailable
hbide_dbg( "undoAvailable(bool)" )
EXIT
CASE updateRequest
//qRect := QRect():configure( p )
//hbide_dbg( "updateRequest(QRect,int)", qRect:x(), qRect:y(), qRect:width(), qRect:height(), p1 )
EXIT
CASE cursorPositionChanged
::dispEditInfo( qEdit )
EXIT
/* QTextDocument */
CASE blockCountChanged
::nBlock := QTextDocument():configure( o ):blockCount()
EXIT
CASE contentsChanged
hbide_dbg( "contentsChanged()" )
EXIT
OTHERWISE
EXIT
ENDSWITCH
RETURN Nil
/*----------------------------------------------------------------------*/
METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
DEFAULT oIde TO ::oIde
@@ -735,11 +893,13 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::buildTabPage( ::sourceFile )
::qEdit := ::buildEditor( 0 ) /* Main Editor */
//
::qCurEditSplit := ::qEdit
::qDocument := QTextDocument():configure( ::qEdit:document() )
//
::Connect( ::qDocument, "blockCountChanged(int)" , {|o,p | ::exeBlock( 21, p, o ) } )
::Connect( ::qDocument, "contentsChanged()" , {| | ::exeBlock( 22 ) } )
::Connect( ::qDocument, "blockCountChanged(int)", {|o,p| ::exeBlock( 21, o, p ) } )
::Connect( ::qDocument, "contentsChanged()" , {|o | ::exeBlock( 22, o ) } )
::qLayout := QGridLayout():new()
::qLayout:setContentsMargins( 0,0,0,0 )
@@ -758,8 +918,9 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme )
::qCursor := QTextCursor():configure( ::qEdit:textCursor() )
/* Populate Tabs Array */
::aTab := { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self }
aadd( ::aTabs, ::aTab )
// ::aTab := { ::oTab, ::qEdit, ::qHiliter, ::qLayout, ::sourceFile, ::qDocument, Self }
// aadd( ::aTabs, ::aTab )
aadd( ::aTabs, { ::oTab, Self } )
::oIde:nCurTab := len( ::oIde:aTabs )
@@ -781,7 +942,7 @@ METHOD IdeEditor:split( nMode, qEditP )
nRows := ::qLayout:rowCount()
nCols := ::qlayout:columnCount()
qEdit := ::buildEditor()
qEdit := ::buildEditor( 1 ) /* Split Window */
IF nMode == 1 /* Horizontal */
::qLayout:addWidget( qEdit, nRows - 1, nCols )
ELSEIF nMode == 2 /* Vertical */
@@ -798,106 +959,6 @@ METHOD IdeEditor:split( nMode, qEditP )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:buildEditor()
LOCAL qEdit
qEdit := QPlainTextEdit():new()
qEdit:setLineWrapMode( QTextEdit_NoWrap )
qEdit:setFont( ::oFont:oWidget )
qEdit:ensureCursorVisible()
qEdit:setContextMenuPolicy( Qt_CustomContextMenu )
::connect( qEdit, "customContextMenuRequested(QPoint)", {|o,p| ::exeBlock( 1, p, o, qEdit ) } )
::Connect( qEdit, "textChanged()" , {| | ::setTabImage() } )
::Connect( qEdit, "cursorPositionChanged()" , {| | ::dispEditInfo( qEdit ) } )
::Connect( qEdit, "updateRequest(QRect,int)" , {|o,p,p1| ::exeBlock( 8, p, p1, o ) } )
::Connect( qEdit, "copyAvailable(bool)" , {|o,p | ::exeBlock( 3, p, o ) } )
::Connect( qEdit, "modificationChanged(bool)", {|o,p | ::exeBlock( 4, p, o ) } )
::Connect( qEdit, "redoAvailable(bool)" , {|o,p | ::exeBlock( 5, p, o ) } )
::Connect( qEdit, "selectionChanged()" , {|o,p | ::exeBlock( 6, p, o ) } )
::Connect( qEdit, "undoAvailable(bool)" , {|o,p | ::exeBlock( 7, p, o ) } )
::Connect( qEdit, "updateRequest(QRect,int)" , {|o,p,p1| ::exeBlock( 8, p, p1, o ) } )
RETURN qEdit
/*----------------------------------------------------------------------*/
METHOD IdeEditor:exeBlock( nMode, p, p1, qEdit )
LOCAL pAct, qAct, n
//LOCAL qRect
HB_SYMBOL_UNUSED( p )
HB_SYMBOL_UNUSED( p1 )
SWITCH nMode
/* QPlainTextEdit */
CASE 1 // "customContextMenuRequested(QPoint)"
IF !empty( pAct := ::oEM:qContextMenu:exec_1( qEdit:mapToGlobal( p ) ) )
qAct := QAction():configure( pAct )
DO CASE
CASE qAct:text() == "Split Horiz..."
::split( 1, qEdit )
CASE qAct:text() == "Split Verti..."
::split( 2, qEdit )
CASE qAct:text() == "Close Split"
IF ( n := ascan( ::aSplits, {|o| o == qEdit } ) ) > 0
::qLayout:removeWidget( qEdit )
hb_adel( ::aSplits, n, .t. )
qEdit:close()
qEdit:pPtr := 0
ENDIF
CASE qAct:text() == "Apply Theme"
::applyTheme()
ENDCASE
ENDIF
EXIT
CASE 2
EXIT
CASE 3 // "copyAvailable(bool)"
hbide_dbg( "copyAvailable(bool)" )
EXIT
CASE 4 // "modificationChanged(bool)"
hbide_dbg( "modificationChanged(bool)" )
EXIT
CASE 5 // "redoAvailable(bool)"
hbide_dbg( "redoAvailable(bool)" )
EXIT
CASE 6 // "selectionChanged()"
hbide_dbg( "selectionChanged()" )
EXIT
CASE 7 // "undoAvailable(bool)"
hbide_dbg( "undoAvailable(bool)" )
EXIT
CASE 8 // "updateRequest(QRect,int)"
//qRect := QRect():configure( p )
//hbide_dbg( "updateRequest(QRect,int)", qRect:x(), qRect:y(), qRect:width(), qRect:height(), p1 )
EXIT
/* QTabPage */
CASE 11 // QEvent_ContextMenu
hbide_dbg( "QEvent_ContextMenu" )
EXIT
CASE 12 // QEvent_ContextMenu
hbide_dbg( "QEvent_ContextMenu" )
EXIT
/* QTextDocument */
CASE 21 // "blockCountChanged(int)"
::nBlock := QTextCursor():configure( ::qEdit:textCursor() ):blockNumber()
EXIT
CASE 22 // "contentsChanged()"
hbide_dbg( "contentsChanged()" )
EXIT
ENDSWITCH
RETURN Nil
/*----------------------------------------------------------------------*/
METHOD IdeEditor:setDocumentProperties()
LOCAL qCursor
@@ -968,28 +1029,6 @@ METHOD IdeEditor:buildTabPage( cSource )
::qTabWidget:setTabTooltip( ::qTabWidget:indexOf( ::oTab:oWidget ), cSource )
::oTab:tabActivate := {|mp1,mp2,oXbp| ::activateTab( mp1, mp2, oXbp ) }
::oTab:closeRequested := {|mp1,mp2,oXbp| ::closeTab( mp1, mp2, oXbp ) }
::oTab:oWidget:setContextMenuPolicy( Qt_CustomContextMenu )
::connect( ::oTab:oWidget, "customContextMenuRequested(QPoint)", {|o,e| ::exeBlock( 11, e, o ) } )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD IdeEditor:closeTab( mp1, mp2, oXbp )
IF PCount() == 00
mp1 := ::nID
mp2 := ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ]:nID == mp1 } )
ELSE
mp2 := ascan( ::aTabs, {|e_| e_[ TAB_OTAB ] == oXbp } )
ENDIF
* Requested tab exists?
IF !Empty( mp2 )
::oSM:closeSource( mp2 )
ENDIF
RETURN Self
@@ -1013,7 +1052,7 @@ METHOD IdeEditor:removeTabPage()
NEXT
::aSplits := {}
n := aScan( ::oIde:aTabs, {|e_| e_[ TAB_OEDITOR ]:nID == ::nID } )
n := aScan( ::aTabs, {|e_| e_[ TAB_OEDITOR ]:nID == ::nID } )
IF n > 0
hb_aDel( ::oIde:aTabs, n, .T. )
ENDIF
@@ -1093,11 +1132,14 @@ METHOD IdeEditor:dispEditInfo( qEdit )
/*----------------------------------------------------------------------*/
METHOD IdeEditor:setTabImage()
LOCAL nIndex := ::qTabWidget:indexOf( ::oTab:oWidget )
LOCAL lModified := ::qDocument:isModified()
LOCAL lReadOnly := ::qEdit:isReadOnly()
LOCAL cIcon
METHOD IdeEditor:setTabImage( qEdit )
LOCAL nIndex, lModified, lReadOnly, cIcon
HB_SYMBOL_UNUSED( qEdit )
nIndex := ::qTabWidget:indexOf( ::oTab:oWidget )
lModified := ::qDocument:isModified()
lReadOnly := ::qEdit:isReadOnly()
IF lModified
cIcon := "tabmodified.png"

View File

@@ -261,7 +261,8 @@ METHOD IdeFindReplace:find( lWarn )
nFlags += iif( ::oUI:q_checkMatchCase:isChecked(), QTextDocument_FindCaseSensitively, 0 )
nFlags += iif( ::oUI:q_radioUp:isChecked(), QTextDocument_FindBackward, 0 )
IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn
//IF !( lFound := ::qCurEdit:find( cText, nFlags ) ) .and. lWarn
IF !( lFound := ::oEM:getEditCurrent():find( cText, nFlags ) ) .and. lWarn
hbide_showWarning( "Cannot find : " + cText )
ENDIF
ENDIF

View File

@@ -96,6 +96,7 @@ CLASS IdeObject
ACCESS oDA INLINE ::oIde:oDA
ACCESS qCurEdit INLINE ::oIde:qCurEdit
ACCESS qCurDocument INLINE ::oIde:qCurDocument
ACCESS oCurEditor INLINE ::oIde:oCurEditor
ACCESS qTabWidget INLINE ::oIde:oDA:oTabWidget:oWidget
ACCESS qBrushWrkProject INLINE ::oIde:qBrushWrkProject
@@ -137,8 +138,6 @@ CLASS IdeObject
DATA aEvents INIT {}
METHOD connect()
METHOD getCurrentTab( ... ) INLINE ::oIde:getCurrentTab( ... )
METHOD getCurCursor( ... ) INLINE ::oIde:getCurCursor( ... )
METHOD createTags( ... ) INLINE ::oIde:createTags( ... )
METHOD addSourceInTree( ... ) INLINE ::oIde:addSourceInTree( ... )
METHOD setPosAndSizeByIni( ... ) INLINE ::oIde:setPosAndSizeByIni( ... )

View File

@@ -897,7 +897,7 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt )
::lLaunch := lLaunch
::cProjectInProcess := cProject
IF ::lPPO .AND. ::oIde:getCurrentTab() == 0
IF ::lPPO .AND. empty( ::oEM:getEditCurrent() )
MsgBox( 'No source available to be compiled' )
RETURN Self
ENDIF
@@ -913,7 +913,6 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt )
::oProject := ::getProjectByTitle( cProject )
//cTargetFN := aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_LOCATION ] + ::pathSep + aPrj[ PRJ_PRP_PROPERTIES, 2, PRJ_PRP_OUTPUT ]
cTargetFN := hbide_pathToOSPath( ::oProject:location + ::pathSep + ;
iif( empty( ::oProject:outputName ), "_temp", ::oProject:outputName ) )
/*

View File

@@ -132,7 +132,7 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
LOCAL oEdit, lNew, cBuffer, qDocument, nIndex, cSource
LOCAL cFileToSave, cFile, cExt, cNewFile, oItem
DEFAULT nTab TO ::oIde:getCurrentTab()
DEFAULT nTab TO ::EM:getTabCurrent()
DEFAULT lAs TO .F.
lCancel := .F.
@@ -173,8 +173,7 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs )
hb_fNameSplit( cFileToSave, , @cFile, @cExt )
IF lNew
oEdit:aTab[ TAB_SOURCEFILE ] := cFileToSave
oEdit:sourceFile := cFileToSave
oEdit:sourceFile := cFileToSave
oEdit:oTab:Caption := cFile + cExt
@@ -249,7 +248,7 @@ METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lA
METHOD IdeSourcesManager:closeSource( nTab, lCanCancel, lCanceled )
LOCAL lSave, n, oEdit
DEFAULT nTab TO ::oIde:getCurrentTab()
DEFAULT nTab TO ::oEM:getTabCurrent()
IF !empty( oEdit := ::oEM:getEditorByTabPosition( nTab ) )
@@ -317,7 +316,7 @@ METHOD IdeSourcesManager:closeAllOthers( nTab )
LOCAL oEdit
LOCAL nID
DEFAULT nTab TO ::oIde:getCurrentTab()
DEFAULT nTab TO ::oEM:getTabCurrent()
IF empty( oEdit := ::oEM:getEditorByTabPosition( nTab ) )
RETURN .F.
@@ -380,25 +379,26 @@ METHOD IdeSourcesManager:saveAndExit()
* 02/01/2010 - 19:45:34
*/
METHOD IdeSourcesManager:revertSource( nTab )
LOCAL oEditor
DEFAULT nTab TO ::oIde:getCurrentTab()
DEFAULT nTab TO ::oEM:getTabCurrent()
IF nTab < 1
IF empty( oEditor := ::oEM:getEditorByTabPosition( nTab ) )
RETURN .F.
ENDIF
IF !::aTabs[ nTab, TAB_QDOCUMENT ]:isModified()
IF !( oEditor:qDocument:isModified() )
* File has not changed, ignore the question to User
ELSE
IF !hbide_getYesNo( 'Revert ' + ::aTabs[ nTab, TAB_OTAB ]:Caption + '?', ;
'The file ' + ::aTabs[ nTab, TAB_SOURCEFILE ] + ' has changed. '+;
IF !hbide_getYesNo( 'Revert ' + oEditor:oTab:Caption + '?', ;
'The file ' + oEditor:sourceFile + ' has changed. '+;
'Discard current changes and revert contents to the previously saved on disk?', 'Revert file?' )
RETURN Self
ENDIF
ENDIF
::aTabs[ nTab, TAB_QEDIT ]:setPlainText( hb_memoRead( ::aTabs[ nTab, TAB_SOURCEFILE ] ) )
::aTabs[ nTab, TAB_QEDIT ]:ensureCursorVisible()
oEditor:qEdit:setPlainText( hb_memoRead( oEditor:sourceFile ) )
oEditor:qEdit:ensureCursorVisible()
::manageFocusInEditor()
RETURN Self