A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-ct.266.mcz ==================== Summary ==================== Name: MorphicExtras-ct.266 Author: ct Time: 21 September 2019, 4:37:53.910719 pm UUID: 925300c8-ccdd-3e44-9274-d5ccf593822b Ancestors: MorphicExtras-mt.263 Refactor ScorePlayerMorph initialization As the current #onScorePlayer:title: implementation does not use the title, I think we can deprecate it? In this case, there are further senders in the image which need to be updated. If you confirm that, I will also move the method into *60Deprecated. Please note this commit also includes some convenience constructors apart from deprectations. =============== Diff against MorphicExtras-mt.263 =============== Item was added: + ----- Method: ScorePlayerMorph class>>on: (in category 'system hookup') ----- + on: aScore + + | player | + player := ScorePlayer onScore: aScore. + ^ self new onScorePlayer: player! Item was added: + ----- Method: ScorePlayerMorph class>>openOn: (in category 'system hookup') ----- + openOn: aScore + + (self on: aScore) openInWorld.! Item was changed: ----- Method: ScorePlayerMorph>>addNewScore (in category 'menu') ----- addNewScore "Open a MIDI score and re-init controls..." | score player | score := MIDIScore new. score tracks: (Array with: Array new). score trackInfo: #('Instrument'). player := ScorePlayer onScore: score. + ^self onScorePlayer: player! - ^self onScorePlayer: player title: 'new'! Item was changed: ----- Method: ScorePlayerMorph>>addTrackToScore (in category 'menu') ----- addTrackToScore "add a instrument track to the current score" | score tracks trackInfo player | score := scorePlayer score. tracks := score tracks copyWith:#(). score tracks: tracks. trackInfo := score trackInfo copyWith: 'Instrument'. score trackInfo: trackInfo. player := ScorePlayer onScore: score. + ^self onScorePlayer: player! - ^self onScorePlayer: player title: 'new'! Item was changed: ----- Method: ScorePlayerMorph>>initialize (in category 'initialization') ----- initialize "initialize the state of the receiver" super initialize. "" self listDirection: #topToBottom; wrapCentering: #center; cellPositioning: #topCenter; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 3; + onScorePlayer: ScorePlayer new initialize; - onScorePlayer: ScorePlayer new initialize title: ' '; extent: 20 @ 20 ! Item was added: + ----- Method: ScorePlayerMorph>>onScorePlayer: (in category 'initialization') ----- + onScorePlayer: aScorePlayer + | divider col r | + scorePlayer := aScorePlayer. + scorePlayer ifNotNil: + [scorePlayer reset. + instrumentSelector := Array new: scorePlayer score tracks size]. + + self removeAllMorphs. + self addMorphBack: self makeControls. + scorePlayer ifNil: [^ self]. + + r := self makeRow + hResizing: #spaceFill; + vResizing: #shrinkWrap. + r addMorphBack: self rateControl; + addMorphBack: (Morph newBounds: (0@0 extent: 20@0) color: Color transparent); + addMorphBack: self volumeControl. + self addMorphBack: r. + self addMorphBack: self scrollControl. + + col := AlignmentMorph newColumn color: color; layoutInset: 0. + self addMorphBack: col. + 1 to: scorePlayer trackCount do: [:trackIndex | + divider := AlignmentMorph new + extent: 10@1; + layoutInset: 0; + borderStyle: (BorderStyle raised width: 1); + color: color; + hResizing: #spaceFill; + vResizing: #rigid. + col addMorphBack: divider. + col addMorphBack: (self trackControlsFor: trackIndex)]. + + LastMIDIPort ifNotNil: [ + "use the most recently set MIDI port" + scorePlayer openMIDIPort: LastMIDIPort].! Item was changed: ----- Method: ScorePlayerMorph>>onScorePlayer:title: (in category 'initialization') ----- onScorePlayer: aScorePlayer title: scoreName - | divider col r | - scorePlayer := aScorePlayer. - scorePlayer ifNotNil: - [scorePlayer reset. - instrumentSelector := Array new: scorePlayer score tracks size]. + self deprecated: 'Use #onScorePlayer:'. + ^ self onScorePlayer: aScorePlayer - self removeAllMorphs. - self addMorphBack: self makeControls. - scorePlayer ifNil: [^ self]. - - r := self makeRow - hResizing: #spaceFill; - vResizing: #shrinkWrap. - r addMorphBack: self rateControl; - addMorphBack: (Morph newBounds: (0@0 extent: 20@0) color: Color transparent); - addMorphBack: self volumeControl. - self addMorphBack: r. - self addMorphBack: self scrollControl. - - col := AlignmentMorph newColumn color: color; layoutInset: 0. - self addMorphBack: col. - 1 to: scorePlayer trackCount do: [:trackIndex | - divider := AlignmentMorph new - extent: 10@1; - layoutInset: 0; - borderStyle: (BorderStyle raised width: 1); - color: color; - hResizing: #spaceFill; - vResizing: #rigid. - col addMorphBack: divider. - col addMorphBack: (self trackControlsFor: trackIndex)]. - - LastMIDIPort ifNotNil: [ - "use the most recently set MIDI port" - scorePlayer openMIDIPort: LastMIDIPort]. ! |
Free forum by Nabble | Edit this page |