1
1
use crate :: LambParams ;
2
2
use crate :: ZoomMode ;
3
- use nih_plug:: prelude:: { Editor } ;
3
+ use nih_plug:: prelude:: Editor ;
4
4
use nih_plug_vizia:: vizia:: prelude:: * ;
5
5
use nih_plug_vizia:: vizia:: vg;
6
6
use nih_plug_vizia:: widgets:: * ;
@@ -151,7 +151,6 @@ pub(crate) fn create(
151
151
. class ( "center" )
152
152
. left ( Percentage ( 2.5 ) ) ;
153
153
} )
154
- // .height(Percentage(100.0))
155
154
. height ( Auto )
156
155
. width ( Percentage ( 100.0 ) ) ; // level + time
157
156
@@ -182,20 +181,13 @@ pub(crate) fn create(
182
181
. height ( Auto )
183
182
. width ( Percentage ( 100.0 ) ) ;
184
183
185
- // meters
186
- // VStack::new(cx, |cx| {
187
184
peak_graph ( cx) ;
188
- // }) // meters
189
- // .width(Percentage(100.0))
190
- // .height(Auto)
191
- // .class("center"); // meters
192
185
} ) // everything
193
- . width ( Percentage ( 95.0 ) )
194
- // .height(Percentage(95.0))
195
- . height ( Auto )
196
- . left ( Percentage ( 2.5 ) )
197
- . right ( Percentage ( 2.5 ) )
198
- . class ( "center" ) ;
186
+ . width ( Percentage ( 95.0 ) )
187
+ . height ( Auto )
188
+ . left ( Percentage ( 2.5 ) )
189
+ . right ( Percentage ( 2.5 ) )
190
+ . class ( "center" ) ;
199
191
ResizeHandle :: new ( cx) ;
200
192
} )
201
193
}
@@ -362,47 +354,31 @@ impl<AttackReleaseDataL: Lens<Target = Arc<LambParams>>> View
362
354
/// Draws a peak graph with a grid backdrop, unit ruler, and a peak meter to side.
363
355
fn peak_graph ( cx : & mut Context ) {
364
356
HStack :: new ( cx, |cx| {
365
- ZStack :: new ( cx, |cx| {
366
- Grid :: new (
367
- cx,
368
- ValueScaling :: Linear ,
369
- ( METER_MIN , METER_MAX ) ,
370
- vec ! [ 0.0 , -6.0 , -12.0 , -18.0 , -24.0 , -30.0 ] ,
371
- Orientation :: Vertical
372
- )
373
- . color ( Color :: rgb ( 60 , 60 , 60 ) ) ;
357
+ HStack :: new ( cx, |cx| {
358
+ ZStack :: new ( cx, |cx| {
359
+ Grid :: new (
360
+ cx,
361
+ ValueScaling :: Linear ,
362
+ ( METER_MIN , METER_MAX ) ,
363
+ vec ! [ 0.0 , -6.0 , -12.0 , -18.0 , -24.0 , -30.0 ] ,
364
+ Orientation :: Vertical
365
+ )
366
+ . color ( Color :: rgb ( 60 , 60 , 60 ) ) ;
374
367
375
- // level
376
- Graph :: new ( cx, LambData :: level_buffer, ( METER_MIN , METER_MAX ) , ValueScaling :: Decibels )
377
- . color ( Color :: rgba ( 60 , 60 , 60 , 160 ) )
378
- . background_color ( Color :: rgba ( 60 , 60 , 60 , 60 ) ) ;
368
+ // level
369
+ Graph :: new ( cx, LambData :: level_buffer, ( METER_MIN , METER_MAX ) , ValueScaling :: Decibels )
370
+ . color ( Color :: rgba ( 60 , 60 , 60 , 160 ) )
371
+ . background_color ( Color :: rgba ( 60 , 60 , 60 , 60 ) ) ;
379
372
380
- // gain reduction
381
- Graph :: new ( cx, LambData :: gr_buffer, ( METER_MIN , METER_MAX ) , ValueScaling :: Decibels )
382
- . color ( Color :: rgba ( 160 , 0 , 0 , 160 ) )
383
- . background_color ( Color :: rgba ( 255 , 16 , 16 , 60 ) )
384
- . fill_from ( 0.0 ) ;
385
- } )
386
- // .background_color(Color::rgb(16, 16, 16))
373
+ // gain reduction
374
+ Graph :: new ( cx, LambData :: gr_buffer, ( METER_MIN , METER_MAX ) , ValueScaling :: Decibels )
375
+ . color ( Color :: rgba ( 160 , 0 , 0 , 160 ) )
376
+ . background_color ( Color :: rgba ( 255 , 16 , 16 , 60 ) )
377
+ . fill_from ( 0.0 ) ;
378
+ } )
379
+ // .background_color(Color::rgb(16, 16, 16))
387
380
;
388
381
389
- UnitRuler :: new (
390
- cx,
391
- ( METER_MIN , METER_MAX ) ,
392
- ValueScaling :: Linear ,
393
- vec ! [
394
- ( -0.0 , "0db" ) ,
395
- ( -6.0 , "-6db" ) ,
396
- ( -12.0 , "-12db" ) ,
397
- ( -18.0 , "-18db" ) ,
398
- ( -24.0 , "-24db" ) ,
399
- ( -30.0 , "-30db" ) ,
400
- ] ,
401
- Orientation :: Vertical ,
402
- )
403
- . font_size ( 12. )
404
- . color ( Color :: rgb ( 160 , 160 , 160 ) )
405
- . width ( Pixels ( 32. ) ) ;
406
382
Meter :: new (
407
383
cx,
408
384
LambData :: level_buffer,
@@ -428,11 +404,34 @@ fn peak_graph(cx: &mut Context) {
428
404
. width ( Pixels ( 32.0 ) )
429
405
. background_color ( Color :: rgb ( 251 , 195 , 195 ) ) ;
430
406
// .background_color(Color::rgba(160, 0, 0, 60));
407
+ } )
408
+ . border_color ( Color :: rgb ( 80 , 80 , 80 ) )
409
+ . border_width ( Pixels ( 1. ) )
410
+ ;
411
+ UnitRuler :: new (
412
+ cx,
413
+ ( METER_MIN , METER_MAX ) ,
414
+ ValueScaling :: Linear ,
415
+ vec ! [
416
+ ( -0.0 , "0db" ) ,
417
+ ( -6.0 , "-6db" ) ,
418
+ ( -12.0 , "-12db" ) ,
419
+ ( -18.0 , "-18db" ) ,
420
+ ( -24.0 , "-24db" ) ,
421
+ ( -30.0 , "-30db" ) ,
422
+ ] ,
423
+ Orientation :: Vertical ,
424
+ )
425
+ . font_size ( 12. )
426
+ . color ( Color :: rgb ( 160 , 160 , 160 ) )
427
+ . width ( Pixels ( 32. ) )
428
+ ;
431
429
} )
432
430
. top ( Pixels ( 13.0 ) )
433
431
. height ( Pixels ( 330.0 ) )
434
432
. width ( Percentage ( 100.0 ) )
435
433
. col_between ( Pixels ( 8. ) )
436
- . border_color ( Color :: rgb ( 80 , 80 , 80 ) )
437
- . border_width ( Pixels ( 1. ) ) ;
434
+ . border_color ( Color :: rgba ( 0 , 0 , 0 , 0 ) )
435
+ . border_width ( Pixels ( 1. ) )
436
+ ;
438
437
}
0 commit comments