--- a/AbstractFileBrowser.st Tue Aug 02 15:15:53 2005 +0200
+++ b/AbstractFileBrowser.st Tue Aug 02 15:16:10 2005 +0200
@@ -49,7 +49,7 @@
List subclass:#DirectoryHistory
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath
- backForwardList backForwardIndex'
+ backForwardList backForwardIndex historySize'
classVariableNames:'HistorySize'
poolDictionaries:''
privateIn:AbstractFileBrowser
@@ -279,10 +279,10 @@
!
commandHistorySize
-
"max no of entries in the HistoryList "
+
CommandHistorySize isNil ifTrue:[
- CommandHistorySize := 50
+ CommandHistorySize := 150
].
^ CommandHistorySize
!
@@ -2440,13 +2440,14 @@
!AbstractFileBrowser methodsFor:'actions history'!
addToCommandHistory:aCommandString for:aFilename
- |cmd suffix cmdHist|
+ |cmd suffix cmdHist historySize|
cmdHist := self class commandHistory.
(aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[
cmdHist notNil ifTrue:[
cmdHist addFirst:aCommandString.
- cmdHist size > self class commandHistorySize ifTrue:[
+ historySize := self class commandHistorySize.
+ (historySize notNil and:[cmdHist size > historySize]) ifTrue:[
cmdHist removeLast
]
].
@@ -2468,7 +2469,7 @@
| fileName|
- fileName := self dirHistory goBackward.
+ fileName := self directoryHistory goBackward.
fileName notNil ifTrue:[
self gotoFile:(fileName asFilename).
]
@@ -2479,7 +2480,7 @@
| fileName|
- fileName := self dirHistory goForward.
+ fileName := self directoryHistory goForward.
fileName notNil ifTrue:[
self gotoFile:(fileName asFilename).
] ifFalse:[
@@ -2879,6 +2880,11 @@
!AbstractFileBrowser methodsFor:'aspects-history'!
dirHistory
+ "obsolete"
+ ^ self directoryHistory
+!
+
+directoryHistory
^ self class directoryHistory
!
@@ -3167,7 +3173,7 @@
self enableDirectoryUp value:(((size == 1) and:[newDirectories first isRootDirectory not]) "or:[(rootInTreeView notNil and:[rootInTreeView value asFilename isRootDirectory not])]").
newDirectories notEmpty ifTrue:[
- self dirHistory addToHistory:(newDirectories first asString).
+ self directoryHistory addToHistory:(newDirectories first asString).
].
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not).
self enableGotoDefault value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not).
@@ -3817,12 +3823,12 @@
canBackward
- ^ self dirHistory canBackward.
+ ^ self directoryHistory canBackward.
!
canForward
- ^ self dirHistory canForward.
+ ^ self directoryHistory canForward.
!
gotoBookmarksMenuSpec
@@ -3861,7 +3867,7 @@
menu := Menu new.
menu receiver:self.
- self dirHistory isEmpty ifTrue:[^ nil].
+ self directoryHistory isEmpty ifTrue:[^ nil].
backOrForward == #back ifTrue:[
currentSel := self currentDirectories value.
currentSel size == 1 ifTrue:[
@@ -3869,9 +3875,9 @@
] ifFalse:[
currentPath := nil.
].
- pathList := self dirHistory getBackCollection.
+ pathList := self directoryHistory getBackCollection.
] ifFalse:[
- pathList := self dirHistory getForwardCollection.
+ pathList := self directoryHistory getForwardCollection.
].
pathList isEmpty ifTrue:[ ^ nil].
pathList do:[:aPath|
@@ -3989,18 +3995,18 @@
menu := Menu new.
menu receiver:self.
- self dirHistory isEmpty ifTrue:[^ nil].
+ self directoryHistory isEmpty ifTrue:[^ nil].
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:(resources string:'Clear History').
text := (resources string:'Clear History').
removeItem := MenuItem new.
removeItem translateLabel:true.
removeItem label:text.
removeItem value:[
- self dirHistory removeAll.
+ self directoryHistory removeAll.
self enableForward value:self canForward.
self enableBack value:self canBackward.
].
- histCopy := self dirHistory.
+ histCopy := self directoryHistory.
histCopy do:[:aFile|
menu addItem:(MenuItem label:aFile asString value:[
self setCurrentFileName:(aFile path asFilename).
@@ -6489,16 +6495,25 @@
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'!
-historySize
-
- ^ 20
+defaultHistorySize
+ ^ 50
! !
!AbstractFileBrowser::DirectoryHistory class methodsFor:'new'!
new
-
- ^ super new initialize.
+ ^ self basicNew initialize.
+! !
+
+!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'!
+
+historySize
+ historySize isNil ifTrue:[^ self class defaultHistorySize].
+ ^ historySize
+!
+
+historySize:aNumber
+ historySize := aNumber
! !
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'!
@@ -6510,7 +6525,7 @@
self backForwardListAdd:aPath.
item isNil ifTrue:[
" not already in history"
- self size >= self class historySize ifTrue:[
+ self size >= self historySize ifTrue:[
self removeLast.
].
item := DirectoryHistoryItem path:aPath.
@@ -6524,7 +6539,6 @@
!
backForwardListAdd:aPath
-
|pathIndex|
pathIndex := backForwardList indexOf:aPath.
@@ -6541,7 +6555,7 @@
].
backForwardList add:aPath afterIndex:backForwardIndex.
backForwardIndex := backForwardIndex + 1.
- backForwardIndex > self class historySize ifTrue:[
+ backForwardIndex > self historySize ifTrue:[
backForwardList removeFirst.
backForwardIndex := backForwardIndex - 1.
].
@@ -6777,5 +6791,5 @@
!AbstractFileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.300 2005-07-13 15:41:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.301 2005-08-02 13:16:10 cg Exp $'
! !