'From Squeak3.1alpha of 5 February 2001 [latest update: #4281] on 23 August 2001 at 6:12:30 pm'! "Change Set: soundInNav Date: 23 August 2001 Author: Bob Arning Add an option sound control to the project navigator (Mac only)" Preferences addPreference: #includeSoundControlInNavigator category: 'media' default: false balloonHelp: 'If true, add a system sound control (Mac only) to the project navigator.'! AlignmentMorphBob1 subclass: #ProjectNavigationMorph instanceVariableNames: 'mouseInside soundSlider ' classVariableNames: 'LastManualPlacement ' poolDictionaries: '' category: 'Morphic-Navigators'! !ProjectNavigationMorph methodsFor: 'as yet unclassified' stamp: 'RAA 8/23/2001 18:10'! checkForRebuild | lastScreenMode flapsSuppressed | lastScreenMode _ ScreenController lastScreenModeSelected ifNil: [false]. flapsSuppressed _ CurrentProjectRefactoring currentFlapsSuppressed. ((self valueOfProperty: #currentNavigatorVersion) = self currentNavigatorVersion and: [lastScreenMode = self inFullScreenMode and: [flapsSuppressed = self inFlapsSuppressedMode and: [(self valueOfProperty: #includeSoundControlInNavigator) = Preferences includeSoundControlInNavigator]]]) ifFalse: [ self setProperty: #includeSoundControlInNavigator toValue: Preferences includeSoundControlInNavigator. self setProperty: #flapsSuppressedMode toValue: flapsSuppressed. self setProperty: #showingFullScreenMode toValue: lastScreenMode. self setProperty: #currentNavigatorVersion toValue: self currentNavigatorVersion. self removeAllMorphs. self addButtons. ]. ! ! !ProjectNavigationMorph methodsFor: 'as yet unclassified' stamp: 'RAA 8/23/2001 17:47'! currentNavigatorVersion ^28 "since these guys get saved, we fix them up if they are older versions"! ! !ProjectNavigationMorph methodsFor: 'as yet unclassified' stamp: 'RAA 8/23/2001 18:06'! makeTheButtons ^{ self buttonShare. self buttonPrev. self buttonNext. self buttonPublish. self buttonNewer. self buttonTell. self buttonFind. self buttonFullScreen. self buttonFlaps. self buttonPaint. }, ( Preferences includeSoundControlInNavigator ifTrue: [{self buttonSound}] ifFalse: [#()] ), { self buttonUndo. self buttonNewProject. } ! ! !ProjectNavigationMorph methodsFor: 'as yet unclassified' stamp: 'RAA 8/23/2001 18:11'! step | wb | owner ifNil: [^ self]. (self ownerThatIsA: HandMorph) ifNotNil: [^self]. self checkForRebuild. owner == self world ifTrue: [ owner addMorphInLayer: self. wb _ self worldBounds. self left < wb left ifTrue: [self left: wb left]. self right > wb right ifTrue: [self right: wb right]. self positionVertically. ].! ! !ProjectNavigationMorph methodsFor: 'the buttons' stamp: 'RAA 8/23/2001 17:45'! buttonSound | myButton m | myButton _ RectangleMorph new borderWidth: 1; cornerStyle: #rounded; borderColor: #raised; color: self colorForButtons; setBalloonText: 'Change sound volume'; on: #mouseDown send: #soundDownEvt:morph: to: self; on: #mouseStillDown send: #soundStillDownEvt:morph: to: self; on: #mouseUp send: #soundUpEvt:morph: to: self; yourself. myButton addMorph: (m _ self speakerIcon lock). myButton extent: m extent + (myButton borderWidth + 6). m position: myButton center - (m extent // 2). ^myButton ! ! !ProjectNavigationMorph methodsFor: 'the buttons' stamp: 'RAA 8/23/2001 17:05'! speakerIcon ^ImageMorph new image: ( (Form extent: 19@18 depth: 8 fromArray: #( 0 0 1493172224 0 0 0 0 1493172224 0 0 0 138 1493172224 0 0 0 35509 2315255808 0 0 0 9090522 2315255808 0 0 0 2327173887 2315255819 0 0 138 3051028442 2315255819 0 0 1505080590 4294957786 2315255808 184549376 0 3053453311 4292532917 1493172224 184549376 0 1505080714 3048584629 1493172224 184549376 0 9079434 3048584629 1493172224 184549376 0 138 2327164341 1493172235 0 0 0 2324346293 1493172235 0 0 0 9079477 1493172224 0 0 0 35466 1493172224 0 0 0 138 0 0 0 0 0 0 0 0 0 0 0 0 0) offset: 0@0) ); setBalloonText: 'Quiet'; on: #mouseUp send: #yourself to: 1 ! ! !ProjectNavigationMorph methodsFor: 'the actions' stamp: 'RAA 8/23/2001 16:55'! setMacVolume: x SoundPlayer setVolumeLeft: x volumeRight: x. ! ! !ProjectNavigationMorph methodsFor: 'the actions' stamp: 'RAA 8/23/2001 18:00'! soundDownEvt: a morph: b soundSlider ifNotNil: [soundSlider delete]. (soundSlider _ RectangleMorph new) setProperty: #morphicLayerNumber toValue: 1; extent: b width @ (b width * 3); color: self colorForButtons; borderColor: #raised; bottomLeft: b boundsInWorld origin. soundSlider addMorph: ( RectangleMorph new color: self colorForButtons; borderColor: #raised; extent: b width @ 8; center: soundSlider center ). soundSlider openInWorld.! ! !ProjectNavigationMorph methodsFor: 'the actions' stamp: 'RAA 8/23/2001 17:58'! soundStillDownEvt: evt morph: b | y pct | soundSlider ifNil: [^self]. y _ evt hand position y. (y between: soundSlider top and: soundSlider bottom) ifTrue: [ pct _ (soundSlider bottom - y) asFloat / soundSlider height. self setMacVolume: pct. soundSlider firstSubmorph top: y - 5. ]. ! ! !ProjectNavigationMorph methodsFor: 'the actions' stamp: 'RAA 8/23/2001 17:43'! soundUpEvt: a morph: b soundSlider ifNotNil: [soundSlider delete]. soundSlider _ nil.! ! ProjectNavigationMorph removeSelector: #lowVolumeIcon! ProjectNavigationMorph removeSelector: #makeVolumeSlider!