The Trunk: Tools-laza.202.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-laza.202.mcz

commits-2
Alexander Lazarević uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-laza.202.mcz

==================== Summary ====================

Name: Tools-laza.202
Author: laza
Time: 8 March 2010, 10:33:15.469 am
UUID: 74339003-ef0c-439f-b93d-1a01d40136eb
Ancestors: Tools-ar.201

Fixes file List display when sorted by size. (Visually this probably only works right with a fixed font)

=============== Diff against Tools-ar.201 ===============

Item was changed:
  ----- Method: FileList>>fileNameFormattedFrom:sizePad: (in category 'volume list and pattern') -----
  fileNameFormattedFrom: entry sizePad: sizePad
  "entry is a 5-element array of the form:
  (name creationTime modificationTime dirFlag fileSize)"
  | sizeStr nameStr dateStr |
  nameStr := entry isDirectory
  ifTrue: [entry name , self folderString]
  ifFalse: [entry name].
  dateStr := ((Date fromSeconds: entry modificationTime )
  printFormat: #(3 2 1 $. 1 1 2)) , ' ' ,
  (String streamContents: [:s |
  (Time fromSeconds: entry modificationTime \\ 86400)
  print24: true on: s]).
  sizeStr := entry fileSize asStringWithCommas.
  sortMode = #name ifTrue:
  [^ nameStr , '    (' , dateStr , ' ' , sizeStr , ')'].
  sortMode = #date ifTrue:
  [^ '(' , dateStr , ' ' , sizeStr , ') ' , nameStr].
  sortMode = #size ifTrue:
+ [^ '(' , (String new: sizePad - sizeStr size withAll: Character space) , sizeStr , ' ' , dateStr , ') ' , nameStr].
- [^ '(' , ((sizeStr size to: sizePad) collect: [:i | $ ]) , sizeStr , ' ' , dateStr , ') ' , nameStr].
  !

Item was changed:
  ----- Method: FileList>>listForPatterns: (in category 'private') -----
  listForPatterns: anArray
  "Make the list be those file names which match the pattern."
 
  | sizePad newList |
  newList := Set new.
  anArray do: [ :pat | newList addAll: (self entriesMatching: pat) ].
  newList := (SortedCollection sortBlock: self sortBlock) addAll: newList; yourself.
  sizePad := (newList inject: 0 into: [:mx :entry | mx max: (entry fileSize)])
+ asStringWithCommas size.
- asStringWithCommas size - 1.
  newList := newList collect: [ :e | self fileNameFormattedFrom: e sizePad: sizePad ].
 
  volList size = 1 ifTrue:
  ["Include known servers along with other desktop volumes"
  ^ newList asArray ,
  (ServerDirectory serverNames collect: [:n | '^' , n , self folderString])].
  ^ newList asArray!