From 3596bc7746eca614bc315cf41bbffedb02a7a8e8 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 24 Jul 2016 19:10:18 +0200 Subject: classes/BowelyzerGUI.sc: Updating the setupEZRanger function to draw its children properly and add default lo/hi values, using the same bounds as EZSlider. --- classes/BowelyzerGUI.sc | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/classes/BowelyzerGUI.sc b/classes/BowelyzerGUI.sc index b769203..99f271a 100644 --- a/classes/BowelyzerGUI.sc +++ b/classes/BowelyzerGUI.sc @@ -443,9 +443,9 @@ BowelyzerGUI{ arg parent, type, name, value; switch( type.asSymbol, - \knob, {this.setupEZKnob(parent, name, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})}, + \knob, {this.setupEZKnob(parent, name, value)}, \slider, {this.setupEZSlider(parent, name, value)}, - \ranger, {this.setupEZRanger(parent, name, value, \controls, name).view.children.do({|item| if(item.isKindOf(NumberBox),{item.align_(\right)})})} + \ranger, {this.setupEZRanger(parent, name, value)} ); } @@ -951,26 +951,37 @@ BowelyzerGUI{ }); } + // setup a ranger setupEZRanger{ arg parent, control, value; - ^EZRanger( + var unit; + unit = EZRanger( parent: parent, - bounds: 300@16, + bounds: sliderWidth@sliderHeight, label: control, - controlSpec: control, + initVal: value, + controlSpec: control.asSymbol, action: { arg controlUnit; var address = NetAddr.new("127.0.0.1", NetAddr.langPort), - type = "/"++controlUnit.view.parent.name.asString, - name = controlUnit.view.parent.parent.parent.name.asSymbol, + type = "/"++controlUnit.view.parent.parent.name.asString, + name = controlUnit.view.parent.parent.parent.parent.name.asSymbol, controlName = controlUnit.labelView.string.asSymbol, controlValue = controlUnit.value; - address.sendMsg(type, name, controlName, controlValue); + address.sendMsg(type, name, controlName, controlValue[0], controlValue[1]); }, - labelWidth: 120, + layout: \line2, + numberWidth: 60, unitWidth:30 - ) - ; + ); + unit.view.children.do({|item| + if(item.isKindOf(NumberBox), { + item.align_(\right); + }); + if(item.isKindOf(RangeSlider), { + item.orientation_(\horizontal); + }); + }); } setupEZKnob{ -- cgit v1.2.3-70-g09d2