From 1ff2990f2e33a01751bb0027a9b6e67ea74a57be Mon Sep 17 00:00:00 2001 From: pjht Date: Thu, 25 Jan 2024 10:34:10 -0600 Subject: [PATCH] Continue work on front panel refactor --- Cargo.lock | 984 ++++++++++++++++++++++++++------------- Cargo.toml | 4 +- src/frontpanel.rs | 480 +++++++++++++++++++ src/frontpanel/led.rs | 54 +++ src/frontpanel/switch.rs | 103 ++-- src/main.rs | 27 +- 6 files changed, 1277 insertions(+), 375 deletions(-) create mode 100644 src/frontpanel/led.rs diff --git a/Cargo.lock b/Cargo.lock index 2005790..bb7c8d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c98a5d094590335462354da402d754fe2cb78f0e6ce5024611c28ed539c1de" +checksum = "6cb10ed32c63247e4e39a8f42e8e30fb9442fbf7878c8e4a9849e7e381619bea" dependencies = [ "enumn", "serde", @@ -30,59 +30,61 @@ dependencies = [ [[package]] name = "accesskit_consumer" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca541e0fdb600916d196a940228df99b86d804fd2e6ef13894d7814f2799db43" +checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" dependencies = [ "accesskit", ] [[package]] name = "accesskit_macos" -version = "0.7.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4baea9413f0daf1cd4aab199bc09f8139cd726ce7673d523c27d186b8b878325" +checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" dependencies = [ "accesskit", "accesskit_consumer", - "objc2", + "objc2 0.3.0-beta.3.patch-leaks.3", "once_cell", ] [[package]] name = "accesskit_unix" -version = "0.5.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4d1517421278cc8e67422d0786a18cf4291093ebe49eadf1cf989ff80e57f90" +checksum = "09f46c18d99ba61ad7123dd13eeb0c104436ab6af1df6a1cd8c11054ed394a08" dependencies = [ "accesskit", "accesskit_consumer", - "async-channel", + "async-channel 2.1.1", + "async-once-cell", "atspi", "futures-lite", + "once_cell", "serde", "zbus", ] [[package]] name = "accesskit_windows" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11c7f177739f23bd19bb856e4a64fdd96eb8638ec0a6a6dde9a7019a9e91c53" +checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" dependencies = [ "accesskit", "accesskit_consumer", - "arrayvec", "once_cell", "paste", - "windows 0.44.0", + "static_assertions", + "windows 0.48.0", ] [[package]] name = "accesskit_winit" -version = "0.14.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f1bd64cd0b480cafb7bdd91eb489a1ff50f0f5702437b9efa32a25b8bb82a1" +checksum = "5284218aca17d9e150164428a0ebc7b955f70e3a9a78b4c20894513aabf98a67" dependencies = [ "accesskit", "accesskit_macos", @@ -99,14 +101,16 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", + "getrandom", "once_cell", "serde", "version_check", + "zerocopy", ] [[package]] @@ -122,7 +126,7 @@ dependencies = [ name = "altair_emu" version = "0.1.0" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "device_query", "eframe", "egui-modal", @@ -142,20 +146,23 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40bc1575e653f158cbdc6ebcd917b9564e66321c5325c232c3591269c257be69" +checksum = "39b801912a977c3fd52d80511fe1c0c8480c6f957f21ae2ce1b92ffe970cf4b9" dependencies = [ "android-properties", - "bitflags 1.3.2", + "bitflags 2.4.2", "cc", + "cesu8", + "jni", "jni-sys", "libc", "log", "ndk", "ndk-context", "ndk-sys", - "num_enum 0.6.1", + "num_enum", + "thiserror", ] [[package]] @@ -179,7 +186,7 @@ dependencies = [ "parking_lot", "thiserror", "winapi", - "x11rb", + "x11rb 0.10.1", ] [[package]] @@ -194,13 +201,19 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + [[package]] name = "async-broadcast" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" dependencies = [ - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -211,10 +224,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] +[[package]] +name = "async-channel" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +dependencies = [ + "concurrent-queue", + "event-listener 4.0.3", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-executor" version = "1.5.1" @@ -254,7 +280,7 @@ dependencies = [ "futures-lite", "log", "parking", - "polling", + "polling 2.8.0", "rustix 0.37.23", "slab", "socket2", @@ -267,9 +293,15 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" dependencies = [ - "event-listener", + "event-listener 2.5.3", ] +[[package]] +name = "async-once-cell" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" + [[package]] name = "async-process" version = "1.7.0" @@ -281,7 +313,7 @@ dependencies = [ "autocfg", "blocking", "cfg-if", - "event-listener", + "event-listener 2.5.3", "futures-lite", "rustix 0.37.23", "signal-hook", @@ -296,7 +328,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -313,7 +345,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -334,37 +366,52 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" -[[package]] -name = "atomic_refcell" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79d6dc922a2792b006573f60b2648076355daeae5ce9cb59507e5908c9625d31" - [[package]] name = "atspi" -version = "0.10.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "674e7a3376837b2e7d12d34d58ac47073c491dc3bf6f71a7adaf687d4d817faa" +checksum = "6059f350ab6f593ea00727b334265c4dfc7fd442ee32d264794bd9bdc68e87ca" dependencies = [ - "async-recursion", - "async-trait", - "atspi-macros", - "enumflags2", - "futures-lite", - "serde", - "tracing", - "zbus", - "zbus_names", + "atspi-common", + "atspi-connection", + "atspi-proxies", ] [[package]] -name = "atspi-macros" -version = "0.2.0" +name = "atspi-common" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb4870a32c0eaa17e35bca0e6b16020635157121fb7d45593d242c295bc768" +checksum = "92af95f966d2431f962bc632c2e68eda7777330158bf640c4af4249349b2cdf5" dependencies = [ - "quote", - "syn 1.0.109", + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-connection" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c65e7d70f86d4c0e3b2d585d9bf3f979f0b19d635a336725a88d279f76b939" +dependencies = [ + "atspi-common", + "atspi-proxies", + "futures-lite", + "zbus", +] + +[[package]] +name = "atspi-proxies" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6495661273703e7a229356dcbe8c8f38223d697aacfaf0e13590a9ac9977bb52" +dependencies = [ + "atspi-common", + "serde", + "zbus", ] [[package]] @@ -393,9 +440,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block" @@ -418,7 +465,16 @@ version = "0.1.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" dependencies = [ - "objc-sys", + "objc-sys 0.2.0-beta.2", +] + +[[package]] +name = "block-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" +dependencies = [ + "objc-sys 0.3.2", ] [[package]] @@ -427,8 +483,18 @@ version = "0.2.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" dependencies = [ - "block-sys", - "objc2-encode", + "block-sys 0.1.0-beta.1", + "objc2-encode 2.0.0-pre.2", +] + +[[package]] +name = "block2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" +dependencies = [ + "block-sys 0.2.1", + "objc2 0.4.1", ] [[package]] @@ -437,7 +503,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-lock", "async-task", "atomic-waker", @@ -469,7 +535,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -496,16 +562,28 @@ dependencies = [ [[package]] name = "calloop" -version = "0.10.6" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "log", - "nix 0.25.1", - "slotmap", + "polling 3.3.2", + "rustix 0.38.30", + "slab", "thiserror", - "vec_map", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +dependencies = [ + "calloop", + "rustix 0.38.30", + "wayland-backend", + "wayland-client", ] [[package]] @@ -576,16 +654,16 @@ dependencies = [ [[package]] name = "cocoa" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" dependencies = [ "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", "core-graphics", - "foreign-types", + "foreign-types 0.5.0", "libc", "objc", ] @@ -600,7 +678,7 @@ dependencies = [ "block", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "libc", "objc", ] @@ -648,14 +726,14 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" -version = "0.22.3" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -747,6 +825,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "cursor-icon" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" + [[package]] name = "derivative" version = "2.2.0" @@ -816,7 +900,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.0", + "libloading", ] [[package]] @@ -827,9 +911,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecolor" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e479a7fa3f23d4e794f8b2f8b3568dd4e47886ad1b12c9c095e141cb591eb63" +checksum = "57539aabcdbb733b6806ef421b66dec158dc1582107ad6d51913db3600303354" dependencies = [ "bytemuck", "serde", @@ -837,9 +921,9 @@ dependencies = [ [[package]] name = "eframe" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4596583a2c680c55b6feaa748f74890c4f9cb9c7cb69d6117110444cb65b2f" +checksum = "79c00143a1d564cf27570234c9a199cbe75dc3d43a135510fb2b93406a87ee8e" dependencies = [ "bytemuck", "cocoa", @@ -854,10 +938,12 @@ dependencies = [ "js-sys", "log", "objc", + "parking_lot", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", "ron", "serde", + "static_assertions", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -868,9 +954,9 @@ dependencies = [ [[package]] name = "egui" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3aef8ec3ae1b772f340170c65bf27d5b8c28f543a0116c844d2ac08d01123e7" +checksum = "e0bf640ed7f3bf3d14ebf00d73bacc09c886443ee84ca6494bde37953012c9e3" dependencies = [ "accesskit", "ahash", @@ -883,42 +969,42 @@ dependencies = [ [[package]] name = "egui-modal" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "868331421dda06e5dc8e96b2be78fd01c33a8e5c99ca452369cebecbef7b6639" +checksum = "5e4dd394948863624a7269cedfaeb5c6a568e6d1d7accfac6fa70c283699c78b" dependencies = [ "egui", ] [[package]] name = "egui-winit" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a49155fd4a0a4fb21224407a91de0030847972ef90fc64edb63621caea61cb2" +checksum = "1d95d9762056c541bd2724de02910d8bccf3af8e37689dc114b21730e64f80a0" dependencies = [ "accesskit_winit", "arboard", "egui", - "instant", "log", - "raw-window-handle", + "raw-window-handle 0.5.2", "serde", "smithay-clipboard", + "web-time", "webbrowser", "winit", ] [[package]] name = "egui_glow" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8c2752cdf1b0ef5fcda59a898cacabad974d4f5880e92a420b2c917022da64" +checksum = "cb2ef815e80d117339c7d6b813f7678d23522d699ccd3243e267ef06166009b9" dependencies = [ "bytemuck", "egui", "glow", "log", - "memoffset 0.6.5", + "memoffset 0.7.1", "wasm-bindgen", "web-sys", ] @@ -931,9 +1017,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "emath" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3857d743a6e0741cdd60b622a74c7a36ea75f5f8f11b793b41d905d2c9721a4b" +checksum = "3ee58355767587db7ba3738930d93cad3052cd834c2b48b9ef6ef26fe4823b7e" dependencies = [ "bytemuck", "serde", @@ -948,7 +1034,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -969,7 +1055,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -980,7 +1066,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -998,13 +1084,12 @@ dependencies = [ [[package]] name = "epaint" -version = "0.22.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09333964d4d57f40a85338ba3ca5ed4716070ab184dcfed966b35491c5c64f3b" +checksum = "e638cb066bff0903bbb6143116cfd134a42279c7d68f19c0352a94f15a402de7" dependencies = [ "ab_glyph", "ahash", - "atomic_refcell", "bytemuck", "ecolor", "emath", @@ -1022,23 +1107,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] @@ -1057,6 +1131,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener 4.0.3", + "pin-project-lite", +] + [[package]] name = "exr" version = "1.7.0" @@ -1120,7 +1215,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", ] [[package]] @@ -1129,6 +1245,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.2.0" @@ -1243,6 +1365,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.1", +] + [[package]] name = "getrandom" version = "0.2.10" @@ -1302,9 +1434,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.12.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "807edf58b70c0b5b2181dd39fe1839dbdb3ba02645630dc5f753e23da307f762" +checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" dependencies = [ "js-sys", "slotmap", @@ -1314,11 +1446,11 @@ dependencies = [ [[package]] name = "glutin" -version = "0.30.9" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b0385782048be65f0a9dd046c469d6a758a53fe1aa63a8111dea394d2ffa2f" +checksum = "005459a22af86adc706522d78d360101118e2638ec21df3852fcc626e0dbb212" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "cfg_aliases", "cgl", "core-foundation", @@ -1326,42 +1458,43 @@ dependencies = [ "glutin_egl_sys", "glutin_glx_sys", "glutin_wgl_sys", - "libloading 0.7.4", - "objc2", + "icrate", + "libloading", + "objc2 0.4.1", "once_cell", - "raw-window-handle", - "wayland-sys 0.30.1", - "windows-sys 0.45.0", + "raw-window-handle 0.5.2", + "wayland-sys", + "windows-sys 0.48.0", "x11-dl", ] [[package]] name = "glutin-winit" -version = "0.3.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" +checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" dependencies = [ "cfg_aliases", "glutin", - "raw-window-handle", + "raw-window-handle 0.5.2", "winit", ] [[package]] name = "glutin_egl_sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3bcbddc51573b977fc6dca5d93867e4f29682cdbaf5d13e48f4fa4346d4d87" +checksum = "77cc5623f5309ef433c3dd4ca1223195347fe62c413da8e2fdd0eb76db2d9bcd" dependencies = [ "gl_generator", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "glutin_glx_sys" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" +checksum = "a165fd686c10dcc2d45380b35796e577eacfd43d4660ee741ec8ebe2201b3b4f" dependencies = [ "gl_generator", "x11-dl", @@ -1369,9 +1502,9 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" dependencies = [ "gl_generator", ] @@ -1462,6 +1595,17 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "icrate" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" +dependencies = [ + "block2 0.3.0", + "dispatch", + "objc2 0.4.1", +] + [[package]] name = "idna" version = "0.4.0" @@ -1514,9 +1658,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -1537,7 +1678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.2", - "rustix 0.38.4", + "rustix 0.38.30", "windows-sys 0.48.0", ] @@ -1610,19 +1751,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libloading" @@ -1642,9 +1773,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1689,9 +1820,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.10" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -1739,18 +1870,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "nanorand" version = "0.7.0" @@ -1762,15 +1881,17 @@ dependencies = [ [[package]] name = "ndk" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "jni-sys", + "log", "ndk-sys", - "num_enum 0.5.11", - "raw-window-handle", + "num_enum", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "thiserror", ] @@ -1782,9 +1903,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.4.1+23.1.7779620" +version = "0.5.0+25.2.9519653" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" dependencies = [ "jni-sys", ] @@ -1801,19 +1922,6 @@ dependencies = [ "memoffset 0.6.5", ] -[[package]] -name = "nix" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.26.2" @@ -1885,44 +1993,23 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive 0.5.11", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", + "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.11" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -1951,15 +2038,31 @@ version = "0.2.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" +[[package]] +name = "objc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" + [[package]] name = "objc2" version = "0.3.0-beta.3.patch-leaks.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" dependencies = [ - "block2", - "objc-sys", - "objc2-encode", + "block2 0.2.0-alpha.6", + "objc-sys 0.2.0-beta.2", + "objc2-encode 2.0.0-pre.2", +] + +[[package]] +name = "objc2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" +dependencies = [ + "objc-sys 0.3.2", + "objc2-encode 3.0.0", ] [[package]] @@ -1968,9 +2071,15 @@ version = "2.0.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" dependencies = [ - "objc-sys", + "objc-sys 0.2.0-beta.2", ] +[[package]] +name = "objc2-encode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" + [[package]] name = "objc_id" version = "0.1.1" @@ -2084,14 +2193,14 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2134,6 +2243,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "polling" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.30", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2168,6 +2291,15 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "quick-xml" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.29" @@ -2213,6 +2345,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + [[package]] name = "rayon" version = "1.7.0" @@ -2321,7 +2459,7 @@ dependencies = [ "objc", "objc-foundation", "objc_id", - "raw-window-handle", + "raw-window-handle 0.5.2", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2355,15 +2493,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.3", - "windows-sys 0.48.0", + "linux-raw-sys 0.4.13", + "windows-sys 0.52.0", ] [[package]] @@ -2389,9 +2527,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sctk-adwaita" -version = "0.5.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550" dependencies = [ "ab_glyph", "log", @@ -2417,7 +2555,7 @@ checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -2428,7 +2566,7 @@ checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -2502,31 +2640,47 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smithay-client-toolkit" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "calloop", - "dlib", - "lazy_static", + "calloop-wayland-source", + "cursor-icon", + "libc", "log", "memmap2", - "nix 0.24.3", - "pkg-config", + "rustix 0.38.30", + "thiserror", + "wayland-backend", "wayland-client", + "wayland-csd-frame", "wayland-cursor", "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", ] [[package]] name = "smithay-clipboard" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +checksum = "0bb62b280ce5a5cba847669933a0948d00904cf83845c944eae96a4738cea1a6" dependencies = [ + "libc", "smithay-client-toolkit", - "wayland-client", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6845563ada680337a52d43bb0b29f396f2d911616f6573012645b9e3d048a49" +dependencies = [ + "serde", ] [[package]] @@ -2599,9 +2753,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -2667,7 +2821,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -2683,23 +2837,23 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.8.4" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +checksum = "b6a067b809476893fce6a254cf285850ff69c847e6cfbade6a20b655b6c7e80d" dependencies = [ "arrayref", "arrayvec", "bytemuck", "cfg-if", - "png", + "log", "tiny-skia-path", ] [[package]] name = "tiny-skia-path" -version = "0.8.4" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +checksum = "5de35e8a90052baaaf61f171680ac2f8e925a1e43ea9d2e3a00514772250e541" dependencies = [ "arrayref", "bytemuck", @@ -2786,7 +2940,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", ] [[package]] @@ -2841,6 +2995,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "url" version = "2.4.0" @@ -2858,12 +3018,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb3ff47e36907a6267572c1e398ff32ef78ac5131de8aa272e53846592c207e" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version-compare" version = "0.1.1" @@ -2919,7 +3073,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", "wasm-bindgen-shared", ] @@ -2953,7 +3107,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.32", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2965,87 +3119,111 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] -name = "wayland-client" -version = "0.29.5" +name = "wayland-backend" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ - "bitflags 1.3.2", + "cc", "downcast-rs", - "libc", - "nix 0.24.3", + "nix 0.26.2", "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys 0.29.5", + "smallvec", + "wayland-sys", ] [[package]] -name = "wayland-commons" -version = "0.29.5" +name = "wayland-client" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ - "nix 0.24.3", - "once_cell", - "smallvec", - "wayland-sys 0.29.5", + "bitflags 2.4.2", + "nix 0.26.2", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.4.2", + "cursor-icon", + "wayland-backend", ] [[package]] name = "wayland-cursor" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ - "nix 0.24.3", + "nix 0.26.2", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", + "wayland-backend", "wayland-client", - "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" +dependencies = [ + "bitflags 2.4.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +dependencies = [ + "bitflags 2.4.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", "wayland-scanner", ] [[package]] name = "wayland-scanner" -version = "0.29.5" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" dependencies = [ "proc-macro2", + "quick-xml", "quote", - "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.29.5" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" dependencies = [ "dlib", - "lazy_static", - "pkg-config", -] - -[[package]] -name = "wayland-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" -dependencies = [ - "dlib", - "lazy_static", "log", + "once_cell", "pkg-config", ] @@ -3059,6 +3237,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webbrowser" version = "0.8.10" @@ -3071,7 +3259,7 @@ dependencies = [ "log", "ndk-context", "objc", - "raw-window-handle", + "raw-window-handle 0.5.2", "url", "web-sys", ] @@ -3122,17 +3310,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-targets 0.42.2", -] - [[package]] name = "windows" version = "0.46.0" @@ -3143,10 +3320,21 @@ dependencies = [ ] [[package]] -name = "windows-implement" -version = "0.44.0" +name = "windows" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-targets 0.48.1", +] + +[[package]] +name = "windows-implement" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" dependencies = [ "proc-macro2", "quote", @@ -3155,9 +3343,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.44.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" dependencies = [ "proc-macro2", "quote", @@ -3182,6 +3370,15 @@ dependencies = [ "windows-targets 0.48.1", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -3212,6 +3409,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -3224,6 +3436,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -3236,6 +3454,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -3248,6 +3472,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -3260,6 +3490,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -3272,6 +3508,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -3284,6 +3526,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -3297,38 +3545,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] -name = "winit" -version = "0.28.6" +name = "windows_x86_64_msvc" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winit" +version = "0.29.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c824f11941eeae66ec71111cc2674373c772f482b58939bb4066b642aa2ffcf" dependencies = [ + "ahash", "android-activity", - "bitflags 1.3.2", + "atomic-waker", + "bitflags 2.4.2", + "bytemuck", + "calloop", "cfg_aliases", "core-foundation", "core-graphics", - "dispatch", - "instant", + "cursor-icon", + "icrate", + "js-sys", "libc", "log", - "mio", + "memmap2", "ndk", - "objc2", + "ndk-sys", + "objc2 0.4.1", "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "redox_syscall 0.3.5", + "rustix 0.38.30", "sctk-adwaita", "smithay-client-toolkit", + "smol_str", + "unicode-segmentation", "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", "wayland-client", - "wayland-commons", "wayland-protocols", - "wayland-scanner", + "wayland-protocols-plasma", "web-sys", - "windows-sys 0.45.0", + "web-time", + "windows-sys 0.48.0", "x11-dl", + "x11rb 0.13.0", + "xkbcommon-dl", ] [[package]] @@ -3376,11 +3644,26 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" dependencies = [ - "gethostname", + "gethostname 0.2.3", "nix 0.24.3", "winapi", "winapi-wsapoll", - "x11rb-protocol", + "x11rb-protocol 0.10.0", +] + +[[package]] +name = "x11rb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +dependencies = [ + "as-raw-xcb-connection", + "gethostname 0.4.3", + "libc", + "libloading", + "once_cell", + "rustix 0.38.30", + "x11rb-protocol 0.13.0", ] [[package]] @@ -3392,6 +3675,12 @@ dependencies = [ "nix 0.24.3", ] +[[package]] +name = "x11rb-protocol" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" + [[package]] name = "xcursor" version = "0.3.4" @@ -3411,6 +3700,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "xkbcommon-dl" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" +dependencies = [ + "bitflags 2.4.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" + [[package]] name = "xml-rs" version = "0.8.15" @@ -3436,7 +3744,7 @@ dependencies = [ "byteorder", "derivative", "enumflags2", - "event-listener", + "event-listener 2.5.3", "futures-core", "futures-sink", "futures-util", @@ -3483,6 +3791,26 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", +] + [[package]] name = "zune-inflate" version = "0.2.54" diff --git a/Cargo.toml b/Cargo.toml index 1cd4816..99c896f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ edition = "2021" [dependencies] bitflags = "2.3.3" device_query = "1.1.3" -eframe = { version = "0.22.0", features = ["ron", "persistence"] } -egui-modal = "0.2.4" +eframe = { version = "0.25.0", features = ["ron", "persistence"] } +egui-modal = "0.3.2" enum_dispatch = "0.3.12" env_logger = "0.10.0" ihex = "3.0.0" diff --git a/src/frontpanel.rs b/src/frontpanel.rs index 5a2a8f4..5be79dd 100644 --- a/src/frontpanel.rs +++ b/src/frontpanel.rs @@ -1 +1,481 @@ +use std::path::Path; + +use eframe::{ + egui::{self, TextureOptions, Ui, Widget, Id, Painter}, + epaint::{vec2, Pos2, Rect, TextureHandle, pos2, Color32}, +}; + +use self::switch::SwitchState; + +pub mod led; pub mod switch; + + +const NULL_UV: Rect = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)); +const NULL_TINT: Color32 = Color32::WHITE; + +#[derive(Copy, Clone, Default)] +struct FrontpanelState { + ad_sws: u16, + power: bool, + runstop: SwitchState, + single_step: SwitchState, + exam: SwitchState, + dep: SwitchState, + reset: SwitchState, + prot: SwitchState, + aux1: SwitchState, + aux2: SwitchState, +} + +pub struct Frontpanel<'a> { + id: Id, + textures: &'a Textures, +} + +impl<'a> Frontpanel<'a> { + pub fn new(id: Id, textures: &'a Textures) -> Self { + Self { + id, + textures, + } + } +} + +impl Widget for Frontpanel<'_> { + fn ui(self, ui: &mut Ui) -> egui::Response { + let mut state: FrontpanelState = ui.data(|data| data.get_temp(self.id).unwrap_or_default()); + let sw_textures = switch::Textures::new( + self.textures.sw_up.clone(), + self.textures.sw_neut.clone(), + self.textures.sw_down.clone(), + ); + let led_textures = + led::Textures::new(self.textures.led_on.clone(), self.textures.led_off.clone()); + let resp = ui.allocate_response( + (800.0, 333.0).into(), + egui::Sense { + click: false, + drag: false, + focusable: false, + }, + ); + let fp_rect = resp.rect; + dbg!(fp_rect); + let painter = Painter::new(ui.ctx().clone(), ui.layer_id(), ui.clip_rect().intersect(resp.rect)); + painter.image(self.textures.fp.id(), painter.clip_rect(), NULL_UV, NULL_TINT); + let x_scale = painter.clip_rect().width() / 800.0; + let y_scale = painter.clip_rect().height() / 333.0; + for led in &LEDS { + let mut pos = led.pos; + pos.x *= x_scale; + pos.y *= y_scale; + pos += fp_rect.left_top().to_vec2(); + let led_data = 0xAAAA; + let led_on = (led_data & led.mask) > 0; + ui.allocate_ui_at_rect( + Rect::from_center_size(pos, vec2(16.0, 16.0)), + |ui| { + ui.add(led::Led::new(led_on, &led_textures)); + }, + ); + }; + // 0: Power + // 1..17: A/D left to right + // 17..25: Action left to right + for (i, switch) in SWITCHES.iter().enumerate() { + let mut pos = switch.pos; + pos.x *= x_scale; + pos.y *= y_scale; + pos += fp_rect.left_top().to_vec2(); + if i == 0 { + ui.allocate_ui_at_rect( + Rect::from_center_size(pos, vec2(32.0, 32.0)), + |ui| { + ui.add(switch::ToggleSwitch::new(&mut state.power, &sw_textures)); + }, + ); + } + if (1..17).contains(&i) { + let bit_mask = 1 << (16 - i); + let mut sw_state = state.ad_sws & bit_mask > 0; + ui.allocate_ui_at_rect( + Rect::from_center_size(pos, vec2(32.0, 32.0)), + |ui| { + ui.add(switch::ToggleSwitch::new(&mut sw_state, &sw_textures)); + }, + ); + state.ad_sws = (state.ad_sws & !(bit_mask)) | ((sw_state as u16) << (16 - i)); + } + if (17..25).contains(&i) { + let state = match i { + 17 => &mut state.runstop, + 18 => &mut state.single_step, + 19 => &mut state.exam, + 20 => &mut state.dep, + 21 => &mut state.reset, + 22 => &mut state.prot, + 23 => &mut state.aux1, + 24 => &mut state.aux2, + _ => unreachable!(), + }; + ui.allocate_ui_at_rect( + Rect::from_center_size(pos, vec2(32.0, 32.0)), + |ui| { + ui.add(switch::ThreePosSwitch::new(state, &sw_textures)); + }, + ); + } + // todo!(); + } + ui.data_mut(|data| data.insert_temp(self.id, state)); + resp + } +} + +pub struct Textures { + fp: TextureHandle, + sw_up: TextureHandle, + sw_neut: TextureHandle, + sw_down: TextureHandle, + led_off: TextureHandle, + led_on: TextureHandle, +} + +impl Textures { + pub fn new(ctx: &egui::Context) -> Self { + Self { + fp: Self::load_texture( + ctx, + "fp", + "/home/pjht/projects/altair_emu/resources/altair800.png", + ) + .unwrap(), + sw_up: Self::load_texture( + ctx, + "sw_up", + "/home/pjht/projects/altair_emu/resources/Togup.png", + ) + .unwrap(), + sw_neut: Self::load_texture( + ctx, + "sw_neut", + "/home/pjht/projects/altair_emu/resources/Togneut.png", + ) + .unwrap(), + sw_down: Self::load_texture( + ctx, + "sw_down", + "/home/pjht/projects/altair_emu/resources/Togdown.png", + ) + .unwrap(), + led_off: Self::load_texture( + ctx, + "led_off", + "/home/pjht/projects/altair_emu/resources/Led_off.png", + ) + .unwrap(), + led_on: Self::load_texture( + ctx, + "led_on", + "/home/pjht/projects/altair_emu/resources/Led_on.png", + ) + .unwrap(), + } + } + + fn load_texture( + ctx: &egui::Context, + name: impl Into, + path: impl AsRef, + ) -> Result { + let image = image::io::Reader::open(path.as_ref())?.decode()?; + let image = egui::ColorImage::from_rgba_unmultiplied( + [image.width() as _, image.height() as _], + image.to_rgba8().as_flat_samples().as_slice(), + ); + Ok(ctx.load_texture(name, image, TextureOptions::LINEAR)) + } +} + +#[derive(Clone, Copy, Debug)] +struct SwitchInfo { + pos: Pos2, +} + +static SWITCHES: [SwitchInfo; 25] = [ + SwitchInfo { + pos: Pos2::new(43.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(183.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(228.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(257.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(285.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(330.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(359.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(388.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(433.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(461.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(491.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(536.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(564.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(593.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(638.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(667.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(696.0, 175.0), + }, + SwitchInfo { + pos: Pos2::new(190.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(248.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(305.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(363.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(420.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(478.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(535.0, 234.0), + }, + SwitchInfo { + pos: Pos2::new(593.0, 234.0), + }, +]; + +#[derive(Clone, Copy, Debug)] +enum LedSource { + Protect, + Iff, + Run, + CpuStatus, + Data, + Address, +} + +struct LedInfo { + pos: Pos2, + source: LedSource, + mask: u16, +} + +static LEDS: [LedInfo; 36] = [ + LedInfo { + pos: Pos2::new(118.0, 58.0), + source: LedSource::Protect, + mask: 0xFF, + }, + LedInfo { + pos: Pos2::new(89.0, 58.0), + source: LedSource::Iff, + mask: 0xFF, + }, + LedInfo { + pos: Pos2::new(89.0, 117.0), + source: LedSource::Run, + mask: 0x0, + }, + LedInfo { + pos: Pos2::new(118.0, 117.0), + source: LedSource::Iff, + mask: 0x0, + }, + LedInfo { + pos: Pos2::new(149.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x80, + }, + LedInfo { + pos: Pos2::new(179.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x40, + }, + LedInfo { + pos: Pos2::new(209.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x20, + }, + LedInfo { + pos: Pos2::new(239.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x10, + }, + LedInfo { + pos: Pos2::new(269.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x8, + }, + LedInfo { + pos: Pos2::new(299.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x4, + }, + LedInfo { + pos: Pos2::new(329.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x2, + }, + LedInfo { + pos: Pos2::new(359.0, 58.0), + source: LedSource::CpuStatus, + mask: 0x1, + }, + LedInfo { + pos: Pos2::new(461.0, 58.0), + source: LedSource::Data, + mask: 0x80, + }, + LedInfo { + pos: Pos2::new(491.0, 58.0), + source: LedSource::Data, + mask: 0x40, + }, + LedInfo { + pos: Pos2::new(536.0, 58.0), + source: LedSource::Data, + mask: 0x20, + }, + LedInfo { + pos: Pos2::new(564.0, 58.0), + source: LedSource::Data, + mask: 0x10, + }, + LedInfo { + pos: Pos2::new(593.0, 58.0), + source: LedSource::Data, + mask: 0x8, + }, + LedInfo { + pos: Pos2::new(638.0, 58.0), + source: LedSource::Data, + mask: 0x4, + }, + LedInfo { + pos: Pos2::new(667.0, 58.0), + source: LedSource::Data, + mask: 0x2, + }, + LedInfo { + pos: Pos2::new(696.0, 58.0), + source: LedSource::Data, + mask: 0x1, + }, + LedInfo { + pos: Pos2::new(182.0, 117.0), + source: LedSource::Address, + mask: 0x8000, + }, + LedInfo { + pos: Pos2::new(227.0, 117.0), + source: LedSource::Address, + mask: 0x4000, + }, + LedInfo { + pos: Pos2::new(256.0, 117.0), + source: LedSource::Address, + mask: 0x2000, + }, + LedInfo { + pos: Pos2::new(285.0, 117.0), + source: LedSource::Address, + mask: 0x1000, + }, + LedInfo { + pos: Pos2::new(330.0, 117.0), + source: LedSource::Address, + mask: 0x800, + }, + LedInfo { + pos: Pos2::new(359.0, 117.0), + source: LedSource::Address, + mask: 0x400, + }, + LedInfo { + pos: Pos2::new(388.0, 117.0), + source: LedSource::Address, + mask: 0x200, + }, + LedInfo { + pos: Pos2::new(433.0, 117.0), + source: LedSource::Address, + mask: 0x100, + }, + LedInfo { + pos: Pos2::new(461.0, 117.0), + source: LedSource::Address, + mask: 0x80, + }, + LedInfo { + pos: Pos2::new(490.0, 117.0), + source: LedSource::Address, + mask: 0x40, + }, + LedInfo { + pos: Pos2::new(536.0, 117.0), + source: LedSource::Address, + mask: 0x20, + }, + LedInfo { + pos: Pos2::new(564.0, 117.0), + source: LedSource::Address, + mask: 0x10, + }, + LedInfo { + pos: Pos2::new(593.0, 117.0), + source: LedSource::Address, + mask: 0x8, + }, + LedInfo { + pos: Pos2::new(638.0, 117.0), + source: LedSource::Address, + mask: 0x4, + }, + LedInfo { + pos: Pos2::new(667.0, 117.0), + source: LedSource::Address, + mask: 0x2, + }, + LedInfo { + pos: Pos2::new(696.0, 117.0), + source: LedSource::Address, + mask: 0x1, + }, +]; diff --git a/src/frontpanel/led.rs b/src/frontpanel/led.rs new file mode 100644 index 0000000..3fe5404 --- /dev/null +++ b/src/frontpanel/led.rs @@ -0,0 +1,54 @@ +use eframe::{ + egui::{Sense, Widget}, + epaint::{pos2, vec2, Color32, Rect, TextureHandle}, +}; + +const NULL_UV: Rect = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)); +const NULL_TINT: Color32 = Color32::WHITE; + +pub struct Textures { + led_on: TextureHandle, + led_off: TextureHandle, +} + +impl Textures { + pub fn new(led_on: TextureHandle, led_off: TextureHandle) -> Self { + Self { led_on, led_off } + } +} + +pub struct Led<'a> { + on: bool, + textures: &'a Textures, +} + +impl<'a> Led<'a> { + pub fn new(on: bool, textures: &'a Textures) -> Self { + Self { on, textures } + } +} + +impl Widget for Led<'_> { + fn ui(self, ui: &mut eframe::egui::Ui) -> eframe::egui::Response { + let (resp, painter) = ui.allocate_painter( + (16.0, 16.0).into(), + Sense { + click: false, + drag: false, + focusable: false, + }, + ); + let texture = if self.on { + self.textures.led_on.id() + } else { + self.textures.led_off.id() + }; + painter.image( + texture, + Rect::from_min_size(painter.clip_rect().left_top(), vec2(16.0, 16.0)), + NULL_UV, + NULL_TINT, + ); + resp + } +} diff --git a/src/frontpanel/switch.rs b/src/frontpanel/switch.rs index 2efe345..04087d5 100644 --- a/src/frontpanel/switch.rs +++ b/src/frontpanel/switch.rs @@ -1,6 +1,6 @@ use eframe::{ - egui::{Id, Sense, Widget}, - epaint::{pos2, vec2, Color32, Rect, TextureHandle}, + egui::{Sense, Widget}, + epaint::{pos2, vec2, Color32, Rect, TextureHandle, TextureId}, }; const NULL_UV: Rect = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)); @@ -20,6 +20,22 @@ impl Textures { sw_down, } } + + pub fn get_for_state(&self, state: SwitchState) -> TextureId { + match state { + SwitchState::Up => self.sw_up.id(), + SwitchState::Neut => self.sw_neut.id(), + SwitchState::Down => self.sw_down.id(), + } + } + + pub fn get_for_bool(&self, state: bool) -> TextureId { + if state { + self.sw_up.id() + } else { + self.sw_down.id() + } + } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -29,51 +45,76 @@ pub enum SwitchState { Down, } -pub struct Switch<'a> { +impl Default for SwitchState { + fn default() -> Self { + Self::Neut + } +} + +pub struct ThreePosSwitch<'a> { state: &'a mut SwitchState, textures: &'a Textures, } -impl<'a> Switch<'a> { +impl<'a> ThreePosSwitch<'a> { pub fn new(state: &'a mut SwitchState, textures: &'a Textures) -> Self { Self { state, textures } } } -impl Widget for Switch<'_> { +impl Widget for ThreePosSwitch<'_> { fn ui(self, ui: &mut eframe::egui::Ui) -> eframe::egui::Response { - let (resp, painter) = ui.allocate_painter((32.0, 32.0).into(), Sense::click()); - let id = Id::new(( - painter.clip_rect().left_top().x as u32, - painter.clip_rect().left_top().y as u32, - )); - let texture = match self.state { - SwitchState::Up => self.textures.sw_up.id(), - SwitchState::Neut => self.textures.sw_neut.id(), - SwitchState::Down => self.textures.sw_down.id(), - }; + let (resp, painter) = ui.allocate_painter((32.0, 32.0).into(), Sense::drag()); painter.image( - texture, + self.textures.get_for_state(*self.state), Rect::from_min_size(painter.clip_rect().left_top(), vec2(32.0, 32.0)), NULL_UV, NULL_TINT, ); - let pointer_state = ui.ctx().input(|inp| inp.pointer.clone()); - let interact_pos = pointer_state.interact_pos(); - dbg!(interact_pos); - let interacted = interact_pos.map(|interact_pos| { - Rect::from_center_size(interact_pos, (10.0, 24.0).into()).contains(painter.clip_rect().left_top()) - }).unwrap_or(false); - let newstate = if interacted { - if interact_pos.unwrap().y > painter.clip_rect().left_top().y { - SwitchState::Down - } else { - SwitchState::Up + if resp.drag_started() { + let interact_pos = resp.interact_pointer_pos().unwrap(); + let sw_center = painter.clip_rect().left_top() + vec2(15.0, 16.0); + if Rect::from_center_size(interact_pos, (10.0, 24.0).into()).contains(sw_center) { + if interact_pos.y > sw_center.y { + *self.state = SwitchState::Down; + } else { + *self.state = SwitchState::Up; + }; } - } else { - SwitchState::Neut - }; - *self.state = newstate; + } else if resp.drag_released() { + *self.state = SwitchState::Neut; + } + resp + } +} + +pub struct ToggleSwitch<'a> { + state: &'a mut bool, + textures: &'a Textures, +} + +impl<'a> ToggleSwitch<'a> { + pub fn new(state: &'a mut bool, textures: &'a Textures) -> Self { + Self { state, textures } + } +} + +impl Widget for ToggleSwitch<'_> { + fn ui(self, ui: &mut eframe::egui::Ui) -> eframe::egui::Response { + let (resp, painter) = ui.allocate_painter((32.0, 32.0).into(), Sense::drag()); + painter.image( + self.textures.get_for_bool(*self.state), + Rect::from_min_size(painter.clip_rect().left_top(), vec2(32.0, 32.0)), + NULL_UV, + NULL_TINT, + ); + if resp.drag_started() { + let interact_pos = resp.interact_pointer_pos().unwrap(); + let sw_center = painter.clip_rect().left_top() + vec2(15.0, 16.0); + if Rect::from_center_size(interact_pos, (10.0, 24.0).into()).contains(sw_center) { + *self.state = !*self.state; + } + } resp } } diff --git a/src/main.rs b/src/main.rs index 7d1ae4f..4c9b393 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,9 +11,9 @@ use std::{ }; use cpu::{MemCycle, Status, I8080}; -use device_query::{DeviceState, Keycode}; +use device_query::DeviceState; use eframe::{ - egui::{self, menu, Button, Pos2, Rect, TextureHandle, TextureOptions, Ui}, + egui::{self, menu, Button, Id, Label, Pos2, Rect, TextureHandle, TextureOptions, Ui}, NativeOptions, }; use egui_modal::Modal; @@ -24,7 +24,7 @@ use rfd::FileDialog; use serde::{Deserialize, Serialize}; use soloud::{audio, AudioExt, LoadExt, Soloud}; -use crate::frontpanel::switch; +use crate::frontpanel::{switch, Frontpanel}; #[derive(Clone, Debug)] enum AudioMessage { @@ -182,7 +182,7 @@ struct Options { } struct AltairEmulator { - textures: Textures, + textures: frontpanel::Textures, ad_sws: u16, power: bool, runstop: SwitchState, @@ -253,7 +253,7 @@ impl AltairEmulator { // 20: 004 // 21: 005 Self { - textures: Textures::new(&cc.egui_ctx), + textures: frontpanel::Textures::new(&cc.egui_ctx), ad_sws: 0x0, power: false, runstop: SwitchState::Neut, @@ -315,7 +315,7 @@ impl eframe::App for AltairEmulator { fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { fn image_topleft(pos: impl Into, texture: &TextureHandle, ui: &mut Ui) { ui.allocate_ui_at_rect(Rect::from_min_size(pos.into(), texture.size_vec2()), |ui| { - ui.image(texture, texture.size_vec2()); + ui.image(texture); }); } @@ -323,13 +323,13 @@ impl eframe::App for AltairEmulator { ui.allocate_ui_at_rect( Rect::from_center_size(pos.into(), texture.size_vec2()), |ui| { - ui.image(texture, texture.size_vec2()); + ui.image(texture); }, ); } ctx.set_pixels_per_point(1.0); - frame.set_window_size((800.0, 333.0).into()); + // frame.set_window_size((800.0, 333.0).into()); let mut disable_fp_sws = self.option_window.is_some(); egui::TopBottomPanel::top("menu").show(ctx, |ui| { menu::bar(ui, |ui| { @@ -378,6 +378,11 @@ impl eframe::App for AltairEmulator { }); }); egui::CentralPanel::default().show(ctx, |ui| { + ui.add(Label::new("Hello")); + ui.add(Frontpanel::new(Id::new("frontpanel"), &self.textures)); + ui.add(Frontpanel::new(Id::new("frontpanel2"), &self.textures)); + // dbg!(ui.input(|input| input.pointer.latest_pos())); + // dbg!(ui.input(|input| input.pointer.latest_pos())); // let (_, fp_rect) = ui.allocate_space((800.0, 333.0).into()); // image_topleft(fp_rect.left_top(), &self.textures.fp, ui); // for led in &LEDS { @@ -728,12 +733,6 @@ impl eframe::App for AltairEmulator { // self.cpu.finish_m_cycle(data); // self.update_fp(); // } - let sw_texts = switch::Textures::new( - self.textures.sw_up.clone(), - self.textures.sw_neut.clone(), - self.textures.sw_down.clone(), - ); - ui.add(switch::Switch::new(&mut self.dep, &sw_texts)); }); let old_fan_enabled = self.options.fan_enabled;