From 7982bb7f0f4ed4ecfca4c90af81e5a1ac0691eef Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 30 Jun 2010 00:59:29 +0000 Subject: [PATCH] 2010-06-29 17:44 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/ideedit.prg * contrib/hbide/ideeditor.prg * contrib/hbide/idetools.prg % Minor fix in "buttonBrowse_clicked" event which was causing RTE when there was no other Tool defined. ! Fix to Ctrl+G which stopped working after keyboard macros synchronization few days back. ! Thumbnail window is closed if a source is closed. To activate it for another source you need to activate it again. However, switching over to another source, it stays as is. + Reimplemented: split behavior of current editing instance. Before it was done in fixed halved window plus split was available verically and horintally any level deep. This was neither appropriate nor desired behavior. Now split is presented in resizable window either horizontally or vertically. The behavior can be changed if all splitted windows are closed first and then again split is initiated. Above anomalies reported by Viktor, thanks. Please test and report back any fix is not upto mark. --- harbour/ChangeLog | 27 +++++ harbour/contrib/hbide/ideedit.prg | 36 ++++--- harbour/contrib/hbide/ideeditor.prg | 154 +++++++++++++--------------- harbour/contrib/hbide/idetools.prg | 2 +- 4 files changed, 120 insertions(+), 99 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5403196ffd..8078b104ab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,33 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-29 17:44 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/ideedit.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idetools.prg + % Minor fix in "buttonBrowse_clicked" event which was causing + RTE when there was no other Tool defined. + + ! Fix to Ctrl+G which stopped working after keyboard macros + synchronization few days back. + + ! Thumbnail window is closed if a source is closed. To + activate it for another source you need to activate it again. + However, switching over to another source, it stays as is. + + + Reimplemented: split behavior of current editing instance. + + Before it was done in fixed halved window plus split + was available verically and horintally any level deep. + This was neither appropriate nor desired behavior. + + Now split is presented in resizable window either horizontally + or vertically. The behavior can be changed if all splitted + windows are closed first and then again split is initiated. + + Above anomalies reported by Viktor, thanks. + Please test and report back any fix is not upto mark. + 2010-06-29 21:29 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/ideprojmanager.prg + Changed to not save hbide options with empty or diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 332b5248a7..61dcbc512e 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -95,7 +95,6 @@ CLASS IdeEdit INHERIT IdeObject DATA oEditor DATA qEdit - DATA qHLayout DATA nOrient INIT 0 DATA nMode INIT 0 @@ -264,7 +263,6 @@ METHOD IdeEdit:create( oIde, oEditor, nMode ) ::oIde := oIde ::oEditor := oEditor ::nMode := nMode - //::oIde := ::oEditor:oIde ::qEdit := HBQPlainTextEdit():new() // @@ -288,12 +286,6 @@ METHOD IdeEdit:create( oIde, oEditor, nMode ) ::qEdit:hbBookMarks( nBlock ) NEXT - ::qHLayout := QHBoxLayout():new() - ::qHLayout:setContentsMargins( 0,0,0,0 ) - ::qHLayout:setSpacing( 0 ) - - ::qHLayout:addWidget( ::qEdit ) - ::connectEditSignals( Self ) Qt_Events_Connect( ::pEvents, ::qEdit, QEvent_KeyPress , {|p| ::execKeyEvent( 101, QEvent_KeyPress, p ) } ) @@ -359,6 +351,9 @@ METHOD IdeEdit:setFont() METHOD IdeEdit:destroy() + ::oUpDn:oUI:setParent( ::oDlg:oWidget ) + ::oSourceThumbnailDock:oWidget:hide() + ::disconnect( ::qTimer, "timeout()" ) IF ::qTimer:isActive() ::qTimer:stop() @@ -373,11 +368,7 @@ METHOD IdeEdit:destroy() ::disconnectEditSignals( Self ) - ::oEditor:qLayout:removeItem( ::qHLayout ) - // - ::qHLayout:removeWidget( ::qEdit ) ::qEdit := NIL - ::qHLayout := NIL ::qFont := NIL RETURN Self @@ -448,10 +439,10 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::oEditor:split( 2, oEdit ) CASE qAct:text() == "Close Split Window" IF ( n := ascan( ::oEditor:aEdits, {|o| o == oEdit } ) ) > 0 /* 1 == Main Edit */ + ::oUpDn:oUI:setParent( ::oEditor:oEdit:qEdit ) oo := ::oEditor:aEdits[ n ] hb_adel( ::oEditor:aEdits, n, .t. ) oo:destroy() - ::oEditor:relay() ::oEditor:qCqEdit := ::oEditor:qEdit ::oEditor:qCoEdit := ::oEditor:oEdit ::oIde:manageFocusInEditor() @@ -1864,8 +1855,27 @@ METHOD IdeEdit:getWord( lSelect ) /*----------------------------------------------------------------------*/ METHOD IdeEdit:goto( nLine ) + LOCAL nRows, qGo LOCAL qCursor := QTextCursor():configure( ::qEdit:textCursor() ) + IF empty( nLine ) + nRows := ::qEdit:blockCount() + nLine := qCursor:blockNumber() + + qGo := QInputDialog():new( ::oDlg:oWidget ) + qGo:setInputMode( 1 ) + qGo:setIntMinimum( 1 ) + qGo:setIntMaximum( nRows ) + qGo:setIntValue( nLine + 1 ) + qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( nRows ) + "]" ) + qGo:setWindowTitle( "Harbour" ) + + ::oIde:setPosByIniEx( qGo, ::oINI:cGotoDialogGeometry ) + qGo:exec() + ::oIde:oINI:cGotoDialogGeometry := hbide_posAndSize( qGo ) + nLine := qGo:intValue() + ENDIF + qCursor:movePosition( QTextCursor_Start ) qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine - 1 ) ::qEdit:setTextCursor( qCursor ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 8cf3da5bc5..5fb33dfedc 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -882,7 +882,7 @@ METHOD IdeEditsManager:zoom( nKey ) RETURN Self /*----------------------------------------------------------------------*/ -//// + METHOD IdeEditsManager:printPreview() LOCAL oEdit IF !empty( oEdit := ::getEditObjectCurrent() ) @@ -928,35 +928,12 @@ METHOD IdeEditsManager:gotoMark( nIndex ) /*----------------------------------------------------------------------*/ METHOD IdeEditsManager:goto( nLine ) - LOCAL qGo, qCursor, nRows, oEdit - + LOCAL oEdit IF ! empty( oEdit := ::oEM:getEditObjectCurrent() ) - qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) - nRows := oEdit:qEdit:blockCount() - - IF hb_isNumeric( nLine ) .AND. nLine >= 0 .AND. nLine <= nRows - // - ELSE - nLine := qCursor:blockNumber() - - qGo := QInputDialog():new( ::oDlg:oWidget ) - qGo:setInputMode( 1 ) - qGo:setIntMinimum( 1 ) - qGo:setIntMaximum( nRows ) - qGo:setIntValue( nLine + 1 ) - qGo:setLabelText( "Goto Line Number [1-" + hb_ntos( nRows ) + "]" ) - qGo:setWindowTitle( "Harbour" ) - - ::oIde:setPosByIniEx( qGo, ::oINI:cGotoDialogGeometry ) - qGo:exec() - ::oIde:oINI:cGotoDialogGeometry := hbide_posAndSize( qGo ) - nLine := qGo:intValue() - ENDIF - oEdit:goto( nLine ) ENDIF + RETURN Self - RETURN nLine /*----------------------------------------------------------------------*/ // Navigation /*----------------------------------------------------------------------*/ @@ -1097,6 +1074,8 @@ CLASS IdeEditor INHERIT IdeObject DATA qThumbnail DATA qTNFont DATA qTNHiliter + DATA qHSpltr + DATA qVSpltr DATA aEdits INIT {} /* Hold IdeEdit Objects */ DATA oEdit @@ -1123,6 +1102,8 @@ CLASS IdeEditor INHERIT IdeObject DATA lReadOnly INIT .F. DATA cEol INIT "" + DATA nSplOrient INIT -1 + DATA qSplitter METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, aBookMarks ) @@ -1215,13 +1196,17 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::buildTabPage( ::sourceFile ) - ::qLayout := QGridLayout():new() + ::qLayout := QBoxLayout():new() ::qLayout:setContentsMargins( 0,0,0,0 ) - ::qLayout:setHorizontalSpacing( 5 ) - ::qLayout:setVerticalSpacing( 5 ) // ::oTab:oWidget:setLayout( ::qLayout ) + ::qHSpltr := QSplitter():new() + ::qHSpltr:setOrientation( Qt_Horizontal ) + + ::qVSpltr := QSplitter():new() + ::qVSpltr:setOrientation( Qt_Vertical ) + ::oEdit := IdeEdit():new( ::oIde, Self, 0 ) ::oEdit:aBookMarks := aBookMarks ::oEdit:create() @@ -1229,6 +1214,8 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::qCqEdit := ::oEdit:qEdit ::qCoEdit := ::oEdit + ::qLayout:addWidget( ::oEdit:qEdit ) + ::connect( ::oEdit:qEdit, "updateRequest(QRect,int)", {|| ::scrollThumbnail() } ) ::qDocument := QTextDocument():configure( ::qEdit:document() ) @@ -1240,8 +1227,6 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ENDIF ::qCursor := QTextCursor():configure( ::qEdit:textCursor() ) - ::qLayout:addLayout( ::oEdit:qHLayout, 0, 0 ) - /* Populate Tabs Array */ aadd( ::aTabs, { ::oTab, Self } ) @@ -1259,6 +1244,59 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a /*----------------------------------------------------------------------*/ +METHOD IdeEditor:relay( oEdit ) + LOCAL oEdt + + IF len( ::aEdits ) == 0 + IF ::nSplOrient > -1 + ::nSplOrient := -1 + ::qLayout:removeWidget( ::qSplitter ) + ::qLayout:addWidget( ::oEdit:qEdit ) + ENDIF + ENDIF + + IF hb_isObject( oEdit ) + aadd( ::aEdits, oEdit ) + ENDIF + + IF ::nSplOrient == -1 + ::nSplOrient := oEdit:nOrient + + IF oEdit:nOrient == 1 + ::qSplitter := QSplitter():new( Qt_Horizontal ) + ELSE + ::qSplitter := QSplitter():new( Qt_Vertical ) + ENDIF + + ::qLayout:removeWidget( ::oEdit:qEdit ) + ::qLayout:addWidget( ::qSplitter ) + + ::qSplitter:addWidget( ::oEdit:qEdit ) + ENDIF + + FOR EACH oEdt IN ::aEdits + ::qSplitter:addWidget( oEdt:qEdit ) + NEXT + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditor:split( nOrient, oEditP ) + LOCAL oEdit + + HB_SYMBOL_UNUSED( oEditP ) + + oEdit := IdeEdit():new( ::oIde, Self, 1 ):create() + oEdit:qEdit:setDocument( ::qDocument ) + oEdit:nOrient := nOrient + + ::relay( oEdit ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditor:destroy() LOCAL n, oEdit @@ -1431,60 +1469,6 @@ HB_TRACE( HB_TR_ALWAYS, "IdeEditor:execEvent( nMode, p )" ) /*----------------------------------------------------------------------*/ -METHOD IdeEditor:relay( oEdit ) - LOCAL nCols, oEdt, nR, nC - - ::qLayout:removeItem( ::oEdit:qHLayout ) - FOR EACH oEdt IN ::aEdits - ::qLayout:removeItem( oEdt:qHLayout ) - // - oEdt:qHLayout:removeWidget( oEdt:qEdit ) - oEdt:qHLayout := QHBoxLayout():new() - oEdt:qHLayout:setContentsMargins( 0,0,0,0 ) - oEdt:qHLayout:setSpacing( 0 ) - - oEdt:qHLayout:addWidget( oEdt:qEdit ) - NEXT - - IF hb_isObject( oEdit ) - aadd( ::aEdits, oEdit ) - ENDIF - ::qLayout:addLayout( ::oEdit:qHLayout, 0, 0 ) - - nR := 0 ; nC := 0 - FOR EACH oEdt IN ::aEdits - IF oEdt:nOrient == 1 // Horiz - nC++ - ::qLayout:addLayout_1( oEdt:qHLayout, 0, nC, 1, 1, Qt_Vertical ) - ENDIF - NEXT - nCols := ::qLayout:columnCount() - FOR EACH oEdt IN ::aEdits - IF oEdt:nOrient == 2 // Verti - nR++ - ::qLayout:addLayout_1( oEdt:qHLayout, nR, 0, 1, nCols, Qt_Horizontal ) - ENDIF - NEXT - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeEditor:split( nOrient, oEditP ) - LOCAL oEdit - - HB_SYMBOL_UNUSED( oEditP ) - - oEdit := IdeEdit():new( ::oIde, Self, 1 ):create() - oEdit:qEdit:setDocument( ::qDocument ) - oEdit:nOrient := nOrient - - ::relay( oEdit ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) LOCAL oEdit diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index 02ff1d2d2c..7b089f4f77 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -364,7 +364,7 @@ METHOD IdeToolsManager:execEvent( cMode, p ) CASE "buttonBrowse_clicked" IF !empty( cFile := hbide_fetchAFile( ::oDlg, "Select a Tool" ) ) hb_fNameSplit( cFile, , @cFileName ) - ::ini2controls() + //::ini2controls() ::oUI:q_editName : setText( cFileName ) ::oUI:q_editCmdLine : setText( cFile ) ENDIF