From b67daee283abbae6150c545c80280788ca644a08 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 9 Feb 2010 17:02:31 +0000 Subject: [PATCH] 2010-02-09 08:38 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.ch * contrib/hbide/hbide.prg * contrib/hbide/ideactions.prg * contrib/hbide/idedocks.prg * contrib/hbide/ideeditor.prg * contrib/hbide/idefindreplace.prg * contrib/hbide/ideobject.prg * contrib/hbide/idesaveload.prg * contrib/hbide/idesources.prg + Implemented multiple views. How it works: * Select "New..." from drop-down menu of "Views" combo-box in toolbar. * An input dialog opens, provide a useful name, keep it "one word" if possible * Press or click "Ok", a blank edit area will come-up. * Make ususal operations to add/delete/move sources. * You must be able to see view's name in the status-bar in blue. * Thus created "view" name will appear in the drop-down list. * To switch to another view, select it from same drop-down. * To verify, come out of the hbIDE and re-enter. * Voila, you have the "views" created. * "Main" view or say "root" view is always present. ;Please report if anything is missing or could be better. --- harbour/ChangeLog | 27 ++++++++ harbour/contrib/hbide/hbide.ch | 23 ++++--- harbour/contrib/hbide/hbide.prg | 11 +++- harbour/contrib/hbide/ideactions.prg | 15 ++++- harbour/contrib/hbide/idedocks.prg | 78 +++++++++++++++++++++--- harbour/contrib/hbide/ideeditor.prg | 34 ++++++++--- harbour/contrib/hbide/idefindreplace.prg | 2 +- harbour/contrib/hbide/ideobject.prg | 2 + harbour/contrib/hbide/idesaveload.prg | 60 ++++++++++++------ harbour/contrib/hbide/idesources.prg | 16 ++--- 10 files changed, 212 insertions(+), 56 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5acabefce9..f9d4a08a7f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,33 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-09 08:38 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.ch + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/ideobject.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idesources.prg + + + Implemented multiple views. + How it works: + * Select "New..." from drop-down menu of "Views" combo-box in toolbar. + * An input dialog opens, provide a useful name, + keep it "one word" if possible + * Press or click "Ok", a blank edit area will come-up. + * Make ususal operations to add/delete/move sources. + * You must be able to see view's name in the status-bar in blue. + * Thus created "view" name will appear in the drop-down list. + * To switch to another view, select it from same drop-down. + * To verify, come out of the hbIDE and re-enter. + * Voila, you have the "views" created. + * "Main" view or say "root" view is always present. + + ;Please report if anything is missing or could be better. + 2010-02-09 15:43 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/pp/ppcore.c * src/vm/strapi.c diff --git a/harbour/contrib/hbide/hbide.ch b/harbour/contrib/hbide/hbide.ch index 535a5b00d5..d5952a0b28 100644 --- a/harbour/contrib/hbide/hbide.ch +++ b/harbour/contrib/hbide/hbide.ch @@ -66,8 +66,9 @@ #define INI_RECENTFILES 6 #define INI_RECENTPROJECTS 7 #define INI_FOLDERS 8 +#define INI_VIEWS 9 -#define INI_SECTIONS_COUNT 8 +#define INI_SECTIONS_COUNT 9 /* INI_HBIDE */ @@ -91,8 +92,9 @@ #define CurrentFind 18 #define CurrentFolderFind 19 #define CurrentReplace 20 +#define CurrentView 21 -#define INI_HBIDE_VRBLS 20 +#define INI_HBIDE_VRBLS 21 /* .hbi structure constants */ #define PRJ_PRP_PROPERTIES 1 @@ -124,10 +126,10 @@ #define E_oPrjLau 7 #define E_oPrjLEx 8 #define E_oPrjInc 9 -#define E_oPrjSrc 10 -#define E_oPrjMta 11 -#define E_oPrjHbp 12 -#define E_oPrjCmp 13 +#define E_oPrjSrc 10 +#define E_oPrjMta 11 +#define E_oPrjHbp 12 +#define E_oPrjCmp 13 #define SB_PNL_MAIN 1 #define SB_PNL_READY 2 @@ -139,10 +141,11 @@ #define SB_PNL_M_2 8 #define SB_PNL_ENVIRON 8 #define SB_PNL_STREAM 9 -#define SB_PNL_EDIT 10 -#define SB_PNL_SEARCH 11 -#define SB_PNL_CODEC 12 -#define SB_PNL_PROJECT 13 +#define SB_PNL_EDIT 10 +#define SB_PNL_SEARCH 11 +#define SB_PNL_CODEC 12 +#define SB_PNL_PROJECT 13 +#define SB_PNL_VIEW 14 #define TAB_OTAB 1 #define TAB_OEDITOR 2 diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index b5e19cfd12..1607707cd0 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -144,6 +144,7 @@ CLASS HbIde DATA oTabParent DATA oFrame DATA qLayoutFrame + DATA qViewsCombo DATA qFindDlg @@ -201,6 +202,7 @@ CLASS HbIde DATA cWrkFind INIT "" DATA cWrkFolderFind INIT "" DATA cWrkReplace INIT "" + DATA cWrkView INIT "" DATA oEnvironment @@ -293,6 +295,7 @@ METHOD HbIde:create( cProjIni ) ::cWrkFind := ::aINI[ INI_HBIDE, CurrentFind ] ::cWrkFolderFind := ::aINI[ INI_HBIDE, CurrentFolderFind ] ::cWrkReplace := ::aINI[ INI_HBIDE, CurrentReplace ] + ::cWrkView := ::aINI[ INI_HBIDE, CurrentView ] /* Set Codec at the Begining */ HbXbp_SetCodec( ::cWrkCodec ) @@ -307,7 +310,7 @@ METHOD HbIde:create( cProjIni ) /* Main Menu */ ::oAC:buildMainMenu() /* StatusBar */ - ::oDK:buildStatusBar() +// ::oDK:buildStatusBar() /* Docking Widgets */ ::oDK:buildDockWidgets() @@ -339,6 +342,12 @@ METHOD HbIde:create( cProjIni ) ::cWrkProject := ::aINI[ INI_HBIDE, CurrentProject ] ::oPM:populate() ::oSM:loadSources() + #if 0 + ::oDK:setView( ::cWrkView ) + IF !empty( ::aIni[ INI_FILES ] ) + ::oEM:setSourceVisibleByIndex( max( 0, val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) ) + ENDIF + #endif ::updateTitleBar() /* Set some last settings */ diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 98fc315514..b2887e9b51 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -304,7 +304,8 @@ METHOD IdeActions:loadActions() /*----------------------------------------------------------------------*/ METHOD IdeActions:buildToolBar() - LOCAL oTBar, nSep := XBPTOOLBAR_BUTTON_SEPARATOR + LOCAL oTBar, s + LOCAL nSep := XBPTOOLBAR_BUTTON_SEPARATOR oTBar := XbpToolBar():new( ::oDlg ) oTBar:imageWidth := 22 @@ -360,6 +361,18 @@ METHOD IdeActions:buildToolBar() oTBar:addItem( ::getAction( "ZoomOut" ), , , , , , "ZoomOut" ) oTBar:addItem( , , , , , nSep ) + /* ComboBox to Manage Views */ + ::oIde:qViewsCombo := QComboBox():new() + oTBar:oWidget:addWidget( ::qViewsCombo ) + ::qViewsCombo:addItem( "New..." ) + ::qViewsCombo:addItem( " " ) + ::qViewsCombo:addItem( "Main" ) + FOR EACH s IN ::aINI[ INI_VIEWS ] + ::qViewsCombo:addItem( s ) + NEXT + ::qViewsCombo:setCurrentIndex( -1 ) + ::connect( ::qViewsCombo, "currentIndexChanged(text)", {|p| ::oDK:setView( p ) } ) + RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 48b5651a79..380ef22bb5 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -80,6 +80,7 @@ CLASS IdeDocks INHERIT IdeObject METHOD create( oIde ) METHOD destroy() METHOD execEvent( nMode, p ) + METHOD setView( cView ) METHOD buildDialog() METHOD buildViewWidget() METHOD buildStackedWidget() @@ -128,15 +129,63 @@ METHOD IdeDocks:destroy() /*----------------------------------------------------------------------*/ +METHOD IdeDocks:setView( cView ) + LOCAL n + + SWITCH cView + + CASE "New..." + cView := hbide_fetchAString( ::qViewsCombo, cView, "Name the View", "New View" ) + IF cView != "New..." + IF ascan( ::aINI[ INI_VIEWS ], {|e| e == cView } ) > 0 + MsgBox( "View: " + cView + ", already exists" ) + ELSE + aadd( ::aINI[ INI_VIEWS ], cView ) + ::qViewsCombo:addItem( cView ) + ::buildViewWidget() + ::oStackedWidget:oWidget:setCurrentIndex( len( ::aINI[ INI_VIEWS ] ) ) + ::oIde:cWrkView := cView + ENDIF + ENDIF + EXIT + + CASE "Main" + ::oIde:nCurView := 0 + ::oIde:qTabWidget := ::aViews[ ::nCurView + 1 ]:oTabWidget:oWidget + ::oIde:oTabParent := ::aViews[ ::nCurView + 1 ] + ::oStackedWidget:oWidget:setCurrentIndex( 0 ) + ::oIde:cWrkView := "Main" + EXIT + + OTHERWISE + IF ( n := ascan( ::aINI[ INI_VIEWS ], cView ) ) > 0 + ::oStackedWidget:oWidget:setCurrentIndex( n ) /* Note: n is always base of zero as main == 1 */ + ::oIde:cWrkView := cView + ENDIF + EXIT + ENDSWITCH + + RETURN NIL + +/*----------------------------------------------------------------------*/ + METHOD IdeDocks:execEvent( nMode, p ) + LOCAL nIndex DO CASE CASE nMode == 1 IF p >= 0 .AND. p <= len( ::aViews ) - ::oIde:nCurView := p + 1 + ::oIde:nCurView := p - ::oIde:qTabWidget := ::aViews[ ::nCurView ]:oTabWidget:oWidget - ::oIde:oTabParent := ::aViews[ ::nCurView ] + ::oIde:qTabWidget := ::aViews[ ::nCurView + 1 ]:oTabWidget:oWidget + ::oIde:oTabParent := ::aViews[ ::nCurView + 1 ] + + nIndex := ::oIde:qTabWidget:currentIndex() + IF nIndex + 1 == ::oIde:qTabWidget:count() + ::oIde:qTabWidget:setCurrentIndex( 0 ) + ::oIde:qTabWidget:setCurrentIndex( nIndex ) /* TODO: Must be last saved */ + ENDIF + ::setStatusText( SB_PNL_VIEW, iif( p == 0, "Main", ::aINI[ INI_VIEWS, ::nCurView ] ) ) ENDIF ENDCASE @@ -153,13 +202,14 @@ METHOD IdeDocks:buildStackedWidget() ::oStackedWidget:oWidget:setObjectName( "myStackedWidget" ) ::oDa:addChild( ::oStackedWidget ) - ::connect( ::oStackedWidget:oWidget, "currentChanged(int)", {|p| ::execEvent( 1, p ) } ) + ::oStackedWidget:connect( ::oStackedWidget:oWidget, "currentChanged(int)", {|p| ::execEvent( 1, p ) } ) RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeDocks:buildDialog() + LOCAL s ::oIde:oDlg := XbpDialog():new() ::oDlg:icon := ::resPath + "vr.png" @@ -184,19 +234,25 @@ METHOD IdeDocks:buildDialog() ::oIde:setPosAndSizeByIni( ::oDlg:oWidget, MainWindowGeometry ) ::oDlg:Show() + /* StatusBar */ + ::buildStatusBar() + /* Attach GRID Layout to Editor Area - Futuristic */ ::oIde:qLayout := QGridLayout():new() ::oIde:qLayout:setContentsMargins( 0,0,0,0 ) ::oIde:qLayout:setHorizontalSpacing( 0 ) ::oIde:qLayout:setVerticalSpacing( 0 ) // + ::oDa:oWidget:setLayout( ::qLayout ) ::buildStackedWidget() ::qLayout:addWidget_1( ::oStackedWidget:oWidget, 0, 0, 1, 1 ) - ::buildViewWidget() - - ::oDa:oWidget:setLayout( ::qLayout ) + /* View Panels */ + ::buildViewWidget() /* Main */ + FOR EACH s IN ::aINI[ INI_VIEWS ] + ::buildViewWidget() + NEXT /* Force to populate current widget */ ::oStackedWidget:oWidget:setCurrentIndex( 0 ) @@ -222,7 +278,6 @@ METHOD IdeDocks:buildViewWidget() oFrame:oTabWidget:oWidget:setUsesScrollButtons( .f. ) oFrame:oTabWidget:oWidget:setMovable( .t. ) - /* The root view widget */ aadd( ::oIde:aViews, oFrame ) ::oStackedWidget:oWidget:addWidget( oFrame:oWidget ) @@ -454,7 +509,7 @@ METHOD IdeDocks:outputDoubleClicked( lSelected ) cText := QTextBlock():configure( qCursor:block() ):text() IF hbide_parseFNfromStatusMsg( cText, @cSource, @nLine, .T. ) - ::oSM:editSource( cSource, 0, 0, 0, NIL, .f. ) + ::oSM:editSource( cSource, 0, 0, 0, NIL, NIL, .f., .t. ) qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() ) nLine := iif( nLine < 1, 0, nLine - 1 ) @@ -490,6 +545,7 @@ METHOD IdeDocks:buildStatusBar() ::oSBar:addItem( "", , , , "Search" ):oWidget:setMinimumWidth( 20 ) ::oSBar:addItem( "", , , , "Codec" ):oWidget:setMinimumWidth( 20 ) ::oSBar:addItem( "", , , , "Project" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "View" ):oWidget:setMinimumWidth( 20 ) FOR i := 1 TO 6 ::oSBar:oWidget:addWidget( ::getMarkWidget( i ) ) @@ -586,7 +642,9 @@ METHOD IdeDocks:setStatusText( nPart, xValue ) CASE SB_PNL_MODIFIED oPanel:caption := iif( xValue, "Modified", "" ) EXIT - CASE SB_PNL_M_2 + CASE SB_PNL_VIEW + oPanel:caption := "View: " + xValue + "" + EXIT CASE SB_PNL_ENVIRON oPanel:caption := "Env: " + xValue EXIT diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 66ca2909dc..52245b9105 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -100,7 +100,7 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD removeSourceInTree( cSourceFile ) METHOD addSourceInTree( cSourceFile ) METHOD exeEvent( nMode, p ) - METHOD buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme ) + METHOD buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) METHOD getTabBySource( cSource ) METHOD getTabCurrent() METHOD getDocumentCurrent() @@ -262,9 +262,9 @@ METHOD IdeEditsManager:exeEvent( nMode, p ) /*----------------------------------------------------------------------*/ -METHOD IdeEditsManager:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme ) +METHOD IdeEditsManager:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) - IdeEditor():new():create( ::oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) + IdeEditor():new():create( ::oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) RETURN Self @@ -905,6 +905,7 @@ CLASS IdeEditor INHERIT IdeObject DATA cExt INIT "" DATA cType INIT "" DATA cTheme INIT "" + DATA cView DATA qDocument DATA qHiliter DATA sourceFile INIT "" @@ -940,8 +941,8 @@ CLASS IdeEditor INHERIT IdeObject DATA qSlots DATA qMarkLayoutOld - METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) - METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) + METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) + METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) METHOD split( nOrient, oEditP ) METHOD relay( oEdit ) METHOD destroy() @@ -957,7 +958,7 @@ CLASS IdeEditor INHERIT IdeObject /*----------------------------------------------------------------------*/ -METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) +METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) DEFAULT oIde TO ::oIde DEFAULT cSourceFile TO ::sourceFile @@ -965,6 +966,7 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) DEFAULT nHPos TO ::nHPos DEFAULT nVPos TO ::nVPos DEFAULT cTheme TO ::cTheme + DEFAULT cView TO ::cView ::oIde := oIde ::sourceFile := cSourceFile @@ -972,13 +974,16 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::nHPos := nHPos ::nVPos := nVPos ::cTheme := cTheme + ::cView := cView + ::nID := hbide_getNextUniqueID() RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) +METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) + LOCAL n ::qSlots := HBSlots():new() @@ -988,6 +993,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) DEFAULT nHPos TO ::nHPos DEFAULT nVPos TO ::nVPos DEFAULT cTheme TO ::cTheme + DEFAULT cView TO ::cView ::oIde := oIde ::SourceFile := hbide_pathNormalized( cSourceFile, .F. ) @@ -995,6 +1001,20 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::nHPos := nHPos ::nVPos := nVPos ::cTheme := cTheme + ::cView := cView + + DEFAULT ::cView TO iif( ::nCurView == 0, "Main", ::aINI[ INI_VIEWS, ::nCurView ] ) + + IF ::cView == "Main" + ::oStackedWidget:oWidget:setCurrentIndex( 0 ) + ELSE + IF ( n := ascan( ::aINI[ INI_VIEWS ], {|e| e == ::cView } ) ) > 0 + ::oStackedWidget:oWidget:setCurrentIndex( n ) + ELSE + ::oStackedWidget:oWidget:setCurrentIndex( 0 ) + ENDIF + ENDIF + ::pathNormalized := hbide_pathNormalized( cSourceFile, .t. ) hb_fNameSplit( cSourceFile, @::cPath, @::cFile, @::cExt ) diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 78cbec16af..c7355cc59e 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -576,7 +576,7 @@ METHOD IdeFindInFiles:execEvent( cEvent, p ) IF nInfo <= len( ::aInfo ) .AND. ::aInfo[ nInfo, 1 ] == -2 cSource := ::aInfo[ nInfo, 2 ] - ::oSM:editSource( cSource, 0, 0, 0, NIL, .f. ) + ::oSM:editSource( cSource, 0, 0, 0, NIL, NIL, .f., .t. ) qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() ) qCursor:setPosition( 0 ) qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, ::aInfo[ nInfo, 3 ] - 1 ) diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index de61ce1aa3..5c821af800 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -110,6 +110,7 @@ CLASS IdeObject ACCESS qTabWidget INLINE ::oIde:qTabWidget ACCESS oTabParent INLINE ::oIde:oTabParent ACCESS qBrushWrkProject INLINE ::oIde:qBrushWrkProject + ACCESS qViewsCombo INLINE ::oIde:qViewsCombo ACCESS cWrkProject INLINE ::oIde:cWrkProject ACCESS cWrkTheme INLINE ::oIde:cWrkTheme @@ -120,6 +121,7 @@ CLASS IdeObject ACCESS cWrkFind INLINE ::oIde:cWrkFind ACCESS cWrkFolderFind INLINE ::oIde:cWrkFolderFind ACCESS cWrkReplace INLINE ::oIde:cWrkReplace + ACCESS cWrkView INLINE ::oIde:cWrkView // ACCESS resPath INLINE ::oIde:resPath ACCESS pathSep INLINE ::oIde:pathSep diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 8c505e7934..b74c79bc34 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -71,8 +71,7 @@ /*----------------------------------------------------------------------*/ FUNCTION hbide_saveINI( oIde ) - LOCAL nTab, pTab, n, txt_, qHScr, qVScr, oEdit, qCursor - LOCAL nTabs := oIde:qTabWidget:count() + LOCAL j, nTab, pTab, n, txt_, qHScr, qVScr, oEdit, qCursor, nTabs txt_:= {} // Properties @@ -98,6 +97,7 @@ FUNCTION hbide_saveINI( oIde ) aadd( txt_, "CurrentFind = " + oIde:cWrkFind ) aadd( txt_, "CurrentFolderFind = " + oIde:cWrkFolderFind ) aadd( txt_, "CurrentReplace = " + oIde:cWrkReplace ) + aadd( txt_, "CurrentView = " + oIde:cWrkView ) aadd( txt_, " " ) aadd( txt_, "[PROJECTS]" ) @@ -107,26 +107,35 @@ FUNCTION hbide_saveINI( oIde ) NEXT aadd( txt_, " " ) + /*------------------- FILES -------------------*/ aadd( txt_, "[FILES]" ) aadd( txt_, " " ) - FOR n := 1 TO nTabs - pTab := oIde:qTabWidget:widget( n-1 ) - nTab := ascan( oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) - oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ] - IF !Empty( oEdit:sourceFile ) .and. !( ".ppo" == lower( oEdit:cExt ) ) + FOR j := 0 TO len( oIde:aINI[ INI_VIEWS ] ) + oIde:oStackedWidget:oWidget:setCurrentIndex( j ) - qHScr := QScrollBar():configure( oEdit:qEdit:horizontalScrollBar() ) - qVScr := QScrollBar():configure( oEdit:qEdit:verticalScrollBar() ) - qCursor := QTextCursor():configure( oEdit:qEdit:textCursor() ) + nTabs := oIde:qTabWidget:count() + FOR n := 1 TO nTabs + pTab := oIde:qTabWidget:widget( n-1 ) + nTab := ascan( oIde:aTabs, {|e_| hbqt_IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, pTab ) } ) + oEdit := oIde:aTabs[ nTab, TAB_OEDITOR ] - 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 + "," ) - ENDIF + IF !Empty( oEdit:sourceFile ) .and. !( ".ppo" == lower( oEdit:cExt ) ) + + 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 + "," ) + ENDIF + NEXT NEXT + aadd( txt_, " " ) aadd( txt_, "[FIND]" ) @@ -164,6 +173,13 @@ FUNCTION hbide_saveINI( oIde ) NEXT aadd( txt_, " " ) + aadd( txt_, "[VIEWS]" ) + aadd( txt_, " " ) + FOR n := 1 TO len( oIde:aIni[ INI_VIEWS ] ) + aadd( txt_, oIde:aIni[ INI_VIEWS, n ] ) + NEXT + aadd( txt_, " " ) + hbide_saveSettings( oIde ) RETURN hbide_createTarget( oIde:cProjIni, txt_ ) @@ -178,7 +194,7 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) "finddialoggeometry" , "themesdialoggeometry", "currenttheme" , ; "currentcodec" , "pathmk2" , "pathenv" , ; "currentenvironment" , "findinfilesdialoggeometry", "currentfind" , ; - "currentreplace" , "currentfolderfind" } + "currentreplace" , "currentfolderfind" , "currentview" } /* Initiate the place holders */ oIde:aIni := Array( INI_SECTIONS_COUNT ) @@ -237,6 +253,9 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) CASE "[FOLDERS]" nPart := INI_FOLDERS EXIT + CASE "[VIEWS]" + nPart := INI_VIEWS + EXIT OTHERWISE /* * If none of the previous sections are valid, do not let it @@ -265,17 +284,19 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) CASE nPart == INI_FILES a_:= hb_atokens( s, "," ) - asize( a_, 5 ) + asize( a_, 6 ) DEFAULT a_[ 1 ] TO "" DEFAULT a_[ 2 ] TO "" DEFAULT a_[ 3 ] TO "" DEFAULT a_[ 4 ] TO "" DEFAULT a_[ 5 ] TO "" + DEFAULT a_[ 6 ] TO "Main" // a_[ 2 ] := val( a_[ 2 ] ) a_[ 3 ] := val( a_[ 3 ] ) a_[ 4 ] := val( a_[ 4 ] ) a_[ 5 ] := a_[ 5 ] + a_[ 6 ] := a_[ 6 ] * Ignores invalid filenames... IF !Empty( a_[ 1 ] ) @@ -301,6 +322,9 @@ FUNCTION hbide_loadINI( oIde, cHbideIni ) CASE nPart == INI_FOLDERS aadd( oIde:aIni[ nPart ], s ) + CASE nPart == INI_VIEWS + aadd( oIde:aIni[ nPart ], s ) + ENDCASE EXIT ENDSWITCH diff --git a/harbour/contrib/hbide/idesources.prg b/harbour/contrib/hbide/idesources.prg index 8296e457de..829b235648 100644 --- a/harbour/contrib/hbide/idesources.prg +++ b/harbour/contrib/hbide/idesources.prg @@ -77,7 +77,7 @@ CLASS IdeSourcesManager INHERIT IdeObject METHOD create( oIde ) METHOD loadSources() METHOD saveSource( nTab, lCancel, lAs ) - METHOD editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert, lVisible ) + METHOD editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, cView, lAlert, lVisible ) METHOD closeSource( nTab, lCanCancel, lCanceled ) METHOD closeAllSources() METHOD closeAllOthers( nTab ) @@ -110,15 +110,15 @@ METHOD IdeSourcesManager:create( oIde ) /*----------------------------------------------------------------------*/ METHOD IdeSourcesManager:loadSources() - LOCAL a_, nIndex + LOCAL a_ IF !empty( ::aIni[ INI_FILES ] ) FOR EACH a_ IN ::aIni[ INI_FILES ] - /* File nPos nVPos nHPos cTheme lAlert lVisible */ - ::editSource( a_[ 1 ], a_[ 2 ], a_[ 3 ], a_[ 4 ], a_[ 5 ], .t., .f. ) + /* File nPos nVPos nHPos cTheme cView lAlert lVisible */ + ::editSource( a_[ 1 ], a_[ 2 ], a_[ 3 ], a_[ 4 ], a_[ 5 ], a_[ 6 ], .t., .f. ) NEXT - nIndex := max( 0, val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) ) - ::oEM:setSourceVisibleByIndex( nIndex ) + ::oDK:setView( ::cWrkView ) + ::oEM:setSourceVisibleByIndex( max( 0, val( ::aIni[ INI_HBIDE, RecentTabIndex ] ) ) ) ENDIF RETURN Self @@ -202,7 +202,7 @@ METHOD IdeSourcesManager:saveSource( nTab, lCancel, lAs ) /*----------------------------------------------------------------------*/ -METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lAlert, lVisible ) +METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, cView, lAlert, lVisible ) DEFAULT lAlert TO .T. DEFAULT lVisible TO .T. @@ -231,7 +231,7 @@ METHOD IdeSourcesManager:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme, lA DEFAULT nHPos TO 0 DEFAULT nVPos TO 0 - ::oEM:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme ) + ::oEM:buildEditor( cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) IF lVisible ::oEM:setSourceVisible( cSourceFile ) ENDIF