[squeak-dev] The Trunk: EToys-ct.481.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Aug 28 13:44:27 UTC 2022
Christoph Thiede uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ct.481.mcz
==================== Summary ====================
Name: EToys-ct.481
Author: ct
Time: 28 August 2022, 3:41:10.098075 pm
UUID: d2de7089-de64-b74c-a3fa-bd61108e1315
Ancestors: EToys-ct.479
Fixes MidiInputMorph so that one can actually select a valid input port instead of an output port (#setMIDIPort). Fixes pan and vol sliders, adds high-dpi support, and uses a DropDownChoiceMorph for the instrument. Note that we might still change the styl the instrument selector later.
=============== Diff against EToys-ct.479 ===============
Item was changed:
----- Method: MidiInputMorph>>addChannelControlsFor: (in category 'accessing') -----
addChannelControlsFor: channelIndex
| r divider col |
r := self makeRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
r addMorphBack: (self channelNumAndMuteButtonFor: channelIndex).
+ r addMorphBack: (Morph new extent: 10 px @ 5 px; color: color). "spacer"
- r addMorphBack: (Morph new extent: 10 at 5; color: color). "spacer"
r addMorphBack: (self panAndVolControlsFor: channelIndex).
divider := AlignmentMorph new
+ extent: 10 px @ 1 px;
- extent: 10 at 1;
layoutInset: 0;
+ borderStyle: (BorderStyle raised width: 1 px);
- borderStyle: (BorderStyle raised width: 1);
color: color;
hResizing: #spaceFill;
vResizing: #rigid.
col := self lastSubmorph.
col addMorphBack: divider.
+ col addMorphBack: r.!
- col addMorphBack: r.
- !
Item was changed:
----- Method: MidiInputMorph>>channelNumAndMuteButtonFor: (in category 'accessing') -----
channelNumAndMuteButtonFor: channelIndex
| muteButton instSelector r |
muteButton := SimpleSwitchMorph new
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
offColor: color;
color: color;
label: 'Mute' translated;
target: midiSynth;
actionSelector: #mutedForChannel:put:;
arguments: (Array with: channelIndex).
+ instSelector := DropDownChoiceMorph new
+ extent: 120 px @ 18 px;
- instSelector := PopUpChoiceMorph new
- extent: 95 at 14;
contentsClipped: 'oboe1';
target: self;
actionSelector: #atChannel:from:selectInstrument:;
getItemsSelector: #instrumentChoicesForChannel:;
getItemsArgs: (Array with: channelIndex).
instSelector arguments:
(Array with: channelIndex with: instSelector).
instrumentSelector at: channelIndex put: instSelector.
r := self makeRow
+ hResizing: #spaceFill;
- hResizing: #rigid;
vResizing: #spaceFill;
+ extent: 70 px @ 10 px.
- extent: 70 at 10.
r addMorphBack:
(StringMorph
contents: channelIndex printString
+ font: (TextStyle defaultFont asPointSize: TextStyle defaultFont pointSize * 1.57)).
- font: (TextStyle default fontOfSize: 24)).
channelIndex < 10
+ ifTrue: [r addMorphBack: (Morph new color: color; extent: 19 px @ 8 px)] "spacer"
+ ifFalse: [r addMorphBack: (Morph new color: color; extent: 8 px @ 8 px)]. "spacer"
- ifTrue: [r addMorphBack: (Morph new color: color; extent: 19 at 8)] "spacer"
- ifFalse: [r addMorphBack: (Morph new color: color; extent: 8 at 8)]. "spacer"
r addMorphBack: instSelector.
r addMorphBack: (AlignmentMorph newRow color: color). "spacer"
r addMorphBack: muteButton.
^ r!
Item was changed:
----- Method: MidiInputMorph>>defaultBorderWidth (in category 'initialization') -----
defaultBorderWidth
"answer the default border width for the receiver"
+ ^ 2 px!
- ^ 2!
Item was changed:
----- Method: MidiInputMorph>>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 px.
- hResizing: #spaceFill;
- vResizing: #spaceFill;
- layoutInset: 3.
midiPortNumber := nil.
midiSynth := MIDISynth new.
instrumentSelector := Array new: 16.
self removeAllMorphs.
self addMorphBack: self makeControls.
self addMorphBack: (AlignmentMorph newColumn color: color;
layoutInset: 0).
self addChannelControlsFor: 1.
+ self extent: 20 px @ 20 px!
- self extent: 20 @ 20!
Item was changed:
----- Method: MidiInputMorph>>makeControls (in category 'initialization') -----
makeControls
| bb r reverbSwitch onOffSwitch |
bb := SimpleButtonMorph new
target: self;
+ borderStyle: (BorderStyle raised width: 2 px);
- borderStyle: (BorderStyle raised width: 2);
color: color.
r := AlignmentMorph newRow.
r color: bb color; borderWidth: 0; layoutInset: 0.
+ r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 px @ 5 px.
- r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 at 5.
r addMorphBack: (
bb label: '<>';
actWhen: #buttonDown;
actionSelector: #invokeMenu).
onOffSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
+ borderWidth: 2 px;
- borderWidth: 2;
label: 'On' translated;
actionSelector: #toggleOnOff;
target: self;
setSwitchState: false.
r addMorphBack: onOffSwitch.
reverbSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
+ borderWidth: 2 px;
- borderWidth: 2;
label: 'Reverb Disable' translated;
actionSelector: #disableReverb:;
target: self;
setSwitchState: SoundPlayer isReverbOn not.
r addMorphBack: reverbSwitch.
^ r!
Item was changed:
----- Method: MidiInputMorph>>panAndVolControlsFor: (in category 'initialization') -----
panAndVolControlsFor: channelIndex
| volSlider panSlider c r middleLine |
volSlider := SimpleSliderMorph new
color: color;
+ extent: 101 px @ 6 px;
+ minWidth: 101 px;
- extent: 101 at 2;
target: midiSynth;
arguments: (Array with: channelIndex);
+ orientation: #horizontal;
actionSelector: #volumeForChannel:put:;
minVal: 0.0;
maxVal: 1.0;
adjustToValue: (midiSynth volumeForChannel: channelIndex).
panSlider := SimpleSliderMorph new
color: color;
+ extent: 101 px @ 6 px;
+ minWidth: 101 px;
- extent: 101 at 2;
target: midiSynth;
arguments: (Array with: channelIndex);
actionSelector: #panForChannel:put:;
minVal: 0.0;
maxVal: 1.0;
adjustToValue: (midiSynth panForChannel: channelIndex).
c := AlignmentMorph newColumn
color: color;
layoutInset: 0;
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap.
middleLine := Morph new "center indicator for pan slider"
color: (Color r: 0.4 g: 0.4 b: 0.4);
+ extent: 1 px @ (panSlider height - 4 px);
+ position: panSlider center x @ (panSlider top + 2 px).
- extent: 1@(panSlider height - 4);
- position: panSlider center x@(panSlider top + 2).
panSlider addMorphBack: middleLine.
r := self makeRow.
r addMorphBack: (StringMorph contents: '0').
r addMorphBack: volSlider.
r addMorphBack: (StringMorph contents: '10').
c addMorphBack: r.
r := self makeRow.
r addMorphBack: (StringMorph contents: 'L').
r addMorphBack: panSlider.
r addMorphBack: (StringMorph contents: 'R').
c addMorphBack: r.
+ ^ c!
- ^ c
- !
Item was changed:
----- Method: MidiInputMorph>>setMIDIPort (in category 'accessing') -----
setMIDIPort
| portNum |
+ portNum := SimpleMIDIPort inputPortNumFromUser.
- portNum := SimpleMIDIPort outputPortNumFromUser.
portNum ifNil: [^ self].
midiPortNumber := portNum.
!
More information about the Squeak-dev
mailing list
|