The Inbox: Tools-ct.963.mcz

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

The Inbox: Tools-ct.963.mcz

commits-2
Christoph Thiede uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.963.mcz

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

Name: Tools-ct.963
Author: ct
Time: 9 April 2020, 4:27:49.889949 pm
UUID: 3f89993a-5c98-044d-8628-61d3815b5937
Ancestors: Tools-mt.957

Fixes a bug in FileList2 >> #endingSpecs, caused by introduction of read-only literals (see Kernel-eem.1318). Fixes MorphicUIManagerTest >> #testShowAllBinParts. Also contains some refactoring of related stuff.

=============== Diff against Tools-mt.957 ===============

Item was changed:
  ----- Method: FileList2 class>>endingSpecs (in category 'blue ui') -----
  endingSpecs
  "Answer a collection of specs to build the selective 'find anything' tool called by the Navigator. This version uses the services registry to do so."
+ "FileList2 morphicViewGeneralLoaderInWorld: Project current world"
+ | specs rejects |
- "FileList2 morphicViewGeneralLoaderInWorld: World"
- | categories specs rejects |
  rejects := #(addFileToNewZip: compressFile: openInZipViewer: extractAllFrom: openOn:).
- categories := #(
- ('Art' ('bmp' 'gif' 'jpg' 'jpeg' 'form' 'png' 'pcx' 'xbm' 'xpm' 'ppm' 'pbm'))
- ('Morphs' ('morph' 'morphs' 'sp'))
- ('Projects' ('extseg' 'project' 'pr'))
- ('MIDI' ('mid' 'midi'))
- ('Music' ('mp3'))
- ('Movies' ('movie' 'mpg' 'mpeg' 'qt' 'mov'))
- ('Flash' ('swf'))
- ).
-
- "('Books' ('bo'))"
- "('Code' ('st' 'cs'))"
- "('TrueType' ('ttf'))"
- "('3ds' ('3ds'))"
- "('Tape' ('tape'))"
- "('Wonderland' ('wrl'))"
- "('HTML' ('htm' 'html'))"
-
- categories first at: 2 put: ImageReadWriter allTypicalFileExtensions.
  specs := OrderedCollection new.
+ self fileExtensionsByCategory keysAndValuesDo: [:category :extensions |
+ | services okExtensions |
- categories do: [ :cat | | catSpecs catServices okExtensions services |
  services := Dictionary new.
- catSpecs := Array new: 3.
- catServices := OrderedCollection new.
  okExtensions := Set new.
+
+ extensions do: [:ext |
+ (FileServices itemsForFile: (FileDirectory default fullPathFor: 'fred.' , ext))
+ reject: [:service | rejects includes: service selector]
+ thenDo: [:service |
+ services at: service label put: service.
+ okExtensions add: ext]].
-
- cat second do: [ :ext | (FileServices itemsForFile: (FileDirectory default fullPathFor: ('fred.',ext))) do: [ :i |
- (rejects includes: i selector) ifFalse: [
- okExtensions add: ext.
- services at: i label put: i ]]].
- services do: [ :svc | catServices add: svc ].
  services isEmpty ifFalse: [
+ specs add: {
+ category.
+ okExtensions.
+ services values }]].
+ ^ specs!
- catSpecs at: 1 put: cat first;
- at: 2 put: okExtensions;
- at: 3 put: catServices.
- specs add: catSpecs ]
- ].
- ^specs
- !

Item was added:
+ ----- Method: FileList2 class>>fileExtensionsByCategory (in category 'blue ui') -----
+ fileExtensionsByCategory
+
+ ^ OrderedDictionary new
+ at: 'Art' put: ImageReadWriter allTypicalFileExtensions;
+ at: 'Morphs' put: #('morph' 'morphs' 'sp');
+ at: 'Projects' put: #('extseg' 'project' 'pr');
+ at: 'MIDI' put: #('mid' 'midi');
+ at: 'Music' put: #('mp3');
+ at: 'Movies' put: #('movie' 'mpg' 'mpeg' 'qt' 'mov');
+ at: 'Flash' put: #('swf');
+ "at: 'Books' put: #('bo');
+ at: 'Code' put: #('st' 'cs');
+ at: 'TrueType' put: #('ttf');
+ at: '3ds' put: #('3ds');
+ at: 'Tape' put: #('tape');
+ at: 'Wonderland' put: #('wrl');
+ at: 'HTML' put: #('htm' 'html');"
+ yourself!

Item was changed:
  ----- Method: FileList2 class>>update:in:fileTypeRow:morphUp: (in category 'morphic ui') -----
  update: actionRow in: window fileTypeRow: fileTypeRow morphUp: morph
 
  | fileTypeInfo info2 buttons textColor1 fileSuffixes fileActions aFileList fileTypeString |
+ (morph notNil and: [(morph valueOfProperty: #enabled) not]) ifTrue: [^ self].
+
+ fileTypeRow submorphsDo: [:sub |
-
- (morph notNil and:[(morph valueOfProperty: #enabled) not]) ifTrue: [^self].
- fileTypeRow submorphsDo: [ :sub |
  sub color: (
  sub == morph
  ifTrue: [Color white]
  ifFalse: [(sub valueOfProperty: #enabled)
+ ifTrue: [Color transparent]
+ ifFalse: [Color gray]])].
+ fileTypeString := morph isNil
+ ifTrue: ['xxxx']
+ ifFalse: [morph valueOfProperty: #buttonText].
+
- ifTrue: [Color transparent] ifFalse: [Color gray]]
- ).
- ].
- fileTypeString := morph isNil ifTrue:['xxxx'] ifFalse:[morph valueOfProperty: #buttonText].
-
  aFileList := window valueOfProperty: #FileList.
  textColor1 := Color r: 0.742 g: 0.839 b: 1.0.
  actionRow removeAllMorphs.
  fileTypeInfo := self endingSpecs.
+ info2 := fileTypeInfo
+ detect: [:each | each first = fileTypeString]
+ ifNone: [nil].
+ info2
+ ifNil: [
+ buttons := OrderedCollection new]
+ ifNotNil: [
- info2 := fileTypeInfo detect: [ :each | each first = fileTypeString] ifNone: [ nil ].
- info2 isNil
- ifTrue:[
- buttons := OrderedCollection new
- ]
- ifFalse:[
  fileSuffixes := info2 second.
  fileActions := info2 third.
+ buttons := fileActions
+ collect: [ :each | aFileList blueButtonForService: each textColor: textColor1 inWindow: window ]
+ as: OrderedCollection.
- buttons := fileActions collect: [ :each | aFileList blueButtonForService: each textColor: textColor1 inWindow: window ].
  buttons do: [ :each |
+ each fillWithRamp: Color lightGreen oriented: (0.75 @ 0)]].
- each fillWithRamp: Color lightGreen oriented: (0.75 @ 0).
- ].
- ].
  buttons addLast: (self
+ blueButtonText: 'Cancel'
+ textColor: textColor1
+ color: Color lightRed
+ inWindow: window
+ balloonText: 'Cancel this search'
+ selector: #cancelHit
+ recipient: aFileList).
+ buttons do: [:each | actionRow addMorphBack: each].
- blueButtonText: 'Cancel'
- textColor: textColor1
- color: Color lightRed
- inWindow: window
- balloonText: 'Cancel this search' selector: #cancelHit recipient: aFileList).
- buttons do: [ :each | actionRow addMorphBack: each].
  window fullBounds.
+ fileSuffixes ifNotNil: [
- fileSuffixes isNil ifFalse:[
  aFileList fileSelectionBlock: (
+ self selectionBlockForSuffixes: (fileSuffixes collect: [ :each | '*.',each]))].
- self selectionBlockForSuffixes: (fileSuffixes collect: [ :each | '*.',each])
- ).
- ].
  aFileList updateFileList.!