From c9b5173abd0b62ba9d21e7baf86e39383de44fd9 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 1 Oct 2023 14:57:53 -0400 Subject: [PATCH] Too many changes to enumerate --- Cargo.lock | 423 +++++++++++++++--------- Cargo.toml | 1 + README.adoc | 4 + rpn_rs_gui/Cargo.lock | 229 +------------ rpn_rs_gui/Cargo.toml | 11 +- rpn_rs_gui/LcdSolid-VPzB.ttf | Bin 0 -> 34900 bytes rpn_rs_gui/src/app.rs | 601 +++++++++++++++++++++------------- rpn_rs_gui/src/app/buttons.rs | 108 ++++++ rpn_rs_gui/src/main.rs | 15 +- 9 files changed, 779 insertions(+), 613 deletions(-) create mode 100644 rpn_rs_gui/LcdSolid-VPzB.ttf create mode 100644 rpn_rs_gui/src/app/buttons.rs diff --git a/Cargo.lock b/Cargo.lock index de21eb1..62b8d96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.9.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4803cf8c252f374ae6bfbb341e49e5a37f7601f2ce74a105927a663eba952c67" +checksum = "76eb1adf08c5bcaa8490b9851fd53cca27fa9880076f178ea9d29f05196728a8" dependencies = [ "enumn", "serde", @@ -30,69 +30,64 @@ dependencies = [ [[package]] name = "accesskit_consumer" -version = "0.13.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee8cf1202a4f94d31837f1902ab0a75c77b65bf59719e093703abe83efd74ec" +checksum = "04bb4d9e4772fe0d47df57d0d5dbe5d85dd05e2f37ae1ddb6b105e76be58fb00" dependencies = [ "accesskit", - "parking_lot 0.12.1", ] [[package]] name = "accesskit_macos" -version = "0.5.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10be25f2b27bc33aa1647072e86b948b41596f1af1ae43a2b4b9be5d2011cbda" +checksum = "134d0acf6acb667c89d3332999b1a5df4edbc8d6113910f392ebb73f2b03bb56" dependencies = [ "accesskit", "accesskit_consumer", "objc2", "once_cell", - "parking_lot 0.12.1", ] [[package]] name = "accesskit_unix" -version = "0.2.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630e7ee8f93c6246478bf0df6760db899b28d9ad54353a5f2d3157138ba817fc" +checksum = "e084cb5168790c0c112626175412dc5ad127083441a8248ae49ddf6725519e83" dependencies = [ "accesskit", "accesskit_consumer", "async-channel", "atspi", "futures-lite", - "parking_lot 0.12.1", "serde", "zbus", ] [[package]] name = "accesskit_windows" -version = "0.12.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13c462fabdd950ef14308a9390b07fa2e2e3aabccba1f3ea36ea2231bb942ab" +checksum = "9eac0a7f2d7cd7a93b938af401d3d8e8b7094217989a7c25c55a953023436e31" dependencies = [ "accesskit", "accesskit_consumer", "arrayvec", "once_cell", - "parking_lot 0.12.1", "paste", "windows", ] [[package]] name = "accesskit_winit" -version = "0.10.0" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17727888757ec027ec221db33070e226ee07df44425b583bc67684204d35eff9" +checksum = "825d23acee1bd6d25cbaa3ca6ed6e73faf24122a774ec33d52c5c86c6ab423c0" dependencies = [ "accesskit", "accesskit_macos", "accesskit_unix", "accesskit_windows", - "parking_lot 0.12.1", "winit", ] @@ -127,9 +122,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -193,7 +188,7 @@ 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", ] @@ -204,20 +199,20 @@ 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-executor" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" +checksum = "78f2db9467baa66a700abce2a18c5ad793f6f83310aca1284796fc3921d113fd" dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand 1.9.0", + "fastrand 2.0.1", "futures-lite", "slab", ] @@ -260,24 +255,23 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", ] [[package]] name = "async-process" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +checksum = "bf012553ce51eb7aa6dc2143804cc8252bd1cb681a1c5cb7fa94ca88682dee1d" dependencies = [ "async-io", "async-lock", - "autocfg", + "async-signal", "blocking", "cfg-if", - "event-listener", + "event-listener 3.0.0", "futures-lite", - "rustix 0.37.23", - "signal-hook 0.3.17", + "rustix 0.38.14", "windows-sys 0.48.0", ] @@ -293,10 +287,29 @@ dependencies = [ ] [[package]] -name = "async-task" -version = "4.4.0" +name = "async-signal" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" +checksum = "4af361a844928cb7d36590d406709473a1b574f443094422ef166daa3b493208" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "concurrent-queue", + "futures-core", + "futures-io", + "libc", + "signal-hook-registry", + "slab", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-task" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" [[package]] name = "async-trait" @@ -311,9 +324,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "atomic_refcell" @@ -323,9 +336,9 @@ checksum = "112ef6b3f6cb3cb6fc5b6b494ef7a848492cff1ab0ef4de10b0f7d572861c905" [[package]] name = "atspi" -version = "0.8.7" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab84c09a770065868da0d713f1f4b35af85d96530a868f1c1a6c249178379187" +checksum = "674e7a3376837b2e7d12d34d58ac47073c491dc3bf6f71a7adaf687d4d817faa" dependencies = [ "async-recursion", "async-trait", @@ -340,17 +353,12 @@ dependencies = [ [[package]] name = "atspi-macros" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ebc5a6f61f6996eca56a4cece7b3fe7da3b86f0473c7b71ab44e229f3acce4" +checksum = "97fb4870a32c0eaa17e35bca0e6b16020635157121fb7d45593d242c295bc768" dependencies = [ - "proc-macro2", "quote", - "serde", "syn 1.0.109", - "zbus", - "zbus_names", - "zvariant", ] [[package]] @@ -428,17 +436,18 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" dependencies = [ "async-channel", "async-lock", "async-task", - "atomic-waker", - "fastrand 1.9.0", + "fastrand 2.0.1", + "futures-io", "futures-lite", - "log", + "piper", + "tracing", ] [[package]] @@ -614,6 +623,42 @@ dependencies = [ "winapi", ] +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation", + "core-graphics-types", + "libc", + "objc", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.6" @@ -626,9 +671,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] @@ -743,7 +788,7 @@ dependencies = [ "libc", "mio 0.7.14", "parking_lot 0.11.2", - "signal-hook 0.1.17", + "signal-hook", "winapi", ] @@ -857,9 +902,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecolor" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f99fe3cac305af9d6d92971af60d0f7ea4d783201ef1673571567b6699964d9" +checksum = "2e479a7fa3f23d4e794f8b2f8b3568dd4e47886ad1b12c9c095e141cb591eb63" dependencies = [ "bytemuck", "serde", @@ -867,11 +912,12 @@ dependencies = [ [[package]] name = "eframe" -version = "0.21.3" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df3ce60931e5f2d83bab4484d1a283908534d5308cc6b0c5c22c59cd15ee7cc" +checksum = "bf4596583a2c680c55b6feaa748f74890c4f9cb9c7cb69d6117110444cb65b2f" dependencies = [ "bytemuck", + "cocoa", "directories-next", "egui", "egui-winit", @@ -879,72 +925,85 @@ dependencies = [ "glow", "glutin", "glutin-winit", + "image", "js-sys", + "log", + "objc", "percent-encoding", "raw-window-handle", "ron", "serde", "thiserror", - "tracing", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "winapi", "winit", ] [[package]] name = "egui" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6412a21e0bde7c0918f7fb44bbbb86b5e1f88e63c026a4e747cc7af02f76dfbe" +checksum = "a3aef8ec3ae1b772f340170c65bf27d5b8c28f543a0116c844d2ac08d01123e7" dependencies = [ "accesskit", "ahash 0.8.3", "epaint", + "log", "nohash-hasher", "ron", "serde", - "tracing", ] [[package]] name = "egui-winit" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab43597ba41f0ce39a364ad83185594578bfd8b3409b99dbcbb01df23afc3dbb" +checksum = "4a49155fd4a0a4fb21224407a91de0030847972ef90fc64edb63621caea61cb2" dependencies = [ "accesskit_winit", - "android-activity", "arboard", "egui", "instant", + "log", + "raw-window-handle", "serde", "smithay-clipboard", - "tracing", "webbrowser", "winit", ] [[package]] -name = "egui_glow" -version = "0.21.0" +name = "egui_extras" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8257332fb168a965b3dca81d6a344e053153773c889cabdba0b3b76f1629ae81" +checksum = "9278f4337b526f0d57e5375e5a7340a311fa6ee8f9fcc75721ac50af13face02" +dependencies = [ + "egui", + "serde", +] + +[[package]] +name = "egui_glow" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8c2752cdf1b0ef5fcda59a898cacabad974d4f5880e92a420b2c917022da64" dependencies = [ "bytemuck", "egui", "glow", + "log", "memoffset 0.6.5", - "tracing", "wasm-bindgen", "web-sys", ] [[package]] name = "emath" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ecd80612937e0267909d5351770fe150004e24dab93954f69ca62eecd3f77e" +checksum = "3857d743a6e0741cdd60b622a74c7a36ea75f5f8f11b793b41d905d2c9721a4b" dependencies = [ "bytemuck", "serde", @@ -984,9 +1043,9 @@ dependencies = [ [[package]] name = "epaint" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e78b5c58a1f7f621f9d546add2adce20636422c9b251e29f749e8a2f713c95" +checksum = "09333964d4d57f40a85338ba3ca5ed4716070ab184dcfed966b35491c5c64f3b" dependencies = [ "ab_glyph", "ahash 0.8.3", @@ -994,6 +1053,7 @@ dependencies = [ "bytemuck", "ecolor", "emath", + "log", "nohash-hasher", "parking_lot 0.12.1", "serde", @@ -1042,6 +1102,17 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29e56284f00d94c1bc7fd3c77027b4623c88c1f53d8d2394c6199f2921dea325" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -1053,9 +1124,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" @@ -1305,9 +1376,9 @@ checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1334,6 +1405,20 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "image" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-rational", + "num-traits", + "png", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1416,9 +1501,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1697,6 +1782,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -1776,9 +1882,9 @@ checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" [[package]] name = "objc2" -version = "0.3.0-beta.3" +version = "0.3.0-beta.3.patch-leaks.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" dependencies = [ "block2", "objc-sys", @@ -1845,9 +1951,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "parking_lot" @@ -1921,6 +2027,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.27" @@ -2136,9 +2253,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rend" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] @@ -2188,6 +2305,7 @@ name = "rpn_rs" version = "0.6.0" dependencies = [ "confy", + "egui_extras", "lazy_static", "rust_decimal", "rust_decimal_macros", @@ -2205,11 +2323,13 @@ dependencies = [ "console_error_panic_hook", "eframe", "egui", + "egui_extras", "rpn_rs", "serde", "tracing", "tracing-subscriber", "tracing-wasm", + "wasm-bindgen", "wasm-bindgen-futures", ] @@ -2267,9 +2387,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" dependencies = [ "bitflags 2.4.0", "errno", @@ -2333,18 +2453,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-xml-rs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0bf1ba0696ccf0872866277143ff1fd14d22eec235d2b23702f95e6660f7dfa" -dependencies = [ - "log", - "serde", - "thiserror", - "xml-rs", -] - [[package]] name = "serde_derive" version = "1.0.188" @@ -2392,9 +2500,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -2421,16 +2529,6 @@ dependencies = [ "signal-hook-registry", ] -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2472,15 +2570,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smithay-client-toolkit" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" dependencies = [ "bitflags 1.3.2", "calloop", @@ -2568,9 +2666,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "fastrand 2.0.0", + "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.13", + "rustix 0.38.14", "windows-sys 0.48.0", ] @@ -2606,9 +2704,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -2619,15 +2717,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -2855,9 +2953,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "url" @@ -2896,9 +2994,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" @@ -2918,9 +3016,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2928,24 +3026,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.37", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -2955,9 +3053,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2965,22 +3063,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wayland-client" @@ -3069,9 +3167,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3112,9 +3210,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -3136,25 +3234,31 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0286ba339aa753e70765d521bb0242cc48e1194562bfa2a2ad7ac8a6de28f5d5" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ "windows-implement", - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-interface", + "windows-targets 0.48.5", ] [[package]] name = "windows-implement" -version = "0.42.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9539b6bd3eadbd9de66c9666b22d802b833da7e996bc06896142e09854a61767" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-interface" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" dependencies = [ "proc-macro2", "quote", @@ -3400,9 +3504,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "yaml-rust" @@ -3432,7 +3536,7 @@ dependencies = [ "byteorder", "derivative", "enumflags2", - "event-listener", + "event-listener 2.5.3", "futures-core", "futures-sink", "futures-util", @@ -3442,7 +3546,6 @@ dependencies = [ "ordered-stream", "rand", "serde", - "serde-xml-rs", "serde_repr", "sha1", "static_assertions", diff --git a/Cargo.toml b/Cargo.toml index 9c32575..53ea37e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ rust_decimal_macros = "1.29.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } tracing-appender = "0.2.2" tracing = "0.1.37" +egui_extras = "0.22.0" [dependencies.confy] # TODO: Update this to v0.5.0 when it finally comes out -- for now, use latest git master diff --git a/README.adoc b/README.adoc index 034f3cb..6a5ace0 100644 --- a/README.adoc +++ b/README.adoc @@ -133,3 +133,7 @@ Will I implement these features? I don't know. Lots of these could be done by se * Bases: Not yet * Different math operators like `!` or `sum`: If someone asks me to, I guess * Conditionals: If someone asks me to, I guess + +=== Credits + +* LCD Solid Font licensed as public domain from: https://www.fontspace.com/lcd-solid-font-f11346 diff --git a/rpn_rs_gui/Cargo.lock b/rpn_rs_gui/Cargo.lock index c54de02..d43524a 100644 --- a/rpn_rs_gui/Cargo.lock +++ b/rpn_rs_gui/Cargo.lock @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cee8cf1202a4f94d31837f1902ab0a75c77b65bf59719e093703abe83efd74ec" dependencies = [ "accesskit", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -48,7 +48,7 @@ dependencies = [ "accesskit_consumer", "objc2", "once_cell", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -62,7 +62,7 @@ dependencies = [ "async-channel", "atspi", "futures-lite", - "parking_lot 0.12.1", + "parking_lot", "serde", "zbus", ] @@ -77,7 +77,7 @@ dependencies = [ "accesskit_consumer", "arrayvec", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "paste", "windows", ] @@ -92,7 +92,7 @@ dependencies = [ "accesskit_macos", "accesskit_unix", "accesskit_windows", - "parking_lot 0.12.1", + "parking_lot", "winit", ] @@ -159,7 +159,7 @@ dependencies = [ "objc-foundation", "objc_id", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "thiserror", "winapi", "x11rb", @@ -185,7 +185,7 @@ checksum = "1b19760fa2b7301cf235360ffd6d3558b1ed4249edd16d6cca8d690cee265b95" dependencies = [ "event-listener", "futures-core", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -412,12 +412,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "cassowary" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" - [[package]] name = "cc" version = "1.0.79" @@ -484,17 +478,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "confy" -version = "0.5.1" -source = "git+https://github.com/rust-cli/confy/#700337e5a3fbc12f4f49fc9b7ce449b1b71040ee" -dependencies = [ - "directories", - "serde", - "serde_yaml", - "thiserror", -] - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -573,31 +556,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossterm" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e86d73f2a0b407b5768d10a8c720cf5d2df49a9efc10ca09176d201ead4b7fb" -dependencies = [ - "bitflags", - "crossterm_winapi", - "lazy_static", - "libc", - "mio 0.7.14", - "parking_lot 0.11.2", - "signal-hook", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2265c3f8e080075d9b6417aa72293fc71662f34b4af2612d8d1b074d29510db" -dependencies = [ - "winapi", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -635,15 +593,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "directories" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" -dependencies = [ - "dirs-sys", -] - [[package]] name = "directories-next" version = "2.0.0" @@ -846,7 +795,7 @@ dependencies = [ "ecolor", "emath", "nohash-hasher", - "parking_lot 0.12.1", + "parking_lot", "serde", ] @@ -1190,12 +1139,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "lock_api" version = "0.4.9" @@ -1263,19 +1206,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - [[package]] name = "mio" version = "0.8.5" @@ -1288,15 +1218,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - [[package]] name = "ndk" version = "0.7.0" @@ -1377,15 +1298,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1521,17 +1433,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -1539,21 +1440,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -1765,37 +1652,18 @@ dependencies = [ ] [[package]] -name = "rpn_rs" -version = "0.6.0" -dependencies = [ - "confy", - "crossterm", - "lazy_static", - "serde", - "toml", - "tui", -] - -[[package]] -name = "rpn_rs_gui" +name = "rpn_rs2" version = "0.1.0" dependencies = [ "console_error_panic_hook", "eframe", "egui", - "rpn_rs", "serde", "tracing-subscriber", "tracing-wasm", "wasm-bindgen-futures", ] -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - [[package]] name = "same-file" version = "1.0.6" @@ -1873,18 +1741,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap", - "ryu", - "serde", - "yaml-rust", -] - [[package]] name = "sha1" version = "0.10.5" @@ -1905,26 +1761,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signal-hook" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" -dependencies = [ - "libc", - "mio 0.7.14", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - [[package]] name = "slab" version = "0.4.7" @@ -2101,15 +1937,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "toml" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -dependencies = [ - "serde", -] - [[package]] name = "toml_datetime" version = "0.5.1" @@ -2202,19 +2029,6 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" -[[package]] -name = "tui" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ced152a8e9295a5b168adc254074525c17ac4a83c90b2716274cc38118bddc9" -dependencies = [ - "bitflags", - "cassowary", - "crossterm", - "unicode-segmentation", - "unicode-width", -] - [[package]] name = "typenum" version = "1.16.0" @@ -2252,18 +2066,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "url" version = "2.3.1" @@ -2666,7 +2468,7 @@ dependencies = [ "instant", "libc", "log", - "mio 0.8.5", + "mio", "ndk", "objc2", "once_cell", @@ -2734,15 +2536,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "zbus" version = "3.9.0" diff --git a/rpn_rs_gui/Cargo.toml b/rpn_rs_gui/Cargo.toml index 90db214..442419c 100644 --- a/rpn_rs_gui/Cargo.toml +++ b/rpn_rs_gui/Cargo.toml @@ -8,17 +8,13 @@ rust-version = "1.65" [dependencies] rpn_rs = {path=".."} -egui = "0.21.0" -eframe = { version = "0.21.0", default-features = false, features = [ - "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. - "default_fonts", # Embed the default egui fonts. - "glow", # Use the glow rendering backend. Alternative: "wgpu". - "persistence", # Enable restoring app state when restarting the app. -] } +egui = "0.22.0" +eframe = { version = "0.22.0", default-features = false, features = ["accesskit", "default_fonts", "glow", "persistence"] } # You only need serde if you want app persistence: serde = { version = "1", features = ["derive"] } tracing = "0.1.37" +egui_extras = "0.22.0" # native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] @@ -28,6 +24,7 @@ tracing-subscriber = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.6" tracing-wasm = "0.2" +wasm-bindgen = { version = "0.2.87" } wasm-bindgen-futures = "0.4" diff --git a/rpn_rs_gui/LcdSolid-VPzB.ttf b/rpn_rs_gui/LcdSolid-VPzB.ttf new file mode 100644 index 0000000000000000000000000000000000000000..808f3ee37d83763cef6fdfdb1f33edece3d59cca GIT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wt^?8Bu$xI}H*%0}z|snfL|Mv)tM49Q=;y40oO{xVx19dxh&%_)Y8;An>DL!74E7 zO1B1Nt^+$ZK-L@G)$U{XmA8+(YuvSv_jO>~*W5$yVfStKWp~W&a$j(dxIcD(;+}Rr z(BaRyFS=j3|KmRIa}NKL%pG+9+db}{b-!`HcE5E`xfk54?(f`Q2xE);LkQygko))C zYwjQ158U6o*WG*WM)%L|4fl_3AN1ju?!UVqx;Nch?q>Jz?mt|&yA?va4Z_<7(LD(< z{=VA*eYp$bz1!XE?sGqLJKY2Be)kFYDfdbDqWh}*1NUk78TX+3x%-9t7DeHQ`Qd(q zAL&Q=8vF=x!PohEKiZG+4gM5A){pb!{RDripXev~$$pBT>QD2h`!jr_Z}MmQY5pvK zwm-*DA9csQH{5yGmOJjeA-DaW=Hc6K*}C$TYn3*uv|DAKRpwj8dTzF!o2}<&>$%x_ZnmDAt>bB zo?EQv7VEjidTz0vTde06>$$~xZnd6Ut>?LO#V#NwEEQjkECOnVe?f51(mQY2a@SpV d+}^nS()LEYPT)1~#EIh4HJxkb%)!Zc{Xak-sL%ia literal 0 HcmV?d00001 diff --git a/rpn_rs_gui/src/app.rs b/rpn_rs_gui/src/app.rs index 8e8c40e..bcb9374 100644 --- a/rpn_rs_gui/src/app.rs +++ b/rpn_rs_gui/src/app.rs @@ -1,35 +1,120 @@ +use std::collections::HashSet; + use egui::{ - Button, Color32, FontId, Frame, Grid, Key, Label, RichText, Rounding, ScrollArea, Stroke, - Style, Vec2, + Align, Button, Color32, Direction, FontData, FontDefinitions, FontFamily, FontId, Frame, Grid, + Id, Key, Label, Layout, Margin, PointerButton, Pos2, Rect, RichText, Rounding, ScrollArea, + Sense, Stroke, Style, TouchId, TouchPhase, Vec2, +}; +use egui_extras::{Column, Size, StripBuilder, TableBuilder}; +use rpn_rs::calc::{ + entries::CalculatorEntry, + errors::CalculatorError, + types::{CalculatorDisplayMode, CalculatorState}, + Calculator, }; -use rpn_rs::calc::{errors::CalculatorError, Calculator}; use tracing::{error, info}; +mod buttons; +use buttons::CalculatorButton; + +use self::buttons::{BUTTON_LAYOUT, BUTTON_LAYOUT_SETTINGS}; const DEFAULT_FONT_SIZE: f32 = 45.0; const STACK_FONT_SIZE: f32 = 25.0; const DEFAULT_FONT: FontId = FontId::monospace(DEFAULT_FONT_SIZE); +// const BUTTON_SIZE_WIDTH: Size = Size::remainder(); +// const BUTTON_SIZE_HEIGHT: Size = Size::remainder(); +// const BUTTON_SIZE: Vec2 = Vec2 { x: 67.0, y: 60.0 }; const BUTTON_SPACING: Vec2 = Vec2 { x: 0.0, y: 0.0 }; -const BUTTON_PADDING: Vec2 = Vec2 { x: 24.0, y: 5.0 }; +// const BUTTON_PADDING: Vec2 = Vec2 { x: 24.0, y: 5.0 }; +const BUTTON_PADDING: Vec2 = Vec2 { x: 0.0, y: 0.0 }; /// We derive Deserialize/Serialize so we can persist app state on shutdown. #[derive(serde::Deserialize, serde::Serialize)] -#[serde(default)] // if we add new fields, give them default values when deserializing old state +#[serde(default)] pub struct TemplateApp { - calculator: Calculator, + calculator: CalculatorInner, #[serde(skip)] latest_error: Option, + #[serde(skip)] + touches_down: HashSet, + + #[serde(skip)] + new_touches: Vec, +} + +#[derive(serde::Deserialize, serde::Serialize, Default)] +#[serde(default)] +pub struct CalculatorInner { + calculator: Calculator, + #[serde(skip)] error_state: ErrorState, } +impl CalculatorInner { + fn calculator_input(&mut self, c: char) { + let action = if c == '$' { + self.calculator.backspace() + } else { + self.calculator.take_input(c) + }; + + if let Err(e) = action { + self.error_state.errored(e); + } else { + self.error_state.success(); + } + } +} + +/// Phase of a click or tap +#[derive(Debug, Clone, Copy)] +enum ClickPhase { + Start, + End, + Ignored, +} + +/// ID of a click or tap +/// +/// Required because taps have IDs, but clicks don't +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] +enum ClickTapId { + Tap(u64), + Click(u8), +} + +impl From<&TouchId> for ClickTapId { + fn from(value: &TouchId) -> Self { + Self::Tap(value.0) + } +} + +impl From<&PointerButton> for ClickTapId { + fn from(value: &PointerButton) -> Self { + Self::Click(*value as u8) + } +} + +impl From<&TouchPhase> for ClickPhase { + fn from(value: &TouchPhase) -> Self { + match value { + TouchPhase::Start => Self::Start, + TouchPhase::End => Self::End, + TouchPhase::Move | TouchPhase::Cancel => Self::Ignored, + } + } +} + impl Default for TemplateApp { fn default() -> Self { Self { - calculator: Calculator::default(), + calculator: CalculatorInner::default(), latest_error: None, - error_state: ErrorState::default(), + touches_down: HashSet::new(), + new_touches: Vec::new(), } } } @@ -42,37 +127,57 @@ impl TemplateApp { // Load previous app state (if any). // Note that you must enable the `persistence` feature for this to work. + let ret; if let Some(storage) = cc.storage { - return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default(); - } - - Default::default() - } - - fn calculator_input(&mut self, c: char) { - if let Err(e) = self.calculator.take_input(c) { - self.error_state.errored(e); + ret = eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default(); } else { - self.error_state.success(); + ret = Default::default() } + + TemplateApp::initialize_fonts(&cc.egui_ctx); + + ret } fn draw_stack(&mut self, ui: &mut egui::Ui) { - ui.add(Label::new( - RichText::new( - self.calculator - .stack - .iter() - .rev() - .map(|e| e.to_string()) - .collect::>() - .join("\n"), - ) - .background_color(egui::Color32::RED) - .font(DEFAULT_FONT) - .size(STACK_FONT_SIZE) - .color(Color32::WHITE), - )); + TableBuilder::new(ui) + .stick_to_bottom(true) + // .column(Column::auto() ) + .column(Column::remainder()) + // .header(20.0, |mut header| { + // header.col(|ui| { + // ui.heading("Entry"); + // }); + // header.col(|ui| { + // ui.heading("Value"); + // }); + // }) + .body(|mut body| { + for (_idx, entry) in self.calculator.calculator.stack.iter().enumerate().rev() { + body.row(30.0, |mut row| { + // row.col(|ui| { + // ui.add(Label::new( + // RichText::new(format!("{idx}")) + // .background_color(Color32::RED) + // .font(DEFAULT_FONT) + // .size(STACK_FONT_SIZE) + // .color(Color32::WHITE) + // )); + // }); + row.col(|ui| { + ui.add(Label::new( + RichText::new( + entry.format_entry(&self.calculator.calculator.display_mode), + ) + .background_color(Color32::DARK_GRAY) + .font(DEFAULT_FONT) + .size(STACK_FONT_SIZE) + .color(Color32::WHITE), + )); + }); + }); + } + }); } fn draw_error(&mut self, ui: &mut egui::Ui) { @@ -81,50 +186,114 @@ impl TemplateApp { RichText::new(e.to_string()) .font(DEFAULT_FONT) .size(STACK_FONT_SIZE) - .color(Color32::RED), + .background_color(Color32::RED) + .color(Color32::WHITE), ); } } fn draw_input(&mut self, ui: &mut egui::Ui) { - egui::Frame::none() - .fill(egui::Color32::RED) - .inner_margin(5.0) - .stroke(Stroke::new(10.0, Color32::BLUE)) - .show(ui, |ui| { - ui.label( - RichText::new(self.calculator.get_l()) - .color(Color32::WHITE) - .font(DEFAULT_FONT), - ); - }); + ui.painter() + .rect_filled(ui.available_rect_before_wrap(), 0.0, Color32::LIGHT_GREEN); + ui.label( + RichText::new(self.calculator.calculator.get_l()) + .color(Color32::BLACK) + .font(FontId::monospace(30.0)), + ); } fn draw_buttons(&mut self, ui: &mut egui::Ui) { - Grid::new("grid").spacing(BUTTON_SPACING).show(ui, |ui| { - for row in BUTTON_LAYOUT.iter() { - for button in row.iter() { - let label = RichText::new(button.value) - .font(DEFAULT_FONT) - .color(Color32::WHITE); - if ui - .add_enabled( - button.enabled, - Button::new(label) - .stroke(Stroke::NONE) - .rounding(Rounding::none()) - .fill(Color32::from_gray(0x12)), - ) - .on_hover_text(button.help) - .clicked() - { - info!("Clicked button {}", button.value); - self.calculator_input(button.value); - } + let button_layout = match self.calculator.calculator.state { + CalculatorState::Normal => BUTTON_LAYOUT, + CalculatorState::WaitingForConstant => return, + CalculatorState::WaitingForMacro => return, + CalculatorState::WaitingForRegister(_) => return, + CalculatorState::WaitingForSetting => BUTTON_LAYOUT_SETTINGS, + }; + + StripBuilder::new(ui) + .sizes(Size::exact(60.0), button_layout.len()) + // .sizes(Size::remainder(), button_layout.len()) + .vertical(|mut strip| { + for row in button_layout.iter() { + strip.strip(|builder| { + builder + .sizes(Size::remainder(), row.len()) + .horizontal(|mut strip| { + for button_definition in row.iter() { + strip.cell(|ui| { + let sense = Sense::click(); + + let label = RichText::new(button_definition.value) + .font(DEFAULT_FONT) + .color(Color32::WHITE) + .background_color(Color32::BLACK); + + ui.painter().rect_filled( + ui.available_rect_before_wrap(), + 0.0, + Color32::GOLD, + ); + ui.style_mut().spacing.window_margin = Margin { + left: 0.0, + right: 0.0, + top: 0.0, + bottom: 0.0, + }; + + let max_size = { + let ret = ui.available_rect_before_wrap(); + Vec2 { + x: ret.width(), + y: ret.height(), + } + }; + + ui.vertical_centered(|ui| { + ui.add_enabled( + button_definition.enabled, + Button::new(label) + .stroke(Stroke::NONE) + .rounding(Rounding::none()) + .fill(Color32::from_gray(0x12)) + .min_size(max_size) + .sense(sense), + ) + }); + + // let button = { + // let ret = ui.add_enabled( + // button_definition.enabled, + // Button::new(label) + // .stroke(Stroke::NONE) + // .rounding(Rounding::none()) + // .fill(Color32::from_gray(0x12)) + // .min_size(max_size) + // .sense(sense), + // ); + + // ret + // }; + + // Check if any new touches intersect with this button + let max_rect = ui.max_rect(); + for touch in self.new_touches.iter() { + if max_rect.contains(*touch) { + self.calculator + .calculator_input(button_definition.value); + } + } + }); + } + }); + }); } - ui.end_row(); - } - }); + }); + } + + fn layout() -> Layout { + Layout::from_main_dir_and_cross_align(Direction::TopDown, Align::Center) + .with_cross_justify(true) } fn handle_input(&mut self, i: &egui::InputState) { @@ -135,63 +304,126 @@ impl TemplateApp { for e in i.events.iter() { match e { egui::Event::Text(t) => { - self.calculator_input(t.chars().next().unwrap()); - } - egui::Event::Key { - key: Key::ArrowLeft, - pressed: true, - .. - } => { - self.calculator_input('<'); + self.calculator.calculator_input(t.chars().next().unwrap()); } + // egui::Event::Key { + // key: Key::ArrowLeft, + // pressed: true, + // .. + // } => { + // self.calculator.calculator_input('<'); + // } egui::Event::Key { key: Key::ArrowRight, pressed: true, .. } => { - self.calculator_input('>'); + self.calculator.calculator_input('>'); } egui::Event::Key { key: Key::Enter, pressed: true, .. } => { - self.calculator_input(' '); + self.calculator.calculator_input(' '); } + egui::Event::Touch { + device_id: _, + id, + phase, + pos, + force: _, + } => { + self.handle_touch_event(phase.into(), pos.clone(), id); + } + egui::Event::PointerButton { + pos, + button, + pressed, + modifiers: _, + } => self.handle_touch_event( + if *pressed { + ClickPhase::Start + } else { + ClickPhase::End + }, + *pos, + button, + ), - egui::Event::Copy => continue, - egui::Event::Cut => continue, - egui::Event::Paste(_) => continue, - egui::Event::Key { + egui::Event::Copy + | egui::Event::Cut + | egui::Event::Paste(_) + | egui::Event::Key { key: _, pressed: _, repeat: _, modifiers: _, - } => continue, - egui::Event::PointerMoved(_) => continue, - egui::Event::PointerButton { - pos: _, - button: _, - pressed: _, + } + | egui::Event::PointerMoved(_) + | egui::Event::PointerGone + | egui::Event::Scroll(_) + | egui::Event::Zoom(_) + | egui::Event::CompositionStart + | egui::Event::CompositionUpdate(_) + | egui::Event::CompositionEnd(_) + | egui::Event::AccessKitActionRequest(_) + | egui::Event::MouseWheel { + unit: _, + delta: _, modifiers: _, - } => continue, - egui::Event::PointerGone => continue, - egui::Event::Scroll(_) => continue, - egui::Event::Zoom(_) => continue, - egui::Event::CompositionStart => continue, - egui::Event::CompositionUpdate(_) => continue, - egui::Event::CompositionEnd(_) => continue, - egui::Event::Touch { - device_id: _, - id: _, - phase: _, - pos: _, - force: _, - } => continue, - egui::Event::AccessKitActionRequest(_) => continue, + } + | egui::Event::WindowFocused(_) => continue, } } } + + fn handle_touch_event(&mut self, phase: ClickPhase, pos: Pos2, id: impl Into) { + let id = id.into(); + match phase { + ClickPhase::Start => { + // TODO: This can be way better + + // If this is a brand new touch + if !self.touches_down.contains(&id) + // And it isn't a duplicate + // This can occur on phones where touches can be pointer events + && !self.new_touches.contains(&pos) + { + self.new_touches.push(pos); + } + self.touches_down.insert(id); + } + ClickPhase::End => { + self.touches_down.remove(&id); + } + ClickPhase::Ignored => {} + } + } + + fn initialize_fonts(egui_ctx: &egui::Context) { + info!("Initializing fonts"); + let mut fonts = FontDefinitions::default(); + + fonts.font_data.insert( + "LCD_Solid".to_owned(), + FontData::from_static(include_bytes!("../LcdSolid-VPzB.ttf")), + ); + + fonts + .families + .get_mut(&FontFamily::Monospace) + .unwrap() + .insert(0, "LCD_Solid".to_owned()); + + fonts + .families + .get_mut(&FontFamily::Monospace) + .unwrap() + .push("LCD_Solid".to_owned()); + + egui_ctx.set_fonts(fonts); + } } impl eframe::App for TemplateApp { @@ -209,135 +441,62 @@ impl eframe::App for TemplateApp { style.spacing.button_padding = BUTTON_PADDING; ctx.set_style(style); - // #[cfg(not(target_arch = "wasm32"))] - // egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { - // // The top panel is often a good place for a menu bar: - // egui::menu::bar(ui, |ui| { - // ui.menu_button("File", |ui| { - // if ui.button("Quit").clicked() { - // _frame.close(); - // } - // }); - // }); - // }); - - self.error_state = ErrorState::default(); + self.calculator.error_state = ErrorState::default(); egui::CentralPanel::default().show(ctx, |ui| { + // ui.with_layout(self.layout, add_contents) ui.input(|i: &egui::InputState| self.handle_input(i)); - Frame::none().fill(Color32::GREEN).show(ui, |ui| { - ui.vertical(|ui| { - ui.heading("rpn_rs_gui"); - ui.hyperlink("https://gitea.austen-wares.com/stonewareslord/rpn_rs"); - - // Buttons - self.draw_buttons(ui); - - // Stack - - ScrollArea::vertical().show(ui, |ui| { + StripBuilder::new(ui) + // header + .size(Size::exact(65.0)) + // Stack + // .size(Size::remainder().at_most(35.0)) + .size(Size::remainder().at_least(40.0)) + // Input + .size(Size::exact(40.0)) + // Error + .size(Size::exact(20.0)) + // Buttons + .size(Size::exact(450.0)) + .vertical(|mut strip| { + strip.cell(|ui| { + ui.heading("rpn_rs_gui"); + ui.hyperlink("https://gitea.austen-wares.com/stonewareslord/rpn_rs"); + }); + strip.cell(|ui| { + // Stack + ui.painter().rect_filled( + ui.available_rect_before_wrap(), + 0.0, + Color32::LIGHT_GRAY, + ); self.draw_stack(ui); }); - - self.draw_input(ui); - // Reset the error state and update `self.latest_error` if required - match std::mem::take(&mut self.error_state) { - ErrorState::NoModify => {} - ErrorState::Errored(e) => self.latest_error = Some(e), - ErrorState::Clear => self.latest_error = None, - } - - self.draw_error(ui); - egui::warn_if_debug_build(ui); - }); - }) + strip.cell(|ui| { + self.draw_input(ui); + // Reset the error state and update `self.latest_error` if required + match std::mem::take(&mut self.calculator.error_state) { + ErrorState::NoModify => {} + ErrorState::Errored(e) => self.latest_error = Some(e), + ErrorState::Clear => self.latest_error = None, + } + }); + strip.cell(|ui| { + // Error bar + self.draw_error(ui); + }); + strip.cell(|ui| { + // Buttons + self.draw_buttons(ui); + }); + }) }); - // if false { - // egui::Window::new("Window").show(ctx, |ui| { - // ui.label("Windows can be moved by dragging them."); - // ui.label("They are automatically sized based on contents."); - // ui.label("You can turn on resizing and scrolling if you like."); - // ui.label("You would normally choose either panels OR windows."); - // }); - // } + self.new_touches.drain(..); } } -struct CalculatorButton { - value: char, - help: &'static str, - enabled: bool, -} - -impl CalculatorButton { - const fn new(value: char, help: &'static str, enabled: bool) -> Self { - Self { - value, - help, - enabled, - } - } -} - -const BUTTON_LAYOUT: &[&[CalculatorButton]] = &[ - &[ - // CalculatorButton::new('s', "Sin", true), - CalculatorButton::new('u', "Undo", true), - CalculatorButton::new('U', "Redo", true), - CalculatorButton::new('>', "Swap", true), - CalculatorButton::new('@', "Drop", true), - ], - &[ - // CalculatorButton::new('|', "AbsoluteValue", true), - CalculatorButton::new('v', "Sqrt", true), - CalculatorButton::new('^', "Pow", true), - CalculatorButton::new('l', "Log", true), - CalculatorButton::new('L', "Ln", true), - ], - &[ - // CalculatorButton::new('c', "Cos", true), - CalculatorButton::new('n', "Negate", true), - CalculatorButton::new('%', "Modulo", true), - CalculatorButton::new('i', "Inverse", true), - CalculatorButton::new('/', "Divide", true), - ], - &[ - // CalculatorButton::new('t', "Tan", true), - CalculatorButton::new('7', "7", true), - CalculatorButton::new('8', "8", true), - CalculatorButton::new('9', "9", true), - CalculatorButton::new('*', "Multiply", true), - ], - &[ - // CalculatorButton::new('S', "ASin", true), - CalculatorButton::new('4', "4", true), - CalculatorButton::new('5', "5", true), - CalculatorButton::new('6', "6", true), - CalculatorButton::new('-', "Subtract", true), - ], - &[ - // CalculatorButton::new('C', "ACos", true), - CalculatorButton::new('1', "1", true), - CalculatorButton::new('2', "2", true), - CalculatorButton::new('3', "3", true), - CalculatorButton::new('+', "Add", true), - ], - &[ - // CalculatorButton::new('T', "ATan", true), - CalculatorButton::new('0', "0", true), - CalculatorButton::new('\\', "Drop", true), - CalculatorButton::new('.', "Decimal", true), - CalculatorButton::new(' ', "Return", true), - ], - // CalculatorButton::new ( '?', "IntegerDivide", true), - // CalculatorButton::new ( 'V', "BuildVector", true), - // CalculatorButton::new ( 'M', "BuildMatrix", true), - // CalculatorButton::new ( '_', "Deconstruct", true), - // CalculatorButton::new ( ', true)', "Transpose"), -]; - enum ErrorState { // Do not touch the state of the error NoModify, diff --git a/rpn_rs_gui/src/app/buttons.rs b/rpn_rs_gui/src/app/buttons.rs new file mode 100644 index 0000000..7adaf46 --- /dev/null +++ b/rpn_rs_gui/src/app/buttons.rs @@ -0,0 +1,108 @@ +use rpn_rs::calc::Calculator; + +pub struct CalculatorButton { + pub value: char, + pub help: Option<&'static str>, + pub enabled: bool, +} + +impl CalculatorButton { + const fn new(value: char, help: Option<&'static str>, enabled: bool) -> Self { + Self { + value, + help, + enabled, + } + } +} + +pub(crate) const BUTTON_LAYOUT_SETTINGS: &[&[CalculatorButton]] = &[ + &[CalculatorButton::new('q', Some("Exit"), true)], + &[ + CalculatorButton::new('d', Some("Degrees"), true), + CalculatorButton::new('r', Some("Radians"), true), + CalculatorButton::new('g', Some("Grads"), true), + ], + &[ + CalculatorButton::new('_', Some("Default"), true), + CalculatorButton::new(',', Some("Comma separated"), true), + CalculatorButton::new(' ', Some("Space separated"), true), + ], + &[ + CalculatorButton::new('s', Some("Scientific"), true), + CalculatorButton::new('S', Some("Scientific (stack precision)"), true), + ], + &[ + CalculatorButton::new('e', Some("Engineering"), true), + CalculatorButton::new('E', Some("Engineering (stack precision)"), true), + ], + &[ + CalculatorButton::new('f', Some("Fixed"), true), + CalculatorButton::new('F', Some("Fixed (stack precision)"), true), + ], + // CalculatorButton::new('w', Some("Do not write settings and stack on quit (default)"), true), + // CalculatorButton::new('W', Some("Write stack and settings on quit"), true), + // CalculatorButton::new('L', Some("Left align"), true), + // CalculatorButton::new('R', Some("Right align"), true), +]; + +pub(crate) const BUTTON_LAYOUT: &[&[CalculatorButton]] = &[ + &[ + // CalculatorButton::new('s', "Sin", true), + CalculatorButton::new('\\', Some("Drop"), true), + // TODO: Settings buttons + CalculatorButton::new('@', Some("Settings"), true), + // CalculatorButton::new(' ', Some("Enter"), true), + CalculatorButton::new('>', Some("Swap"), true), + CalculatorButton::new('$', Some("Backspace"), true), + ], + &[ + // CalculatorButton::new('|', "AbsoluteValue", true), + CalculatorButton::new('^', Some("Pow"), true), + CalculatorButton::new('U', Some("Redo"), true), + CalculatorButton::new('u', Some("Undo"), true), + CalculatorButton::new('L', Some("Ln"), true), + // CalculatorButton::new('l', Some("Log"), true), + ], + &[ + // CalculatorButton::new('c', "Cos", true), + CalculatorButton::new('v', Some("Sqrt"), true), + // CalculatorButton::new('%', Some("Modulo"), true), + CalculatorButton::new('n', Some("Negate"), true), + CalculatorButton::new('i', Some("Inverse"), true), + CalculatorButton::new('/', Some("Divide"), true), + ], + &[ + // CalculatorButton::new('t', "Tan", true), + CalculatorButton::new('7', None, true), + CalculatorButton::new('8', None, true), + CalculatorButton::new('9', None, true), + CalculatorButton::new('*', Some("Multiply"), true), + ], + &[ + // CalculatorButton::new('S', "ASin", true), + CalculatorButton::new('4', None, true), + CalculatorButton::new('5', None, true), + CalculatorButton::new('6', None, true), + CalculatorButton::new('-', Some("Subtract"), true), + ], + &[ + // CalculatorButton::new('C', "ACos", true), + CalculatorButton::new('1', None, true), + CalculatorButton::new('2', None, true), + CalculatorButton::new('3', None, true), + CalculatorButton::new('+', Some("Add"), true), + ], + &[ + // CalculatorButton::new('T', "ATan", true), + CalculatorButton::new('0', None, true), + CalculatorButton::new('.', Some("Decimal"), true), + CalculatorButton::new(' ', Some("Return"), true), + CalculatorButton::new(' ', Some("Return"), true), + ], + // CalculatorButton::new ( '?', "IntegerDivide", true), + // CalculatorButton::new ( 'V', "BuildVector", true), + // CalculatorButton::new ( 'M', "BuildMatrix", true), + // CalculatorButton::new ( '_', "Deconstruct", true), + // CalculatorButton::new ( ', true)', "Transpose"), +]; diff --git a/rpn_rs_gui/src/main.rs b/rpn_rs_gui/src/main.rs index c1a7239..79fe911 100644 --- a/rpn_rs_gui/src/main.rs +++ b/rpn_rs_gui/src/main.rs @@ -27,12 +27,13 @@ fn main() { let web_options = eframe::WebOptions::default(); wasm_bindgen_futures::spawn_local(async { - eframe::start_web( - "the_canvas_id", // hardcode it - web_options, - Box::new(|cc| Box::new(rpn_rs_gui::TemplateApp::new(cc))), - ) - .await - .expect("failed to start eframe"); + eframe::WebRunner::new() + .start( + "the_canvas_id", // hardcode it + web_options, + Box::new(|cc| Box::new(rpn_rs_gui::TemplateApp::new(cc))), + ) + .await + .expect("failed to start eframe"); }); }