'From Squeak3.1alpha of 5 February 2001 [latest update: #3796] on 6 March 2001 at 12:57:42 pm'! "Change Set: mpegTweaks Date: 6 March 2001 Author: Bob Arning - moved MPEGPlayerMorph to category Morphic-Media so it will be easier to find in new morph menu - added nicer file selector"! Morph subclass: #MPEGPlayerMorph instanceVariableNames: 'foo play progress videoMorph volume playOrStop ledWasUndeclared ' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Media'! !FileList methodsFor: 'initialization' stamp: 'RAA 3/6/2001 12:35'! optionalButtonRow | aRow aButton | aRow _ AlignmentMorph newRow beSticky. aRow color: Color transparent. aRow clipSubmorphs: true. aRow addTransparentSpacerOfSize: (5@0). self optionalButtonSpecs do: [:spec | aButton _ PluggableButtonMorph on: self getState: nil action: spec second. aButton color: Color transparent; hResizing: #spaceFill; vResizing: #spaceFill; useRoundedCorners; label: spec first asString; askBeforeChanging: true; onColor: Color transparent offColor: Color transparent. aRow addMorphBack: aButton. aRow addTransparentSpacerOfSize: (3 @ 0). aButton setBalloonText: spec fourth. aRow addTransparentSpacerOfSize: (3 @ 0). (spec second == #sortBySize) ifTrue: [aRow addTransparentSpacerOfSize: (4@0)]]. ^ aRow! ! !FileList2 class methodsFor: 'button specs' stamp: 'RAA 3/6/2001 12:16'! specsForFileSelector ^ #( ('OK' okHit sortingByName 'use the currently selected file') ('Cancel' cancelHit sortingByDate 'cancel this request') ) ! ! !FileList2 class methodsFor: 'modal dialogs' stamp: 'RAA 3/6/2001 12:40'! modalFileSelector | window | window _ self morphicViewFileSelector. window openCenteredInWorld. [window world notNil] whileTrue: [ window outermostWorldMorph doOneCycleNow. ]. ^(window valueOfProperty: #fileListModel) getSelectedFile! ! !FileList2 class methodsFor: 'modal dialogs' stamp: 'RAA 3/6/2001 12:47'! modalFileSelectorForSuffixes: aList | window aFileList | window _ self morphicViewFileSelectorForSuffixes: aList. aFileList _ window valueOfProperty: #fileListModel. window openCenteredInWorld. [window world notNil] whileTrue: [ window outermostWorldMorph doOneCycleNow. ]. ^aFileList getSelectedFile! ! !FileList2 class methodsFor: 'utility' stamp: 'RAA 3/6/2001 12:39'! textRow: aString ^AlignmentMorph newRow wrapCentering: #center; cellPositioning: #leftCenter; color: Color transparent; layoutInset: 0; addMorph: ( AlignmentMorph newColumn wrapCentering: #center; cellPositioning: #topCenter; color: Color transparent; vResizing: #shrinkWrap; layoutInset: 0; addMorph: ( AlignmentMorph newRow wrapCentering: #center; cellPositioning: #leftCenter; color: Color transparent; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 0; addMorph: ((StringMorph contents: aString) color: Color blue; lock) ) )! ! !FileList2 class methodsFor: 'morphic ui' stamp: 'RAA 3/6/2001 12:47'! morphicViewFileSelector ^self morphicViewFileSelectorForSuffixes: nil ! ! !FileList2 class methodsFor: 'morphic ui' stamp: 'RAA 3/6/2001 12:48'! morphicViewFileSelectorForSuffixes: aList | dir aFileList window fixedSize midLine gap | dir _ FileDirectory default. aFileList _ self new directory: dir. aFileList optionalButtonSpecs: self specsForFileSelector. aList ifNotNil: [ aFileList fileSelectionBlock: [ :entry :myPattern | entry isDirectory ifTrue: [ false ] ifFalse: [ aList includes: (aFileList getSuffix: entry name asLowercase) ] ] fixTemps. ]. window _ BorderedMorph new layoutPolicy: ProportionalLayout new; color: Color lightBlue; borderColor: Color blue; borderWidth: 4; layoutInset: 4; extent: 600@400; useRoundedCorners. window setProperty: #fileListModel toValue: aFileList. aFileList modalView: window. midLine _ 0.4. fixedSize _ 25. gap _ 5. self addFullPanesTo: window from: { {self textRow: 'Please select a file'. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@fixedSize corner: 0@(fixedSize * 2)}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. gap @(fixedSize * 2) corner: gap negated@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. gap@(fixedSize * 2) corner: gap negated@0}. }. aFileList postOpen. ^ window ! ! !FileList2 class methodsFor: 'morphic ui' stamp: 'RAA 3/6/2001 12:43'! morphicViewImageViewer | dir aFileList window midLine fixedSize | dir _ FileDirectory default. aFileList _ self new directory: dir. aFileList optionalButtonSpecs: self specsForImageViewer. aFileList fileSelectionBlock: [ :entry :myPattern | entry isDirectory ifTrue: [ false ] ifFalse: [ #('bmp' 'gif' 'jpg' 'form' 'png') includes: (aFileList getSuffix: entry name asLowercase) ] ] fixTemps. window _ (SystemWindow labelled: dir pathName) model: aFileList. fixedSize _ 25. midLine _ 0.4. self addFullPanesTo: window from: { {aFileList optionalButtonRow. 0 @ 0 corner: 1 @ 0. 0@0 corner: 0@fixedSize}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@1. 0@fixedSize corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@1. 0@fixedSize corner: 0@0}. }. aFileList postOpen. ^ window ! ! !MPEGPlayerMorph methodsFor: 'as yet unclassified' stamp: 'RAA 3/6/2001 12:54'! openMPEGFile | file | (file _ FileList2 modalFileSelectorForSuffixes: #('mpg' 'mpeg')) ifNil: [^self]. foo _ MPEGPlayer2 openFile: file fullName asLowercase. foo ifNil: [^nil]. videoMorph ifNotNil:[videoMorph delete. videoMorph _ nil]. foo videoMorph ifNotNil: [self addMorph: (videoMorph _ foo videoMorph)]. progress setValue: 0! !