The Trunk: Morphic-dtl.1418.mcz

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

The Trunk: Morphic-dtl.1418.mcz

commits-2
David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.1418.mcz

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

Name: Morphic-dtl.1418
Author: dtl
Time: 22 April 2018, 12:38:19.743621 pm
UUID: 3e663437-df0d-445a-946a-fb072a336165
Ancestors: Morphic-cmm.1417

Re-save Morphic-kfr.1418 to fix a problem in its ancestry.

Name: Morphic-kfr.1418
Author: kfr
Time: 22 April 2018, 11:30:41.518937 am
UUID: d6dd46c1-fa46-5043-bf0d-8b4542cf733d
Ancestors: Morphic-kfr.1416, Morphic-cmm.1417

Some maintenance to ScorePlayerMorph.
Fixing some layout issues.
Add menu options to make a new score and add tracks to the score.

=============== Diff against Morphic-cmm.1417 ===============

Item was added:
+ ----- 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 title: 'new'!

Item was added:
+ ----- 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 title: 'new'!

Item was changed:
  ----- Method: ScorePlayerMorph>>invokeMenu (in category 'menu') -----
  invokeMenu
  "Invoke a menu of additonal functions for this ScorePlayer."
-
  | aMenu |
  aMenu := MenuMorph new defaultTarget: self.
+ aMenu add: 'add a new score' translated action: #addNewScore.
+ aMenu add: 'add a new track to score' translated action: #addTrackToScore.
  aMenu add: 'open a MIDI file' translated action: #openMIDIFile.
+ aMenu addList: {#-. {'save as AIFF file' translated. #saveAsAIFF}. {'save as WAV file' translated. #saveAsWAV}. {'save as Sun AU file' translated. #saveAsSunAudio}. #-}.
+ aMenu
+ add: 'reload instruments' translated
+ target: AbstractSound
+ selector: #updateScorePlayers.
- aMenu addList: {
- #-.
- {'save as AIFF file' translated. #saveAsAIFF}.
- {'save as WAV file' translated. #saveAsWAV}.
- {'save as Sun AU file' translated. #saveAsSunAudio}.
- #-}.
- aMenu add: 'reload instruments' translated target: AbstractSound selector: #updateScorePlayers.
  aMenu addLine.
  scorePlayer midiPort
+ ifNil: [aMenu add: 'play via MIDI' translated action: #openMIDIPort]
+ ifNotNil: [aMenu add: 'play via built in synth' translated action: #closeMIDIPort.
- ifNil: [
- aMenu add: 'play via MIDI' translated action: #openMIDIPort]
- ifNotNil: [
- aMenu add: 'play via built in synth' translated action: #closeMIDIPort.
  aMenu add: 'new MIDI controller' translated action: #makeMIDIController:].
  aMenu addLine.
  aMenu add: 'make a pause marker' translated action: #makeAPauseEvent:.
+ aMenu popUpInWorld: self world!
-
- aMenu popUpInWorld: self world.
- !

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 removeAllMorphs.
  self addMorphBack: self makeControls.
  scorePlayer ifNil: [^ self].
 
  r := self makeRow
+ hResizing: #spaceFill;
- hResizing: #shrinkWrap;
  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;
  borderWidth: 1;
  layoutInset: 0;
  borderColor: #raised;
  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>>rateControl (in category 'layout') -----
  rateControl
 
  | rateSlider middleLine r |
  rateSlider := SimpleSliderMorph new
  color: color;
  sliderColor: Color gray;
+ extent: 180@12;
- extent: 180@6;
  target: self;
  actionSelector: #setLogRate:;
  minVal: -1.0;
  maxVal: 1.0;
  adjustToValue: 0.0.
  middleLine := Morph new  "center indicator for pan slider"
  color: (Color r: 0.4 g: 0.4 b: 0.4);
  extent: 1@(rateSlider height - 4);
  position: rateSlider center x@(rateSlider top + 2).
  rateSlider addMorphBack: middleLine.
  r := self makeRow
+ hResizing: #spaceFill;
- hResizing: #shrinkWrap;
  vResizing: #rigid;
  height: 24.
  r addMorphBack: (StringMorph contents: 'slow ' translated).
  r addMorphBack: rateSlider.
  r addMorphBack: (StringMorph contents: ' fast' translated).
  ^ r
  !

Item was changed:
  ----- Method: ScorePlayerMorph>>scrollControl (in category 'layout') -----
  scrollControl
 
  | r |
  scrollSlider := SimpleSliderMorph new
  color: color;
  sliderColor: Color gray;
+ extent: 360@12;
- extent: 360@6;
  target: scorePlayer;
  actionSelector: #positionInScore:;
  adjustToValue: scorePlayer positionInScore.
  r := self makeRow
+ hResizing: #spaceFill;
- hResizing: #shrinkWrap;
  vResizing: #rigid;
  height: 24.
  r addMorphBack: (StringMorph contents: 'start ' translated).
  r addMorphBack: scrollSlider.
  r addMorphBack: (StringMorph contents: ' end' translated).
  ^ r
  !

Item was changed:
  ----- Method: ScorePlayerMorph>>trackNumAndMuteButtonFor: (in category 'layout') -----
  trackNumAndMuteButtonFor: trackIndex
 
  | muteButton instSelector pianoRollColor r |
  muteButton := SimpleSwitchMorph new
  onColor: (Color r: 1.0 g: 0.6 b: 0.6);
  offColor: color;
  color: color;
  label: 'Mute' translated;
  target: scorePlayer;
  actionSelector: #mutedForTrack:put:;
  arguments: (Array with: trackIndex).
  instSelector := PopUpChoiceMorph new
  extent: 95@14;
  contentsClipped: 'oboe1';
  target: self;
  actionSelector: #atTrack:from:selectInstrument:;
  getItemsSelector: #instrumentChoicesForTrack:;
  getItemsArgs: (Array with: trackIndex).
  instSelector arguments:
  (Array with: trackIndex with: instSelector).
  instrumentSelector at: trackIndex put: instSelector.
 
  "select track color using same color list as PianoRollScoreMorph"
  pianoRollColor := (Color wheel: scorePlayer score tracks size) at: trackIndex.
 
  r := self makeRow
  hResizing: #spaceFill;
  vResizing: #spaceFill;
  extent: 70@10.
  r addMorphBack:
  ((StringMorph
  contents: trackIndex printString
  font: (TextStyle default fontOfSize: 24)) color: pianoRollColor).
  trackIndex < 10
  ifTrue: [r addMorphBack: (Morph new color: color; extent: 19@8)]  "spacer"
  ifFalse: [r addMorphBack: (Morph new color: color; extent: 8@8)].  "spacer"
  r addMorphBack:
  (StringMorph new
+ extent: 80@14;
- extent: 140@14;
  contentsClipped: (scorePlayer infoForTrack: trackIndex)).
  r addMorphBack: (Morph new color: color; extent: 8@8).  "spacer"
  r addMorphBack: instSelector.
  r addMorphBack: (AlignmentMorph newRow color: color).  "spacer"
  r addMorphBack: muteButton.
  ^ r
  !

Item was changed:
  ----- Method: ScorePlayerMorph>>volumeControl (in category 'layout') -----
  volumeControl
 
  | volumeSlider r |
  volumeSlider := SimpleSliderMorph new
  color: color;
  sliderColor: Color gray;
+ extent: 80@12;
- extent: 80@6;
  target: scorePlayer;
  actionSelector: #overallVolume:;
  adjustToValue: scorePlayer overallVolume.
  r := self makeRow
+ hResizing: #spaceFill;
- hResizing: #shrinkWrap;
  vResizing: #rigid;
  height: 24.
  r addMorphBack: (StringMorph contents: 'soft  ' translated).
  r addMorphBack: volumeSlider.
  r addMorphBack: (StringMorph contents: ' loud' translated).
  ^ r
  !