1
+ // use nih_plug::prelude::{util, Editor};
2
+ use nih_plug:: prelude:: Editor ;
3
+ use nih_plug_vizia:: vizia:: prelude:: * ;
4
+ use nih_plug_vizia:: widgets:: * ;
5
+ use nih_plug_vizia:: * ;
6
+ use std:: sync:: Arc ;
7
+
8
+ use crate :: CrrshrrParams ;
9
+
10
+ #[ derive( Lens ) ]
11
+ struct Data {
12
+ params : Arc < CrrshrrParams > ,
13
+ }
14
+
15
+ impl Model for Data { }
16
+
17
+ pub ( crate ) fn default_state ( ) -> Arc < ViziaState > {
18
+ ViziaState :: new ( || ( 200 , 300 ) )
19
+ }
20
+
21
+ pub ( crate ) fn create (
22
+ params : Arc < CrrshrrParams > ,
23
+ editor_state : Arc < ViziaState > ,
24
+ ) -> Option < Box < dyn Editor > > {
25
+ create_vizia_editor ( editor_state, ViziaTheming :: Custom , move |cx, _| {
26
+ assets:: register_noto_sans_light ( cx) ;
27
+ assets:: register_noto_sans_thin ( cx) ;
28
+
29
+ Data {
30
+ params : params. clone ( ) ,
31
+ }
32
+ . build ( cx) ;
33
+
34
+ ResizeHandle :: new ( cx) ;
35
+
36
+ VStack :: new ( cx, |cx| {
37
+ Label :: new ( cx, "CRRSHRR" )
38
+ . font_family ( vec ! [ FamilyOwned :: Name ( String :: from(
39
+ assets:: NOTO_SANS_THIN ,
40
+ ) ) ] )
41
+ . font_size ( 30.0 )
42
+ . height ( Pixels ( 50.0 ) )
43
+ . child_top ( Stretch ( 1.0 ) )
44
+ . child_bottom ( Pixels ( 0.0 ) )
45
+ . color ( Color :: white ( ) ) ;
46
+
47
+ Label :: new ( cx, "BITS" ) . color ( Color :: white ( ) ) ;
48
+ ParamSlider :: new ( cx, Data :: params, |params| & params. bits )
49
+ . background_color ( Color :: white ( ) ) ;
50
+
51
+ Label :: new ( cx, "RATE" ) . color ( Color :: white ( ) ) ;
52
+ ParamSlider :: new ( cx, Data :: params, |params| & params. rate )
53
+ . background_color ( Color :: white ( ) ) ;
54
+
55
+ Label :: new ( cx, "RAND" ) . color ( Color :: white ( ) ) ;
56
+ ParamSlider :: new ( cx, Data :: params, |params| & params. rand )
57
+ . background_color ( Color :: white ( ) ) ;
58
+
59
+ Label :: new ( cx, "RAND RATE" ) . color ( Color :: white ( ) ) ;
60
+ ParamSlider :: new ( cx, Data :: params, |params| & params. rand_rate )
61
+ . background_color ( Color :: white ( ) ) ;
62
+
63
+ Label :: new ( cx, "NOISE" ) . color ( Color :: white ( ) ) ;
64
+ ParamSlider :: new ( cx, Data :: params, |params| & params. noise )
65
+ . background_color ( Color :: white ( ) ) ;
66
+ } )
67
+ . row_between ( Pixels ( 0.0 ) )
68
+ . child_left ( Stretch ( 1.0 ) )
69
+ . child_right ( Stretch ( 1.0 ) )
70
+ . background_color ( Color :: rgb ( 0x00 , 0x00 , 0x00 ) ) ;
71
+ } )
72
+ }
0 commit comments