From ca9505254ca03916a09707e7c8399679d1559dc7 Mon Sep 17 00:00:00 2001 From: Surinder Singh Matoo Date: Fri, 23 Aug 2024 09:41:42 +0530 Subject: [PATCH] wip --- Cargo.lock | 648 ++++++++++++++---------------- Cargo.toml | 35 +- core/src/app.rs | 7 +- core/src/egui/composite_button.rs | 49 ++- core/src/egui/composite_icon.rs | 81 ++-- core/src/egui/theme/mod.rs | 26 +- core/src/frame.rs | 4 +- core/src/modules/block_dag.rs | 4 +- core/src/modules/metrics.rs | 6 +- core/src/modules/overview.rs | 4 +- core/src/modules/welcome.rs | 6 +- 11 files changed, 446 insertions(+), 424 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e4aebb..1b3ca76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,76 +20,94 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.12.3" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74a4b14f3d99c1255dcba8f45621ab1a2e7540a0009652d33989005a4d0bfc6b" +checksum = "e4700bdc115b306d6c43381c344dc307f03b7f0460c304e4892c309930322bd7" dependencies = [ "enumn", "serde", ] +[[package]] +name = "accesskit_atspi_common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1de72dc7093910a1284cef784b6b143bab0a34d67f6178e4fc3aaaf29a09f8b" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "serde", + "thiserror", + "zvariant 3.15.2", +] + [[package]] name = "accesskit_consumer" -version = "0.16.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" +checksum = "fe3a07a32ab5837ad83db3230ac490c8504c2cd5b90ac8c00db6535f6ed65d0b" dependencies = [ "accesskit", + "immutable-chunkmap", ] [[package]] name = "accesskit_macos" -version = "0.10.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" +checksum = "a189d159c153ae0fce5f9eefdcfec4a27885f453ce5ef0ccf078f72a73c39d34" dependencies = [ "accesskit", "accesskit_consumer", - "objc2 0.3.0-beta.3.patch-leaks.3", + "objc2", + "objc2-app-kit", + "objc2-foundation", "once_cell", ] [[package]] name = "accesskit_unix" -version = "0.6.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f46c18d99ba61ad7123dd13eeb0c104436ab6af1df6a1cd8c11054ed394a08" +checksum = "b76c448cfd96d16131a9ad3ab786d06951eb341cdac1db908978ab010245a19d" dependencies = [ "accesskit", - "accesskit_consumer", + "accesskit_atspi_common", "async-channel 2.3.1", - "async-once-cell", + "async-executor", + "async-task", "atspi", "futures-lite 1.13.0", - "once_cell", + "futures-util", "serde", "zbus 3.15.2", ] [[package]] name = "accesskit_windows" -version = "0.15.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" +checksum = "682d8c4fb425606f97408e7577793f32e96310b646fa77662eb4216293eddc7f" dependencies = [ "accesskit", "accesskit_consumer", - "once_cell", "paste", "static_assertions", - "windows 0.48.0", + "windows 0.54.0", ] [[package]] name = "accesskit_winit" -version = "0.16.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284218aca17d9e150164428a0ebc7b955f70e3a9a78b4c20894513aabf98a67" +checksum = "9afbd6d598b7c035639ad2b664aa0edc94c93dc1fc3ebb4b40d8a95fcd43ffac" dependencies = [ "accesskit", "accesskit_macos", "accesskit_unix", "accesskit_windows", + "raw-window-handle", "winit", ] @@ -172,9 +190,9 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" +checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" dependencies = [ "android-properties", "bitflags 2.6.0", @@ -284,7 +302,7 @@ checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" dependencies = [ "clipboard-win", "log", - "objc2 0.5.2", + "objc2", "objc2-app-kit", "objc2-foundation", "parking_lot", @@ -521,12 +539,6 @@ dependencies = [ "futures-lite 2.3.0", ] -[[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.8.1" @@ -921,51 +933,13 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-sys" -version = "0.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" -dependencies = [ - "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.5", -] - -[[package]] -name = "block2" -version = "0.2.0-alpha.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" -dependencies = [ - "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]] name = "block2" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "objc2 0.5.2", + "objc2", ] [[package]] @@ -1070,20 +1044,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "calloop" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" -dependencies = [ - "bitflags 2.6.0", - "log", - "polling 3.7.3", - "rustix 0.38.34", - "slab", - "thiserror", -] - [[package]] name = "calloop" version = "0.13.0" @@ -1098,25 +1058,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "calloop-wayland-source" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" -dependencies = [ - "calloop 0.12.4", - "rustix 0.38.34", - "wayland-backend", - "wayland-client", -] - [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop 0.13.0", + "calloop", "rustix 0.38.34", "wayland-backend", "wayland-client", @@ -1864,6 +1812,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dpi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" + [[package]] name = "duct" version = "0.13.7" @@ -1884,28 +1838,24 @@ checksum = "2334658684d7c213e18602aa72ce37e94d1c9b535882ef6e30bc444b7514a1ee" [[package]] name = "ecolor" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7637fc2e74d17e52931bac90ff4fc061ac776ada9c7fa272f24cdca5991972" - -[[package]] -name = "ecolor" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "bytemuck", - "emath 0.27.2", + "emath", "serde", ] [[package]] name = "eframe" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "ahash", "bytemuck", "directories", "document-features", - "egui 0.27.2", + "egui", "egui-winit", "egui_glow", "glow", @@ -1914,13 +1864,12 @@ dependencies = [ "image 0.25.2", "js-sys", "log", - "objc2 0.5.2", + "objc2", "objc2-app-kit", "objc2-foundation", "parking_lot", "percent-encoding", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", + "raw-window-handle", "ron", "serde", "static_assertions", @@ -1934,23 +1883,13 @@ dependencies = [ [[package]] name = "egui" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e46df77bb493b9ead5733540efdd2a1b0c18a5f75915921fc734495108172a5" -dependencies = [ - "ahash", - "epaint 0.24.0", - "nohash-hasher", -] - -[[package]] -name = "egui" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "accesskit", "ahash", - "emath 0.27.2", - "epaint 0.27.2", + "emath", + "epaint", "log", "nohash-hasher", "ron", @@ -1959,32 +1898,31 @@ dependencies = [ [[package]] name = "egui-notify" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bedb26510c661d5d69958aae802d768aa1c344673e9029a20b356fa7f8a4a8e1" +version = "0.15.0" +source = "git+https://github.com/aspectron/egui-notify?branch=omega#ab851504357351f99299c0ab3eccea656ab778cd" dependencies = [ - "egui 0.24.0", + "egui", ] [[package]] name = "egui-phosphor" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3bb4c76b07a91bcc3021ea7a53c7484b62880a307680f92d81affe57c9e61b" +version = "0.6.0" +source = "git+https://github.com/aspectron/egui-phosphor?branch=omega#a2cbf0f75116267a46a64d2dd9b369b659e2f87a" dependencies = [ - "egui 0.24.0", + "egui", ] [[package]] name = "egui-winit" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "accesskit_winit", "ahash", "arboard", - "egui 0.27.2", + "egui", "log", - "raw-window-handle 0.6.2", + "raw-window-handle", "serde", "smithay-clipboard", "web-time", @@ -1994,10 +1932,11 @@ dependencies = [ [[package]] name = "egui_extras" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "ahash", - "egui 0.27.2", + "egui", "enum-map", "image 0.25.2", "log", @@ -2008,11 +1947,12 @@ dependencies = [ [[package]] name = "egui_glow" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "ahash", "bytemuck", - "egui 0.27.2", + "egui", "glow", "log", "memoffset 0.9.1", @@ -2022,11 +1962,12 @@ dependencies = [ [[package]] name = "egui_plot" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui_plot?branch=omega#eaee496b859c67fbf5c7a64c2a28ae2380f09eed" dependencies = [ "ahash", - "egui 0.27.2", - "emath 0.27.2", + "egui", + "emath", ] [[package]] @@ -2037,13 +1978,8 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a045c6c0b44b35e98513fc1e9d183ab42881ac27caccb9fa345465601f56cce4" - -[[package]] -name = "emath" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "bytemuck", "serde", @@ -2162,33 +2098,26 @@ dependencies = [ [[package]] name = "epaint" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f370b53e435fc235243174f3b2bf68a4b0202f3885cece16ad4aecd03222c4" -dependencies = [ - "ab_glyph", - "ahash", - "ecolor 0.24.1", - "emath 0.24.1", - "nohash-hasher", - "parking_lot", -] - -[[package]] -name = "epaint" -version = "0.27.2" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" dependencies = [ "ab_glyph", "ahash", "bytemuck", - "ecolor 0.27.2", - "emath 0.27.2", + "ecolor", + "emath", + "epaint_default_fonts", "log", "nohash-hasher", "parking_lot", "serde", ] +[[package]] +name = "epaint_default_fonts" +version = "0.28.1" +source = "git+https://github.com/aspectron/egui?branch=omega#56e89bd4e0b98ab2c64cace884ac9c6b31409531" + [[package]] name = "equivalent" version = "1.0.1" @@ -2609,55 +2538,56 @@ dependencies = [ [[package]] name = "glutin" -version = "0.31.3" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fcd4ae4e86d991ad1300b8f57166e5be0c95ef1f63f3f5b827f8a164548746" +checksum = "2491aa3090f682ddd920b184491844440fdd14379c7eef8f5bc10ef7fb3242fd" dependencies = [ "bitflags 2.6.0", - "cfg_aliases 0.1.1", + "cfg_aliases 0.2.1", "cgl", "core-foundation", "dispatch", "glutin_egl_sys", "glutin_glx_sys", "glutin_wgl_sys", - "icrate", "libloading", - "objc2 0.4.1", + "objc2", + "objc2-app-kit", + "objc2-foundation", "once_cell", - "raw-window-handle 0.5.2", + "raw-window-handle", "wayland-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "x11-dl", ] [[package]] name = "glutin-winit" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" dependencies = [ - "cfg_aliases 0.1.1", + "cfg_aliases 0.2.1", "glutin", - "raw-window-handle 0.5.2", + "raw-window-handle", "winit", ] [[package]] name = "glutin_egl_sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77cc5623f5309ef433c3dd4ca1223195347fe62c413da8e2fdd0eb76db2d9bcd" +checksum = "cae99fff4d2850dbe6fb8c1fa8e4fead5525bab715beaacfccf3fb994e01c827" dependencies = [ "gl_generator", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "glutin_glx_sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a165fd686c10dcc2d45380b35796e577eacfd43d4660ee741ec8ebe2201b3b4f" +checksum = "9c2b2d3918e76e18e08796b55eb64e8fe6ec67d5a6b2e2a7e2edce224ad24c63" dependencies = [ "gl_generator", "x11-dl", @@ -2665,9 +2595,9 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c" dependencies = [ "gl_generator", ] @@ -3020,17 +2950,6 @@ dependencies = [ "cc", ] -[[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 = "ident_case" version = "1.0.1" @@ -3111,6 +3030,15 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" +[[package]] +name = "immutable-chunkmap" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4419f022e55cc63d5bbd6b44b71e1d226b9c9480a47824c706e9d54e5c40c5eb" +dependencies = [ + "arrayvec", +] + [[package]] name = "indexed_db_futures" version = "0.5.0" @@ -3996,13 +3924,13 @@ dependencies = [ "downcast", "downcast-rs", "eframe", - "egui 0.27.2", + "egui", "egui-notify", "egui-phosphor", "egui_extras", "egui_plot", "env_logger 0.10.2", - "epaint 0.27.2", + "epaint", "futures", "futures-util", "image 0.24.9", @@ -4753,7 +4681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if 1.0.0", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -5200,17 +5128,16 @@ dependencies = [ [[package]] name = "ndk" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ "bitflags 2.6.0", "jni-sys", "log", "ndk-sys", "num_enum", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", + "raw-window-handle", "thiserror", ] @@ -5222,9 +5149,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.5.0+25.2.9519653" +version = "0.6.0+11769913" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" dependencies = [ "jni-sys", ] @@ -5499,12 +5426,6 @@ dependencies = [ "objc_id", ] -[[package]] -name = "objc-sys" -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.5" @@ -5513,49 +5434,52 @@ checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" [[package]] name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" dependencies = [ - "block2 0.2.0-alpha.6", - "objc-sys 0.2.0-beta.2", - "objc2-encode 2.0.0-pre.2", + "objc-sys", + "objc2-encode", ] [[package]] -name = "objc2" -version = "0.4.1" +name = "objc2-app-kit" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "objc-sys 0.3.5", - "objc2-encode 3.0.0", + "bitflags 2.6.0", + "block2", + "libc", + "objc2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation", + "objc2-quartz-core", ] [[package]] -name = "objc2" -version = "0.5.2" +name = "objc2-cloud-kit" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ - "objc-sys 0.3.5", - "objc2-encode 4.0.3", + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", ] [[package]] -name = "objc2-app-kit" +name = "objc2-contacts" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ - "bitflags 2.6.0", - "block2 0.5.1", - "libc", - "objc2 0.5.2", - "objc2-core-data", - "objc2-core-image", + "block2", + "objc2", "objc2-foundation", - "objc2-quartz-core", ] [[package]] @@ -5565,8 +5489,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", ] @@ -5576,27 +5500,24 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", "objc2-metal", ] [[package]] -name = "objc2-encode" -version = "2.0.0-pre.2" +name = "objc2-core-location" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ - "objc-sys 0.2.0-beta.2", + "block2", + "objc2", + "objc2-contacts", + "objc2-foundation", ] -[[package]] -name = "objc2-encode" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" - [[package]] name = "objc2-encode" version = "4.0.3" @@ -5610,9 +5531,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", + "block2", + "dispatch", "libc", - "objc2 0.5.2", + "objc2", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2", + "objc2", + "objc2-app-kit", + "objc2-foundation", ] [[package]] @@ -5622,8 +5556,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", ] @@ -5634,12 +5568,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", "objc2-metal", ] +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] + [[package]] name = "objc_id" version = "0.1.1" @@ -6256,12 +6245,6 @@ dependencies = [ "random-number", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "raw-window-handle" version = "0.6.2" @@ -6294,15 +6277,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -6433,7 +6407,7 @@ dependencies = [ "objc-foundation", "objc_id", "pollster", - "raw-window-handle 0.6.2", + "raw-window-handle", "urlencoding", "wasm-bindgen", "wasm-bindgen-futures", @@ -7034,31 +7008,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" -[[package]] -name = "smithay-client-toolkit" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" -dependencies = [ - "bitflags 2.6.0", - "calloop 0.12.4", - "calloop-wayland-source 0.2.0", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.34", - "thiserror", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols 0.31.2", - "wayland-protocols-wlr 0.2.0", - "wayland-scanner", - "xkeysym", -] - [[package]] name = "smithay-client-toolkit" version = "0.19.2" @@ -7066,8 +7015,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.6.0", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", + "calloop", + "calloop-wayland-source", "cursor-icon", "libc", "log", @@ -7078,8 +7027,8 @@ dependencies = [ "wayland-client", "wayland-csd-frame", "wayland-cursor", - "wayland-protocols 0.32.3", - "wayland-protocols-wlr 0.3.3", + "wayland-protocols", + "wayland-protocols-wlr", "wayland-scanner", "xkeysym", ] @@ -7091,7 +7040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc8216eec463674a0e90f29e0ae41a4db573ec5b56b1c6c1c71615d249b6d846" dependencies = [ "libc", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "wayland-backend", ] @@ -8149,18 +8098,6 @@ dependencies = [ "xcursor", ] -[[package]] -name = "wayland-protocols" -version = "0.31.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - [[package]] name = "wayland-protocols" version = "0.32.3" @@ -8175,27 +8112,14 @@ dependencies = [ [[package]] name = "wayland-protocols-plasma" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-protocols 0.31.2", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.2.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +checksum = "f79f2d57c7fcc6ab4d602adba364bf59a5c24de57bd194486bf9b8360e06bfc4" dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-scanner", ] @@ -8208,7 +8132,7 @@ dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client", - "wayland-protocols 0.32.3", + "wayland-protocols", "wayland-scanner", ] @@ -8247,9 +8171,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -8261,13 +8185,13 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e" dependencies = [ - "block2 0.5.1", + "block2", "core-foundation", "home", "jni", "log", "ndk-context", - "objc2 0.5.2", + "objc2", "objc2-foundation", "url", "web-sys", @@ -8318,13 +8242,14 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.48.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" dependencies = [ - "windows-implement 0.48.0", - "windows-interface 0.48.0", - "windows-targets 0.48.5", + "windows-core 0.54.0", + "windows-implement 0.53.0", + "windows-interface 0.53.0", + "windows-targets 0.52.6", ] [[package]] @@ -8346,6 +8271,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.57.0" @@ -8360,13 +8295,13 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.75", ] [[package]] @@ -8382,13 +8317,13 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" +checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.75", ] [[package]] @@ -8657,47 +8592,50 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.29.15" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca" +checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" dependencies = [ "ahash", "android-activity", "atomic-waker", "bitflags 2.6.0", + "block2", "bytemuck", - "calloop 0.12.4", - "cfg_aliases 0.1.1", + "calloop", + "cfg_aliases 0.2.1", + "concurrent-queue", "core-foundation", "core-graphics", "cursor-icon", - "icrate", + "dpi", "js-sys", "libc", - "log", "memmap2", "ndk", - "ndk-sys", - "objc2 0.4.1", - "once_cell", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", "orbclient", "percent-encoding", - "raw-window-handle 0.5.2", - "raw-window-handle 0.6.2", - "redox_syscall 0.3.5", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", "rustix 0.38.34", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "smol_str", + "tracing", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", "wayland-client", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-protocols-plasma", "web-sys", "web-time", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "x11-dl", "x11rb", "xkbcommon-dl", diff --git a/Cargo.toml b/Cargo.toml index f07bc69..c4837b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ kaspa-ng-macros = { version = "0.2.3", path = "macros/" } # egui = "=0.24.0" # epaint = "=0.24.0" -# egui_plot = "=0.24.0" + # egui_extras = { version = "=0.24.0", features = ["svg","image"] } # eframe = { version = "=0.24.0", default-features = false, features = [ # "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. @@ -39,19 +39,36 @@ kaspa-ng-macros = { version = "0.2.3", path = "macros/" } # "persistence", # Enable restoring app state when restarting the app. # ] } -egui = { path="../egui/crates/egui"} -epaint = { path="../egui/crates/epaint"} -egui_plot = { path="../egui/crates/egui_plot"} -egui_extras = { path="../egui/crates/egui_extras", features = ["svg","image", "serde"] } -eframe = { path="../egui/crates/eframe", default-features = false, features = [ +# egui = { path="../egui/crates/egui", version="=0.28.1"} +# epaint = { path="../egui/crates/epaint"} +# # epaint = "=0.28.1" +# egui_plot = "=0.28.1" +# # egui_plot = { path="../egui/crates/egui_plot"} +# egui_extras = { path="../egui/crates/egui_extras", features = ["svg","image", "serde"] } +# eframe = { path="../egui/crates/eframe", 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-phosphor = { path = "../egui-phosphor", version = "=0.6.0", features = ["thin","light","regular","bold"] } +# egui-notify = { path = "../egui-notify" } +# egui-toast = { path = "../egui-toast" } + +egui = { git = "https://github.com/aspectron/egui", branch = "omega"} +epaint = { git = "https://github.com/aspectron/egui", branch = "omega"} + +egui_plot = { git = "https://github.com/aspectron/egui_plot", branch = "omega"} +egui_extras = { git = "https://github.com/aspectron/egui", branch = "omega", features = ["svg","image", "serde"] } +eframe = { git = "https://github.com/aspectron/egui", branch = "omega", 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-phosphor = { version = "=0.3.1", features = ["thin","light","regular","bold"] } -egui-notify = "=0.11.0" -# egui-toast = "0.9.0" +egui-phosphor = { git = "https://github.com/aspectron/egui-phosphor", branch = "omega", version = "=0.6.0", features = ["thin","light","regular","bold"] } +egui-notify = { git = "https://github.com/aspectron/egui-notify", branch = "omega"} +# egui-toast = { git = "https://github.com/aspectron/egui-toast", branch = "omega" } # egui = { path = "../egui/crates/egui" } # egui_extras = { path = "../egui/crates/egui_extras", features = ["svg", "image"] } diff --git a/core/src/app.rs b/core/src/app.rs index f48e8ad..1878f0e 100644 --- a/core/src/app.rs +++ b/core/src/app.rs @@ -286,7 +286,7 @@ cfg_if! { runtime::signals::Signals::bind(&runtime); runtime.start(); - Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, window_frame)) + Ok(Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, window_frame))) }), )?; @@ -302,6 +302,7 @@ cfg_if! { // use crate::result::Result; // use crate::adaptor::Adaptor; + use wasm_bindgen::JsCast; // pub async fn kaspa_ng_main(wallet_api : Option>, application_events : Option, adaptor: Option>) -> Result<()> { pub async fn kaspa_ng_main(application_context : ApplicationContext) -> Result<()> { @@ -347,7 +348,7 @@ cfg_if! { eframe::WebRunner::new() .start( - "kaspa-ng", + document().get_element_by_id("kaspa-ng").expect(" not found.").dyn_into::().unwrap(), web_options, Box::new(move |cc| { @@ -366,7 +367,7 @@ cfg_if! { - Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, false)) + Ok(Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, false))) }), ) .await diff --git a/core/src/egui/composite_button.rs b/core/src/egui/composite_button.rs index ad79178..f357ffa 100644 --- a/core/src/egui/composite_button.rs +++ b/core/src/egui/composite_button.rs @@ -291,11 +291,26 @@ impl Widget for CompositeButton<'_> { secondary_text_style = TextStyle::Monospace; } - let text = text.map(|text| text.into_galley(ui, wrap, text_wrap_width, TextStyle::Button)); + let wrap_mode = wrap.map(|wrap| { + if wrap { + TextWrapMode::Wrap + } else { + TextWrapMode::Extend + } + }); + + let text = + text.map(|text| text.into_galley(ui, wrap_mode, text_wrap_width, TextStyle::Button)); let secondary_text = secondary_text - .map(|text| text.into_galley(ui, wrap, text_wrap_width, secondary_text_style)); - let shortcut_text = (!shortcut_text.is_empty()) - .then(|| shortcut_text.into_galley(ui, Some(false), f32::INFINITY, TextStyle::Button)); + .map(|text| text.into_galley(ui, wrap_mode, text_wrap_width, secondary_text_style)); + let shortcut_text = (!shortcut_text.is_empty()).then(|| { + shortcut_text.into_galley( + ui, + Some(TextWrapMode::Extend), + f32::INFINITY, + TextStyle::Button, + ) + }); let mut desired_size = Vec2::new(pulldown_padding, 0.0); //Vec2::ZERO; let mut img_plus_spacing_width = 0.0; @@ -340,7 +355,7 @@ impl Widget for CompositeButton<'_> { let (rect, mut response) = ui.allocate_at_least(desired_size, sense); response.widget_info(|| { if let Some(text) = &text { - WidgetInfo::labeled(WidgetType::Button, text.text()) + WidgetInfo::labeled(WidgetType::Button, true, text.text()) } else { WidgetInfo::new(WidgetType::Button) } @@ -397,11 +412,23 @@ impl Widget for CompositeButton<'_> { image.image_options(), ); - response = texture_load_result_response(image.source(), &tlr, response); + response = + texture_load_result_response(&image.source(ui.ctx()), &tlr, response); } Composite::Icon(icon) => { let galley = WidgetText::RichText(icon.clone().size(image_size.y)) - .into_galley(ui, wrap, text_wrap_width, TextStyle::Button); + .into_galley( + ui, + wrap.map(|wrap| { + if wrap { + TextWrapMode::Wrap + } else { + TextWrapMode::Extend + } + }), + text_wrap_width, + TextStyle::Button, + ); let image_rect = Rect::from_min_size( pos2(cursor_x, rect.center().y - 0.5 - (galley.size().y / 2.0)), galley.size(), @@ -472,7 +499,13 @@ impl Widget for CompositeButton<'_> { if pulldown_selector { let galley = WidgetText::RichText(RichText::new("⏷").size(14.)).into_galley( ui, - wrap, + wrap.map(|wrap| { + if wrap { + TextWrapMode::Wrap + } else { + TextWrapMode::Extend + } + }), text_wrap_width, TextStyle::Button, ); diff --git a/core/src/egui/composite_icon.rs b/core/src/egui/composite_icon.rs index 0c5d34a..e9bd21d 100644 --- a/core/src/egui/composite_icon.rs +++ b/core/src/egui/composite_icon.rs @@ -2,6 +2,34 @@ use egui::*; use std::sync::Arc; +pub struct LayoutResult { + pos: Pos2, + text_pos: Pos2, + response: Response, + icon_text: Arc, + text: Option>, + secondary_text: Option>, +} +impl LayoutResult { + fn new( + pos: Pos2, + text_pos: Pos2, + response: Response, + icon_text: Arc, + text: Option>, + secondary_text: Option>, + ) -> Self { + Self { + pos, + text_pos, + response, + icon_text, + text, + secondary_text, + } + } +} + /// Clickable button with text. /// /// See also [`Ui::button`]. @@ -156,17 +184,7 @@ impl CompositeIcon { } /// Do layout and position the galley in the ui, without painting it or adding widget info. - pub fn layout_in_ui( - &self, - ui: &mut Ui, - ) -> ( - Pos2, - Pos2, - Response, - Arc, - Option>, - Option>, - ) { + pub fn layout_in_ui(&self, ui: &mut Ui) -> LayoutResult { let sense = { // We only want to focus icon if the screen reader is on. if ui.memory(|mem| mem.options.screen_reader) { @@ -185,14 +203,22 @@ impl CompositeIcon { secondary_text_style = TextStyle::Body; } - let text = self - .text - .clone() - .map(|text| text.into_galley(ui, Some(true), text_wrap_width, TextStyle::Button)); - let secondary_text = self - .secondary_text - .clone() - .map(|text| text.into_galley(ui, Some(true), text_wrap_width, secondary_text_style)); + let text = self.text.clone().map(|text| { + text.into_galley( + ui, + Some(TextWrapMode::Wrap), + text_wrap_width, + TextStyle::Button, + ) + }); + let secondary_text = self.secondary_text.clone().map(|text| { + text.into_galley( + ui, + Some(TextWrapMode::Wrap), + text_wrap_width, + secondary_text_style, + ) + }); if let Some(text) = &text { text_size += text.size(); @@ -222,7 +248,7 @@ impl CompositeIcon { // h-center //pos.x = response.rect.left() + (response.rect.width() - icon_size.x)/2.0; - (pos, text_pos, response, text_galley, text, secondary_text) + LayoutResult::new(pos, text_pos, response, text_galley, text, secondary_text) }; // if let WidgetText::Galley(galley) = self.icon.clone() { @@ -250,7 +276,7 @@ impl CompositeIcon { .into_layout_job(ui.style(), FontSelection::Default, valign); let truncate = true; - let wrap = !truncate && ui.wrap_text(); + let wrap = !truncate && ui.wrap_mode() == TextWrapMode::Wrap; let available_width = ui.available_width(); if wrap @@ -263,7 +289,7 @@ impl CompositeIcon { let cursor = ui.cursor(); let first_row_indentation = available_width - ui.available_size_before_wrap().x; - egui_assert!(first_row_indentation.is_finite()); + assert!(first_row_indentation.is_finite()); layout_job.wrap.max_width = available_width; layout_job.first_row_min_height = cursor.height(); @@ -328,11 +354,18 @@ impl CompositeIcon { impl Widget for CompositeIcon { fn ui(self, ui: &mut Ui) -> Response { - let (pos, text_pos, response, icon_text, text, secondary_text) = self.layout_in_ui(ui); + let LayoutResult { + pos, + text_pos, + response, + icon_text, + text, + secondary_text, + } = self.layout_in_ui(ui); response.widget_info(|| { if let Some(text) = &self.text { - WidgetInfo::labeled(WidgetType::Button, text.text()) + WidgetInfo::labeled(WidgetType::Button, true, text.text()) } else { WidgetInfo::new(WidgetType::Button) } diff --git a/core/src/egui/theme/mod.rs b/core/src/egui/theme/mod.rs index a56fe7f..b41340b 100644 --- a/core/src/egui/theme/mod.rs +++ b/core/src/egui/theme/mod.rs @@ -8,12 +8,12 @@ pub use style::*; use crate::imports::*; #[derive(Clone)] -pub struct Theme { +pub struct AppTheme { pub color: ThemeColor, pub style: ThemeStyle, } -impl Theme { +impl AppTheme { pub fn new(color: ThemeColor, style: ThemeStyle) -> Self { Self { color, style } } @@ -29,7 +29,7 @@ impl Theme { } } -impl Default for Theme { +impl Default for AppTheme { fn default() -> Self { Self { color: ThemeColor::dark(), @@ -38,8 +38,8 @@ impl Default for Theme { } } -impl From<&Theme> for Visuals { - fn from(theme: &Theme) -> Self { +impl From<&AppTheme> for Visuals { + fn from(theme: &AppTheme) -> Self { let mut visuals = if theme.color.dark_mode { Visuals::dark() } else { @@ -62,16 +62,16 @@ impl From<&Theme> for Visuals { } } -impl AsRef for Theme { +impl AsRef for AppTheme { fn as_ref(&self) -> &Self { self } } -static mut THEME: Option = None; +static mut THEME: Option = None; #[inline(always)] -pub fn theme() -> &'static Theme { - unsafe { THEME.get_or_insert_with(Theme::default) } +pub fn theme() -> &'static AppTheme { + unsafe { THEME.get_or_insert_with(AppTheme::default) } } #[inline(always)] @@ -107,7 +107,7 @@ pub fn apply_theme_by_name( ThemeStyle::default() }); - apply_theme(ctx, Theme::new(theme_color, theme_style)); + apply_theme(ctx, AppTheme::new(theme_color, theme_style)); } pub fn apply_theme_color_by_name(ctx: &Context, theme_color_name: impl Into) { @@ -120,7 +120,7 @@ pub fn apply_theme_color_by_name(ctx: &Context, theme_color_name: impl Into) { @@ -133,10 +133,10 @@ pub fn apply_theme_style_by_name(ctx: &Context, theme_style_name: impl Into::from_timestamp((grid.value / 1000.0) as i64, 0) .expect("could not parse timestamp") .with_timezone(&chrono::Local) diff --git a/core/src/modules/overview.rs b/core/src/modules/overview.rs index b2dc271..6674adc 100644 --- a/core/src/modules/overview.rs +++ b/core/src/modules/overview.rs @@ -458,7 +458,7 @@ impl Overview { let text = format!("{} {}", i18n(metric.title().1).to_uppercase(), metric.format(value, true, true)); let rich_text_top = RichText::new(&text).size(10.).color(theme_color().raised_text_color); - let label_top = Label::new(rich_text_top).wrap(false); + let label_top = Label::new(rich_text_top).extend(); let mut rect_top = plot_result.response.rect; rect_top.set_bottom(rect_top.top() + 12.); @@ -467,7 +467,7 @@ impl Overview { vec2(1.0,1.0),vec2(1.0,-1.0),vec2(-1.0,1.0),vec2(-1.0,-1.0), ].iter().for_each(|offset| { let rich_text_back = RichText::new(&text).size(10.).color(theme_color().raised_text_shadow); - let label_back = Label::new(rich_text_back).wrap(false); + let label_back = Label::new(rich_text_back).extend(); let mut rect_back = rect_top; rect_back.set_center(rect_back.center()+*offset); ui.put(rect_back, label_back); diff --git a/core/src/modules/welcome.rs b/core/src/modules/welcome.rs index 2b5956f..55ad3ab 100644 --- a/core/src/modules/welcome.rs +++ b/core/src/modules/welcome.rs @@ -94,7 +94,7 @@ impl Welcome { egui::ComboBox::from_id_source("language_selector") .selected_text(language) .show_ui(ui, |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(TextWrapMode::Extend); ui.set_min_width(60.0); dictionary.enabled_languages().into_iter().for_each(|(code,lang)| { ui.selectable_value(&mut self.settings.language_code, code.to_string(), lang); @@ -108,7 +108,7 @@ impl Welcome { egui::ComboBox::from_id_source("theme_color_selector") .selected_text(theme_color.as_str()) .show_ui(ui, |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(TextWrapMode::Extend); ui.set_min_width(60.0); theme_colors().keys().for_each(|name| { ui.selectable_value(&mut theme_color, name.to_string(), name); @@ -127,7 +127,7 @@ impl Welcome { egui::ComboBox::from_id_source("theme_style_selector") .selected_text(theme_style.as_str()) .show_ui(ui, |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(TextWrapMode::Extend); ui.set_min_width(60.0); theme_styles().keys().for_each(|name| { ui.selectable_value(&mut theme_style, name.to_string(), name);