From dc9ad267594348a3c195727680354c421e0a365a Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 9 Feb 2010 02:45:05 +0000 Subject: [PATCH] 2010-02-08 18:44 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/idedocks.prg * contrib/hbide/ideeditor.prg * contrib/hbide/ideobject.prg % More ground cover in preperation of multiple views. Just to versionize changes. ;NOTE: Unreleased memory blocks have reduced considerably after parent/child relations fix in prev commit. This implies that in sometime in near future, memory issue is going to be the ghost of past. --- harbour/ChangeLog | 13 ++++ harbour/contrib/hbide/hbide.prg | 10 ++- harbour/contrib/hbide/idedocks.prg | 113 ++++++++++++++-------------- harbour/contrib/hbide/ideeditor.prg | 3 +- harbour/contrib/hbide/ideobject.prg | 3 + 5 files changed, 82 insertions(+), 60 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 75c7772cc9..e7ca98302b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-08 18:44 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideobject.prg + % More ground cover in preperation of multiple views. + Just to versionize changes. + + ;NOTE: Unreleased memory blocks have reduced considerably + after parent/child relations fix in prev commit. + This implies that in sometime in near future, + memory issue is going to be the ghost of past. + 2010-02-08 17:16 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbxbp/xbp.ch * contrib/hbxbp/xbpparthandler.prg diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 1ba1d69360..b5e19cfd12 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -131,13 +131,20 @@ CLASS HbIde DATA aTabs INIT {} DATA aINI INIT {} + DATA aViews INIT {} DATA aProjData INIT {} DATA aPrpObjs INIT {} DATA aEditorPath INIT {} + DATA nCurView INIT 1 /* HBQT Objects */ DATA qLayout + DATA qTabWidget + DATA oTabParent + DATA oFrame + DATA qLayoutFrame + DATA qFindDlg DATA qCursor @@ -170,7 +177,6 @@ CLASS HbIde DATA oCompileResult DATA oLinkResult DATA oNewDlg - DATA oTabWidget DATA oPBFind, oPBRepl, oPBClose, oFind, oRepl DATA oCurProjItem DATA oCurProject @@ -245,8 +251,6 @@ CLASS HbIde METHOD execEditorAction( cKey ) METHOD execWindowsAction( cKey ) - DATA oFrame - ENDCLASS /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index ef2123c638..48b5651a79 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -79,9 +79,10 @@ CLASS IdeDocks INHERIT IdeObject METHOD new( oIde ) METHOD create( oIde ) METHOD destroy() + METHOD execEvent( nMode, p ) METHOD buildDialog() - METHOD buildTabWidget() - METHOD buildStackWidget() + METHOD buildViewWidget() + METHOD buildStackedWidget() METHOD buildDockWidgets() METHOD buildProjectTree() METHOD buildEditorTree() @@ -127,6 +128,37 @@ METHOD IdeDocks:destroy() /*----------------------------------------------------------------------*/ +METHOD IdeDocks:execEvent( nMode, p ) + + DO CASE + CASE nMode == 1 + IF p >= 0 .AND. p <= len( ::aViews ) + ::oIde:nCurView := p + 1 + + ::oIde:qTabWidget := ::aViews[ ::nCurView ]:oTabWidget:oWidget + ::oIde:oTabParent := ::aViews[ ::nCurView ] + ENDIF + ENDCASE + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:buildStackedWidget() + + /* Its parent will be drawing area and pages will be XbpTabWidgets() */ + + ::oIde:oStackedWidget := XbpWindow():new( ::oDa ) + ::oStackedWidget:oWidget := QStackedWidget():new( ::oDa:oWidget ) + ::oStackedWidget:oWidget:setObjectName( "myStackedWidget" ) + ::oDa:addChild( ::oStackedWidget ) + + ::connect( ::oStackedWidget:oWidget, "currentChanged(int)", {|p| ::execEvent( 1, p ) } ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeDocks:buildDialog() ::oIde:oDlg := XbpDialog():new() @@ -159,76 +191,45 @@ METHOD IdeDocks:buildDialog() ::oIde:qLayout:setVerticalSpacing( 0 ) // - #if 0 - ::buildTabWidget() - ::qLayout:addWidget_1( ::oDa:oTabWidget:oWidget, 0, 0, 1, 1 ) - #else - ::buildStackWidget() + ::buildStackedWidget() ::qLayout:addWidget_1( ::oStackedWidget:oWidget, 0, 0, 1, 1 ) - ::buildTabWidget() - #endif - ::oDa:oWidget:setLayout( ::oIde:qLayout ) + ::buildViewWidget() + + ::oDa:oWidget:setLayout( ::qLayout ) + + /* Force to populate current widget */ + ::oStackedWidget:oWidget:setCurrentIndex( 0 ) RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeDocks:buildStackWidget() +METHOD IdeDocks:buildViewWidget() + LOCAL n := len( ::aViews ) + 1 + LOCAL oFrame - /* Its parent will be drawing area and pages will be XbpTabWidgets() */ + oFrame := XbpWindow():new( ::oStackedWidget ) + oFrame:oWidget := QWidget():new( ::oStackedWidget:oWidget ) + oFrame:oWidget:setObjectName( "viewWidget" + hb_ntos( n ) ) + ::oStackedWidget:addChild( oFrame ) - ::oIde:oStackedWidget := XbpWindow():new( ::oDa ) - ::oStackedWidget:oWidget := QStackedWidget():new( ::oDa:oWidget ) - ::oStackedWidget:oWidget:setObjectName( "myStackedWidget" ) - ::oDa:addChild( ::oStackedWidget ) + oFrame:hbLayout := HBPLAYOUT_TYPE_VERTBOX + oFrame:qLayout:setContentsMargins( 2, 2, 2, 2 ) - RETURN Self + oFrame:oTabWidget := XbpTabWidget():new():create( oFrame, , {0,0}, {200,200}, , .t. ) -/*----------------------------------------------------------------------*/ + oFrame:oTabWidget:oWidget:setUsesScrollButtons( .f. ) + oFrame:oTabWidget:oWidget:setMovable( .t. ) -METHOD IdeDocks:buildTabWidget() - #if 0 + /* The root view widget */ + aadd( ::oIde:aViews, oFrame ) - ::oIde:oDa:oTabWidget := XbpTabWidget():new():create( ::oDa, , {0,0}, {10,10}, , .t. ) - ::oIde:qTabWidget := ::oDa:oTabWidget:oWidget - - ::qTabWidget:setUsesScrollButtons( .f. ) - ::qTabWidget:setMovable( .t. ) - - ::qTabWidget:setContextMenuPolicy( Qt_CustomContextMenu ) - ::connect( ::qTabWidget, "customContextMenuRequested(QPoint)", {|p| ::exeEvent( 1, p ) } ) - - #else - #if 0 - ::oIde:oFrame := XbpWindow():new( ::oIde:oStackedWidget ) - ::oFrame:oWidget := QWidget():new( ::oIde:oStackedWidget:oWidget ) - ::oStackedWidget:addChild( ::oFrame ) - ::oFrame:oTabWidget := XbpTabWidget():new():create( ::oFrame, , {0,0}, {200,200}, , .t. ) - ::oIde:qTabWidget := ::oIde:oFrame:oTabWidget:oWidget - ::qTabWidget:setUsesScrollButtons( .f. ) - ::qTabWidget:setMovable( .t. ) - ::oStackedWidget:oWidget:addWidget( ::oFrame:oWidget ) - ::oStackedWidget:oWidget:setCurrentIndex( 1 ) - #else /* Below Works */ - LOCAL oTabWidget - STATIC qTabWidget - - oTabWidget := XbpTabWidget():new():create( ::oIde:oStackedWidget , {0,0}, {10,10}, , .t. ) - ::oIde:oDa:oTabWidget := oTabWidget /* Important - Look deep why it be so */ - ::oIde:qTabWidget := oTabWidget:oWidget - ::qTabWidget:setUsesScrollButtons( .f. ) - ::qTabWidget:setMovable( .t. ) - ::oStackedWidget:oWidget:addWidget( ::qTabWidget ) - - qTabWidget := QTabWidget():new( ::oStackedWidget:oWidget ) - ::oStackedWidget:oWidget:addWidget( qTabWidget ) + ::oStackedWidget:oWidget:addWidget( oFrame:oWidget ) ::oStackedWidget:oWidget:setCurrentIndex( 0 ) - #endif - #endif - RETURN Self + RETURN oFrame /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index c3f97c3ccb..66ca2909dc 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1229,7 +1229,8 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) METHOD IdeEditor:buildTabPage( cSource ) - ::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) + //::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) + ::oTab := XbpTabPage():new( ::oTabParent, , { 5,5 }, { 700,400 }, , .t. ) IF Empty( cSource ) ::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() ) diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index 15161a3a9e..de61ce1aa3 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -108,6 +108,7 @@ CLASS IdeObject ACCESS qCurDocument INLINE ::oIde:qCurDocument ACCESS oCurEditor INLINE ::oIde:oCurEditor ACCESS qTabWidget INLINE ::oIde:qTabWidget + ACCESS oTabParent INLINE ::oIde:oTabParent ACCESS qBrushWrkProject INLINE ::oIde:qBrushWrkProject ACCESS cWrkProject INLINE ::oIde:cWrkProject @@ -130,7 +131,9 @@ CLASS IdeObject ACCESS aEditorPath INLINE ::oIde:aEditorPath ACCESS aProjData INLINE ::oIde:aProjData ACCESS aTabs INLINE ::oIde:aTabs + ACCESS aViews INLINE ::oIde:aViews + ACCESS nCurView INLINE ::oIde:nCurView ACCESS nTabSpaces INLINE ::oIde:nTabSpaces ACCESS cTabSpaces INLINE ::oIde:cTabSpaces ACCESS cSeparator INLINE ::oIde:cSeparator