From 06a094209c9529ad131134d3cbdc7a532ea02133 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 5 Aug 2012 05:00:32 +0000 Subject: [PATCH] 2012-08-04 21:56 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/tools.prg + Implemented: removal of a editng panel with confirmation. All modified sources will be confirmed to be saved if modified before a panel is removed. ! Fixed: if order has not been changed, alert message requesting re-loading HbIDE will not be displayed. Before the message was displayed in every click on button. --- harbour/ChangeLog | 9 +++++ harbour/contrib/hbide/tools.prg | 62 +++++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 89b7e19f75..848a1b6857 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-04 21:56 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/tools.prg + + Implemented: removal of a editng panel with confirmation. + All modified sources will be confirmed to be saved if modified + before a panel is removed. + ! Fixed: if order has not been changed, alert message requesting + re-loading HbIDE will not be displayed. Before the message was + displayed in every click on button. + 2012-08-04 00:51 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + contrib/hbide/panels.ui * contrib/hbide/hbide.hbp diff --git a/harbour/contrib/hbide/tools.prg b/harbour/contrib/hbide/tools.prg index 319ce2819e..a453a6276e 100644 --- a/harbour/contrib/hbide/tools.prg +++ b/harbour/contrib/hbide/tools.prg @@ -1,4 +1,4 @@ -/* + /* * $Id$ */ @@ -138,6 +138,7 @@ CLASS IdeToolsManager INHERIT IdeObject METHOD execView( cView ) METHOD managePanels() METHOD arrangePanels() + METHOD deletePanel( cView ) ENDCLASS @@ -981,6 +982,7 @@ METHOD IdeToolsManager:managePanels() METHOD IdeToolsManager:arrangePanels() LOCAL a_:={}, v_:={}, w_:={}, n, i, cView + LOCAL lOrder := .f. ::oINI:nPanelsTabShape := ::oUIPnls:comboShape:currentIndex() ::oINI:nPanelsTabPosition := ::oUIPnls:comboPos:currentIndex() @@ -992,24 +994,64 @@ METHOD IdeToolsManager:arrangePanels() /* Rearrange panels */ FOR i := 1 TO ::oUIPnls:listOrder:count() cView := ::oUIPnls:listOrder:item( i - 1 ):text() - aadd( a_, ascan( ::oDK:aViewsInfo, {|e_| e_[ 1 ] == cView } ) ) + n := ascan( ::oDK:aViewsInfo, {|e_| e_[ 1 ] == cView } ) + aadd( a_, n ) + IF n != i + lOrder := .t. + ENDIF NEXT - FOR EACH n IN a_ - aadd( v_, ::oDK:aViewsInfo[ n ] ) - aadd( w_, ::oIde:aViews[ n ] ) - NEXT - ::oDK:aViewsInfo := v_ - ::oIde:aViews := w_ + IF lOrder + FOR EACH n IN a_ + aadd( v_, ::oDK:aViewsInfo[ n ] ) + aadd( w_, ::oIde:aViews[ n ] ) + NEXT + ::oDK:aViewsInfo := v_ + ::oIde:aViews := w_ + ENDIF /* tobe done at the end after re-order */ IF ! empty( cView := trim( ::oUIPnls:editView:text() ) ) ::oDK:setView( cView ) - ::oDK:setView( cView ) ENDIF - MsgBox( "You will need to close HbIDE for panels re-order to take effect !" ) + IF ::oUIPnls:comboDelete:currentIndex() >= 0 + ::deletePanel( ::oUIPnls:comboDelete:currentText() ) + ENDIF + /* Reordering needs that HbIDE be re-executed */ + IF lOrder + MsgBox( "You will need to close HbIDE for panels re-order to take effect !" ) + ENDIF RETURN Self /*----------------------------------------------------------------------*/ +METHOD IdeToolsManager:deletePanel( cView ) + LOCAL nTab, n, pTab, oEdit + + ::oDK:setView( cView ) + IF ! hbide_getYesNo( "Are you sure to remove - " + cView + " - panel ?" ) + RETURN NIL + ENDIF + + DO WHILE ::oIde:qTabWidget:count() > 0 + pTab := ::oIde:qTabWidget:widget( 0 ) + IF ( nTab := ascan( ::oIde:aTabs, {|e_| hbqt_IsEqual( e_[ 1 ]:oWidget, pTab ) } ) ) > 0 + oEdit := ::oIde:aTabs[ nTab, TAB_OEDITOR ] + IF ! Empty( oEdit:sourceFile ) .AND. !( ".ppo" == lower( oEdit:cExt ) ) + ::oSM:closeSource( nTab, .F., .F., .T. ) /* This deletes the tabs also */ + ENDIF + ENDIF + ENDDO + + n := ascan( ::oDK:aViewsInfo, {|e_| e_[ 1 ] == cView } ) + // + ::oStackedWidget:oWidget:removeSubWindow( ::oIde:aMdies[ n ] ) + ::oIde:aMdies[ n ]:setParent( QWidget() ) /* Release memory */ + hb_adel( ::oIde:aMdies , n, .t. ) + hb_adel( ::oDK:aViewsInfo, n, .t. ) + hb_adel( ::oIde:aViews , n, .t. ) + + RETURN Self + +/*----------------------------------------------------------------------*/