Skip to content

Commit

Permalink
fix construction of DSP ui
Browse files Browse the repository at this point in the history
  • Loading branch information
lucretiomsp committed Jan 23, 2025
1 parent 4b23242 commit b70426b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CoypuIDE/BlElement.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ BlElement >> fromDictionary: aDictionary forDsp: aDsp [
widgetDictionary := Dictionary new.
widgetDictionary
add: #hslider -> #ICDarkKnob3;
add: #vslider -> #ICDarkKnob3;
add: #button -> #ICLabelButton;
add: #hbargraph -> #ICValueDisplay.
add: #hbargraph -> #ICValueDisplay;
add: #nentry -> #ICDarkKnob3;
add: #checkbox -> #ICLabelButton.

^ (self class environment at:
(widgetDictionary at: (aDictionary at: #type)))
Expand Down
6 changes: 5 additions & 1 deletion CoypuIDE/DSP.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ DSP >> displayUI [
do: [ :evt | space extent: evt target extent ].

space root addChild: container.

space addEventHandlerOn: BlSpaceClosedEvent
do: [ Transcript show: 'Space closed' ].
space show.
space addEventFilterOn: [ BlSpaceClosedEvent ] do: [ ICValueDisplay isUpdating: false ].


^ space
]

Expand Down
6 changes: 3 additions & 3 deletions CoypuIDE/ICKnob.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ ICKnob class >> fromDictionary: aDictionary [

{ #category : 'instance creation' }
ICKnob class >> fromDictionary: aDictionary forDsp: aDsp [

( aDictionary at: #label ) traceCr.
^ (self
label: (aDictionary at: #label)
label: (aDictionary at: #shortname)
minValue: (aDictionary at: #min)
maxValue: (aDictionary at: #max)
callBack: [ :i |
aDsp setValue: i parameter: (aDictionary at: #label) ])
aDsp setValue: i parameter: (aDictionary at: #shortname) ])
setValue: (aDictionary at: #init); stepValue: (aDictionary at: #step)
]

Expand Down
4 changes: 2 additions & 2 deletions CoypuIDE/ICLabelButton.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Class {
ICLabelButton class >> fromDictionary: aDictionary forDsp: aDsp [

| paramLabel btn paramLabelAndType |
paramLabel := aDictionary at: #label.
paramLabel := (aDictionary at: #address) afterLastSlash .
"we split the actual label from its type"
paramLabelAndType := paramLabel splitOn: $~.
btn := self label: (paramLabelAndType at: 1).
btn callback: [ :x | aDsp setValue: x parameter: paramLabel ].
"if the button is a checkbox"

paramLabelAndType size > 1 ifTrue: [ btn isToggleable: true ].

^ btn
Expand Down

0 comments on commit b70426b

Please sign in to comment.