From 9c39f2c59ebd67f2715531fc4c31ee4617c15df8 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 4 Aug 2010 01:17:05 +0000 Subject: [PATCH] 2010-08-03 18:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/ideprojmanager.prg % Fixed: ( hopefully ) the OS path syndrome when a .hbp from Windows is ported to *nixes. * contrib/hbide/ideedit.prg ! Minor. * contrib/hbide/idedocks.prg + Implemented: MDI Editing Area - LeftToolbar - Actions: 1. Show Maximized: turns all panels in maximized mode. In this mode MDI and Stacked protocols are almost the same, though, MDI mode has many other advantages than Stacked one. 2. Show Stacked Vertically: viewport is distributed in equal parts vertically and each panel is assigned this much height. Width of the panel is limited to viewport width. In this mode "Stats" panel is not considered. 3. Show Stacked Horizontally: viewport is distributed in equal parts horizontally and each panel is assigned this much width. Height of the panels equals viewport height. 4. Zoom-in: If view mode is "Stacked Vertically | Horizontally", then per zoom-in increases the height|width of the panel by 25% more than the current. Zoom-in and zoom-out are never in the same ratio. If hbIDE is closed in maximized state, it is presented the same at next run. This is not true for Vertical|Horizontal stacked view. The reason is size of the viewport is not determined at the time of panel creation. Icons on the toolbar are not representing the actions properly, and hence are subject to change. --- harbour/ChangeLog | 36 +++++ harbour/contrib/hbide/idedocks.prg | 169 ++++++++++++++++++++++- harbour/contrib/hbide/ideedit.prg | 1 - harbour/contrib/hbide/ideprojmanager.prg | 5 +- 4 files changed, 202 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 435424a0f9..31620abc54 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,42 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-03 18:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/ideprojmanager.prg + % Fixed: ( hopefully ) the OS path syndrome when a .hbp from + Windows is ported to *nixes. + + * contrib/hbide/ideedit.prg + ! Minor. + + * contrib/hbide/idedocks.prg + + Implemented: MDI Editing Area - LeftToolbar - Actions: + 1. Show Maximized: turns all panels in maximized mode. + In this mode MDI and Stacked protocols are almost the same, + though, MDI mode has many other advantages than Stacked one. + + 2. Show Stacked Vertically: viewport is distributed in equal + parts vertically and each panel is assigned this much height. + Width of the panel is limited to viewport width. In this + mode "Stats" panel is not considered. + + 3. Show Stacked Horizontally: viewport is distributed in + equal parts horizontally and each panel is assigned this + much width. Height of the panels equals viewport height. + + 4. Zoom-in: If view mode is "Stacked Vertically | Horizontally", + then per zoom-in increases the height|width of the panel by + 25% more than the current. Zoom-in and zoom-out are never in the + same ratio. + + If hbIDE is closed in maximized state, it is presented the same + at next run. This is not true for Vertical|Horizontal stacked view. + The reason is size of the viewport is not determined at the time + of panel creation. + + Icons on the toolbar are not representing the actions properly, + and hence are subject to change. + 2010-08-03 21:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbextern.ch * src/vm/Makefile diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 712a19968f..9ae5ec3def 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -147,6 +147,11 @@ CLASS IdeDocks INHERIT IdeObject METHOD getEditorPanelsInfo() METHOD restPanelsGeometry() METHOD savePanelsGeometry() + METHOD stackVertically() + METHOD stackHorizontally() + METHOD stackMaximized() + METHOD stackZoom( nMode ) + METHOD restState( nMode ) ENDCLASS @@ -334,13 +339,24 @@ METHOD IdeDocks:buildDialog() IF x_[ 1,5 ] == QMdiArea_TabbedView ::oStackedWidget:oWidget:setViewMode( QMdiArea_TabbedView ) ENDIF - FOR EACH a_ IN x_ - ::oIde:aMdies[ a_:__enumIndex() ]:setWindowState( a_[ 4 ] ) - NEXT - IF x_[ 1,6 ] == 1 + + IF x_[ 1,6 ] == 1 ::oStackedWidget:oWidget:tileSubWindows() ELSEIF x_[ 1,6 ] == 2 ::oStackedWidget:oWidget:cascadeSubWindows() + ELSEIF x_[ 1,6 ] == 3 + ::stackMaximized() +#if 0 /* At this point size of the viewport is not determined */ + ELSEIF x_[ 1,6 ] == 4 + ::stackVertically() + ELSEIF x_[ 1,6 ] == 5 + ::stackHorizontally() +#endif + ELSE + FOR EACH a_ IN x_ + ::oIde:aMdies[ a_:__enumIndex() ]:setGeometry( a_[ 2 ] ) + ::oIde:aMdies[ a_:__enumIndex() ]:setWindowState( a_[ 4 ] ) + NEXT ENDIF ENDIF @@ -572,7 +588,7 @@ HB_TRACE( HB_TR_ALWAYS, "projectTree_dropEvent" ) CASE "buttonViewOrganized_clicked" ::nViewStyle := 0 - ::restPanelsGeometry() + ::restState() EXIT CASE "buttonViewTiled_clicked" @@ -585,6 +601,29 @@ HB_TRACE( HB_TR_ALWAYS, "projectTree_dropEvent" ) ::nViewStyle := 2 EXIT + CASE "buttonViewMaximized_clicked" + ::nViewStyle := 3 + ::stackMaximized() + EXIT + + CASE "buttonViewStackedVert_clicked" + ::nViewStyle := 4 + ::stackVertically() + EXIT + + CASE "buttonViewStackedHorz_clicked" + ::nViewStyle := 5 + ::stackHorizontally() + EXIT + + CASE "buttonViewZoomedIn_clicked" + ::stackZoom( +1 ) + EXIT + + CASE "buttonViewZoomedOut_clicked" + ::stackZoom( -1 ) + EXIT + CASE "buttonViewTabbed_clicked" ::oStackedWidget:oWidget:setViewMode( iif( ::oStackedWidget:oWidget:viewMode() == QMdiArea_TabbedView, QMdiArea_SubWindowView, QMdiArea_TabbedView ) ) EXIT @@ -610,6 +649,116 @@ HB_TRACE( HB_TR_ALWAYS, "projectTree_dropEvent" ) /*----------------------------------------------------------------------*/ +METHOD IdeDocks:restState( nMode ) + LOCAL qMdi + + HB_SYMBOL_UNUSED( nMode ) + FOR EACH qMdi IN ::oIde:aMdies + qMdi:setWindowState( 0 ) + NEXT + ::restPanelsGeometry() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:stackMaximized() + LOCAL qObj, qMdi + + qObj := QMdiSubWindow():from( ::oStackedWidget:oWidget:activeSubWindow() ) + FOR EACH qMdi IN ::oIde:aMdies + qMdi:setWindowState( Qt_WindowMaximized ) + NEXT + ::oStackedWidget:oWidget:setActiveSubWindow( qObj ) + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:stackZoom( nMode ) + LOCAL qMdi, nT, nL, nH, nW, qRect + + HB_SYMBOL_UNUSED( nMode ) + + IF ::nViewStyle == 4 .OR. ::nViewStyle == 5 + IF ::nViewStyle == 4 + nT := 0 + FOR EACH qMdi IN ::oIde:aMdies + IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + qRect := QRect():from( qMdi:geometry() ) + nH := qRect:height() + ( nMode * ( qRect:height() / 4 ) ) + qMdi:setGeometry( QRect():new( 0, nT, qRect:width(), nH ) ) + nT += nH + ENDIF + NEXT + ELSE + nL := 0 + FOR EACH qMdi IN ::oIde:aMdies + IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + qRect := QRect():from( qMdi:geometry() ) + nW := qRect:width() + ( nMode * ( qRect:width() / 4 ) ) + qMdi:setGeometry( QRect():new( nL, 0, nW, qRect:height() ) ) + nL += nW + ENDIF + NEXT + ENDIF + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:stackHorizontally() + LOCAL qArea, qObj, qVPort, nH, nT, nW, qMdi, nL + + ::restState( 0 ) + + qArea := ::oStackedWidget:oWidget + + qObj := QMdiSubWindow():from( qArea:activeSubWindow() ) + + qVPort := QWidget():from( qArea:viewport() ) + nH := qVPort:height() + nW := qVPort:width() / ( len( ::oIde:aMdies ) - 1 ) + nT := 0 + nL := 0 + + FOR EACH qMdi IN ::oIde:aMdies + IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + qMdi:setGeometry( QRect():new( nL, nT, nW, nH ) ) + nL += nW + ENDIF + NEXT + + ::oStackedWidget:oWidget:setActiveSubWindow( qObj ) + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeDocks:stackVertically() + LOCAL qArea, qObj, qVPort, nH, nT, nW, qMdi + + ::restState() + + qArea := ::oStackedWidget:oWidget + + qObj := QMdiSubWindow():from( qArea:activeSubWindow() ) + + qVPort := QWidget():from( qArea:viewport() ) + nH := qVPort:height() / ( len( ::oIde:aMdies ) - 1 ) + nW := qVPort:width() + nT := 0 + + FOR EACH qMdi IN ::oIde:aMdies + IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + qMdi:setGeometry( QRect():new( 0, nT, nW, nH ) ) + nT += nH + ENDIF + NEXT + + ::oStackedWidget:oWidget:setActiveSubWindow( qObj ) + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeDocks:restPanelsGeometry() LOCAL a_, n FOR EACH a_ IN ::aViewsInfo @@ -821,6 +970,11 @@ METHOD IdeDocks:buildMdiToolbarLeft() aadd( aBtn, ::buildToolButton( qTBar, { "View as arranged" , "view_organized" , {|| ::execEvent( "buttonViewOrganized_clicked" ) }, .f. } ) ) aadd( aBtn, ::buildToolButton( qTBar, { "View as cascaded" , "view_cascaded" , {|| ::execEvent( "buttonViewCascaded_clicked" ) }, .f. } ) ) aadd( aBtn, ::buildToolButton( qTBar, { "View as tiled" , "view_tiled" , {|| ::execEvent( "buttonViewTiled_clicked" ) }, .f. } ) ) + aadd( aBtn, ::buildToolButton( qTBar, { "View Maximized" , "fullscreen" , {|| ::execEvent( "buttonViewMaximized_clicked" ) }, .f. } ) ) + aadd( aBtn, ::buildToolButton( qTBar, { "View Vertically Tiled" , "view_tiled" , {|| ::execEvent( "buttonViewStackedVert_clicked" ) }, .f. } ) ) + aadd( aBtn, ::buildToolButton( qTBar, { "View Horizontally Tiled" , "view_tiled" , {|| ::execEvent( "buttonViewStackedHorz_clicked" ) }, .f. } ) ) + aadd( aBtn, ::buildToolButton( qTBar, { "View Zoom In" , "zoomin" , {|| ::execEvent( "buttonViewZoomedIn_clicked" ) }, .f. } ) ) + aadd( aBtn, ::buildToolButton( qTBar, { "View Zoom Out" , "zoomout" , {|| ::execEvent( "buttonViewZoomedOut_clicked" ) }, .f. } ) ) aadd( aBtn, ::buildToolButton( qTBar, {} ) ) aadd( aBtn, ::buildToolButton( qTBar, { "Save layout" , "save" , {|| ::execEvent( "buttonSaveLayout_clicked" ) }, .f. } ) ) aadd( aBtn, ::buildToolButton( qTBar, {} ) ) @@ -984,8 +1138,9 @@ METHOD IdeDocks:buildStackedWidget() ::oStackedWidget:oWidget:setDocumentMode( .t. ) ::oStackedWidget:oWidget:setTabShape( QTabWidget_Triangular ) ::oStackedWidget:oWidget:setOption( QMdiArea_DontMaximizeSubWindowOnActivation, .t. ) - ::oStackedWidget:oWidget:setVerticalScrollBarPolicy( Qt_ScrollBarAsNeeded ) - ::oStackedWidget:oWidget:setHorizontalScrollBarPolicy( Qt_ScrollBarAsNeeded ) + ::oStackedWidget:oWidget:setVerticalScrollBarPolicy( Qt_ScrollBarAlwaysOn ) + ::oStackedWidget:oWidget:setHorizontalScrollBarPolicy( Qt_ScrollBarAlwaysOn ) + ::oStackedWidget:oWidget:setActivationOrder( QMdiArea_CreationOrder ) ::oDa:addChild( ::oStackedWidget ) diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 988d8b33a3..91c0cf66a4 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -448,7 +448,6 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) IF !hbqt_isEmptyQtPointer( pAct ) qAct := QAction():configure( pAct ) cAct := strtran( qAct:text(), "&", "" ) -HB_TRACE( HB_TR_ALWAYS, cAct ) SWITCH cAct CASE "Split Horizontally" ::oEditor:split( 1, oEdit ) diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index a31543f76c..e24797e81a 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -94,6 +94,8 @@ CLASS IdeSource METHOD IdeSource:new( cSource ) LOCAL cFilt, cPathFile, cPath, cFile, cExt + cSource := hbide_pathToOSPath( cSource ) + hbide_parseHbpFilter( cSource, @cFilt, @cPathFile ) hb_fNameSplit( cPathFile, @cPath, @cFile, @cExt ) @@ -102,7 +104,8 @@ METHOD IdeSource:new( cSource ) ::filter := cFilt ::path := hbide_pathNormalized( cPath, .t. ) ::file := cFile - ::ext := lower( cExt ) + //::ext := lower( cExt ) + ::ext := cExt RETURN Self