1
0
Fork 0

Update Vizia

With two months of breaking changes, hooray! But everything should still
work after some bug squashing in Vizia.
This commit is contained in:
Robbert van der Helm 2022-06-18 01:59:53 +02:00
parent a291e0dfb6
commit b7bfa5f18e
13 changed files with 522 additions and 136 deletions

489
Cargo.lock generated
View file

@ -62,6 +62,12 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "android_glue"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.57" 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" source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/mouse-event-modifiers#5b57af2463ef55c4ac702ef662c3472c328a3c6b"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"core-foundation", "core-foundation 0.9.3",
"keyboard-types", "keyboard-types",
"nix", "nix",
"objc", "objc",
@ -340,7 +346,7 @@ version = "0.1.0"
source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize#b5d0751c82c3fd0301366f1f31c07f3cd53aa52f" source = "git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize#b5d0751c82c3fd0301366f1f31c07f3cd53aa52f"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"core-foundation", "core-foundation 0.9.3",
"keyboard-types", "keyboard-types",
"nix", "nix",
"objc", "objc",
@ -462,6 +468,15 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cgl"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "checked_int_cast" name = "checked_int_cast"
version = "1.0.0" version = "1.0.0"
@ -470,16 +485,16 @@ checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.2" version = "3.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e538f9ee5aa3b3963f09a997035f883677966ed50fce0292611927ce6f6d8c6" checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"indexmap", "indexmap",
"lazy_static", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap", "textwrap",
@ -493,9 +508,9 @@ checksum = "4a8aa914ef6a42441b5ef7884eef20c6d38bd5b24c3c9eba865b08bf3353bc11"
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.2" version = "3.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f98063cac4652f23ccda556b8d04347a7fc4b2cff1f7577cc8c6546e0d8078" checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -541,8 +556,8 @@ dependencies = [
"bitflags", "bitflags",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"core-foundation", "core-foundation 0.9.3",
"core-graphics", "core-graphics 0.22.3",
"foreign-types", "foreign-types",
"libc", "libc",
"objc", "objc",
@ -556,7 +571,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
"core-foundation", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
"libc", "libc",
@ -588,6 +603,16 @@ dependencies = [
"cache-padded", "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]] [[package]]
name = "copyless" name = "copyless"
version = "0.1.5" version = "0.1.5"
@ -608,22 +633,50 @@ dependencies = [
"x11-clipboard", "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]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.3" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys 0.8.3",
"libc", "libc",
] ]
[[package]]
name = "core-foundation-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]] [[package]]
name = "core-foundation-sys" name = "core-foundation-sys"
version = "0.8.3" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 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]] [[package]]
name = "core-graphics" name = "core-graphics"
version = "0.22.3" version = "0.22.3"
@ -631,7 +684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
"libc", "libc",
@ -644,7 +697,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation", "core-foundation 0.9.3",
"foreign-types", "foreign-types",
"libc", "libc",
] ]
@ -655,12 +708,25 @@ version = "19.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25"
dependencies = [ dependencies = [
"core-foundation", "core-foundation 0.9.3",
"core-graphics", "core-graphics 0.22.3",
"foreign-types", "foreign-types",
"libc", "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]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.3.2" version = "1.3.2"
@ -694,9 +760,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-channel" name = "crossbeam-channel"
version = "0.5.4" version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils", "crossbeam-utils",
@ -715,15 +781,15 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.8" version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils", "crossbeam-utils",
"lazy_static",
"memoffset", "memoffset",
"once_cell",
"scopeguard", "scopeguard",
] ]
@ -739,12 +805,12 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.8" version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"lazy_static", "once_cell",
] ]
[[package]] [[package]]
@ -819,6 +885,41 @@ dependencies = [
"winapi", "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]] [[package]]
name = "data-url" name = "data-url"
version = "0.1.1" version = "0.1.1"
@ -878,6 +979,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "dispatch"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
[[package]] [[package]]
name = "dlib" name = "dlib"
version = "0.5.0" version = "0.5.0"
@ -1012,13 +1119,14 @@ dependencies = [
"fnv", "fnv",
"generational-arena", "generational-arena",
"glow", "glow",
"glutin",
"image 0.24.2", "image 0.24.2",
"imgref", "imgref",
"lru", "lru",
"ouroboros", "ouroboros",
"rgb", "rgb",
"rustybuzz 0.5.1", "rustybuzz 0.5.1",
"ttf-parser 0.15.1", "ttf-parser 0.15.2",
"unicode-bidi", "unicode-bidi",
"unicode-segmentation", "unicode-segmentation",
"wasm-bindgen", "wasm-bindgen",
@ -1104,8 +1212,8 @@ checksum = "46c9a156ec38864999bc9c4156e5f3b50224d4a5578028a64e5a3875caa9ee28"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"byteorder", "byteorder",
"core-foundation", "core-foundation 0.9.3",
"core-graphics", "core-graphics 0.22.3",
"core-text", "core-text",
"dirs-next", "dirs-next",
"dwrote", "dwrote",
@ -1429,6 +1537,76 @@ dependencies = [
"log", "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]] [[package]]
name = "glyph_brush" name = "glyph_brush"
version = "0.7.4" version = "0.7.4"
@ -1506,7 +1684,7 @@ checksum = "a538f217be4d405ff4719a283ca68323cc2384003eca5baaa87501e821c81dda"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown", "hashbrown 0.11.2",
] ]
[[package]] [[package]]
@ -1537,6 +1715,12 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hashbrown"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.0" version = "0.4.0"
@ -1674,6 +1858,12 @@ dependencies = [
"wgpu_glyph", "wgpu_glyph",
] ]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "image" name = "image"
version = "0.23.14" version = "0.23.14"
@ -1714,12 +1904,12 @@ checksum = "7d6a8cd48d0dc604999b8beacfbfc2f4eb289a52af175029d4f79fb57b80c7d5"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.8.2" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown 0.12.1",
] ]
[[package]] [[package]]
@ -1798,6 +1988,12 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "jni-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]] [[package]]
name = "jpeg-decoder" name = "jpeg-decoder"
version = "0.1.22" version = "0.1.22"
@ -1809,9 +2005,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.57" version = "0.3.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -2085,6 +2281,18 @@ dependencies = [
"adler", "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]] [[package]]
name = "morphorm" name = "morphorm"
version = "0.3.0" version = "0.3.0"
@ -2118,6 +2326,59 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "nih_plug" name = "nih_plug"
version = "0.0.0" version = "0.0.0"
@ -2241,9 +2502,9 @@ dependencies = [
[[package]] [[package]]
name = "num-complex" name = "num-complex"
version = "0.4.1" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19"
dependencies = [ dependencies = [
"num-traits", "num-traits",
] ]
@ -2310,6 +2571,27 @@ dependencies = [
"libc", "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]] [[package]]
name = "num_threads" name = "num_threads"
version = "0.1.6" version = "0.1.6"
@ -2388,6 +2670,15 @@ version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" 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]] [[package]]
name = "ouroboros" name = "ouroboros"
version = "0.15.0" version = "0.15.0"
@ -2418,7 +2709,7 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d" checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d"
dependencies = [ dependencies = [
"ttf-parser 0.15.1", "ttf-parser 0.15.2",
] ]
[[package]] [[package]]
@ -2518,6 +2809,12 @@ dependencies = [
"rustc_version", "rustc_version",
] ]
[[package]]
name = "percent-encoding"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "pest" name = "pest"
version = "2.1.3" version = "2.1.3"
@ -2663,6 +2960,16 @@ dependencies = [
"num-integer", "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]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "1.0.4" version = "1.0.4"
@ -3007,7 +3314,7 @@ dependencies = [
"bitflags", "bitflags",
"bytemuck", "bytemuck",
"smallvec", "smallvec",
"ttf-parser 0.15.1", "ttf-parser 0.15.2",
"unicode-bidi-mirroring", "unicode-bidi-mirroring",
"unicode-ccc", "unicode-ccc",
"unicode-general-category", "unicode-general-category",
@ -3153,6 +3460,16 @@ dependencies = [
"pkg-config", "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]] [[package]]
name = "sid" name = "sid"
version = "0.6.1" version = "0.6.1"
@ -3371,13 +3688,15 @@ dependencies = [
[[package]] [[package]]
name = "sys-locale" name = "sys-locale"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3913c5a3d30054d7f77cf07cdd800c8103ace15c6e44437c5db66a43dd3a92cf" checksum = "658ee915b6c7b73ec4c1ffcd838506b5c5a4087eadc1ec8f862f1066cf2c8132"
dependencies = [ dependencies = [
"cc", "cc",
"cstr_core", "cstr_core",
"js-sys",
"libc", "libc",
"wasm-bindgen",
"web-sys", "web-sys",
"winapi", "winapi",
] ]
@ -3502,9 +3821,9 @@ checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6"
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
version = "0.15.1" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42d4b50cba812f0f04f0707bb6a0eaa5fae4ae05d90fc2a377998d2f21e77a1c" checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd"
[[package]] [[package]]
name = "twox-hash" name = "twox-hash"
@ -3659,20 +3978,22 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "vizia" name = "vizia"
version = "0.1.0" 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 = [ dependencies = [
"vizia_baseview", "vizia_baseview",
"vizia_core", "vizia_core",
"vizia_winit",
] ]
[[package]] [[package]]
name = "vizia_baseview" name = "vizia_baseview"
version = "0.1.0" 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 = [ dependencies = [
"baseview 0.1.0 (git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize)", "baseview 0.1.0 (git+https://github.com/robbert-vdh/baseview.git?branch=feature/resize)",
"femtovg", "femtovg",
"keyboard-types", "keyboard-types",
"lazy_static",
"raw-window-handle", "raw-window-handle",
"vizia_core", "vizia_core",
] ]
@ -3680,7 +4001,7 @@ dependencies = [
[[package]] [[package]]
name = "vizia_core" name = "vizia_core"
version = "0.1.0" 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 = [ dependencies = [
"bitflags", "bitflags",
"copypasta", "copypasta",
@ -3705,13 +4026,28 @@ dependencies = [
[[package]] [[package]]
name = "vizia_derive" name = "vizia_derive"
version = "0.1.0" 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 = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "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]] [[package]]
name = "vst3-com" name = "vst3-com"
version = "0.1.0" version = "0.1.0"
@ -3780,9 +4116,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -3790,9 +4126,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -3805,9 +4141,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.30" version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -3817,9 +4153,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -3827,9 +4163,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3840,9 +4176,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.80" version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
[[package]] [[package]]
name = "wasm-timer" name = "wasm-timer"
@ -4192,6 +4528,36 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 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]] [[package]]
name = "wio" name = "wio"
version = "0.2.2" version = "0.2.2"
@ -4220,6 +4586,17 @@ dependencies = [
"xcb 0.10.1", "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]] [[package]]
name = "xcb" name = "xcb"
version = "0.9.0" version = "0.9.0"

View file

@ -15,4 +15,4 @@ baseview = { git = "https://github.com/robbert-vdh/baseview.git", branch = "feat
crossbeam = "0.8" crossbeam = "0.8"
# This fork contains changed for better keyboard modifier handling and DPI # This fork contains changed for better keyboard modifier handling and DPI
# scaling, window scaling, and a lot more fixes and improvements # 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"] }

View file

@ -1,7 +1,7 @@
//! Binary assets for use with `nih_plug_vizia`. These fonts first need to be registered by calling //! 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()]. //! [`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. // This module provides a re-export and simple font wrappers around the re-exported fonts.
pub use nih_plug_assets::*; pub use nih_plug_assets::*;

View file

@ -5,7 +5,7 @@ use crossbeam::atomic::AtomicCell;
use nih_plug::prelude::{Editor, GuiContext, ParentWindowHandle}; use nih_plug::prelude::{Editor, GuiContext, ParentWindowHandle};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc; use std::sync::Arc;
use vizia::{Application, Color, Context, Entity, Model, PropSet}; use vizia::prelude::*;
// Re-export for convenience // Re-export for convenience
pub use vizia; pub use vizia;
@ -172,10 +172,14 @@ impl Editor for ViziaEditor {
cx.set_default_font(assets::NOTO_SANS_LIGHT); cx.set_default_font(assets::NOTO_SANS_LIGHT);
// TOOD: `:root { background-color: #fafafa; }` in a stylesheet doesn't work // TOOD: `:root { background-color: #fafafa; }` in a stylesheet doesn't work
Entity::root().set_background_color(cx, Color::rgb(250, 250, 250)); cx.style()
Entity::root().set_color(cx, Color::rgb(10, 10, 10)); .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 // 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")); 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 // There doesn't seem to be any way to bundle styles with a widget, so we'll always

View file

@ -7,8 +7,7 @@
use nih_plug::prelude::{GuiContext, Param, ParamPtr}; use nih_plug::prelude::{GuiContext, Param, ParamPtr};
use std::sync::Arc; use std::sync::Arc;
use vizia::prelude::*;
use vizia::{Context, Lens, Model, WindowEvent};
use super::ViziaState; use super::ViziaState;
@ -76,7 +75,7 @@ pub(crate) struct WindowModel {
} }
impl Model for ParamModel { 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` // `ParamEvent` gets downcast into `NormalizedParamEvent` by the `Message`
// implementation below // implementation below
event.map(|param_event, _| match *param_event { event.map(|param_event, _| match *param_event {
@ -92,14 +91,14 @@ impl Model for ParamModel {
} }
impl Model for WindowModel { 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 // This gets fired whenever the inner window gets resized
event.map(|window_event, _| { event.map(|window_event, _| {
if let WindowEvent::WindowResize = 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) = let old_logical_size @ (old_logical_width, old_logical_height) =
self.vizia_state.size.load(); 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(); 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 // 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); 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 // This will cause the window's size to be reverted on the next event loop
cx.window_size.width = old_logical_width; cx.set_window_size(WindowSize {
cx.window_size.height = old_logical_height; width: old_logical_width,
cx.user_scale_factor = old_user_scale_factor; height: old_logical_height,
});
cx.set_user_scale_factor(old_user_scale_factor);
} }
} }
}); });

View file

@ -3,7 +3,7 @@
use std::sync::Arc; use std::sync::Arc;
use nih_plug::prelude::{ParamFlags, ParamPtr, Params}; use nih_plug::prelude::{ParamFlags, ParamPtr, Params};
use vizia::*; use vizia::prelude::*;
use super::{ParamSlider, ParamSliderExt, ParamSliderStyle}; use super::{ParamSlider, ParamSliderExt, ParamSliderStyle};
@ -95,7 +95,7 @@ impl GenericUi {
} }
impl View for GenericUi { impl View for GenericUi {
fn element(&self) -> Option<String> { fn element(&self) -> Option<&'static str> {
Some(String::from("generic-ui")) Some("generic-ui")
} }
} }

View file

@ -1,7 +1,7 @@
//! A slider that integrates with NIH-plug's [`Param`] types. //! A slider that integrates with NIH-plug's [`Param`] types.
use nih_plug::prelude::{Param, ParamPtr}; use nih_plug::prelude::{Param, ParamPtr};
use vizia::*; use vizia::prelude::*;
use super::util::{self, ModifiersExt}; use super::util::{self, ModifiersExt};
use super::RawParamEvent; use super::RawParamEvent;
@ -240,11 +240,12 @@ impl ParamSlider {
if text_input_active.get(cx) { if text_input_active.get(cx) {
Textbox::new(cx, param_display_value_lens) Textbox::new(cx, param_display_value_lens)
.class("value-entry") .class("value-entry")
.on_submit(|cx, string| { .on_submit(|cx, string, success| {
if success {
cx.emit(ParamSliderEvent::TextInput(string)) cx.emit(ParamSliderEvent::TextInput(string))
}) } else {
.on_edit_end(|cx| {
cx.emit(ParamSliderEvent::CancelTextInput); cx.emit(ParamSliderEvent::CancelTextInput);
}
}) })
.on_build(|cx| { .on_build(|cx| {
cx.emit(TextEvent::StartEdit); cx.emit(TextEvent::StartEdit);
@ -410,15 +411,15 @@ impl ParamSlider {
} }
impl View for ParamSlider { impl View for ParamSlider {
fn element(&self) -> Option<String> { fn element(&self) -> Option<&'static str> {
Some(String::from("param-slider")) Some("param-slider")
} }
fn event(&mut self, cx: &mut Context, event: &mut Event) { fn event(&mut self, cx: &mut Context, event: &mut Event) {
event.map(|param_slider_event, _| match param_slider_event { event.map(|param_slider_event, _| match param_slider_event {
ParamSliderEvent::CancelTextInput => { ParamSliderEvent::CancelTextInput => {
cx.emit(ParamSliderInternalEvent::SetTextInputActive(false)); cx.emit(ParamSliderInternalEvent::SetTextInputActive(false));
cx.current.set_active(cx, false); cx.set_active(false);
} }
ParamSliderEvent::TextInput(string) => { ParamSliderEvent::TextInput(string) => {
if let Some(normalized_value) = if let Some(normalized_value) =
@ -435,11 +436,11 @@ impl View for ParamSlider {
event.map(|window_event, _| match window_event { event.map(|window_event, _| match window_event {
WindowEvent::MouseDown(MouseButton::Left) => { WindowEvent::MouseDown(MouseButton::Left) => {
if cx.modifiers.alt() { if cx.modifiers().alt() {
// ALt+Click brings up a text entry dialog // ALt+Click brings up a text entry dialog
cx.emit(ParamSliderInternalEvent::SetTextInputActive(true)); cx.emit(ParamSliderInternalEvent::SetTextInputActive(true));
cx.current.set_active(cx, true); cx.set_active(true);
} else if cx.modifiers.command() || self.is_double_click { } else if cx.modifiers().command() || self.is_double_click {
// Ctrl+Click and double click should reset the parameter instead of initiating // Ctrl+Click and double click should reset the parameter instead of initiating
// a drag operation // a drag operation
cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr)); cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr));
@ -452,21 +453,21 @@ impl View for ParamSlider {
self.drag_active = true; self.drag_active = true;
cx.capture(); cx.capture();
// NOTE: Otherwise we don't get key up events // NOTE: Otherwise we don't get key up events
cx.focused = cx.current; cx.focus();
cx.current.set_active(cx, true); cx.set_active(true);
// When holding down shift while clicking on a parameter we want to granuarly // When holding down shift while clicking on a parameter we want to granuarly
// edit the parameter without jumping to a new value // edit the parameter without jumping to a new value
cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr)); cx.emit(RawParamEvent::BeginSetParameter(self.param_ptr));
if cx.modifiers.shift() { if cx.modifiers().shift() {
self.granular_drag_start_x_value = Some((cx.mouse.cursorx, unsafe { self.granular_drag_start_x_value = Some((cx.mouse().cursorx, unsafe {
self.param_ptr.unmodulated_normalized_value() self.param_ptr.unmodulated_normalized_value()
})); }));
} else { } else {
self.granular_drag_start_x_value = None; self.granular_drag_start_x_value = None;
self.set_normalized_value_drag( self.set_normalized_value_drag(
cx, 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 { if self.drag_active {
self.drag_active = false; self.drag_active = false;
cx.release(); cx.release();
cx.current.set_active(cx, false); cx.set_active(false);
cx.emit(RawParamEvent::EndSetParameter(self.param_ptr)); cx.emit(RawParamEvent::EndSetParameter(self.param_ptr));
} }
@ -492,10 +493,10 @@ impl View for ParamSlider {
if self.drag_active { if self.drag_active {
// If shift is being held then the drag should be more granular instead of // If shift is being held then the drag should be more granular instead of
// absolute // absolute
if cx.modifiers.shift() { if cx.modifiers().shift() {
let (drag_start_x, drag_start_value) = let (drag_start_x, drag_start_value) =
*self.granular_drag_start_x_value.get_or_insert_with(|| { *self.granular_drag_start_x_value.get_or_insert_with(|| {
(cx.mouse.cursorx, unsafe { (cx.mouse().cursorx, unsafe {
self.param_ptr.unmodulated_normalized_value() self.param_ptr.unmodulated_normalized_value()
}) })
}); });
@ -526,7 +527,7 @@ impl View for ParamSlider {
self.granular_drag_start_x_value = None; self.granular_drag_start_x_value = None;
self.set_normalized_value( self.set_normalized_value(
cx, 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> { impl ParamSliderExt for Handle<'_, ParamSlider> {
fn set_style(self, style: ParamSliderStyle) -> Self { fn set_style(self, style: ParamSliderStyle) -> Self {
self.cx.event_queue.push_back( self.cx.emit_custom(
Event::new(ParamSliderInternalEvent::SetStyle(style)) Event::new(ParamSliderInternalEvent::SetStyle(style))
.target(self.entity) .target(self.entity)
.origin(self.entity) .origin(self.entity)

View file

@ -4,7 +4,8 @@ use nih_plug::prelude::util;
use std::cell::Cell; use std::cell::Cell;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use vizia::*; use vizia::prelude::*;
use vizia::vg;
/// The thickness of a tick inside of the peak meter's bar. /// The thickness of a tick inside of the peak meter's bar.
const TICK_WIDTH: f32 = 1.0; const TICK_WIDTH: f32 = 1.0;
@ -97,8 +98,8 @@ impl PeakMeter {
Element::new(cx).class("ticks__tick"); Element::new(cx).class("ticks__tick");
} }
let font_size = cx.style.font_size.get(cx.current).unwrap_or(&15.0) let font_size = cx.style_ref().font_size.get(cx.current()).unwrap_or(&15.0)
* cx.style.dpi_factor as f32; * cx.style_ref().dpi_factor as f32;
let label = if first_tick { let label = if first_tick {
Label::new(cx, "-inf") Label::new(cx, "-inf")
.class("ticks__label") .class("ticks__label")
@ -133,8 +134,8 @@ impl PeakMeter {
} }
impl View for PeakMeter { impl View for PeakMeter {
fn element(&self) -> Option<String> { fn element(&self) -> Option<&'static str> {
Some(String::from("peak-meter")) Some("peak-meter")
} }
} }

View file

@ -1,6 +1,8 @@
//! A resize handle for uniformly scaling a plugin GUI. //! 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. /// A resize handle placed at the bottom right of the window that lets you resize the window.
pub struct ResizeHandle { pub struct ResizeHandle {
@ -30,8 +32,8 @@ impl ResizeHandle {
} }
impl View for ResizeHandle { impl View for ResizeHandle {
fn element(&self) -> Option<String> { fn element(&self) -> Option<&'static str> {
Some(String::from("resize-handle")) Some("resize-handle")
} }
fn event(&mut self, cx: &mut Context, event: &mut Event) { 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 // The handle is a triangle, so we should also interac twith it as if it was a
// triangle // triangle
if intersects_triangle( if intersects_triangle(
cx.cache.get_bounds(cx.current), cx.cache_ref().get_bounds(cx.current()),
(cx.mouse.cursorx, cx.mouse.cursory), (cx.mouse().cursorx, cx.mouse().cursory),
) { ) {
cx.capture(); cx.capture();
cx.current.set_active(cx, true); cx.set_active(true);
self.drag_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 = ( self.start_physical_coordinates = (
cx.mouse.cursorx * cx.style.dpi_factor as f32, cx.mouse().cursorx * cx.style().dpi_factor as f32,
cx.mouse.cursory * cx.style.dpi_factor as f32, cx.mouse().cursory * cx.style().dpi_factor as f32,
); );
meta.consume(); meta.consume();
@ -61,16 +63,16 @@ impl View for ResizeHandle {
WindowEvent::MouseUp(MouseButton::Left) => { WindowEvent::MouseUp(MouseButton::Left) => {
if self.drag_active { if self.drag_active {
cx.release(); cx.release();
cx.current.set_active(cx, false); cx.set_active(false);
self.drag_active = false; self.drag_active = false;
} }
} }
WindowEvent::MouseMove(x, y) => { WindowEvent::MouseMove(x, y) => {
cx.current.set_hover( cx.set_hover(intersects_triangle(
cx, cx.cache_ref().get_bounds(cx.current()),
intersects_triangle(cx.cache.get_bounds(cx.current), (x, y)), (x, y),
); ));
if self.drag_active { if self.drag_active {
// We need to convert our measurements into physical pixels relative to the // 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 // If this is different then the window will automatically be resized at the end
// of the frame // of the frame
cx.user_scale_factor = new_scale_factor; cx.set_user_scale_factor(new_scale_factor);
} }
} }
_ => {} _ => {}

View file

@ -1,6 +1,6 @@
//! Utilities for writing VIZIA widgets. //! Utilities for writing VIZIA widgets.
use vizia::{Context, Modifiers, PropGet}; use vizia::prelude::*;
/// An extension trait for [`Modifiers`] that adds platform-independent getters. /// An extension trait for [`Modifiers`] that adds platform-independent getters.
pub trait ModifiersExt { 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 /// 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. /// 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 { pub fn remap_current_entity_x_t(cx: &Context, t: f32) -> f32 {
let border_width = match cx.current.get_border_width(cx) { let border_width = match cx.style_ref().border_width.get(cx.current()) {
vizia::Units::Pixels(x) => x, Some(Units::Pixels(x)) => *x,
_ => 0.0, _ => 0.0,
}; };
let x_pos = cx.cache.get_posx(cx.current) + border_width; let x_pos = cx.cache_ref().get_posx(cx.current()) + border_width;
let width = cx.cache.get_width(cx.current) - (border_width * 2.0); let width = cx.cache_ref().get_width(cx.current()) - (border_width * 2.0);
x_pos + (width * t.clamp(0.0, 1.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 /// 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. /// 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 { pub fn remap_current_entity_y_t(cx: &Context, t: f32) -> f32 {
let border_width = match cx.current.get_border_width(cx) { let border_width = match cx.style_ref().border_width.get(cx.current()) {
vizia::Units::Pixels(x) => x, Some(Units::Pixels(x)) => *x,
_ => 0.0, _ => 0.0,
}; };
let y_pos = cx.cache.get_posy(cx.current) + border_width; let y_pos = cx.cache_ref().get_posy(cx.current()) + border_width;
let height = cx.cache.get_height(cx.current) - (border_width * 2.0); let height = cx.cache_ref().get_height(cx.current()) - (border_width * 2.0);
y_pos + (height * t.clamp(0.0, 1.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 /// 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. /// 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 { pub fn remap_current_entity_x_coordinate(cx: &Context, x_coord: f32) -> f32 {
let border_width = match cx.current.get_border_width(cx) { let border_width = match cx.style_ref().border_width.get(cx.current()) {
vizia::Units::Pixels(x) => x, Some(Units::Pixels(x)) => *x,
_ => 0.0, _ => 0.0,
}; };
let x_pos = cx.cache.get_posx(cx.current) + border_width; let x_pos = cx.cache_ref().get_posx(cx.current()) + border_width;
let width = cx.cache.get_width(cx.current) - (border_width * 2.0); let width = cx.cache_ref().get_width(cx.current()) - (border_width * 2.0);
((x_coord - x_pos) / width).clamp(0.0, 1.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 /// 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. /// 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 { pub fn remap_current_entity_y_coordinate(cx: &Context, y_coord: f32) -> f32 {
let border_width = match cx.current.get_border_width(cx) { let border_width = match cx.style_ref().border_width.get(cx.current()) {
vizia::Units::Pixels(x) => x, Some(Units::Pixels(x)) => *x,
_ => 0.0, _ => 0.0,
}; };
let y_pos = cx.cache.get_posy(cx.current) + border_width; let y_pos = cx.cache_ref().get_posy(cx.current()) + border_width;
let height = cx.cache.get_height(cx.current) - (border_width * 2.0); let height = cx.cache_ref().get_height(cx.current()) - (border_width * 2.0);
((y_coord - y_pos) / height).clamp(0.0, 1.0) ((y_coord - y_pos) / height).clamp(0.0, 1.0)
} }

View file

@ -15,7 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use nih_plug::prelude::Editor; 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::widgets::*;
use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState};
use std::sync::Arc; use std::sync::Arc;

View file

@ -15,7 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use nih_plug::prelude::Editor; 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::widgets::*;
use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState};
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,6 +1,6 @@
use atomic_float::AtomicF32; use atomic_float::AtomicF32;
use nih_plug::prelude::{util, Editor}; 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::widgets::*;
use nih_plug_vizia::{assets, create_vizia_editor, ViziaState}; use nih_plug_vizia::{assets, create_vizia_editor, ViziaState};
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;