[squeak-dev] The Inbox: MorphicExtras-tpr.166.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 23 19:35:08 UTC 2015


tim Rowledge uploaded a new version of MorphicExtras to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-tpr.166.mcz

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

Name: MorphicExtras-tpr.166
Author: tpr
Time: 23 November 2015, 11:34:44.792 am
UUID: ec623673-dea1-40f9-a046-7bb0791cdb06
Ancestors: MorphicExtras-cmm.164, MorphicExtras-kfr.165

Handle the SoundRecorder Warning exception in EventRecordingmorph and RecordingControlsMorph to notify the user.

Note that BaseSoundSystem>>#randomBitsFromSoundInput: is not altered - the best I can think of is to let the debugger  warning get raised here since it isn't a UI item. It may be better to handel the exceptio to either do nothing (so there will be bad random numbers) or delgate to some other randomiser.

=============== Diff against MorphicExtras-cmm.164 ===============

Item was changed:
  ----- Method: EventRecorderMorph>>resumeRecordIn: (in category 'pause/resume') -----
  resumeRecordIn: aWorld
  
  	recHand := aWorld activeHand ifNil: [aWorld primaryHand].
  	recHand newKeyboardFocus: aWorld.
  	recHand addEventListener: self.
  
  	lastEvent := nil.
  	state := #record.
  
  	voiceRecorder ifNotNil:
  		[voiceRecorder clearRecordedSound.
+ 		[voiceRecorder resumeRecording] on: Warning do:[:ex|
+ 			self inform: ex tag "NB - it may be better to simply ignore this; all that would happen is nothing gets recorded"].
- 		voiceRecorder resumeRecording.
  		startSoundEvent := MorphicUnknownEvent new setType: #startSound argument: nil hand: nil stamp: Time millisecondClockValue.
  		tapeStream nextPut: startSoundEvent].
  
  	self synchronize.
  !

Item was changed:
  ----- Method: RecordingControlsMorph>>record (in category 'button commands') -----
  record
  
  	recorder clearRecordedSound.
+ 	[recorder resumeRecording] on: Warning do:[:ex|
+ 		self inform: ex tag]
- 	recorder resumeRecording.
  !

Item was removed:
- ----- Method: ReferenceMorph>>handlesMouseMove: (in category 'event handling') -----
- handlesMouseMove: anEvent 
- 	^true!

Item was changed:
  BookMorph subclass: #StoryboardBookMorph
  	instanceVariableNames: 'alansSliders panAndTiltFactor zoomFactor zoomController'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'MorphicExtras-Books'!
  
+ !StoryboardBookMorph commentStamp: 'kfr 5/17/2015 23:37' prior: 0!
+ A BookMorph variant whose pages are instances of ZoomAndScrollMorph. 
+ I have a control area where the user may pan, tilt and zoom over the image shown in the page.
- !StoryboardBookMorph commentStamp: '<historical>' prior: 0!
- A BookMorph variant whose pages are instances of ZoomAndScrollMorph. I have a control area where the user may pan, tilt and zoom over the image shown in the page.
  
+ StoryboardBookMorph new openInWorld
+ 
+ Drop an picture at the book.
+ 
+ Mouse
+ - drag up and down to tilt
- - drag up and down to zoom in and out
  - drag left and right to pan
+ - shift-drag up and down to zoom in and out
+ 
+ Keyboard
+ Arrow keys pan and tilts the image
+ X and Z zoom in and out 
+ 
+ From top left in control panel you pull out stills from diffrent zoom, tilt and pan posititons.
+ Drop these after eachother to make an animation script.
+ The numbers between the stills are playback speed, that can be edited.
+ Save script from the scripts halo menu.
+ 
+ Playback script from controll panels halo menu.
+ 
+ !
- - shift-drag up and down to tilt.!

Item was changed:
  ----- Method: StoryboardBookMorph>>initialize (in category 'initialization') -----
  initialize
  
+ 	newPagePrototype := ZoomAndScrollMorph new extent: 300 at 300.
- 	newPagePrototype := ZoomAndScrollMorph new extent: Display extent // 3.
  	zoomController := ZoomAndScrollControllerMorph new
+ 			setBalloonText: 'Drag in here to zoom, tilt and pan the page above';
+ 			extent: 246 at 147.
- 			setBalloonText: 'Drag in here to zoom, tilt and pan the page above'.
  
  	super initialize.
+ 	zoomController openInWorld.
+ 	
+ 	"tool := RectangleMorph new extent: 250 at 170; layoutPolicy: TableLayout new.
+ 	tool addMorph: zoomController.
  
- 	self addMorphBack: zoomController.
- 
  	alansSliders := {
  		{#changeTiltFactor: . #getTiltFactor . 'Pan and tilt sensitivity'}.
  		{#changeZoomFactor: . #getZoomFactor . 'Zoom sensitivity'}.
  	} collect: [ :sData |
  		{
  			SimpleSliderMorph new
  				extent: 150 at 10;
  				color: Color orange;
  				sliderColor: Color gray;
  				target: self; 
  				actionSelector: sData first;
  				setBalloonText: sData third;
  				adjustToValue: (self perform: sData second).
  			sData second
  		}
  	].
+ 	alansSliders do: [ :each | tool addMorphBack: each first].
+ 	tool openInWorld"
- 	alansSliders do: [ :each | self addMorphBack: each first]
  !

Item was changed:
  ----- Method: ZoomAndScrollControllerMorph>>changeKeys (in category 'as yet unclassified') -----
  changeKeys
  
  	upDownCodes := Dictionary new.
+ 	changeKeysState := #(up down left right in out).
- 	changeKeysState := #(up down in out).
  	self changed.!

Item was changed:
  ----- Method: ZoomAndScrollControllerMorph>>initialize (in category 'initialization') -----
  initialize
  	"initialize the state of the receiver"
  	| displayer dataMorph |
  	super initialize.
  	""
  	hasFocus := true.
  	currentKeyDown := Set new.
  	upDownCodes := Dictionary new.
+ 	upDownCodes at:  31 put: #up; "arrow keys"
+ 		 at: 30 put: #down;
+ 		 at: 29 put: #left;
+ 		 at: 28 put: #right;
+ 		at: 88 put:#in; "x"
+ 		at: 90 put:#out. "y"
+ 	
- 	upDownCodes at: 126 put: #up;
- 		 at: 125 put: #down;
- 		 at: 123 put: #out;
- 		 at: 124 put: #in.
- 	"arrow keys on the mac"
  	self extent: 40 @ 40;
  		 vResizing: #rigid;
  		 hResizing: #spaceFill;
  		 setBalloonText: 'Drag in here to zoom, tilt and pan the page above'.
  	dataMorph := AlignmentMorph newColumn.
  	dataMorph color: Color yellow;
  		 hResizing: #shrinkWrap;
  		 vResizing: #shrinkWrap.
  	dataMorph
  		on: #mouseDown
  		send: #grabCameraPositionEvent:morph:
  		to: self.
  	displayer := UpdatingStringMorph new getSelector: #cameraPointRounded;
  				 target: self;
  				 growable: true;
  				 putSelector: nil.
  	dataMorph addMorph: displayer lock.
  	displayer := UpdatingStringMorph new getSelector: #cameraScale;
  				 target: self;
  				 growable: true;
  				 floatPrecision: 0.001;
  				 putSelector: nil.
  	dataMorph addMorph: displayer lock.
  	self addMorph: dataMorph!

Item was changed:
  ----- Method: ZoomAndScrollControllerMorph>>step (in category 'stepping and presenter') -----
  step
  
+ 	| delta halfDW shift |
+ 	shift := false.
- 	| delta halfDW |
- 
  	(self valueOfProperty: #currentCameraVersion ifAbsent: [0]) = 
  							self currentCameraVersion ifFalse: [
  		self patchOldVersion1.
  		self setProperty: #currentCameraVersion toValue: self currentCameraVersion.
  	].
  	super step.
  	self doProgrammedMoves.
  
+ 	(currentKeyDown ifNil: [#()]) do: [ :each | | action | 
+ 		action := upDownCodes at: each ifAbsent: [shift := true]. 
- 	(currentKeyDown ifNil: [#()]) do: [ :each | | action |
- 		action := upDownCodes at: each ifAbsent: [#fugeddaboutit].
  		action == #in ifTrue: [
  			target scaleImageBy: -10.
  		].
  		action == #out ifTrue: [
  			target scaleImageBy: 10.
  		].
  		action == #up ifTrue: [
+ 			target panImageBy: 0@ -20.
- 			target tiltImageBy: -20.
  		].
  		action == #down ifTrue: [
+ 			target panImageBy: 0 at 20.
- 			target tiltImageBy: 20.
  		].
+ 		action == #left ifTrue: [
+ 			target panImageBy: -20 at 0.
+ 		].
+ 		action == #right ifTrue: [
+ 			target panImageBy: 20 at 0.
+ 		].
  	].
  	mouseMovePoint ifNil: [^self].
  	mouseDownPoint ifNil: [^self].
  	target ifNil: [^self].
  	halfDW := self deadZoneWidth // 2.
+ 	halfDW := self deadZoneWidth // 2.
  	delta := mouseMovePoint - mouseDownPoint.
  	delta x abs <= halfDW ifTrue: [delta := 0 at delta y].
  	delta y abs <= halfDW ifTrue: [delta := delta x at 0].
+ 	shift ifTrue:[^target scaleImageBy: delta x].
+ 	target panImageBy: delta x @ delta y
- 	
- 	target panImageBy: delta x.
  
  
  
  !

Item was changed:
  ----- Method: ZoomAndScrollMorph>>panImageBy: (in category 'as yet unclassified') -----
  panImageBy: pixels
  
+ 	self changeOffsetBy: (pixels x* self getTiltFactor * 0.1) @ (pixels y* self getTiltFactor * 0.1)
- 	self changeOffsetBy: (pixels * self getTiltFactor * 0.1) @ 0.
  
  	"steps := (pixels abs / 6) exp rounded * pixels sign."
  "==Alan's preferred factors
  pan = 0.0425531914893617
  zoom = 0.099290780141844
  ==="
  
  !

Item was removed:
- ----- Method: ZoomAndScrollMorph>>tiltImageBy: (in category 'as yet unclassified') -----
- tiltImageBy: pixels
- 
- 	self changeOffsetBy: 0 @ (pixels * self getTiltFactor * 0.1)
- 
- "	steps := (pixels abs / 6) exp rounded * pixels sign.
- "
- "==Alan's preferred factors
- pan = 0.0425531914893617
- zoom = 0.099290780141844
- ==="
- !



More information about the Squeak-dev mailing list