From 8b4250514db15b0e33e078e115eea4fc19c5c1a0 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 3 Sep 2012 22:44:00 +0000 Subject: [PATCH] 2012-09-03 15:35 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/editor.prg * contrib/hbide/misc.prg * contrib/hbide/saveload.prg * contrib/hbide/setup.ui % Changed: naming of => % Restored: the source extension on the editor tabs by default. + Implemented: to toggle source extension to be removed from source tabs to get more sources viewable at any given time. Activation: This is not in-place activable, restart of HbIDE is required. + Implemented: source tabs having closable button. Activation: This is not in-place activable, restart of HbIDE is required. This is not the default, needs to be activated. --- harbour/ChangeLog | 16 ++++++++++++ harbour/contrib/hbide/editor.prg | 11 +++++++- harbour/contrib/hbide/misc.prg | 5 ++-- harbour/contrib/hbide/saveload.prg | 14 +++++++++- harbour/contrib/hbide/setup.ui | 41 +++++++++++++++++++++++++++++- 5 files changed, 81 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index de305b69e0..67f9139573 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-03 15:35 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/editor.prg + * contrib/hbide/misc.prg + * contrib/hbide/saveload.prg + * contrib/hbide/setup.ui + % Changed: naming of => + % Restored: the source extension on the editor tabs by default. + + Implemented: to toggle source extension to be removed from + source tabs to get more sources viewable at any given time. + Activation: + This is not in-place activable, restart of HbIDE is required. + + Implemented: source tabs having closable button. + Activation: + This is not in-place activable, restart of HbIDE is required. + This is not the default, needs to be activated. + 2012-09-03 10:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/main.prg * contrib/hbxbp/listbox.prg diff --git a/harbour/contrib/hbide/editor.prg b/harbour/contrib/hbide/editor.prg index 647dc0ae93..03cc4dc97d 100644 --- a/harbour/contrib/hbide/editor.prg +++ b/harbour/contrib/hbide/editor.prg @@ -81,6 +81,7 @@ #define __qDocContentsChange__ 2004 #define __qTimeSave_timeout__ 2005 #define __qTab_contextMenu__ 2006 +#define __qTabWidget_tabCloseRequested__ 2007 #define __selectionMode_stream__ 1 @@ -1749,6 +1750,10 @@ METHOD IdeEditor:execEvent( nEvent, p, p1, p2 ) SWITCH nEvent + CASE __qTabWidget_tabCloseRequested__ + ::oSM:closeSource( p + 1 ) + EXIT + CASE __qDocModificationChanged__ ::setTabImage() EXIT @@ -1811,12 +1816,16 @@ METHOD IdeEditor:buildTabPage( cSource ) IF Empty( cSource ) ::oTab:caption := "Untitled " + hb_ntos( hbide_getNextUntitled() ) ELSE - ::oTab:caption := ::cFile // + ::cExt /* to reduce the tab width which eventually leads to good visibility of tabs */ + ::oTab:caption := ::cFile + iif( ::oINI:lTabRemoveExt, "", ::cExt ) ENDIF ::oTab:minimized := .F. ::oTab:create() + IF ::oINI:lTabAddClose + ::qTabWidget:setTabsClosable( .T. ) + ::qTabWidget:connect( "tabCloseRequested(int)", {|i| ::execEvent( __qTabWidget_tabCloseRequested__, i ) } ) + ENDIF ::qTabWidget:setTabTooltip( ::qTabWidget:indexOf( ::oTab:oWidget ), cSource ) ::oTab:tabActivate := {|mp1,mp2,oXbp| ::activateTab( mp1, mp2, oXbp ) } diff --git a/harbour/contrib/hbide/misc.prg b/harbour/contrib/hbide/misc.prg index df4e0b17ce..9c2c3d9630 100644 --- a/harbour/contrib/hbide/misc.prg +++ b/harbour/contrib/hbide/misc.prg @@ -1966,7 +1966,7 @@ FUNCTION app_image( cName ) /*----------------------------------------------------------------------*/ -FUNCTION hbide_isCompilerSource( cSource, cIncList ) +STATIC FUNCTION hbide_isCompilerSource( cSource, cIncList ) LOCAL cExt, aExt DEFAULT cIncList TO ".c,.cpp,.prg,.hb,.rc,.res,.hbm,.hbc,.qrc,.ui,.hbp" @@ -1974,8 +1974,7 @@ FUNCTION hbide_isCompilerSource( cSource, cIncList ) cIncList := lower( cIncList ) aExt := hb_aTokens( lower( cIncList ), "," ) - hb_FNameSplit( cSource, , , @cExt ) - cExt := lower( cExt ) + cExt := lower( hb_FNameExt( cSource ) ) RETURN ascan( aExt, {|e| cExt == e } ) > 0 diff --git a/harbour/contrib/hbide/saveload.prg b/harbour/contrib/hbide/saveload.prg index 6c60e4bc17..d244eeb062 100644 --- a/harbour/contrib/hbide/saveload.prg +++ b/harbour/contrib/hbide/saveload.prg @@ -295,6 +295,9 @@ CLASS IdeINI INHERIT IdeObject DATA cISMethods INIT "new" DATA cISFormat INIT "class:method" + DATA lTabRemoveExt INIT .F. + DATA lTabAddClose INIT .F. + METHOD new( oIde ) METHOD create( oIde ) METHOD destroy() @@ -561,6 +564,8 @@ METHOD IdeINI:save( cHbideIni ) AAdd( txt_, "ISFormat" + "=" + ::cISFormat ) // AAdd( txt_, "SelToolbar" + "=" + iif( ::lSelToolbar , "YES", "NO" ) ) + AAdd( txt_, "TabRemoveExt" + "=" + iif( ::lTabRemoveExt , "YES", "NO" ) ) + AAdd( txt_, "TabAddClose" + "=" + iif( ::lTabAddClose , "YES", "NO" ) ) aadd( txt_, "" ) aadd( txt_, "[PROJECTS]" ) @@ -925,6 +930,8 @@ METHOD IdeINI:load( cHbideIni ) CASE "ISFormat" ; ::cISFormat := cVal ; EXIT // CASE "SelToolbar" ; ::lSelToolbar := !( cVal == "NO" ) ; EXIT + CASE "TabRemoveExt" ; ::lTabRemoveExt := !( cVal == "NO" ) ; EXIT + CASE "TabAddClose" ; ::lTabAddClose := !( cVal == "NO" ) ; EXIT ENDSWITCH ENDIF @@ -1250,7 +1257,7 @@ CLASS IdeSetup INHERIT IdeObject DATA oINI DATA qOrgPalette DATA aItems INIT {} - DATA aTree INIT { "General", "Intelli-sense", "Selections", "Font", "Paths", "Variables", "Dictionaries", "Themes", "Formatting", "VSS" } + DATA aTree INIT { "General", "Intelli-sense", "Selections", "Miscellaneous", "Paths", "Variables", "Dictionaries", "Themes", "Formatting", "VSS" } DATA aStyles INIT { "cleanlooks", "windows", "windowsxp", ; "windowsvista", "cde", "motif", "plastique", "macintosh" } DATA aKeyItems INIT {} @@ -1612,6 +1619,8 @@ METHOD IdeSetup:retrieve() ::oINI:cISData := ::oUI:comboISData : currentText() ::oINI:cISMethods := ::oUI:comboISMethods : currentText() ::oINI:cISFormat := ::oUI:comboISFormat : currentText() + ::oINI:lTabRemoveExt := ::oUI:chkTabRemoveExt : isChecked() + ::oINI:lTabAddClose := ::oUI:chkTabAddClose : isChecked() RETURN Self @@ -1743,6 +1752,9 @@ METHOD IdeSetup:populate() ::oUI:comboISMethods : setCurrentIndex( AScan( { "new", "new;create", "new;create;destroy" }, {|e| e == ::oINI:cISMethods } ) - 1 ) ::oUI:comboISFormat : setCurrentIndex( iif( ::oINI:cISFormat == "class:method", 0, 1 ) ) + ::oUI:chkTabRemoveExt : setChecked( ::oINI:lTabRemoveExt ) + ::oUI:chkTabAddClose : setChecked( ::oINI:lTabAddClose ) + ::connectSlots() ::pushThemesData() diff --git a/harbour/contrib/hbide/setup.ui b/harbour/contrib/hbide/setup.ui index b3b15647f1..d5a4e73af8 100644 --- a/harbour/contrib/hbide/setup.ui +++ b/harbour/contrib/hbide/setup.ui @@ -44,7 +44,7 @@ - 0 + 3 @@ -1533,6 +1533,45 @@ + + + + 176 + 236 + 165 + 117 + + + + Source Editor Tabs + + + + + 12 + 20 + 137 + 17 + + + + Remove File Extension ? + + + + + + 12 + 44 + 137 + 17 + + + + Add Closing Button ? + + +