@@ -94,40 +94,27 @@ ICMixerFader >> barDefaultColor [
9494 ^ Color black
9595]
9696
97- { #category : ' api - values ' }
98- ICMixerFader >> basicSetValue: aNumber [
97+ { #category : ' defaults ' }
98+ ICMixerFader >> barSize [
9999
100- value := aNumber.
101- self callBack ifNotNil: [ :e | e value: value ]
100+ ^ self
101+ ifHorizontal: [ barLength @ self slotThickness ]
102+ ifVertical: [ self slotThickness @ barLength ]
102103]
103104
104105{ #category : ' accessing' }
105106ICMixerFader >> coloredBarDefaultColor [
106107 ^ Color veryVeryLightGray.
107108]
108109
109- { #category : ' setting' }
110- ICMixerFader >> configuredStringDark: aString size: anInteger [
111- ^ aString asRopedText attributes: {(BlTextForegroundAttribute
112- paint: Color white) . (BlFontWeightAttribute bold) . (BlFontSizeAttribute size: anInteger) }
113- ]
114-
115110{ #category : ' api - bounds' }
116- ICMixerFader >> defaultBar [
117-
118- | size |
119- size := self
120- ifHorizontal: [ self defaultBarLength @ self defaultBarThickness - 70 ]
121- ifVertical: [ self defaultBarThickness - 60 @ self defaultBarLength ].
111+ ICMixerFader >> defaultBar [
122112
123113 ^ BlElement new
124114 geometry: (BlRoundedRectangleGeometry cornerRadius: 4 );
125115 background: self barDefaultColor;
126- extent: size;
127- constraintsDo: [ :c |
128- c frame horizontal alignCenter.
129- c frame vertical alignCenter ];
130- " constraintsDo: [ :c | c ignoreByLayout ];" yourself
116+ constraintsDo: [ :c | c ignoreByLayout ];
117+ yourself
131118]
132119
133120{ #category : ' api - bounds' }
@@ -150,28 +137,23 @@ ICMixerFader >> defaultColor [
150137]
151138
152139{ #category : ' api - bounds' }
153- ICMixerFader >> defaultHandle [
154-
155- | e1 e2 size elt |
156- size := self ifHorizontal: [ 5 @ barThickness ] ifVertical: [ 20 @ 40 ].
157-
158- elt := BlElement new
159- background: self handleDefaultColor;
160- geometry: (BlRoundedRectangleGeometry cornerRadius: 4 );
161- effect: (BlGaussianShadowEffect color: (Color black alpha: 0.6 ) offset: 4 @ 4 width: 15 );
162- border: (BlBorder paint: Color veryLightGray width: 2 );
163- constraintsDo: [ :c | c ignoreByLayout ];
164- extent: size;
165- transformDo: [ :t | t translateBy: size negated / 2 ];
166- yourself . " e1:=BlElement new
140+ ICMixerFader >> defaultHandle [
141+
142+ ^ BlElement new
143+ background: self handleDefaultColor;
167144 geometry: (BlRoundedRectangleGeometry cornerRadius: 4 );
168- background: self barDefaultColor;
169- size: 30@60;
170- constraintsDo: [ :c | c frame horizontal alignCenter. c frame vertical alignCenter. ];
171- yourself.
172-
173- ^ e1."
174- ^ elt
145+ effect: (BlGaussianShadowEffect
146+ color: (Color black alpha: 0.6 )
147+ offset: 4 @ 4
148+ width: 15 );
149+ border: (BlBorder paint: Color veryLightGray width: 2 );
150+ constraintsDo: [ :c | c ignoreByLayout ];
151+ yourself
152+ ]
153+
154+ { #category : ' defaults' }
155+ ICMixerFader >> defaultIsHorizontal [
156+ ^ false
175157]
176158
177159{ #category : ' api - bounds' }
@@ -198,13 +180,6 @@ ICMixerFader >> defaultTickCount [
198180 ^ 5
199181]
200182
201- { #category : ' accessing' }
202- ICMixerFader >> direction [
203- " Returns true if horizontal else false"
204- ^ self ifHorizontal: [ true ]
205- ifVertical: [ false ].
206- ]
207-
208183{ #category : ' ui building' }
209184ICMixerFader >> fromDictionary: aDictionary forDsp: aDsp [
210185
@@ -226,54 +201,22 @@ ICMixerFader >> handleDefaultColor [
226201 ^ Color veryVeryLightGray
227202]
228203
229- { #category : ' accessing' }
230- ICMixerFader >> horizontal: aBoolean [
231-
232- isHorizontal := aBoolean
233- ]
234-
235- { #category : ' building' }
236- ICMixerFader >> ifHorizontal: horizontalBlock ifVertical: verticalBlock [
237-
238- ^ self isHorizontal
239- ifTrue: horizontalBlock
240- ifFalse: verticalBlock
241- ]
242-
243- { #category : ' api - slider' }
244- ICMixerFader >> incrementValue: aValue [
204+ { #category : ' api - bounds' }
205+ ICMixerFader >> handleSize [
245206
246- | tmp |
247- tmp := value + aValue.
248- self setValue: tmp
207+ ^ self
208+ ifHorizontal: [ self handleThickness @ self handleWidth ]
209+ ifVertical: [ self handleWidth @ self handleThickness]
249210]
250211
251- { #category : ' initialization' }
252- ICMixerFader >> initalizeTicks [
253-
254- ticks := (1 to: self defaultTickCount) collect: [ :i |
255- BlElement new
256- geometry: BlRectangleGeometry new ;
257- background: self tickColor;
258- constraintsDo: [ :c | c ignoreByLayout ];
259- yourself ].
260- self addChildren: ticks
212+ { #category : ' defaults' }
213+ ICMixerFader >> handleThickness [
214+ ^ self barThickness * 4 / 7
261215]
262216
263- { #category : ' initialization' }
264- ICMixerFader >> initialize [
265-
266- super initialize.
267- isHorizontal := false .
268- segmented := false .
269- self initializeSizes.
270- self name: ' ' .
271- self widgetSize: self defaultSize .
272- self background: self defaultColor.
273- self layout: BlFrameLayout new .
274- self initializeValues.
275- self initializeParts.
276- self initializeEvents
217+ { #category : ' defaults' }
218+ ICMixerFader >> handleWidth [
219+ ^ self barThickness * 2 / 7
277220]
278221
279222{ #category : ' initialization' }
@@ -285,23 +228,14 @@ ICMixerFader >> initializeParts [
285228]
286229
287230{ #category : ' initialization' }
288- ICMixerFader >> initializeSizes [
289-
290- barLength := self defaultBarLength.
291- barThickness := self defaultBarThickness.
292- marginLength := self defaultMarginLength.
293- marginThickness := self defaultMarginThickness.
294- ]
295-
296- { #category : ' initialization' }
297- ICMixerFader >> initializeTicks [
231+ ICMixerFader >> initializeTicks [
298232
299233 ticks := (1 to: self defaultTickCount) collect: [ :i |
300- BlElement new
301- geometry: BlRectangleGeometry new ;
302- background: self defaultTickColor;
303- constraintsDo: [ :c | c ignoreByLayout ];
304- yourself ].
234+ BlElement new
235+ geometry: BlRectangleGeometry new ;
236+ background: self defaultTickColor;
237+ constraintsDo: [ :c | c ignoreByLayout ];
238+ yourself ].
305239 self addChildren: ticks
306240]
307241
@@ -313,72 +247,15 @@ ICMixerFader >> initializeValues [
313247 value := self minValue
314248]
315249
316- { #category : ' api - transformations' }
317- ICMixerFader >> moveHandleTo: aPosition [
318-
319- | newPos |
320- newPos := aPosition.
321- " deal with segmentation"
322- self isSegmented ifTrue: [
323- " | value |"
324- value := self valueAtCoord: aPosition.
325- newPos := self valueToCoord: value ].
326- self
327- ifHorizontal: [
328- | newPosX |
329- newPosX := newPos x.
330- newPos x < bar position x ifTrue: [ newPosX := bar position x ].
331- newPos x > (bar position x + barLength) ifTrue: [
332- newPosX := bar position x + barLength ].
333- newPos := newPosX @ handle position y.
334- handle position: newPos ]
335- ifVertical: [
336- | newPosY |
337- newPosY := newPos y.
338- newPos y < bar position y ifTrue: [ newPosY := bar position y ].
339- newPos y > (bar position y + barLength) ifTrue: [
340- newPosY := bar position y + barLength ].
341- newPos := handle position x @ newPosY.
342- handle position: newPos ].
343- self updateColoredBarTo: newPos.
344- self basicSetValue: (self valueAtCoord: newPos)
345-
346-
347- ]
348-
349- { #category : ' initialization' }
350- ICMixerFader >> setToMax [
351-
352- " this method is created with a button that would set to max in the widget"
353- self setValue: self maxValue.
354- ]
355-
356- { #category : ' initialization' }
357- ICMixerFader >> setToMin [
358-
359- " this method is created with a button that would set to max in the widget"
360- self setValue: self minValue.
361- ]
362-
363- { #category : ' accessing' }
364- ICMixerFader >> setValue: aNumber [
365-
366- | newValue |
367- newValue := aNumber.
368- aNumber < self minValue ifTrue: [ newValue := minValue ].
369- aNumber > self maxValue ifTrue: [ newValue := maxValue ].
250+ { #category : ' defaults' }
251+ ICMixerFader >> lengthPadding [
370252
371- self moveHandleTo: ( self valueToCoord: newValue)
253+ ^ self handleThickness / 2
372254]
373255
374- { #category : ' api - bounds' }
375- ICMixerFader >> size: aValue [
376- " just to keep the widgset size"
377-
378- super extent: aValue " for now do not support resize
379-
380- self isBuildSlider ifTrue: [ self rebuildSlider ]
381- "
256+ { #category : ' defaults' }
257+ ICMixerFader >> slotThickness [
258+ ^ self barThickness / 7
382259]
383260
384261{ #category : ' api - bounds' }
@@ -389,25 +266,7 @@ ICMixerFader >> tickSize [
389266 ifVertical: [ self barThickness * 4 / 7 @ 3 ]
390267]
391268
392- { #category : ' api - transformations' }
393- ICMixerFader >> updateColoredBarTo: aPosition [
394-
395- self
396- ifHorizontal: [
397- coloredBar position: bar position.
398- coloredBar extent:
399- (aPosition - coloredBar position) x @ barThickness ]
400- ifVertical: [
401- coloredBar position:
402- aPosition x - (barThickness / 2 ) @ aPosition y.
403- coloredBar extent:
404- barThickness @ (bar position y + barLength - aPosition y) ]
405- ]
406-
407- { #category : ' api - transformations' }
408- ICMixerFader >> valueAtCoord: aPoint [
409-
410- ^ self
411- ifHorizontal: [ self valueAtX: aPoint ]
412- ifVertical: [ self valueAtY: aPoint ]
269+ { #category : ' api - bounds' }
270+ ICMixerFader >> ticks [
271+ ^ ticks
413272]
0 commit comments