From b7bfa5f18e0ddea151425dc3f0b833b12ccc1a36 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 18 Jun 2022 01:59:53 +0200 Subject: [PATCH] Update Vizia With two months of breaking changes, hooray! But everything should still work after some bug squashing in Vizia. --- Cargo.lock | 489 ++++++++++++++++-- nih_plug_vizia/Cargo.toml | 2 +- nih_plug_vizia/src/assets.rs | 2 +- nih_plug_vizia/src/lib.rs | 12 +- nih_plug_vizia/src/widgets.rs | 19 +- nih_plug_vizia/src/widgets/generic_ui.rs | 6 +- nih_plug_vizia/src/widgets/param_slider.rs | 45 +- nih_plug_vizia/src/widgets/peak_meter.rs | 11 +- nih_plug_vizia/src/widgets/resize_handle.rs | 32 +- nih_plug_vizia/src/widgets/util.rs | 34 +- plugins/crisp/src/editor.rs | 2 +- plugins/diopser/src/editor.rs | 2 +- plugins/examples/gain_gui_vizia/src/editor.rs | 2 +- 13 files changed, 522 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5295a02..ed922da0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,6 +62,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" + [[package]] name = "anyhow" version = "1.0.57" @@ -322,7 +328,7 @@ version = "0.1.0" source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/mouse-event-modifiers#5b57af2463ef55c4ac702ef662c3472c328a3c6b" dependencies = [ "cocoa", - "core-foundation", + "core-foundation 0.9.3", "keyboard-types", "nix", "objc", @@ -340,7 +346,7 @@ version = "0.1.0" source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize#b5d0751c82c3fd0301366f1f31c07f3cd53aa52f" dependencies = [ "cocoa", - "core-foundation", + "core-foundation 0.9.3", "keyboard-types", "nix", "objc", @@ -462,6 +468,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "checked_int_cast" version = "1.0.0" @@ -470,16 +485,16 @@ checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919" [[package]] name = "clap" -version = "3.2.2" +version = "3.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e538f9ee5aa3b3963f09a997035f883677966ed50fce0292611927ce6f6d8c6" +checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", "indexmap", - "lazy_static", + "once_cell", "strsim", "termcolor", "textwrap", @@ -493,9 +508,9 @@ checksum = "4a8aa914ef6a42441b5ef7884eef20c6d38bd5b24c3c9eba865b08bf3353bc11" [[package]] name = "clap_derive" -version = "3.2.2" +version = "3.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f98063cac4652f23ccda556b8d04347a7fc4b2cff1f7577cc8c6546e0d8078" +checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9" dependencies = [ "heck", "proc-macro-error", @@ -541,8 +556,8 @@ dependencies = [ "bitflags", "block", "cocoa-foundation", - "core-foundation", - "core-graphics", + "core-foundation 0.9.3", + "core-graphics 0.22.3", "foreign-types", "libc", "objc", @@ -556,7 +571,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ "bitflags", "block", - "core-foundation", + "core-foundation 0.9.3", "core-graphics-types", "foreign-types", "libc", @@ -588,6 +603,16 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + [[package]] name = "copyless" version = "0.1.5" @@ -608,22 +633,50 @@ dependencies = [ "x11-clipboard", ] +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[package]] name = "core-foundation-sys" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + [[package]] name = "core-graphics" version = "0.22.3" @@ -631,7 +684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.9.3", "core-graphics-types", "foreign-types", "libc", @@ -644,7 +697,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.9.3", "foreign-types", "libc", ] @@ -655,12 +708,25 @@ version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" dependencies = [ - "core-foundation", - "core-graphics", + "core-foundation 0.9.3", + "core-graphics 0.22.3", "foreign-types", "libc", ] +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -694,9 +760,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -715,15 +781,15 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] @@ -739,12 +805,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] @@ -819,6 +885,41 @@ dependencies = [ "winapi", ] +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "data-url" version = "0.1.1" @@ -878,6 +979,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + [[package]] name = "dlib" version = "0.5.0" @@ -1012,13 +1119,14 @@ dependencies = [ "fnv", "generational-arena", "glow", + "glutin", "image 0.24.2", "imgref", "lru", "ouroboros", "rgb", "rustybuzz 0.5.1", - "ttf-parser 0.15.1", + "ttf-parser 0.15.2", "unicode-bidi", "unicode-segmentation", "wasm-bindgen", @@ -1104,8 +1212,8 @@ checksum = "46c9a156ec38864999bc9c4156e5f3b50224d4a5578028a64e5a3875caa9ee28" dependencies = [ "bitflags", "byteorder", - "core-foundation", - "core-graphics", + "core-foundation 0.9.3", + "core-graphics 0.22.3", "core-text", "dirs-next", "dwrote", @@ -1429,6 +1537,76 @@ dependencies = [ "log", ] +[[package]] +name = "glutin" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00ea9dbe544bc8a657c4c4a798c2d16cd01b549820e47657297549d28371f6d2" +dependencies = [ + "android_glue", + "cgl", + "cocoa", + "core-foundation 0.9.3", + "glutin_egl_sys", + "glutin_emscripten_sys", + "glutin_gles2_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "lazy_static", + "libloading", + "log", + "objc", + "osmesa-sys", + "parking_lot 0.11.2", + "winapi", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211" +dependencies = [ + "gl_generator", + "winapi", +] + +[[package]] +name = "glutin_emscripten_sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" + +[[package]] +name = "glutin_gles2_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103" +dependencies = [ + "gl_generator", + "objc", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696" +dependencies = [ + "gl_generator", +] + [[package]] name = "glyph_brush" version = "0.7.4" @@ -1506,7 +1684,7 @@ checksum = "a538f217be4d405ff4719a283ca68323cc2384003eca5baaa87501e821c81dda" dependencies = [ "bitflags", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.11.2", ] [[package]] @@ -1537,6 +1715,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" + [[package]] name = "heck" version = "0.4.0" @@ -1674,6 +1858,12 @@ dependencies = [ "wgpu_glyph", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "image" version = "0.23.14" @@ -1714,12 +1904,12 @@ checksum = "7d6a8cd48d0dc604999b8beacfbfc2f4eb289a52af175029d4f79fb57b80c7d5" [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.1", ] [[package]] @@ -1798,6 +1988,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jpeg-decoder" version = "0.1.22" @@ -1809,9 +2005,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -2085,6 +2281,18 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + [[package]] name = "morphorm" version = "0.3.0" @@ -2118,6 +2326,59 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ndk" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" +dependencies = [ + "bitflags", + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-glue" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" + [[package]] name = "nih_plug" version = "0.0.0" @@ -2241,9 +2502,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ "num-traits", ] @@ -2310,6 +2571,27 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "num_threads" version = "0.1.6" @@ -2388,6 +2670,15 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +dependencies = [ + "shared_library", +] + [[package]] name = "ouroboros" version = "0.15.0" @@ -2418,7 +2709,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d" dependencies = [ - "ttf-parser 0.15.1", + "ttf-parser 0.15.2", ] [[package]] @@ -2518,6 +2809,12 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + [[package]] name = "pest" version = "2.1.3" @@ -2663,6 +2960,16 @@ dependencies = [ "num-integer", ] +[[package]] +name = "proc-macro-crate" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +dependencies = [ + "thiserror", + "toml", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3007,7 +3314,7 @@ dependencies = [ "bitflags", "bytemuck", "smallvec", - "ttf-parser 0.15.1", + "ttf-parser 0.15.2", "unicode-bidi-mirroring", "unicode-ccc", "unicode-general-category", @@ -3153,6 +3460,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "shared_library" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" +dependencies = [ + "lazy_static", + "libc", +] + [[package]] name = "sid" version = "0.6.1" @@ -3371,13 +3688,15 @@ dependencies = [ [[package]] name = "sys-locale" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3913c5a3d30054d7f77cf07cdd800c8103ace15c6e44437c5db66a43dd3a92cf" +checksum = "658ee915b6c7b73ec4c1ffcd838506b5c5a4087eadc1ec8f862f1066cf2c8132" dependencies = [ "cc", "cstr_core", + "js-sys", "libc", + "wasm-bindgen", "web-sys", "winapi", ] @@ -3502,9 +3821,9 @@ checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6" [[package]] name = "ttf-parser" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d4b50cba812f0f04f0707bb6a0eaa5fae4ae05d90fc2a377998d2f21e77a1c" +checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "twox-hash" @@ -3659,20 +3978,22 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vizia" version = "0.1.0" -source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#bed8c53cb40585323731b9585c5e7d02df9040e9" +source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#65baceacba8d4fb7dda41a46e26b625ed1ecda4a" dependencies = [ "vizia_baseview", "vizia_core", + "vizia_winit", ] [[package]] name = "vizia_baseview" version = "0.1.0" -source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#bed8c53cb40585323731b9585c5e7d02df9040e9" +source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#65baceacba8d4fb7dda41a46e26b625ed1ecda4a" dependencies = [ "baseview 0.1.0 (git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize)", "femtovg", "keyboard-types", + "lazy_static", "raw-window-handle", "vizia_core", ] @@ -3680,7 +4001,7 @@ dependencies = [ [[package]] name = "vizia_core" version = "0.1.0" -source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#bed8c53cb40585323731b9585c5e7d02df9040e9" +source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#65baceacba8d4fb7dda41a46e26b625ed1ecda4a" dependencies = [ "bitflags", "copypasta", @@ -3705,13 +4026,28 @@ dependencies = [ [[package]] name = "vizia_derive" version = "0.1.0" -source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#bed8c53cb40585323731b9585c5e7d02df9040e9" +source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#65baceacba8d4fb7dda41a46e26b625ed1ecda4a" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "vizia_winit" +version = "0.1.0" +source = "git+https://github.com/robbert-vdh/vizia.git?branch=patched#65baceacba8d4fb7dda41a46e26b625ed1ecda4a" +dependencies = [ + "console_error_panic_hook", + "femtovg", + "glutin", + "keyboard-types", + "vizia_core", + "wasm-bindgen", + "web-sys", + "winit", +] + [[package]] name = "vst3-com" version = "0.1.0" @@ -3780,9 +4116,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3790,9 +4126,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", @@ -3805,9 +4141,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3817,9 +4153,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3827,9 +4163,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ "proc-macro2", "quote", @@ -3840,9 +4176,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "wasm-timer" @@ -4192,6 +4528,36 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "winit" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" +dependencies = [ + "bitflags", + "cocoa", + "core-foundation 0.9.3", + "core-graphics 0.22.3", + "core-video-sys", + "dispatch", + "instant", + "lazy_static", + "libc", + "log", + "mio", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot 0.11.2", + "percent-encoding", + "raw-window-handle", + "wasm-bindgen", + "web-sys", + "winapi", + "x11-dl", +] + [[package]] name = "wio" version = "0.2.2" @@ -4220,6 +4586,17 @@ dependencies = [ "xcb 0.10.1", ] +[[package]] +name = "x11-dl" +version = "2.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" +dependencies = [ + "lazy_static", + "libc", + "pkg-config", +] + [[package]] name = "xcb" version = "0.9.0" diff --git a/nih_plug_vizia/Cargo.toml b/nih_plug_vizia/Cargo.toml index 5c198e83..468dec1a 100644 --- a/nih_plug_vizia/Cargo.toml +++ b/nih_plug_vizia/Cargo.toml @@ -15,4 +15,4 @@ baseview = { git = "https://github.com/robbert-vdh/baseview.git", branch = "feat crossbeam = "0.8" # This fork contains changed for better keyboard modifier handling and DPI # scaling, window scaling, and a lot more fixes and improvements -vizia = { git = "https://github.com/robbert-vdh/vizia.git", branch = "patched", default_features = false, features = ["baseview", "clipboard"] } +vizia = { git = "https://github.com/robbert-vdh/vizia.git", branch = "patched", default_features = false, features = ["baseview", "clipboard", "x11"] } diff --git a/nih_plug_vizia/src/assets.rs b/nih_plug_vizia/src/assets.rs index a4206434..038d5322 100644 --- a/nih_plug_vizia/src/assets.rs +++ b/nih_plug_vizia/src/assets.rs @@ -1,7 +1,7 @@ //! Binary assets for use with `nih_plug_vizia`. These fonts first need to be registered by calling //! [`nih_plug_vizia::assets::register_fonts()`][register_fonts()]. -use vizia::Context; +use vizia::prelude::*; // This module provides a re-export and simple font wrappers around the re-exported fonts. pub use nih_plug_assets::*; diff --git a/nih_plug_vizia/src/lib.rs b/nih_plug_vizia/src/lib.rs index a6a2de98..b446a64d 100644 --- a/nih_plug_vizia/src/lib.rs +++ b/nih_plug_vizia/src/lib.rs @@ -5,7 +5,7 @@ use crossbeam::atomic::AtomicCell; use nih_plug::prelude::{Editor, GuiContext, ParentWindowHandle}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; -use vizia::{Application, Color, Context, Entity, Model, PropSet}; +use vizia::prelude::*; // Re-export for convenience pub use vizia; @@ -172,10 +172,14 @@ impl Editor for ViziaEditor { cx.set_default_font(assets::NOTO_SANS_LIGHT); // TOOD: `:root { background-color: #fafafa; }` in a stylesheet doesn't work - Entity::root().set_background_color(cx, Color::rgb(250, 250, 250)); - Entity::root().set_color(cx, Color::rgb(10, 10, 10)); + cx.style() + .background_color + .insert(Entity::root(), Color::rgb(250, 250, 250)); + cx.style() + .font_color + .insert(Entity::root(), Color::rgb(10, 10, 10)); // VIZIA uses points instead of pixels, this is 20px - Entity::root().set_font_size(cx, 15.0); + cx.style().font_size.insert(Entity::root(), 15.0); cx.add_theme(include_str!("../assets/theme.css")); // There doesn't seem to be any way to bundle styles with a widget, so we'll always diff --git a/nih_plug_vizia/src/widgets.rs b/nih_plug_vizia/src/widgets.rs index eeca46d9..e4662fb0 100644 --- a/nih_plug_vizia/src/widgets.rs +++ b/nih_plug_vizia/src/widgets.rs @@ -7,8 +7,7 @@ use nih_plug::prelude::{GuiContext, Param, ParamPtr}; use std::sync::Arc; - -use vizia::{Context, Lens, Model, WindowEvent}; +use vizia::prelude::*; use super::ViziaState; @@ -76,7 +75,7 @@ pub(crate) struct WindowModel { } impl Model for ParamModel { - fn event(&mut self, _cx: &mut vizia::Context, event: &mut vizia::Event) { + fn event(&mut self, _cx: &mut Context, event: &mut Event) { // `ParamEvent` gets downcast into `NormalizedParamEvent` by the `Message` // implementation below event.map(|param_event, _| match *param_event { @@ -92,14 +91,14 @@ impl Model for ParamModel { } impl Model for WindowModel { - fn event(&mut self, cx: &mut vizia::Context, event: &mut vizia::Event) { + fn event(&mut self, cx: &mut Context, event: &mut Event) { // This gets fired whenever the inner window gets resized event.map(|window_event, _| { if let WindowEvent::WindowResize = window_event { - let logical_size = (cx.window_size.width, cx.window_size.height); + let logical_size = (cx.window_size().width, cx.window_size().height); let old_logical_size @ (old_logical_width, old_logical_height) = self.vizia_state.size.load(); - let scale_factor = cx.user_scale_factor; + let scale_factor = cx.user_scale_factor(); let old_user_scale_factor = self.vizia_state.scale_factor.load(); // Don't do anything if the current size already matches the new size, this could @@ -117,9 +116,11 @@ impl Model for WindowModel { self.vizia_state.scale_factor.store(old_user_scale_factor); // This will cause the window's size to be reverted on the next event loop - cx.window_size.width = old_logical_width; - cx.window_size.height = old_logical_height; - cx.user_scale_factor = old_user_scale_factor; + cx.set_window_size(WindowSize { + width: old_logical_width, + height: old_logical_height, + }); + cx.set_user_scale_factor(old_user_scale_factor); } } }); diff --git a/nih_plug_vizia/src/widgets/generic_ui.rs b/nih_plug_vizia/src/widgets/generic_ui.rs index f186c586..191537da 100644 --- a/nih_plug_vizia/src/widgets/generic_ui.rs +++ b/nih_plug_vizia/src/widgets/generic_ui.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use nih_plug::prelude::{ParamFlags, ParamPtr, Params}; -use vizia::*; +use vizia::prelude::*; use super::{ParamSlider, ParamSliderExt, ParamSliderStyle}; @@ -95,7 +95,7 @@ impl GenericUi { } impl View for GenericUi { - fn element(&self) -> Option { - Some(String::from("generic-ui")) + fn element(&self) -> Option<&'static str> { + Some("generic-ui") } } diff --git a/nih_plug_vizia/src/widgets/param_slider.rs b/nih_plug_vizia/src/widgets/param_slider.rs index 06689e4e..61192750 100644 --- a/nih_plug_vizia/src/widgets/param_slider.rs +++ b/nih_plug_vizia/src/widgets/param_slider.rs @@ -1,7 +1,7 @@ //! A slider that integrates with NIH-plug's [`Param`] types. use nih_plug::prelude::{Param, ParamPtr}; -use vizia::*; +use vizia::prelude::*; use super::util::{self, ModifiersExt}; use super::RawParamEvent; @@ -240,11 +240,12 @@ impl ParamSlider { if text_input_active.get(cx) { Textbox::new(cx, param_display_value_lens) .class("value-entry") - .on_submit(|cx, string| { - cx.emit(ParamSliderEvent::TextInput(string)) - }) - .on_edit_end(|cx| { - cx.emit(ParamSliderEvent::CancelTextInput); + .on_submit(|cx, string, success| { + if success { + cx.emit(ParamSliderEvent::TextInput(string)) + } else { + cx.emit(ParamSliderEvent::CancelTextInput); + } }) .on_build(|cx| { cx.emit(TextEvent::StartEdit); @@ -410,15 +411,15 @@ impl ParamSlider { } impl View for ParamSlider { - fn element(&self) -> Option { - Some(String::from("param-slider")) + fn element(&self) -> Option<&'static str> { + Some("param-slider") } fn event(&mut self, cx: &mut Context, event: &mut Event) { event.map(|param_slider_event, _| match param_slider_event { ParamSliderEvent::CancelTextInput => { cx.emit(ParamSliderInternalEvent::SetTextInputActive(false)); - cx.current.set_active(cx, false); + cx.set_active(false); } ParamSliderEvent::TextInput(string) => { if let Some(normalized_value) = @@ -435,11 +436,11 @@ impl View for ParamSlider { event.map(|window_event, _| match window_event { WindowEvent::MouseDown(MouseButton::Left) => { - if cx.modifiers.alt() { + if cx.modifiers().alt() { // ALt+Click brings up a text entry dialog cx.emit(ParamSliderInternalEvent::SetTextInputActive(true)); - cx.current.set_active(cx, true); - } else if cx.modifiers.command() || self.is_double_click { + cx.set_active(true); + } else if cx.modifiers().command() || self.is_double_click { // Ctrl+Click and double click should reset the parameter instead of initiating // a drag operation cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr)); @@ -452,21 +453,21 @@ impl View for ParamSlider { self.drag_active = true; cx.capture(); // NOTE: Otherwise we don't get key up events - cx.focused = cx.current; - cx.current.set_active(cx, true); + cx.focus(); + cx.set_active(true); // When holding down shift while clicking on a parameter we want to granuarly // edit the parameter without jumping to a new value cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr)); - if cx.modifiers.shift() { - self.granular_drag_start_x_value = Some((cx.mouse.cursorx, unsafe { + if cx.modifiers().shift() { + self.granular_drag_start_x_value = Some((cx.mouse().cursorx, unsafe { self.param_ptr.unmodulated_normalized_value() })); } else { self.granular_drag_start_x_value = None; self.set_normalized_value_drag( cx, - util::remap_current_entity_x_coordinate(cx, cx.mouse.cursorx), + util::remap_current_entity_x_coordinate(cx, cx.mouse().cursorx), ); } } @@ -483,7 +484,7 @@ impl View for ParamSlider { if self.drag_active { self.drag_active = false; cx.release(); - cx.current.set_active(cx, false); + cx.set_active(false); cx.emit(RawParamEvent::EndSetParameter(self.param_ptr)); } @@ -492,10 +493,10 @@ impl View for ParamSlider { if self.drag_active { // If shift is being held then the drag should be more granular instead of // absolute - if cx.modifiers.shift() { + if cx.modifiers().shift() { let (drag_start_x, drag_start_value) = *self.granular_drag_start_x_value.get_or_insert_with(|| { - (cx.mouse.cursorx, unsafe { + (cx.mouse().cursorx, unsafe { self.param_ptr.unmodulated_normalized_value() }) }); @@ -526,7 +527,7 @@ impl View for ParamSlider { self.granular_drag_start_x_value = None; self.set_normalized_value( cx, - util::remap_current_entity_x_coordinate(cx, cx.mouse.cursorx), + util::remap_current_entity_x_coordinate(cx, cx.mouse().cursorx), ); } } @@ -543,7 +544,7 @@ pub trait ParamSliderExt { impl ParamSliderExt for Handle<'_, ParamSlider> { fn set_style(self, style: ParamSliderStyle) -> Self { - self.cx.event_queue.push_back( + self.cx.emit_custom( Event::new(ParamSliderInternalEvent::SetStyle(style)) .target(self.entity) .origin(self.entity) diff --git a/nih_plug_vizia/src/widgets/peak_meter.rs b/nih_plug_vizia/src/widgets/peak_meter.rs index 6a840c7e..b12cee0e 100644 --- a/nih_plug_vizia/src/widgets/peak_meter.rs +++ b/nih_plug_vizia/src/widgets/peak_meter.rs @@ -4,7 +4,8 @@ use nih_plug::prelude::util; use std::cell::Cell; use std::time::Duration; use std::time::Instant; -use vizia::*; +use vizia::prelude::*; +use vizia::vg; /// The thickness of a tick inside of the peak meter's bar. const TICK_WIDTH: f32 = 1.0; @@ -97,8 +98,8 @@ impl PeakMeter { Element::new(cx).class("ticks__tick"); } - let font_size = cx.style.font_size.get(cx.current).unwrap_or(&15.0) - * cx.style.dpi_factor as f32; + let font_size = cx.style_ref().font_size.get(cx.current()).unwrap_or(&15.0) + * cx.style_ref().dpi_factor as f32; let label = if first_tick { Label::new(cx, "-inf") .class("ticks__label") @@ -133,8 +134,8 @@ impl PeakMeter { } impl View for PeakMeter { - fn element(&self) -> Option { - Some(String::from("peak-meter")) + fn element(&self) -> Option<&'static str> { + Some("peak-meter") } } diff --git a/nih_plug_vizia/src/widgets/resize_handle.rs b/nih_plug_vizia/src/widgets/resize_handle.rs index 93f3b7c6..a8dea9ef 100644 --- a/nih_plug_vizia/src/widgets/resize_handle.rs +++ b/nih_plug_vizia/src/widgets/resize_handle.rs @@ -1,6 +1,8 @@ //! A resize handle for uniformly scaling a plugin GUI. -use vizia::*; +use vizia::cache::BoundingBox; +use vizia::prelude::*; +use vizia::vg; /// A resize handle placed at the bottom right of the window that lets you resize the window. pub struct ResizeHandle { @@ -30,8 +32,8 @@ impl ResizeHandle { } impl View for ResizeHandle { - fn element(&self) -> Option { - Some(String::from("resize-handle")) + fn element(&self) -> Option<&'static str> { + Some("resize-handle") } fn event(&mut self, cx: &mut Context, event: &mut Event) { @@ -40,17 +42,17 @@ impl View for ResizeHandle { // The handle is a triangle, so we should also interac twith it as if it was a // triangle if intersects_triangle( - cx.cache.get_bounds(cx.current), - (cx.mouse.cursorx, cx.mouse.cursory), + cx.cache_ref().get_bounds(cx.current()), + (cx.mouse().cursorx, cx.mouse().cursory), ) { cx.capture(); - cx.current.set_active(cx, true); + cx.set_active(true); self.drag_active = true; - self.start_scale_factor = cx.user_scale_factor; + self.start_scale_factor = cx.user_scale_factor(); self.start_physical_coordinates = ( - cx.mouse.cursorx * cx.style.dpi_factor as f32, - cx.mouse.cursory * cx.style.dpi_factor as f32, + cx.mouse().cursorx * cx.style().dpi_factor as f32, + cx.mouse().cursory * cx.style().dpi_factor as f32, ); meta.consume(); @@ -61,16 +63,16 @@ impl View for ResizeHandle { WindowEvent::MouseUp(MouseButton::Left) => { if self.drag_active { cx.release(); - cx.current.set_active(cx, false); + cx.set_active(false); self.drag_active = false; } } WindowEvent::MouseMove(x, y) => { - cx.current.set_hover( - cx, - intersects_triangle(cx.cache.get_bounds(cx.current), (x, y)), - ); + cx.set_hover(intersects_triangle( + cx.cache_ref().get_bounds(cx.current()), + (x, y), + )); if self.drag_active { // We need to convert our measurements into physical pixels relative to the @@ -93,7 +95,7 @@ impl View for ResizeHandle { // If this is different then the window will automatically be resized at the end // of the frame - cx.user_scale_factor = new_scale_factor; + cx.set_user_scale_factor(new_scale_factor); } } _ => {} diff --git a/nih_plug_vizia/src/widgets/util.rs b/nih_plug_vizia/src/widgets/util.rs index b8e28099..55461657 100644 --- a/nih_plug_vizia/src/widgets/util.rs +++ b/nih_plug_vizia/src/widgets/util.rs @@ -1,6 +1,6 @@ //! Utilities for writing VIZIA widgets. -use vizia::{Context, Modifiers, PropGet}; +use vizia::prelude::*; /// An extension trait for [`Modifiers`] that adds platform-independent getters. pub trait ModifiersExt { @@ -37,47 +37,47 @@ impl ModifiersExt for Modifiers { /// Remap a `[0, 1]` value to an x-coordinate within the current entity's bounding box. The value /// will be clamped to `[0, 1]` if it isn't already in that range. This ignores the border width. pub fn remap_current_entity_x_t(cx: &Context, t: f32) -> f32 { - let border_width = match cx.current.get_border_width(cx) { - vizia::Units::Pixels(x) => x, + let border_width = match cx.style_ref().border_width.get(cx.current()) { + Some(Units::Pixels(x)) => *x, _ => 0.0, }; - let x_pos = cx.cache.get_posx(cx.current) + border_width; - let width = cx.cache.get_width(cx.current) - (border_width * 2.0); + let x_pos = cx.cache_ref().get_posx(cx.current()) + border_width; + let width = cx.cache_ref().get_width(cx.current()) - (border_width * 2.0); x_pos + (width * t.clamp(0.0, 1.0)) } /// Remap a `[0, 1]` value to a y-coordinate within the current entity's bounding box. The value /// will be clamped to `[0, 1]` if it isn't already in that range. This ignores the border width. pub fn remap_current_entity_y_t(cx: &Context, t: f32) -> f32 { - let border_width = match cx.current.get_border_width(cx) { - vizia::Units::Pixels(x) => x, + let border_width = match cx.style_ref().border_width.get(cx.current()) { + Some(Units::Pixels(x)) => *x, _ => 0.0, }; - let y_pos = cx.cache.get_posy(cx.current) + border_width; - let height = cx.cache.get_height(cx.current) - (border_width * 2.0); + let y_pos = cx.cache_ref().get_posy(cx.current()) + border_width; + let height = cx.cache_ref().get_height(cx.current()) - (border_width * 2.0); y_pos + (height * t.clamp(0.0, 1.0)) } /// Remap an x-coordinate to a `[0, 1]` value within the current entity's bounding box. The value /// will be clamped to `[0, 1]` if it isn't already in that range. This ignores the border width. pub fn remap_current_entity_x_coordinate(cx: &Context, x_coord: f32) -> f32 { - let border_width = match cx.current.get_border_width(cx) { - vizia::Units::Pixels(x) => x, + let border_width = match cx.style_ref().border_width.get(cx.current()) { + Some(Units::Pixels(x)) => *x, _ => 0.0, }; - let x_pos = cx.cache.get_posx(cx.current) + border_width; - let width = cx.cache.get_width(cx.current) - (border_width * 2.0); + let x_pos = cx.cache_ref().get_posx(cx.current()) + border_width; + let width = cx.cache_ref().get_width(cx.current()) - (border_width * 2.0); ((x_coord - x_pos) / width).clamp(0.0, 1.0) } /// Remap an y-coordinate to a `[0, 1]` value within the current entity's bounding box. The value /// will be clamped to `[0, 1]` if it isn't already in that range. This ignores the border width. pub fn remap_current_entity_y_coordinate(cx: &Context, y_coord: f32) -> f32 { - let border_width = match cx.current.get_border_width(cx) { - vizia::Units::Pixels(x) => x, + let border_width = match cx.style_ref().border_width.get(cx.current()) { + Some(Units::Pixels(x)) => *x, _ => 0.0, }; - let y_pos = cx.cache.get_posy(cx.current) + border_width; - let height = cx.cache.get_height(cx.current) - (border_width * 2.0); + let y_pos = cx.cache_ref().get_posy(cx.current()) + border_width; + let height = cx.cache_ref().get_height(cx.current()) - (border_width * 2.0); ((y_coord - y_pos) / height).clamp(0.0, 1.0) } diff --git a/plugins/crisp/src/editor.rs b/plugins/crisp/src/editor.rs index 52794f44..e8bcbe97 100644 --- a/plugins/crisp/src/editor.rs +++ b/plugins/crisp/src/editor.rs @@ -15,7 +15,7 @@ // along with this program. If not, see . use nih_plug::prelude::Editor; -use nih_plug_vizia::vizia::*; +use nih_plug_vizia::vizia::prelude::*; use nih_plug_vizia::widgets::*; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use std::sync::Arc; diff --git a/plugins/diopser/src/editor.rs b/plugins/diopser/src/editor.rs index cb0b1e3a..f1095d8f 100644 --- a/plugins/diopser/src/editor.rs +++ b/plugins/diopser/src/editor.rs @@ -15,7 +15,7 @@ // along with this program. If not, see . use nih_plug::prelude::Editor; -use nih_plug_vizia::vizia::*; +use nih_plug_vizia::vizia::prelude::*; use nih_plug_vizia::widgets::*; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use std::sync::Arc; diff --git a/plugins/examples/gain_gui_vizia/src/editor.rs b/plugins/examples/gain_gui_vizia/src/editor.rs index 84675398..90677f2a 100644 --- a/plugins/examples/gain_gui_vizia/src/editor.rs +++ b/plugins/examples/gain_gui_vizia/src/editor.rs @@ -1,6 +1,6 @@ use atomic_float::AtomicF32; use nih_plug::prelude::{util, Editor}; -use nih_plug_vizia::vizia::*; +use nih_plug_vizia::vizia::prelude::*; use nih_plug_vizia::widgets::*; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use std::sync::atomic::Ordering;