darkfi 1 год назад
Родитель
Сommit
53ca281102
47 измененных файлов с 451 добавлено и 756 удалено
  1. 1 1
      bin/app/Cargo.lock
  2. 1 2
      bin/app/Cargo.toml
  3. 1 1
      bin/app/Makefile
  4. 13 21
      bin/app/src/app/mod.rs
  5. 4 10
      bin/app/src/app/node.rs
  6. 33 64
      bin/app/src/app/schema/chat.rs
  7. 12 29
      bin/app/src/app/schema/menu.rs
  8. 27 37
      bin/app/src/app/schema/mod.rs
  9. 1 0
      bin/app/src/app/schema/settings.rs
  10. 7 17
      bin/app/src/app/schema/test.rs
  11. 3 10
      bin/app/src/expr/compile.rs
  12. 8 27
      bin/app/src/gfx/mod.rs
  13. 12 7
      bin/app/src/logger.rs
  14. 28 30
      bin/app/src/main.rs
  15. 11 14
      bin/app/src/mesh.rs
  16. 2 2
      bin/app/src/net.rs
  17. 3 5
      bin/app/src/plugin/darkirc.rs
  18. 21 24
      bin/app/src/plugin/mod.rs
  19. 1 3
      bin/app/src/prop/guard.rs
  20. 13 14
      bin/app/src/prop/mod.rs
  21. 11 5
      bin/app/src/prop/wrap.rs
  22. 4 5
      bin/app/src/scene.rs
  23. 12 12
      bin/app/src/shape/mod.rs
  24. 2 3
      bin/app/src/text/atlas.rs
  25. 4 12
      bin/app/src/text/mod.rs
  26. 0 24
      bin/app/src/text/shape.rs
  27. 1 1
      bin/app/src/text/wrap.rs
  28. 5 9
      bin/app/src/text2/atlas.rs
  29. 9 6
      bin/app/src/text2/editor/parley.rs
  30. 7 10
      bin/app/src/text2/mod.rs
  31. 8 8
      bin/app/src/text2/render.rs
  32. 7 12
      bin/app/src/ui/button.rs
  33. 39 86
      bin/app/src/ui/chatedit.rs
  34. 11 20
      bin/app/src/ui/chatview/mod.rs
  35. 14 41
      bin/app/src/ui/chatview/page.rs
  36. 4 11
      bin/app/src/ui/emoji_picker/emoji.rs
  37. 11 24
      bin/app/src/ui/emoji_picker/mod.rs
  38. 1 2
      bin/app/src/ui/gesture.rs
  39. 17 21
      bin/app/src/ui/image.rs
  40. 6 10
      bin/app/src/ui/layer.rs
  41. 28 29
      bin/app/src/ui/mod.rs
  42. 2 2
      bin/app/src/ui/shortcut.rs
  43. 18 37
      bin/app/src/ui/text.rs
  44. 16 25
      bin/app/src/ui/vector_art/mod.rs
  45. 4 7
      bin/app/src/ui/vector_art/shape.rs
  46. 5 4
      bin/app/src/ui/win.rs
  47. 3 12
      bin/app/src/util/mod.rs

+ 1 - 1
bin/app/Cargo.lock

@@ -3177,7 +3177,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
 [[package]]
 [[package]]
 name = "miniquad"
 name = "miniquad"
 version = "0.4.8"
 version = "0.4.8"
-source = "git+https://github.com/narodnik/miniquad#a48953ab76c8f4d918633bd65becdbceeceedacc"
+source = "git+https://github.com/not-fl3/miniquad#d225104a04a88345b5c7b055e1a250ade86c6bb8"
 dependencies = [
 dependencies = [
  "libc",
  "libc",
  "ndk-sys",
  "ndk-sys",

+ 1 - 2
bin/app/Cargo.toml

@@ -9,8 +9,7 @@ homepage = "https://dark.fi"
 repository = "https://codeberg.org/darkrenaissance/darkfi"
 repository = "https://codeberg.org/darkrenaissance/darkfi"
 
 
 [dependencies]
 [dependencies]
-#miniquad = { git = "https://github.com/not-fl3/miniquad" }
-miniquad = { git = "https://github.com/narodnik/miniquad" }
+miniquad = { git = "https://github.com/not-fl3/miniquad" }
 
 
 # Currently latest version links to freetype-sys 0.19 but we use 0.21
 # Currently latest version links to freetype-sys 0.19 but we use 0.21
 #harfbuzz-sys = "0.6.1"
 #harfbuzz-sys = "0.6.1"

+ 1 - 1
bin/app/Makefile

@@ -19,7 +19,7 @@ DEBUG_FEATURES = --features=enable-filelog,enable-plugins
 
 
 #DEV_FEATURES = --features=enable-filelog,enable-netdebug,emulate-android
 #DEV_FEATURES = --features=enable-filelog,enable-netdebug,emulate-android
 #DEV_FEATURES = --features=enable-filelog,enable-netdebug,enable-plugins
 #DEV_FEATURES = --features=enable-filelog,enable-netdebug,enable-plugins
-DEV_FEATURES = --features=enable-netdebug
+DEV_FEATURES = --features=enable-netdebug,enable-plugins
 
 
 default: build-release
 default: build-release
 	./darkfi-app
 	./darkfi-app

+ 13 - 21
bin/app/src/app/mod.rs

@@ -16,33 +16,24 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use async_recursion::async_recursion;
-use chrono::{Local, NaiveDate, NaiveDateTime, TimeZone};
-use darkfi::system::CondVar;
-use darkfi_serial::{deserialize, Decodable, Encodable};
-use futures::{stream::FuturesUnordered, StreamExt};
+use chrono::{NaiveDate, NaiveDateTime};
+use darkfi_serial::Encodable;
 use sled_overlay::sled;
 use sled_overlay::sled;
 use smol::Task;
 use smol::Task;
-use std::{
-    fs::File,
-    io::Cursor,
-    sync::{Arc, Mutex as SyncMutex},
-    thread,
-};
+use std::sync::{Arc, Mutex as SyncMutex};
 
 
 #[cfg(target_os = "android")]
 #[cfg(target_os = "android")]
 use crate::android;
 use crate::android;
 
 
 use crate::{
 use crate::{
     error::Error,
     error::Error,
-    expr::Op,
-    gfx::{EpochIndex, GraphicsEventPublisherPtr, RenderApi, Vertex},
+    gfx::{EpochIndex, GraphicsEventPublisherPtr, RenderApi},
     plugin::PluginSettings,
     plugin::PluginSettings,
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyBool, PropertyStr, PropertySubType, PropertyType,
+        Property, PropertyAtomicGuard, PropertySubType, PropertyType,
         PropertyValue, Role,
         PropertyValue, Role,
     },
     },
-    scene::{Pimpl, SceneNode, SceneNodePtr, SceneNodeType, Slot},
+    scene::{Pimpl, SceneNode, SceneNodePtr, SceneNodeType},
     text::TextShaperPtr,
     text::TextShaperPtr,
     ui::{chatview, Window},
     ui::{chatview, Window},
     ExecutorPtr,
     ExecutorPtr,
@@ -50,12 +41,12 @@ use crate::{
 
 
 mod node;
 mod node;
 mod schema;
 mod schema;
-use schema::{get_settingsdb_path, get_window_scale_filename, settings};
+use schema::get_settingsdb_path;
 
 
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "app", $($arg)*); } }
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "app", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "app", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "app", $($arg)*); } }
 macro_rules! i { ($($arg:tt)*) => { info!(target: "app", $($arg)*); } }
 macro_rules! i { ($($arg:tt)*) => { info!(target: "app", $($arg)*); } }
-macro_rules! w { ($($arg:tt)*) => { warn!(target: "app", $($arg)*); } }
+//macro_rules! w { ($($arg:tt)*) => { warn!(target: "app", $($arg)*); } }
 macro_rules! e { ($($arg:tt)*) => { error!(target: "app", $($arg)*); } }
 macro_rules! e { ($($arg:tt)*) => { error!(target: "app", $($arg)*); } }
 
 
 //fn print_type_of<T>(_: &T) {
 //fn print_type_of<T>(_: &T) {
@@ -110,7 +101,7 @@ impl App {
             sled_tree: settings_tree,
             sled_tree: settings_tree,
         });
         });
 
 
-        let mut window_scale = 1.;
+        let window_scale = 1.;
         #[cfg(target_os = "android")]
         #[cfg(target_os = "android")]
         {
         {
             window_scale = android::get_screen_density() / 2.625;
             window_scale = android::get_screen_density() / 2.625;
@@ -150,14 +141,14 @@ impl App {
     /// Begins the draw of the tree, and then starts the UI procs.
     /// Begins the draw of the tree, and then starts the UI procs.
     pub async fn start(self: Arc<Self>, event_pub: GraphicsEventPublisherPtr, epoch: EpochIndex) {
     pub async fn start(self: Arc<Self>, event_pub: GraphicsEventPublisherPtr, epoch: EpochIndex) {
         d!("Starting app epoch={epoch}");
         d!("Starting app epoch={epoch}");
-        let atom = &mut PropertyAtomicGuard::new();
+        let mut atom = PropertyAtomicGuard::new();
 
 
         let window_node = self.sg_root.clone().lookup_node("/window").unwrap();
         let window_node = self.sg_root.clone().lookup_node("/window").unwrap();
         let prop = window_node.get_property("screen_size").unwrap();
         let prop = window_node.get_property("screen_size").unwrap();
         // We can only do this once the window has been created in miniquad.
         // We can only do this once the window has been created in miniquad.
         let (screen_width, screen_height) = miniquad::window::screen_size();
         let (screen_width, screen_height) = miniquad::window::screen_size();
-        prop.clone().set_f32(atom, Role::App, 0, screen_width);
-        prop.clone().set_f32(atom, Role::App, 1, screen_height);
+        prop.clone().set_f32(&mut atom, Role::App, 0, screen_width).unwrap();
+        prop.clone().set_f32(&mut atom, Role::App, 1, screen_height).unwrap();
 
 
         drop(atom);
         drop(atom);
 
 
@@ -204,6 +195,7 @@ impl App {
 }
 }
 
 
 // Just for testing
 // Just for testing
+#[allow(dead_code)]
 fn populate_tree(tree: &sled::Tree) {
 fn populate_tree(tree: &sled::Tree) {
     let chat_txt = include_str!("../../data/chat.txt");
     let chat_txt = include_str!("../../data/chat.txt");
     for line in chat_txt.lines() {
     for line in chat_txt.lines() {

+ 4 - 10
bin/app/src/app/node.rs

@@ -17,13 +17,8 @@
  */
  */
 
 
 use crate::{
 use crate::{
-    error::Error,
-    expr::Op,
-    gfx::{GraphicsEventPublisherPtr, Vertex},
-    prop::{Property, PropertyBool, PropertyStr, PropertySubType, PropertyType, Role},
-    scene::{CallArgType, SceneNode, SceneNodeType, Slot},
-    text::TextShaperPtr,
-    ExecutorPtr,
+    prop::{Property, PropertySubType, PropertyType},
+    scene::{CallArgType, SceneNode, SceneNodeType},
 };
 };
 
 
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "app::node", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "app::node", $($arg)*); } }
@@ -110,6 +105,7 @@ pub fn create_shortcut(name: &str) -> SceneNode {
     node
     node
 }
 }
 
 
+#[allow(dead_code)]
 pub fn create_gesture(name: &str) -> SceneNode {
 pub fn create_gesture(name: &str) -> SceneNode {
     t!("create_gesture({name})");
     t!("create_gesture({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Gesture);
     let mut node = SceneNode::new(name, SceneNodeType::Gesture);
@@ -164,9 +160,6 @@ pub fn create_text(name: &str) -> SceneNode {
     prop.allow_exprs();
     prop.allow_exprs();
     node.add_property(prop).unwrap();
     node.add_property(prop).unwrap();
 
 
-    let prop = Property::new("baseline", PropertyType::Float32, PropertySubType::Pixel);
-    node.add_property(prop).unwrap();
-
     let mut prop = Property::new("lineheight", PropertyType::Float32, PropertySubType::Pixel);
     let mut prop = Property::new("lineheight", PropertyType::Float32, PropertySubType::Pixel);
     prop.set_ui_text("Line Height", "Line height/lead (em)");
     prop.set_ui_text("Line Height", "Line height/lead (em)");
     prop.set_defaults_f32(vec![1.2]).unwrap();
     prop.set_defaults_f32(vec![1.2]).unwrap();
@@ -196,6 +189,7 @@ pub fn create_text(name: &str) -> SceneNode {
     node
     node
 }
 }
 
 
+#[allow(dead_code)]
 pub fn create_editbox(name: &str) -> SceneNode {
 pub fn create_editbox(name: &str) -> SceneNode {
     t!("create_editbox({name})");
     t!("create_editbox({name})");
     let mut node = SceneNode::new(name, SceneNodeType::EditBox);
     let mut node = SceneNode::new(name, SceneNodeType::EditBox);

+ 33 - 64
bin/app/src/app/schema/chat.rs

@@ -16,7 +16,6 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use darkfi::system::msleep;
 use darkfi_serial::Encodable;
 use darkfi_serial::Encodable;
 use sled_overlay::sled;
 use sled_overlay::sled;
 use std::time::UNIX_EPOCH;
 use std::time::UNIX_EPOCH;
@@ -24,15 +23,12 @@ use std::time::UNIX_EPOCH;
 use crate::{
 use crate::{
     app::{
     app::{
         node::{
         node::{
-            create_button, create_chatedit, create_chatview, create_editbox, create_emoji_picker,
-            create_image, create_layer, create_shortcut, create_text, create_vector_art,
+            create_button, create_chatedit, create_chatview, create_emoji_picker,
+            create_layer, create_shortcut, create_text, create_vector_art,
         },
         },
-        populate_tree, App,
+        App,
     },
     },
-    error::Error,
-    expr::{self, Compiler, Op},
-    gfx::{GraphicsEventPublisherPtr, Point, Rectangle, RenderApi, Vertex},
-    mesh::{Color, MeshBuilder},
+    expr::{self, Compiler},
     plugin::darkirc,
     plugin::darkirc,
     prop::{
     prop::{
         Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
         Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
@@ -40,22 +36,20 @@ use crate::{
     },
     },
     scene::{Pimpl, SceneNodePtr, Slot},
     scene::{Pimpl, SceneNodePtr, Slot},
     shape,
     shape,
-    text::TextShaperPtr,
     ui::{
     ui::{
-        chatview, emoji_picker, Button, ChatEdit, ChatView, EditBox, EmojiPicker, Image, Layer,
-        ShapeVertex, Shortcut, Text, VectorArt, VectorShape, Window,
+        chatview, emoji_picker, Button, ChatEdit, ChatView, EmojiPicker, Layer,
+        Shortcut, Text, VectorArt, VectorShape,
     },
     },
     util::unixtime,
     util::unixtime,
-    ExecutorPtr,
 };
 };
 
 
 use super::{ColorScheme, COLOR_SCHEME};
 use super::{ColorScheme, COLOR_SCHEME};
 
 
+#[cfg(any(target_os = "android", feature = "emulate-android"))]
 mod android_ui_consts {
 mod android_ui_consts {
     use crate::gfx::{Point, Rectangle};
     use crate::gfx::{Point, Rectangle};
 
 
     pub const CHANNEL_LABEL_Y: f32 = 30.;
     pub const CHANNEL_LABEL_Y: f32 = 30.;
-    pub const CHANNEL_LABEL_BASELINE: f32 = 30.;
     pub const BACKARROW_SCALE: f32 = 30.;
     pub const BACKARROW_SCALE: f32 = 30.;
     pub const BACKARROW_X: f32 = 50.;
     pub const BACKARROW_X: f32 = 50.;
     pub const BACKARROW_Y: f32 = 70.;
     pub const BACKARROW_Y: f32 = 70.;
@@ -91,7 +85,6 @@ mod android_ui_consts {
     pub const CMD_HELP_HEIGHT: f32 = 110.;
     pub const CMD_HELP_HEIGHT: f32 = 110.;
     pub const CMD_HELP_GAP: f32 = 10.;
     pub const CMD_HELP_GAP: f32 = 10.;
     pub const CMD_HELP_CMD_FONTSIZE: f32 = 48.;
     pub const CMD_HELP_CMD_FONTSIZE: f32 = 48.;
-    pub const CMD_HELP_BASELINE: f32 = 74.;
     pub const CMD_HELP_CMD_LABEL_X_INSET: f32 = 40.;
     pub const CMD_HELP_CMD_LABEL_X_INSET: f32 = 40.;
     pub const CMD_HELP_NICK_CMD_WIDTH: f32 = 280.;
     pub const CMD_HELP_NICK_CMD_WIDTH: f32 = 280.;
     pub const CMD_HELP_NICK_DESC_WIDTH: f32 = 1000.;
     pub const CMD_HELP_NICK_DESC_WIDTH: f32 = 1000.;
@@ -124,7 +117,6 @@ mod ui_consts {
 
 
     // Chat UI
     // Chat UI
     pub const CHANNEL_LABEL_Y: f32 = 12.;
     pub const CHANNEL_LABEL_Y: f32 = 12.;
-    pub const CHANNEL_LABEL_BASELINE: f32 = 37.;
     pub const BACKARROW_SCALE: f32 = 15.;
     pub const BACKARROW_SCALE: f32 = 15.;
     pub const BACKARROW_X: f32 = 38.;
     pub const BACKARROW_X: f32 = 38.;
     pub const BACKARROW_Y: f32 = 26.;
     pub const BACKARROW_Y: f32 = 26.;
@@ -160,7 +152,6 @@ mod ui_consts {
     pub const CMD_HELP_HEIGHT: f32 = 55.;
     pub const CMD_HELP_HEIGHT: f32 = 55.;
     pub const CMD_HELP_GAP: f32 = 5.;
     pub const CMD_HELP_GAP: f32 = 5.;
     pub const CMD_HELP_CMD_FONTSIZE: f32 = 24.;
     pub const CMD_HELP_CMD_FONTSIZE: f32 = 24.;
-    pub const CMD_HELP_BASELINE: f32 = 37.;
     pub const CMD_HELP_CMD_LABEL_X_INSET: f32 = 20.;
     pub const CMD_HELP_CMD_LABEL_X_INSET: f32 = 20.;
     pub const CMD_HELP_NICK_CMD_WIDTH: f32 = 140.;
     pub const CMD_HELP_NICK_CMD_WIDTH: f32 = 140.;
     pub const CMD_HELP_NICK_DESC_WIDTH: f32 = 500.;
     pub const CMD_HELP_NICK_DESC_WIDTH: f32 = 500.;
@@ -227,7 +218,7 @@ pub async fn make(
     layer_node.set_property_bool(atom, Role::App, "is_visible", false).unwrap();
     layer_node.set_property_bool(atom, Role::App, "is_visible", false).unwrap();
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     let layer_node =
     let layer_node =
-        layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     window.link(layer_node.clone());
     window.link(layer_node.clone());
 
 
     // Create the toolbar bg
     // Create the toolbar bg
@@ -267,7 +258,7 @@ pub async fn make(
     );
     );
 
 
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create the send button
     // Create the send button
@@ -281,7 +272,7 @@ pub async fn make(
 
 
     let shape = shape::create_back_arrow().scaled(BACKARROW_SCALE);
     let shape = shape::create_back_arrow().scaled(BACKARROW_SCALE);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create the back button
     // Create the back button
@@ -321,7 +312,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create shortcut to go back as well
     // Create shortcut to go back as well
@@ -354,7 +345,6 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 1, CHANNEL_LABEL_Y).unwrap();
     prop.clone().set_f32(atom, Role::App, 1, CHANNEL_LABEL_Y).unwrap();
     prop.clone().set_expr(atom, Role::App, 2, expr::load_var("w")).unwrap();
     prop.clone().set_expr(atom, Role::App, 2, expr::load_var("w")).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, CHATEDIT_HEIGHT).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, CHATEDIT_HEIGHT).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", CHANNEL_LABEL_BASELINE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE * 1.2).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE * 1.2).unwrap();
     node.set_property_str(atom, Role::App, "text", &("#".to_string() + channel)).unwrap();
     node.set_property_str(atom, Role::App, "text", &("#".to_string() + channel)).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -379,8 +369,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -400,7 +388,6 @@ pub async fn make(
     prop.clone().set_expr(atom, Role::App, 3, expr::load_var("dynamic_h")).unwrap();
     prop.clone().set_expr(atom, Role::App, 3, expr::load_var("dynamic_h")).unwrap();
     prop.add_depend(&emoji_dynamic_h_prop, 0, "dynamic_h");
     prop.add_depend(&emoji_dynamic_h_prop, 0, "dynamic_h");
     let emoji_h_prop = PropertyFloat32::wrap(&node, Role::App, "dynamic_h", 0).unwrap();
     let emoji_h_prop = PropertyFloat32::wrap(&node, Role::App, "dynamic_h", 0).unwrap();
-    //node.set_property_f32(atom, Role::App, "baseline", CHANNEL_LABEL_BASELINE).unwrap();
     //node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     //node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     node.set_property_f32(atom, Role::App, "emoji_size", EMOJI_PICKER_ICON_SIZE).unwrap();
     node.set_property_f32(atom, Role::App, "emoji_size", EMOJI_PICKER_ICON_SIZE).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
@@ -408,10 +395,8 @@ pub async fn make(
         .setup(|me| {
         .setup(|me| {
             EmojiPicker::new(
             EmojiPicker::new(
                 me,
                 me,
-                window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
                 emoji_meshes,
                 emoji_meshes,
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -455,7 +440,7 @@ pub async fn make(
     //    [0.41, 0.6, 0.65, 1.],
     //    [0.41, 0.6, 0.65, 1.],
     //);
     //);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Main content view
     // Main content view
@@ -472,7 +457,7 @@ pub async fn make(
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     let layer_node =
     let layer_node =
-        layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     chat_layer_node.clone().link(layer_node.clone());
     chat_layer_node.clone().link(layer_node.clone());
 
 
     // ChatView
     // ChatView
@@ -564,7 +549,6 @@ pub async fn make(
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
                 app.text_shaper.clone(),
                 app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -646,7 +630,7 @@ pub async fn make(
     //    [0.41, 0.6, 0.65, 1.],
     //    [0.41, 0.6, 0.65, 1.],
     //);
     //);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create the send button
     // Create the send button
@@ -661,7 +645,7 @@ pub async fn make(
     node.set_property_u32(atom, Role::App, "z_index", 5).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 5).unwrap();
     let shape = shape::create_send_arrow().scaled(EMOJI_SCALE);
     let shape = shape::create_send_arrow().scaled(EMOJI_SCALE);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create the emoji button
     // Create the emoji button
@@ -680,7 +664,7 @@ pub async fn make(
     };
     };
     let shape = shape::create_emoji_selector(color).scaled(EMOJI_SCALE);
     let shape = shape::create_emoji_selector(color).scaled(EMOJI_SCALE);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create the emoji button
     // Create the emoji button
@@ -696,7 +680,7 @@ pub async fn make(
     node.set_property_u32(atom, Role::App, "z_index", 5).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 5).unwrap();
     let shape = shape::create_close_icon().scaled(EMOJI_CLOSE_SCALE);
     let shape = shape::create_close_icon().scaled(EMOJI_CLOSE_SCALE);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Text edit
     // Text edit
@@ -814,8 +798,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -866,7 +848,7 @@ pub async fn make(
         ]
         ]
     );
     );
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
     */
     */
 
 
@@ -904,7 +886,7 @@ pub async fn make(
             if text.starts_with("/nick") {
             if text.starts_with("/nick") {
                 let nick = text.split_whitespace().nth(1).unwrap_or("anon");
                 let nick = text.split_whitespace().nth(1).unwrap_or("anon");
                 info!(target: "app::chat", "Setting nick to: {nick}");
                 info!(target: "app::chat", "Setting nick to: {nick}");
-                darkirc.set_property_str(atom, Role::App, "nick", nick);
+                darkirc.set_property_str(atom, Role::App, "nick", nick).unwrap();
 
 
                 let msg = format!("You are now known as <{nick}>");
                 let msg = format!("You are now known as <{nick}>");
                 let id: [u8; 32] = rand::random();
                 let id: [u8; 32] = rand::random();
@@ -954,7 +936,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create shortcut to send as well
     // Create shortcut to send as well
@@ -1052,7 +1034,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Commands help hint
     // Commands help hint
@@ -1070,7 +1052,7 @@ pub async fn make(
     cmd_layer_node.set_property_bool(atom, Role::App, "is_visible", false).unwrap();
     cmd_layer_node.set_property_bool(atom, Role::App, "is_visible", false).unwrap();
     cmd_layer_node.set_property_u32(atom, Role::App, "z_index", 3).unwrap();
     cmd_layer_node.set_property_u32(atom, Role::App, "z_index", 3).unwrap();
     let cmd_layer_node =
     let cmd_layer_node =
-        cmd_layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        cmd_layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     layer_node.clone().link(cmd_layer_node.clone());
     layer_node.clone().link(cmd_layer_node.clone());
 
 
     let cmd_hint_is_visible =
     let cmd_hint_is_visible =
@@ -1099,7 +1081,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     cmd_layer_node.clone().link(node);
     cmd_layer_node.clone().link(node);
 
 
     // Create the actionbar bg
     // Create the actionbar bg
@@ -1143,7 +1125,7 @@ pub async fn make(
     );
     );
 
 
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     cmd_layer_node.clone().link(node);
     cmd_layer_node.clone().link(node);
 
 
     // Create some text
     // Create some text
@@ -1153,7 +1135,6 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 1, CMD_HELP_LABEL_Y).unwrap();
     prop.clone().set_f32(atom, Role::App, 1, CMD_HELP_LABEL_Y).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 1000.).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", CMD_HELP_BASELINE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", CMD_HELP_CMD_FONTSIZE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", CMD_HELP_CMD_FONTSIZE).unwrap();
     node.set_property_str(atom, Role::App, "text", "/nick").unwrap();
     node.set_property_str(atom, Role::App, "text", "/nick").unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -1171,8 +1152,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -1185,7 +1164,6 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 1, CMD_HELP_LABEL_Y).unwrap();
     prop.clone().set_f32(atom, Role::App, 1, CMD_HELP_LABEL_Y).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 1000.).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", CMD_HELP_BASELINE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     node.set_property_str(atom, Role::App, "text", "Change your nickname").unwrap();
     node.set_property_str(atom, Role::App, "text", "Change your nickname").unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -1203,8 +1181,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -1235,7 +1211,7 @@ pub async fn make(
         [1., 0., 0., 1.],
         [1., 0., 0., 1.],
     );
     );
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
     */
     */
 
 
@@ -1256,7 +1232,7 @@ pub async fn make(
     // Priority higher than chatview but lower than chatedit
     // Priority higher than chatview but lower than chatedit
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     let layer_node =
     let layer_node =
-        layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     content_layer_node.clone().link(layer_node.clone());
     content_layer_node.clone().link(layer_node.clone());
 
 
     let actions_is_visible = PropertyBool::wrap(&layer_node, Role::App, "is_visible", 0).unwrap();
     let actions_is_visible = PropertyBool::wrap(&layer_node, Role::App, "is_visible", 0).unwrap();
@@ -1335,7 +1311,7 @@ pub async fn make(
     );
     );
 
 
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create some text
     // Create some text
@@ -1345,7 +1321,6 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 1, ACTION_LABEL_POS.y).unwrap();
     prop.clone().set_f32(atom, Role::App, 1, ACTION_LABEL_POS.y).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, ACTION_SELECT_ALL_RECT.rhs()).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, ACTION_SELECT_ALL_RECT.rhs()).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_SELECT_ALL_RECT.h).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_SELECT_ALL_RECT.h).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", 0.).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE * 1.24).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE * 1.24).unwrap();
     node.set_property_str(atom, Role::App, "text", "copy   paste   select all").unwrap();
     node.set_property_str(atom, Role::App, "text", "copy   paste   select all").unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -1363,8 +1338,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -1394,7 +1367,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Paste button
     // Paste button
@@ -1426,7 +1399,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Select all button
     // Select all button
@@ -1440,7 +1413,6 @@ pub async fn make(
 
 
     let (slot, recvr) = Slot::new("select_all_clicked");
     let (slot, recvr) = Slot::new("select_all_clicked");
     node.register("click", slot).unwrap();
     node.register("click", slot).unwrap();
-    let actions_is_visible2 = actions_is_visible.clone();
     let listen_click = app.ex.spawn(async move {
     let listen_click = app.ex.spawn(async move {
         while let Ok(_) = recvr.recv().await {
         while let Ok(_) = recvr.recv().await {
             info!(target: "app::chat", "clicked select_all");
             info!(target: "app::chat", "clicked select_all");
@@ -1448,7 +1420,7 @@ pub async fn make(
     });
     });
     app.tasks.lock().unwrap().push(listen_click);
     app.tasks.lock().unwrap().push(listen_click);
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Paste overlay popup
     // Paste overlay popup
@@ -1467,7 +1439,7 @@ pub async fn make(
     // Priority higher than chatview but lower than chatedit
     // Priority higher than chatview but lower than chatedit
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "priority", 1).unwrap();
     let layer_node =
     let layer_node =
-        layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     content_layer_node.link(layer_node.clone());
     content_layer_node.link(layer_node.clone());
 
 
     let pasta_is_visible = PropertyBool::wrap(&layer_node, Role::App, "is_visible", 0).unwrap();
     let pasta_is_visible = PropertyBool::wrap(&layer_node, Role::App, "is_visible", 0).unwrap();
@@ -1519,7 +1491,7 @@ pub async fn make(
     );
     );
 
 
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create some text
     // Create some text
@@ -1529,7 +1501,6 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 1, ACTION_LABEL_POS.y).unwrap();
     prop.clone().set_f32(atom, Role::App, 1, ACTION_LABEL_POS.y).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, ACTION_SELECT_ALL_RECT.rhs()).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, ACTION_SELECT_ALL_RECT.rhs()).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_SELECT_ALL_RECT.h).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_SELECT_ALL_RECT.h).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", 0.).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", FONTSIZE).unwrap();
     node.set_property_str(atom, Role::App, "text", "paste").unwrap();
     node.set_property_str(atom, Role::App, "text", "paste").unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
     //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -1547,8 +1518,6 @@ pub async fn make(
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -1563,7 +1532,7 @@ pub async fn make(
     prop.clone().set_f32(atom, Role::App, 2, ACTION_PASTE_RECT.w).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, ACTION_PASTE_RECT.w).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_PASTE_RECT.h).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, ACTION_PASTE_RECT.h).unwrap();
 
 
-    let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+    let node = node.setup(|me| Button::new(me)).await;
     layer_node.clone().link(node.clone());
     layer_node.clone().link(node.clone());
 
 
     let (slot, recvr) = Slot::new("paste_clicked");
     let (slot, recvr) = Slot::new("paste_clicked");

+ 12 - 29
bin/app/src/app/schema/menu.rs

@@ -16,42 +16,34 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use sled_overlay::sled;
-
 use crate::{
 use crate::{
     app::{
     app::{
         node::{
         node::{
-            create_button, create_chatedit, create_chatview, create_editbox, create_image,
+            create_button,
             create_layer, create_shortcut, create_text, create_vector_art,
             create_layer, create_shortcut, create_text, create_vector_art,
         },
         },
-        populate_tree, App,
+        App,
     },
     },
-    error::Error,
-    expr::{self, Compiler, Op},
-    gfx::{GraphicsEventPublisherPtr, Rectangle, RenderApi, Vertex},
-    mesh::{Color, MeshBuilder},
+    expr,
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
-        PropertyType, Role,
+        PropertyAtomicGuard, PropertyBool, PropertyFloat32,
+        Role,
     },
     },
     scene::{SceneNodePtr, Slot},
     scene::{SceneNodePtr, Slot},
-    shape,
-    text::TextShaperPtr,
     ui::{
     ui::{
-        Button, ChatEdit, ChatView, EditBox, Image, Layer, ShapeVertex, Shortcut, Text, VectorArt,
-        VectorShape, Window,
+        Button, Layer, ShapeVertex, Shortcut, Text, VectorArt,
+        VectorShape,
     },
     },
-    ExecutorPtr,
 };
 };
 
 
 use super::{ColorScheme, CHANNELS, COLOR_SCHEME};
 use super::{ColorScheme, CHANNELS, COLOR_SCHEME};
 
 
+#[cfg(any(target_os = "android", feature = "emulate-android"))]
 mod android_ui_consts {
 mod android_ui_consts {
     pub const CHANNEL_LABEL_X: f32 = 40.;
     pub const CHANNEL_LABEL_X: f32 = 40.;
     pub const CHANNEL_LABEL_Y: f32 = 35.;
     pub const CHANNEL_LABEL_Y: f32 = 35.;
     pub const CHANNEL_LABEL_LINESPACE: f32 = 140.;
     pub const CHANNEL_LABEL_LINESPACE: f32 = 140.;
     pub const CHANNEL_LABEL_FONTSIZE: f32 = 44.;
     pub const CHANNEL_LABEL_FONTSIZE: f32 = 44.;
-    pub const CHANNEL_LABEL_BASELINE: f32 = 82.;
 }
 }
 
 
 #[cfg(target_os = "android")]
 #[cfg(target_os = "android")]
@@ -73,7 +65,6 @@ mod ui_consts {
     pub const CHANNEL_LABEL_Y: f32 = 14.;
     pub const CHANNEL_LABEL_Y: f32 = 14.;
     pub const CHANNEL_LABEL_LINESPACE: f32 = 60.;
     pub const CHANNEL_LABEL_LINESPACE: f32 = 60.;
     pub const CHANNEL_LABEL_FONTSIZE: f32 = 22.;
     pub const CHANNEL_LABEL_FONTSIZE: f32 = 22.;
-    pub const CHANNEL_LABEL_BASELINE: f32 = 37.;
 }
 }
 
 
 use ui_consts::*;
 use ui_consts::*;
@@ -88,8 +79,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     .unwrap();
     .unwrap();
     let atom = &mut PropertyAtomicGuard::new();
     let atom = &mut PropertyAtomicGuard::new();
 
 
-    let mut cc = Compiler::new();
-
     // Main view
     // Main view
     let layer_node = create_layer("menu_layer");
     let layer_node = create_layer("menu_layer");
     let prop = layer_node.get_property("rect").unwrap();
     let prop = layer_node.get_property("rect").unwrap();
@@ -100,7 +89,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     layer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     layer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     layer_node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     let layer_node =
     let layer_node =
-        layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     window.link(layer_node.clone());
     window.link(layer_node.clone());
 
 
     // Channels label bg
     // Channels label bg
@@ -141,7 +130,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     );
     );
 
 
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     layer_node.clone().link(node);
     layer_node.clone().link(node);
 
 
     // Create some text
     // Create some text
@@ -152,7 +141,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 200.).unwrap();
     prop.clone().set_f32(atom, Role::App, 3, 200.).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
-    node.set_property_f32(atom, Role::App, "baseline", CHANNEL_LABEL_BASELINE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", CHANNEL_LABEL_FONTSIZE).unwrap();
     node.set_property_f32(atom, Role::App, "font_size", CHANNEL_LABEL_FONTSIZE).unwrap();
     node.set_property_str(atom, Role::App, "text", "CHANNELS").unwrap();
     node.set_property_str(atom, Role::App, "text", "CHANNELS").unwrap();
     //node.set_property_str(atom, Role::App, "text", "anon1").unwrap();
     //node.set_property_str(atom, Role::App, "text", "anon1").unwrap();
@@ -177,8 +165,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
                 me,
                 me,
                 window_scale.clone(),
                 window_scale.clone(),
                 app.render_api.clone(),
                 app.render_api.clone(),
-                app.text_shaper.clone(),
-                app.ex.clone(),
             )
             )
         })
         })
         .await;
         .await;
@@ -220,7 +206,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
         );
         );
 
 
         let node = node
         let node = node
-            .setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone()))
+            .setup(|me| VectorArt::new(me, shape, app.render_api.clone()))
             .await;
             .await;
         layer_node.clone().link(node);
         layer_node.clone().link(node);
 
 
@@ -239,7 +225,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
         prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
         prop.clone().set_f32(atom, Role::App, 2, 1000.).unwrap();
         prop.clone().set_f32(atom, Role::App, 3, 200.).unwrap();
         prop.clone().set_f32(atom, Role::App, 3, 200.).unwrap();
         node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
         node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
-        node.set_property_f32(atom, Role::App, "baseline", CHANNEL_LABEL_BASELINE).unwrap();
         node.set_property_f32(atom, Role::App, "font_size", CHANNEL_LABEL_FONTSIZE).unwrap();
         node.set_property_f32(atom, Role::App, "font_size", CHANNEL_LABEL_FONTSIZE).unwrap();
         node.set_property_str(atom, Role::App, "text", text).unwrap();
         node.set_property_str(atom, Role::App, "text", text).unwrap();
         //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
         //node.set_property_bool(atom, Role::App, "debug", true).unwrap();
@@ -267,8 +252,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
                     me,
                     me,
                     window_scale.clone(),
                     window_scale.clone(),
                     app.render_api.clone(),
                     app.render_api.clone(),
-                    app.text_shaper.clone(),
-                    app.ex.clone(),
                 )
                 )
             })
             })
             .await;
             .await;
@@ -307,7 +290,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
         });
         });
         app.tasks.lock().unwrap().push(listen_click);
         app.tasks.lock().unwrap().push(listen_click);
 
 
-        let node = node.setup(|me| Button::new(me, app.ex.clone())).await;
+        let node = node.setup(|me| Button::new(me)).await;
         layer_node.clone().link(node);
         layer_node.clone().link(node);
 
 
         // Create shortcut
         // Create shortcut

+ 27 - 37
bin/app/src/app/schema/mod.rs

@@ -16,44 +16,38 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use darkfi_serial::{deserialize, Encodable};
+use darkfi_serial::Encodable;
 use sled_overlay::sled;
 use sled_overlay::sled;
 use std::fs::File;
 use std::fs::File;
 
 
 use crate::{
 use crate::{
     app::{
     app::{
         node::{
         node::{
-            create_button, create_chatedit, create_chatview, create_editbox, create_gesture,
-            create_image, create_layer, create_shortcut, create_text, create_vector_art,
+            create_image, create_layer, create_shortcut, create_vector_art,
         },
         },
-        populate_tree, App,
+        App,
     },
     },
-    error::Error,
-    expr::{self, Compiler, Op},
-    gfx::{GraphicsEventPublisherPtr, Rectangle, RenderApi, Vertex},
-    mesh::{Color, MeshBuilder},
+    expr::{self, Compiler},
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
-        PropertyType, Role,
+        PropertyAtomicGuard, Role,
     },
     },
     scene::{SceneNodePtr, Slot},
     scene::{SceneNodePtr, Slot},
     shape,
     shape,
-    text::TextShaperPtr,
     ui::{
     ui::{
-        emoji_picker, Button, ChatEdit, ChatView, EditBox, Gesture, Image, Layer, ShapeVertex,
-        Shortcut, Text, VectorArt, VectorShape, Window,
+        emoji_picker, Image, Layer,
+        Shortcut, VectorArt, VectorShape,
     },
     },
-    ExecutorPtr,
 };
 };
 
 
 mod chat;
 mod chat;
 mod menu;
 mod menu;
-pub mod settings;
-pub mod test;
+//mod settings;
+//mod test;
 
 
-pub const COLOR_SCHEME: ColorScheme = ColorScheme::DarkMode;
-//pub const COLOR_SCHEME: ColorScheme = ColorScheme::PaperLight;
+const COLOR_SCHEME: ColorScheme = ColorScheme::DarkMode;
+//const COLOR_SCHEME: ColorScheme = ColorScheme::PaperLight;
 
 
+#[cfg(any(target_os = "android", feature = "emulate-android"))]
 mod android_ui_consts {
 mod android_ui_consts {
     pub const SETTINGS_ICON_SIZE: f32 = 140.;
     pub const SETTINGS_ICON_SIZE: f32 = 140.;
     pub const NETSTATUS_ICON_SIZE: f32 = 140.;
     pub const NETSTATUS_ICON_SIZE: f32 = 140.;
@@ -119,8 +113,6 @@ mod ui_consts {
     not(feature = "emulate-android")
     not(feature = "emulate-android")
 ))]
 ))]
 mod ui_consts {
 mod ui_consts {
-    pub const SETTINGS_ICON_SIZE: f32 = 60.;
-    pub const SETTINGS_LOGO_SCALE: f32 = 25.;
     pub const NETSTATUS_ICON_SIZE: f32 = 60.;
     pub const NETSTATUS_ICON_SIZE: f32 = 60.;
     pub const NETLOGO_SCALE: f32 = 25.;
     pub const NETLOGO_SCALE: f32 = 25.;
     pub const EMOJI_PICKER_ICON_SIZE: f32 = 40.;
     pub const EMOJI_PICKER_ICON_SIZE: f32 = 40.;
@@ -166,7 +158,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
             }
             }
 
 
             let atom = &mut PropertyAtomicGuard::new();
             let atom = &mut PropertyAtomicGuard::new();
-            window_scale2.set_property_f32(atom, Role::User, "value", scale);
+            window_scale2.set_property_f32(atom, Role::User, "value", scale).unwrap();
         }
         }
     });
     });
     app.tasks.lock().unwrap().push(listen_zoom);
     app.tasks.lock().unwrap().push(listen_zoom);
@@ -193,7 +185,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
             }
             }
 
 
             let atom = &mut PropertyAtomicGuard::new();
             let atom = &mut PropertyAtomicGuard::new();
-            window_scale2.set_property_f32(atom, Role::User, "value", scale);
+            window_scale2.set_property_f32(atom, Role::User, "value", scale).unwrap();
         }
         }
     });
     });
     app.tasks.lock().unwrap().push(listen_zoom);
     app.tasks.lock().unwrap().push(listen_zoom);
@@ -240,7 +232,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
         layer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
         layer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
         layer_node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
         layer_node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
         let layer_node =
         let layer_node =
-            layer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+            layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
         window.clone().link(layer_node.clone());
         window.clone().link(layer_node.clone());
 
 
         // Create a bg image
         // Create a bg image
@@ -253,8 +245,8 @@ pub async fn make(app: &App, window: SceneNodePtr) {
 
 
         // Image aspect ratio
         // Image aspect ratio
         //let R = 1.78;
         //let R = 1.78;
-        let R = 1.555;
-        cc.add_const_f32("R", R);
+        let r = 1.555;
+        cc.add_const_f32("R", r);
 
 
         let prop = node.get_property("uv").unwrap();
         let prop = node.get_property("uv").unwrap();
         prop.clone().set_f32(atom, Role::App, 0, 0.).unwrap();
         prop.clone().set_f32(atom, Role::App, 0, 0.).unwrap();
@@ -282,7 +274,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
 
 
         node.set_property_str(atom, Role::App, "path", BG_PATH).unwrap();
         node.set_property_str(atom, Role::App, "path", BG_PATH).unwrap();
         node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
         node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
-        let node = node.setup(|me| Image::new(me, app.render_api.clone(), app.ex.clone())).await;
+        let node = node.setup(|me| Image::new(me, app.render_api.clone())).await;
         layer_node.clone().link(node);
         layer_node.clone().link(node);
 
 
         // Create a bg mesh on top to fade the bg image
         // Create a bg mesh on top to fade the bg image
@@ -297,7 +289,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
         //let c = if LIGHTMODE { 1. } else { 0. };
         //let c = if LIGHTMODE { 1. } else { 0. };
         let c = 0.;
         let c = 0.;
         // Setup the pimpl
         // Setup the pimpl
-        let node_id = node.id;
         let mut shape = VectorShape::new();
         let mut shape = VectorShape::new();
         shape.add_filled_box(
         shape.add_filled_box(
             expr::const_f32(0.),
             expr::const_f32(0.),
@@ -307,7 +298,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
             [c, c, c, 0.3],
             [c, c, c, 0.3],
         );
         );
         let node = node
         let node = node
-            .setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone()))
+            .setup(|me| VectorArt::new(me, shape, app.render_api.clone()))
             .await;
             .await;
         layer_node.clone().link(node);
         layer_node.clone().link(node);
     } else if COLOR_SCHEME == ColorScheme::PaperLight {
     } else if COLOR_SCHEME == ColorScheme::PaperLight {
@@ -321,7 +312,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
 
 
         let c = 1.;
         let c = 1.;
         // Setup the pimpl
         // Setup the pimpl
-        let node_id = node.id;
         let mut shape = VectorShape::new();
         let mut shape = VectorShape::new();
         shape.add_filled_box(
         shape.add_filled_box(
             expr::const_f32(0.),
             expr::const_f32(0.),
@@ -331,7 +321,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
             [c, c, c, 0.3],
             [c, c, c, 0.3],
         );
         );
         let node = node
         let node = node
-            .setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone()))
+            .setup(|me| VectorArt::new(me, shape, app.render_api.clone()))
             .await;
             .await;
         window.clone().link(node);
         window.clone().link(node);
     }
     }
@@ -348,7 +338,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     netlayer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     netlayer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     netlayer_node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
     netlayer_node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
     let netlayer_node =
     let netlayer_node =
-        netlayer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        netlayer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     window.clone().link(netlayer_node.clone());
     window.clone().link(netlayer_node.clone());
 
 
     let node = create_vector_art("net0");
     let node = create_vector_art("net0");
@@ -363,7 +353,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     shape.join(shape::create_netlogo2([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo2([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     let net0_node =
     let net0_node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     netlayer_node.clone().link(net0_node);
     netlayer_node.clone().link(net0_node);
 
 
     let node = create_vector_art("net1");
     let node = create_vector_art("net1");
@@ -378,7 +368,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     shape.join(shape::create_netlogo2([0.49, 0.57, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo2([0.49, 0.57, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0.27, 0.4, 0.4, 1.]).scaled(NETLOGO_SCALE));
     let net1_node =
     let net1_node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     netlayer_node.clone().link(net1_node);
     netlayer_node.clone().link(net1_node);
 
 
     let node = create_vector_art("net2");
     let node = create_vector_art("net2");
@@ -393,7 +383,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     shape.join(shape::create_netlogo2([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo2([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     let net2_node =
     let net2_node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     netlayer_node.clone().link(net2_node);
     netlayer_node.clone().link(net2_node);
 
 
     let node = create_vector_art("net3");
     let node = create_vector_art("net3");
@@ -408,7 +398,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     shape.join(shape::create_netlogo2([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo2([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     shape.join(shape::create_netlogo3([0., 0.94, 1., 1.]).scaled(NETLOGO_SCALE));
     let net3_node =
     let net3_node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     netlayer_node.clone().link(net3_node);
     netlayer_node.clone().link(net3_node);
 
 
     // Navbar Settings Button
     // Navbar Settings Button
@@ -425,7 +415,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     settingslayer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     settingslayer_node.set_property_bool(atom, Role::App, "is_visible", true).unwrap();
     settingslayer_node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
     settingslayer_node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
     let settingslayer_node =
     let settingslayer_node =
-        settingslayer_node.setup(|me| Layer::new(me, app.render_api.clone(), app.ex.clone())).await;
+        settingslayer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     window.clone().link(settingslayer_node.clone());
     window.clone().link(settingslayer_node.clone());
 
 
     // Background
     // Background
@@ -439,7 +429,7 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
     node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
     let shape = shape::create_settings([0., 0.94, 1., 1.]).scaled(20.);
     let shape = shape::create_settings([0., 0.94, 1., 1.]).scaled(20.);
     let node =
     let node =
-        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone(), app.ex.clone())).await;
+        node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
     settingslayer_node.clone().link(node);
     settingslayer_node.clone().link(node);
 
 
     // Button
     // Button

+ 1 - 0
bin/app/src/app/schema/settings.rs

@@ -36,6 +36,7 @@ use std::{
     sync::{Arc, Mutex},
     sync::{Arc, Mutex},
 };
 };
 
 
+#[cfg(any(target_os = "android", feature = "emulate-android"))]
 mod android_ui_consts {
 mod android_ui_consts {
     pub const SETTING_LABEL_X: f32 = 40.;
     pub const SETTING_LABEL_X: f32 = 40.;
     pub const SETTING_LABEL_LINESPACE: f32 = 140.;
     pub const SETTING_LABEL_LINESPACE: f32 = 140.;

+ 7 - 17
bin/app/src/app/schema/test.rs

@@ -16,31 +16,23 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use sled_overlay::sled;
-
 use crate::{
 use crate::{
     app::{
     app::{
         node::{
         node::{
-            create_button, create_chatedit, create_chatview, create_editbox, create_image,
             create_layer, create_text, create_vector_art,
             create_layer, create_text, create_vector_art,
         },
         },
-        populate_tree, App,
+        App,
     },
     },
-    error::Error,
-    expr::{self, Compiler, Op},
-    gfx::{GraphicsEventPublisherPtr, Rectangle, RenderApi, Vertex},
-    mesh::{Color, MeshBuilder, COLOR_PURPLE},
+    expr,
+    mesh::COLOR_PURPLE,
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
-        PropertyType, Role,
+        PropertyAtomicGuard, PropertyFloat32, Role,
     },
     },
-    scene::{SceneNodePtr, Slot},
-    text::TextShaperPtr,
+    scene::SceneNodePtr,
     ui::{
     ui::{
-        Button, ChatEdit, ChatView, EditBox, Image, Layer, ShapeVertex, Text, VectorArt,
-        VectorShape, Window,
+        Layer, Text, VectorArt,
+        VectorShape,
     },
     },
-    ExecutorPtr,
 };
 };
 
 
 const LIGHTMODE: bool = false;
 const LIGHTMODE: bool = false;
@@ -70,8 +62,6 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     )
     )
     .unwrap();
     .unwrap();
 
 
-    let mut cc = Compiler::new();
-
     // Create a layer called view
     // Create a layer called view
     let layer_node = create_layer("view");
     let layer_node = create_layer("view");
     let prop = layer_node.get_property("rect").unwrap();
     let prop = layer_node.get_property("rect").unwrap();

+ 3 - 10
bin/app/src/expr/compile.rs

@@ -48,13 +48,6 @@ enum Token {
 }
 }
 
 
 impl Token {
 impl Token {
-    fn is_sub_expr(&self) -> bool {
-        match self {
-            Self::SubExpr(_) => true,
-            _ => false,
-        }
-    }
-
     fn flatten(self) -> Vec<Self> {
     fn flatten(self) -> Vec<Self> {
         match self {
         match self {
             Self::NestedExpr(tokens) => {
             Self::NestedExpr(tokens) => {
@@ -206,7 +199,7 @@ impl Compiler {
 /// Convert from infix to reverse polish notation
 /// Convert from infix to reverse polish notation
 fn to_rpn(tokens: Vec<Token>) -> Result<Vec<Token>> {
 fn to_rpn(tokens: Vec<Token>) -> Result<Vec<Token>> {
     //println!("to_rpn = {tokens:#?}");
     //println!("to_rpn = {tokens:#?}");
-    let mut out = Vec::new();
+    let mut out;
     let mut stack = Vec::new();
     let mut stack = Vec::new();
 
 
     // equals
     // equals
@@ -275,7 +268,7 @@ fn to_rpn(tokens: Vec<Token>) -> Result<Vec<Token>> {
                 // Did we finally reach the closing paren for this subexpr?
                 // Did we finally reach the closing paren for this subexpr?
                 if paren == 0 {
                 if paren == 0 {
                     let stack = std::mem::take(&mut stack);
                     let stack = std::mem::take(&mut stack);
-                    let mut rpn = to_rpn(stack)?;
+                    let rpn = to_rpn(stack)?;
                     out.push(Token::NestedExpr(Box::new(rpn)));
                     out.push(Token::NestedExpr(Box::new(rpn)));
                 } else {
                 } else {
                     stack.push(token);
                     stack.push(token);
@@ -318,7 +311,7 @@ fn to_rpn(tokens: Vec<Token>) -> Result<Vec<Token>> {
                 // Did we finally reach the closing paren for this subexpr?
                 // Did we finally reach the closing paren for this subexpr?
                 if paren == 0 {
                 if paren == 0 {
                     let stack = std::mem::take(&mut stack);
                     let stack = std::mem::take(&mut stack);
-                    let mut rpn = to_rpn(stack)?;
+                    let rpn = to_rpn(stack)?;
                     out.push(Token::SubExpr(Box::new(rpn)));
                     out.push(Token::SubExpr(Box::new(rpn)));
                 } else {
                 } else {
                     stack.push(token);
                     stack.push(token);

+ 8 - 27
bin/app/src/gfx/mod.rs

@@ -16,9 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use darkfi::system::CondVar;
 use darkfi_serial::{async_trait, Decodable, Encodable, SerialDecodable, SerialEncodable};
 use darkfi_serial::{async_trait, Decodable, Encodable, SerialDecodable, SerialEncodable};
-use futures::AsyncWriteExt;
 use log::debug;
 use log::debug;
 use miniquad::{
 use miniquad::{
     conf, window, Backend, Bindings, BlendFactor, BlendState, BlendValue, BufferLayout,
     conf, window, Backend, Bindings, BlendFactor, BlendState, BlendValue, BufferLayout,
@@ -32,9 +30,8 @@ use std::{
     path::PathBuf,
     path::PathBuf,
     sync::{
     sync::{
         atomic::{AtomicU32, Ordering},
         atomic::{AtomicU32, Ordering},
-        mpsc, Arc, Mutex as SyncMutex,
+        Arc,
     },
     },
-    time::{Duration, Instant},
 };
 };
 
 
 mod favico;
 mod favico;
@@ -43,10 +40,7 @@ pub use linalg::{Dimension, Point, Rectangle};
 mod shader;
 mod shader;
 
 
 use crate::{
 use crate::{
-    app::AppPtr,
     error::{Error, Result},
     error::{Error, Result},
-    pubsub::{Publisher, PublisherPtr, Subscription, SubscriptionId},
-    util::{ansi_texture, AsyncRuntime},
     GOD,
     GOD,
 };
 };
 
 
@@ -65,10 +59,7 @@ pub use crate::gfxtag;
 pub type DebugTag = Option<&'static str>;
 pub type DebugTag = Option<&'static str>;
 
 
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "gfx", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "gfx", $($arg)*); } }
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "gfx", $($arg)*); } }
-macro_rules! i { ($($arg:tt)*) => { info!(target: "gfx", $($arg)*); } }
 macro_rules! e { ($($arg:tt)*) => { error!(target: "gfx", $($arg)*); } }
 macro_rules! e { ($($arg:tt)*) => { error!(target: "gfx", $($arg)*); } }
-macro_rules! w { ($($arg:tt)*) => { warn!(target: "gfx", $($arg)*); } }
 
 
 #[cfg(target_os = "android")]
 #[cfg(target_os = "android")]
 pub fn get_window_size_filename() -> PathBuf {
 pub fn get_window_size_filename() -> PathBuf {
@@ -268,7 +259,7 @@ impl GfxDrawMesh {
     ) -> Option<DrawMesh> {
     ) -> Option<DrawMesh> {
         let vertex_buffer_id = self.vertex_buffer.id;
         let vertex_buffer_id = self.vertex_buffer.id;
         let index_buffer_id = self.index_buffer.id;
         let index_buffer_id = self.index_buffer.id;
-        let buffers_keep_alive = [self.vertex_buffer, self.index_buffer];
+        let _buffers_keep_alive = [self.vertex_buffer, self.index_buffer];
         let texture = match self.texture {
         let texture = match self.texture {
             Some(gfx_texture) => Self::try_get_texture(textures, gfx_texture, debug_str),
             Some(gfx_texture) => Self::try_get_texture(textures, gfx_texture, debug_str),
             None => None,
             None => None,
@@ -276,7 +267,7 @@ impl GfxDrawMesh {
         Some(DrawMesh {
         Some(DrawMesh {
             vertex_buffer: Self::try_get_buffer(buffers, vertex_buffer_id, debug_str)?,
             vertex_buffer: Self::try_get_buffer(buffers, vertex_buffer_id, debug_str)?,
             index_buffer: Self::try_get_buffer(buffers, index_buffer_id, debug_str)?,
             index_buffer: Self::try_get_buffer(buffers, index_buffer_id, debug_str)?,
-            buffers_keep_alive,
+            _buffers_keep_alive,
             texture,
             texture,
             num_elements: self.num_elements,
             num_elements: self.num_elements,
         })
         })
@@ -289,15 +280,14 @@ impl GfxDrawMesh {
     ) -> Option<(ManagedTexturePtr, miniquad::TextureId)> {
     ) -> Option<(ManagedTexturePtr, miniquad::TextureId)> {
         let gfx_texture_id = gfx_texture.id;
         let gfx_texture_id = gfx_texture.id;
 
 
-        let Some(mq_texture_id) = textures.get(&gfx_texture_id) else {
+        let Some(_mq_texture_id) = textures.get(&gfx_texture_id) else {
             error!(target: "gfx", "Serious error: missing texture ID={gfx_texture_id}, debug={debug_str}");
             error!(target: "gfx", "Serious error: missing texture ID={gfx_texture_id}, debug={debug_str}");
             error!(target: "gfx", "Dumping textures:");
             error!(target: "gfx", "Dumping textures:");
             for (gfx_texture_id, texture_id) in textures {
             for (gfx_texture_id, texture_id) in textures {
                 error!(target: "gfx", "{gfx_texture_id} => {texture_id:?}");
                 error!(target: "gfx", "{gfx_texture_id} => {texture_id:?}");
             }
             }
 
 
-            panic!("Missing texture ID={gfx_texture_id}");
-            return None
+            panic!("Missing texture ID={gfx_texture_id}")
         };
         };
 
 
         Some((gfx_texture, textures[&gfx_texture_id]))
         Some((gfx_texture, textures[&gfx_texture_id]))
@@ -315,8 +305,7 @@ impl GfxDrawMesh {
                 error!(target: "gfx", "{gfx_buffer_id} => {buffer_id:?}");
                 error!(target: "gfx", "{gfx_buffer_id} => {buffer_id:?}");
             }
             }
 
 
-            panic!("Missing buffer ID={gfx_buffer_id}");
-            return None
+            panic!("Missing buffer ID={gfx_buffer_id}")
         };
         };
         Some(*mq_buffer_id)
         Some(*mq_buffer_id)
     }
     }
@@ -395,7 +384,7 @@ struct DrawMesh {
     vertex_buffer: miniquad::BufferId,
     vertex_buffer: miniquad::BufferId,
     index_buffer: miniquad::BufferId,
     index_buffer: miniquad::BufferId,
     /// Keeps the buffers alive for the duration of this draw call
     /// Keeps the buffers alive for the duration of this draw call
-    buffers_keep_alive: [ManagedBufferPtr; 2],
+    _buffers_keep_alive: [ManagedBufferPtr; 2],
     texture: Option<(ManagedTexturePtr, miniquad::TextureId)>,
     texture: Option<(ManagedTexturePtr, miniquad::TextureId)>,
     num_elements: i32,
     num_elements: i32,
 }
 }
@@ -434,7 +423,6 @@ impl<'a> RenderContext<'a> {
         if DEBUG_RENDER {
         if DEBUG_RENDER {
             debug!(target: "gfx", "RenderContext::draw()");
             debug!(target: "gfx", "RenderContext::draw()");
         }
         }
-        let curr_pos = Point::zero();
         self.draw_call(&self.draw_calls[&0], 0, DEBUG_RENDER);
         self.draw_call(&self.draw_calls[&0], 0, DEBUG_RENDER);
         if DEBUG_RENDER {
         if DEBUG_RENDER {
             debug!(target: "gfx", "RenderContext::draw() [DONE]");
             debug!(target: "gfx", "RenderContext::draw() [DONE]");
@@ -480,7 +468,7 @@ impl<'a> RenderContext<'a> {
     }
     }
 
 
     fn draw_call(&mut self, draw_call: &DrawCall, mut indent: u32, mut is_debug: bool) {
     fn draw_call(&mut self, draw_call: &DrawCall, mut indent: u32, mut is_debug: bool) {
-        let mut ws = if is_debug { " ".repeat(indent as usize * 4) } else { String::new() };
+        let ws = if is_debug { " ".repeat(indent as usize * 4) } else { String::new() };
 
 
         let old_scale = self.scale;
         let old_scale = self.scale;
         let old_view = self.view;
         let old_view = self.view;
@@ -761,7 +749,6 @@ impl Stage {
         god.start_app(epoch);
         god.start_app(epoch);
         let method_rep = god.method_rep.clone();
         let method_rep = god.method_rep.clone();
         let event_pub = god.event_pub.clone();
         let event_pub = god.event_pub.clone();
-        drop(god);
 
 
         let white_texture = ctx.new_texture_from_rgba8(1, 1, &[255, 255, 255, 255]);
         let white_texture = ctx.new_texture_from_rgba8(1, 1, &[255, 255, 255, 255]);
 
 
@@ -820,12 +807,6 @@ impl Stage {
         }
         }
     }
     }
 
 
-    fn clear(&mut self) {
-        std::mem::take(&mut self.draw_calls);
-        std::mem::take(&mut self.textures);
-        std::mem::take(&mut self.buffers);
-    }
-
     fn process_method(&mut self, mut method: GraphicsMethod) {
     fn process_method(&mut self, mut method: GraphicsMethod) {
         //debug!(target: "gfx", "Received method: {:?}", method);
         //debug!(target: "gfx", "Received method: {:?}", method);
         let res = match &mut method {
         let res = match &mut method {

+ 12 - 7
bin/app/src/logger.rs

@@ -16,15 +16,20 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use file_rotate::{compression::Compression, suffix::AppendCount, ContentLimit, FileRotate};
-use log::{Level, LevelFilter, Log, Metadata, Record};
+use log::{LevelFilter, Log, Metadata, Record};
 use simplelog::{
 use simplelog::{
     ColorChoice, CombinedLogger, Config, ConfigBuilder, SharedLogger, TermLogger, TerminalMode,
     ColorChoice, CombinedLogger, Config, ConfigBuilder, SharedLogger, TermLogger, TerminalMode,
-    WriteLogger,
 };
 };
-use std::{path::PathBuf, thread::sleep, time::Duration};
+
+#[cfg(feature = "enable-filelog")]
+use {
+    file_rotate::{compression::Compression, suffix::AppendCount, ContentLimit, FileRotate},
+    simplelog::WriteLogger,
+    std::{path::PathBuf, thread::sleep, time::Duration}
+};
 
 
 // Measured in bytes
 // Measured in bytes
+#[cfg(feature = "enable-filelog")]
 const LOGFILE_MAXSIZE: usize = 5_000_000;
 const LOGFILE_MAXSIZE: usize = 5_000_000;
 
 
 static MUTED_TARGETS: &[&'static str] = &[
 static MUTED_TARGETS: &[&'static str] = &[
@@ -47,13 +52,13 @@ static MUTED_TARGETS: &[&'static str] = &[
 
 
 static ALLOW_TRACE: &[&'static str] = &["ui", "app", "gfx"];
 static ALLOW_TRACE: &[&'static str] = &["ui", "app", "gfx"];
 
 
-#[cfg(target_os = "android")]
+#[cfg(all(target_os = "android", feature = "enable-filelog"))]
 fn logfile_path() -> PathBuf {
 fn logfile_path() -> PathBuf {
     use crate::android::get_external_storage_path;
     use crate::android::get_external_storage_path;
     get_external_storage_path().join("darkfi-app.log")
     get_external_storage_path().join("darkfi-app.log")
 }
 }
 
 
-#[cfg(not(target_os = "android"))]
+#[cfg(all(not(target_os = "android"), feature = "enable-filelog"))]
 fn logfile_path() -> PathBuf {
 fn logfile_path() -> PathBuf {
     dirs::cache_dir().unwrap().join("darkfi/darkfi-app.log")
     dirs::cache_dir().unwrap().join("darkfi/darkfi-app.log")
 }
 }
@@ -130,7 +135,7 @@ mod desktop {
     }
     }
 
 
     impl CustomTermLogger {
     impl CustomTermLogger {
-        pub fn new(level: LevelFilter, cfg: Config) -> Box<Self> {
+        pub fn new(_level: LevelFilter, cfg: Config) -> Box<Self> {
             let logger =
             let logger =
                 TermLogger::new(LevelFilter::Trace, cfg, TerminalMode::Mixed, ColorChoice::Auto);
                 TermLogger::new(LevelFilter::Trace, cfg, TerminalMode::Mixed, ColorChoice::Auto);
             Box::new(Self { logger: *logger })
             Box::new(Self { logger: *logger })

+ 28 - 30
bin/app/src/main.rs

@@ -16,18 +16,8 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-// Use these to incrementally fix warnings with cargo fix
-#![allow(warnings, unused)]
-//#![deny(unused_imports)]
-
-use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock};
 use darkfi::system::CondVar;
 use darkfi::system::CondVar;
-use darkfi_serial::{deserialize, Decodable, Encodable};
-use file_rotate::{compression::Compression, suffix::AppendCount, ContentLimit, FileRotate};
-use std::{
-    io::Cursor,
-    sync::{mpsc, Arc, OnceLock},
-};
+use std::sync::{Arc, OnceLock};
 
 
 #[macro_use]
 #[macro_use]
 extern crate log;
 extern crate log;
@@ -53,12 +43,13 @@ mod expr;
 mod gfx;
 mod gfx;
 mod logger;
 mod logger;
 mod mesh;
 mod mesh;
+#[cfg(feature = "enable-netdebug")]
 mod net;
 mod net;
 mod plugin;
 mod plugin;
 mod prop;
 mod prop;
 mod pubsub;
 mod pubsub;
 //mod py;
 //mod py;
-mod ringbuf;
+//mod ringbuf;
 mod scene;
 mod scene;
 mod shape;
 mod shape;
 mod text;
 mod text;
@@ -69,25 +60,32 @@ mod util;
 use crate::{
 use crate::{
     app::{App, AppPtr},
     app::{App, AppPtr},
     gfx::EpochIndex,
     gfx::EpochIndex,
-    net::ZeroMQAdapter,
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyBool, PropertyStr, PropertySubType, PropertyType,
-        Role,
+        Property, PropertySubType, PropertyType,
     },
     },
-    scene::{CallArgType, SceneNode, SceneNodePtr, SceneNodeType, Slot},
+    scene::{CallArgType, SceneNode, SceneNodeType},
     text::TextShaper,
     text::TextShaper,
-    ui::chatview,
     util::AsyncRuntime,
     util::AsyncRuntime,
 };
 };
+#[cfg(feature = "enable-plugins")]
+use {
+    scene::{SceneNodePtr, Slot},
+    prop::{PropertyStr, Role, PropertyAtomicGuard, PropertyBool},
+    ui::chatview,
+    std::io::Cursor,
+    darkfi_serial::{Encodable, Decodable, deserialize},
+};
+#[cfg(feature = "enable-netdebug")]
+use net::ZeroMQAdapter;
 
 
 // This is historical, but ideally we can fix the entire project and remove this import.
 // This is historical, but ideally we can fix the entire project and remove this import.
 pub use util::ExecutorPtr;
 pub use util::ExecutorPtr;
 
 
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "main", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "main", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "main", $($arg)*); } }
-macro_rules! i { ($($arg:tt)*) => { info!(target: "main", $($arg)*); } }
-macro_rules! w { ($($arg:tt)*) => { warn!(target: "main", $($arg)*); } }
-macro_rules! e { ($($arg:tt)*) => { error!(target: "main", $($arg)*); } }
+#[cfg(feature = "enable-plugins")]
+macro_rules! d { ($($arg:tt)*) => { trace!(target: "main", $($arg)*); } }
+#[cfg(feature = "enable-plugins")]
+macro_rules! i { ($($arg:tt)*) => { trace!(target: "main", $($arg)*); } }
 
 
 // Hides the cmd.exe terminal on Windows.
 // Hides the cmd.exe terminal on Windows.
 // Enable this when making release builds.
 // Enable this when making release builds.
@@ -103,11 +101,11 @@ fn panic_hook(panic_info: &std::panic::PanicHookInfo) {
 /// running a foreground service. Everytime the UI restarts main() is called again.
 /// running a foreground service. Everytime the UI restarts main() is called again.
 /// However the global state remains intact.
 /// However the global state remains intact.
 struct God {
 struct God {
-    bg_runtime: AsyncRuntime,
-    bg_ex: ExecutorPtr,
+    _bg_runtime: AsyncRuntime,
+    _bg_ex: ExecutorPtr,
 
 
     fg_runtime: AsyncRuntime,
     fg_runtime: AsyncRuntime,
-    fg_ex: ExecutorPtr,
+    _fg_ex: ExecutorPtr,
 
 
     /// App must fully finish setup() before start() is allowed to begin.
     /// App must fully finish setup() before start() is allowed to begin.
     cv_app_is_setup: Arc<CondVar>,
     cv_app_is_setup: Arc<CondVar>,
@@ -145,7 +143,7 @@ impl God {
 
 
         let exe_path = std::env::current_exe().unwrap();
         let exe_path = std::env::current_exe().unwrap();
         let basename = exe_path.parent().unwrap();
         let basename = exe_path.parent().unwrap();
-        std::env::set_current_dir(basename);
+        std::env::set_current_dir(basename).unwrap();
 
 
         let bg_ex = Arc::new(smol::Executor::new());
         let bg_ex = Arc::new(smol::Executor::new());
         let fg_ex = Arc::new(smol::Executor::new());
         let fg_ex = Arc::new(smol::Executor::new());
@@ -181,7 +179,7 @@ impl God {
         let cv_app_is_setup = Arc::new(CondVar::new());
         let cv_app_is_setup = Arc::new(CondVar::new());
         let cv = cv_app_is_setup.clone();
         let cv = cv_app_is_setup.clone();
         let app_task = fg_ex.spawn(async move {
         let app_task = fg_ex.spawn(async move {
-            app2.setup().await;
+            app2.setup().await.unwrap();
             cv.notify();
             cv.notify();
         });
         });
         fg_runtime.push_task(app_task);
         fg_runtime.push_task(app_task);
@@ -200,11 +198,11 @@ impl God {
         warn!(target: "main", "Plugins are disabled in this build");
         warn!(target: "main", "Plugins are disabled in this build");
 
 
         Self {
         Self {
-            bg_runtime,
-            bg_ex,
+            _bg_runtime: bg_runtime,
+            _bg_ex: bg_ex,
 
 
             fg_runtime,
             fg_runtime,
-            fg_ex,
+            _fg_ex: fg_ex,
             cv_app_is_setup,
             cv_app_is_setup,
             app,
             app,
 
 
@@ -260,7 +258,7 @@ impl std::fmt::Debug for God {
     }
     }
 }
 }
 
 
-pub static GOD: OnceLock<God> = OnceLock::new();
+static GOD: OnceLock<God> = OnceLock::new();
 
 
 #[cfg(feature = "enable-plugins")]
 #[cfg(feature = "enable-plugins")]
 async fn load_plugins(ex: ExecutorPtr, sg_root: SceneNodePtr, cv: Arc<CondVar>) {
 async fn load_plugins(ex: ExecutorPtr, sg_root: SceneNodePtr, cv: Arc<CondVar>) {

+ 11 - 14
bin/app/src/mesh.rs

@@ -16,13 +16,10 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use crate::{
-    error::Result,
-    gfx::{
+use crate::gfx::{
         DebugTag, GfxDrawMesh, ManagedBufferPtr, ManagedTexturePtr, Point, Rectangle, RenderApi,
         DebugTag, GfxDrawMesh, ManagedBufferPtr, ManagedTexturePtr, Point, Rectangle, RenderApi,
         Vertex,
         Vertex,
-    },
-};
+    };
 
 
 pub type Color = [f32; 4];
 pub type Color = [f32; 4];
 
 
@@ -32,9 +29,11 @@ pub const COLOR_RED: Color = [1., 0., 0., 1.];
 pub const COLOR_DARKGREY: Color = [0.2, 0.2, 0.2, 1.];
 pub const COLOR_DARKGREY: Color = [0.2, 0.2, 0.2, 1.];
 #[allow(dead_code)]
 #[allow(dead_code)]
 pub const COLOR_LIGHTGREY: Color = [0.7, 0.7, 0.7, 1.];
 pub const COLOR_LIGHTGREY: Color = [0.7, 0.7, 0.7, 1.];
+#[allow(dead_code)]
 pub const COLOR_GREEN: Color = [0., 1., 0., 1.];
 pub const COLOR_GREEN: Color = [0., 1., 0., 1.];
 pub const COLOR_BLUE: Color = [0., 0., 1., 1.];
 pub const COLOR_BLUE: Color = [0., 0., 1., 1.];
 pub const COLOR_PINK: Color = [0.8, 0.3, 0.8, 1.];
 pub const COLOR_PINK: Color = [0.8, 0.3, 0.8, 1.];
+#[allow(dead_code)]
 pub const COLOR_PURPLE: Color = [1., 0., 1., 1.];
 pub const COLOR_PURPLE: Color = [1., 0., 1., 1.];
 pub const COLOR_WHITE: Color = [1., 1., 1., 1.];
 pub const COLOR_WHITE: Color = [1., 1., 1., 1.];
 #[allow(dead_code)]
 #[allow(dead_code)]
@@ -70,6 +69,7 @@ impl MeshInfo {
     }
     }
 }
 }
 
 
+// TODO: remove clipper => simplify impl
 pub struct MeshBuilder {
 pub struct MeshBuilder {
     pub verts: Vec<Vertex>,
     pub verts: Vec<Vertex>,
     pub indices: Vec<u16>,
     pub indices: Vec<u16>,
@@ -81,9 +81,6 @@ impl MeshBuilder {
     pub fn new(tag: DebugTag) -> Self {
     pub fn new(tag: DebugTag) -> Self {
         Self { verts: vec![], indices: vec![], clipper: None, tag }
         Self { verts: vec![], indices: vec![], clipper: None, tag }
     }
     }
-    pub fn with_clip(tag: DebugTag, clipper: Rectangle) -> Self {
-        Self { verts: vec![], indices: vec![], clipper: Some(clipper), tag }
-    }
 
 
     pub fn append(&mut self, mut verts: Vec<Vertex>, indices: Vec<u16>) {
     pub fn append(&mut self, mut verts: Vec<Vertex>, indices: Vec<u16>) {
         let mut indices = indices.into_iter().map(|i| i + self.verts.len() as u16).collect();
         let mut indices = indices.into_iter().map(|i| i + self.verts.len() as u16).collect();
@@ -100,11 +97,11 @@ impl MeshBuilder {
             None => obj.clone(),
             None => obj.clone(),
         };
         };
 
 
-        let (x1, y1) = clipped.top_left().unpack();
-        let (x2, y2) = clipped.bottom_right().unpack();
+        let (x1, y1) = clipped.pos().unpack();
+        let (x2, y2) = clipped.corner().unpack();
 
 
-        let (u1, v1) = uv.top_left().unpack();
-        let (u2, v2) = uv.bottom_right().unpack();
+        let (u1, v1) = uv.pos().unpack();
+        let (u2, v2) = uv.corner().unpack();
 
 
         // Interpolate UV coords
         // Interpolate UV coords
 
 
@@ -144,9 +141,9 @@ impl MeshBuilder {
     }
     }
 
 
     pub fn draw_outline(&mut self, obj: &Rectangle, color: Color, thickness: f32) {
     pub fn draw_outline(&mut self, obj: &Rectangle, color: Color, thickness: f32) {
-        let (x1, y1) = obj.top_left().unpack();
+        let (x1, y1) = obj.pos().unpack();
         let (dist_x, dist_y) = (obj.w, obj.h);
         let (dist_x, dist_y) = (obj.w, obj.h);
-        let (x2, y2) = obj.bottom_right().unpack();
+        let (x2, y2) = obj.corner().unpack();
 
 
         // top
         // top
         self.draw_filled_box(&Rectangle::new(x1, y1, dist_x, thickness), color);
         self.draw_filled_box(&Rectangle::new(x1, y1, dist_x, thickness), color);

+ 2 - 2
bin/app/src/net.rs

@@ -20,14 +20,14 @@ use async_lock::Mutex;
 use darkfi_serial::{async_trait, deserialize, Decodable, Encodable, SerialDecodable, VarInt};
 use darkfi_serial::{async_trait, deserialize, Decodable, Encodable, SerialDecodable, VarInt};
 use std::{
 use std::{
     io::Cursor,
     io::Cursor,
-    sync::{mpsc, Arc},
+    sync::Arc
 };
 };
 use zeromq::{Socket, SocketRecv, SocketSend};
 use zeromq::{Socket, SocketRecv, SocketSend};
 
 
 use crate::{
 use crate::{
     error::{Error, Result},
     error::{Error, Result},
     expr::SExprCode,
     expr::SExprCode,
-    prop::{Property, PropertyAtomicGuard, PropertySubType, PropertyType, PropertyValue, Role},
+    prop::{PropertyAtomicGuard, PropertyType, Role},
     scene::{SceneNodeId, SceneNodePtr, ScenePath},
     scene::{SceneNodeId, SceneNodePtr, ScenePath},
     ExecutorPtr,
     ExecutorPtr,
 };
 };

+ 3 - 5
bin/app/src/plugin/darkirc.rs

@@ -40,8 +40,8 @@ use std::{
 
 
 use crate::{
 use crate::{
     error::{Error, Result},
     error::{Error, Result},
-    prop::{PropertyAtomicGuard, PropertyPtr, PropertyStr, PropertyType, PropertyValue, Role},
-    scene::{MethodCallSub, Pimpl, SceneNode, SceneNodePtr, SceneNodeType, SceneNodeWeak},
+    prop::{PropertyAtomicGuard, PropertyStr, Role},
+    scene::{MethodCallSub, Pimpl, SceneNode, SceneNodeType, SceneNodeWeak},
     ui::{
     ui::{
         chatview::{MessageId, Timestamp},
         chatview::{MessageId, Timestamp},
         OnModify,
         OnModify,
@@ -171,7 +171,6 @@ pub struct DarkIrc {
 
 
     p2p: P2pPtr,
     p2p: P2pPtr,
     event_graph: EventGraphPtr,
     event_graph: EventGraphPtr,
-    db: sled::Db,
 
 
     seen_msgs: SyncMutex<SeenMessages>,
     seen_msgs: SyncMutex<SeenMessages>,
     nick: PropertyStr,
     nick: PropertyStr,
@@ -274,7 +273,6 @@ impl DarkIrc {
 
 
             p2p,
             p2p,
             event_graph,
             event_graph,
-            db,
 
 
             seen_msgs: SyncMutex::new(SeenMessages::new()),
             seen_msgs: SyncMutex::new(SeenMessages::new()),
             nick,
             nick,
@@ -546,6 +544,6 @@ impl DarkIrc {
 
 
         let mut tasks = vec![send_method_task, ev_task, dag_task];
         let mut tasks = vec![send_method_task, ev_task, dag_task];
         tasks.append(&mut on_modify.tasks);
         tasks.append(&mut on_modify.tasks);
-        self.tasks.set(tasks);
+        self.tasks.set(tasks).unwrap();
     }
     }
 }
 }

+ 21 - 24
bin/app/src/plugin/mod.rs

@@ -16,10 +16,9 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use async_trait::async_trait;
-use std::sync::Arc;
-
-use crate::ExecutorPtr;
+use std::{sync::Arc,
+array::TryFromSliceError, string::FromUtf8Error};
+use sled_overlay::sled;
 
 
 pub mod darkirc;
 pub mod darkirc;
 pub use darkirc::{DarkIrc, DarkIrcPtr};
 pub use darkirc::{DarkIrc, DarkIrcPtr};
@@ -28,13 +27,11 @@ use darkfi::net::Settings as NetSettings;
 
 
 use crate::{
 use crate::{
     prop::{
     prop::{
-        Property, PropertyAtomicGuard, PropertyPtr, PropertyStr, PropertySubType, PropertyType,
+        Property, PropertyAtomicGuard, PropertySubType, PropertyType,
         PropertyValue, Role,
         PropertyValue, Role,
     },
     },
-    scene::{MethodCallSub, Pimpl, SceneNode, SceneNodePtr, SceneNodeType, SceneNodeWeak},
+    scene::{SceneNode, SceneNodePtr, SceneNodeType},
 };
 };
-use sled_overlay::sled;
-use std::{array::TryFromSliceError, string::FromUtf8Error};
 
 
 pub struct PluginSettings {
 pub struct PluginSettings {
     pub setting_root: SceneNodePtr,
     pub setting_root: SceneNodePtr,
@@ -50,8 +47,8 @@ impl PluginSettings {
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
                 let prop = Property::new("default", PropertyType::Bool, PropertySubType::Null);
                 let prop = Property::new("default", PropertyType::Bool, PropertySubType::Null);
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
-                node.set_property_bool(atom, Role::User, "value", b.clone());
-                node.set_property_bool(atom, Role::App, "default", b.clone());
+                node.set_property_bool(atom, Role::User, "value", b.clone()).unwrap();
+                node.set_property_bool(atom, Role::App, "default", b.clone()).unwrap();
                 Some(node)
                 Some(node)
             }
             }
             PropertyValue::Uint32(u) => {
             PropertyValue::Uint32(u) => {
@@ -60,8 +57,8 @@ impl PluginSettings {
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
                 let prop = Property::new("default", PropertyType::Uint32, PropertySubType::Null);
                 let prop = Property::new("default", PropertyType::Uint32, PropertySubType::Null);
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
-                node.set_property_u32(atom, Role::User, "value", u.clone());
-                node.set_property_u32(atom, Role::App, "default", u.clone());
+                node.set_property_u32(atom, Role::User, "value", u.clone()).unwrap();
+                node.set_property_u32(atom, Role::App, "default", u.clone()).unwrap();
                 Some(node)
                 Some(node)
             }
             }
             PropertyValue::Float32(f) => {
             PropertyValue::Float32(f) => {
@@ -70,8 +67,8 @@ impl PluginSettings {
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
                 let prop = Property::new("default", PropertyType::Float32, PropertySubType::Null);
                 let prop = Property::new("default", PropertyType::Float32, PropertySubType::Null);
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
-                node.set_property_f32(atom, Role::User, "value", f.clone());
-                node.set_property_f32(atom, Role::App, "default", f.clone());
+                node.set_property_f32(atom, Role::User, "value", f.clone()).unwrap();
+                node.set_property_f32(atom, Role::App, "default", f.clone()).unwrap();
                 Some(node)
                 Some(node)
             }
             }
             PropertyValue::Str(s) => {
             PropertyValue::Str(s) => {
@@ -80,8 +77,8 @@ impl PluginSettings {
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
                 let prop = Property::new("default", PropertyType::Str, PropertySubType::Null);
                 let prop = Property::new("default", PropertyType::Str, PropertySubType::Null);
                 node.add_property(prop).unwrap();
                 node.add_property(prop).unwrap();
-                node.set_property_str(atom, Role::User, "value", s.clone());
-                node.set_property_str(atom, Role::App, "default", s.clone());
+                node.set_property_str(atom, Role::User, "value", s.clone()).unwrap();
+                node.set_property_str(atom, Role::App, "default", s.clone()).unwrap();
                 Some(node)
                 Some(node)
             }
             }
             _ => None,
             _ => None,
@@ -115,7 +112,7 @@ impl PluginSettings {
                             Role::User,
                             Role::User,
                             "value",
                             "value",
                             sled_value[0] != 0,
                             sled_value[0] != 0,
-                        );
+                        ).unwrap();
                     }
                     }
                 }
                 }
                 PropertyType::Uint32 => {
                 PropertyType::Uint32 => {
@@ -130,7 +127,7 @@ impl PluginSettings {
                                     Role::User,
                                     Role::User,
                                     "value",
                                     "value",
                                     u32::from_le_bytes(b),
                                     u32::from_le_bytes(b),
-                                );
+                                ).unwrap();
                             }
                             }
                         }
                         }
                     }
                     }
@@ -147,7 +144,7 @@ impl PluginSettings {
                                     Role::User,
                                     Role::User,
                                     "value",
                                     "value",
                                     f32::from_le_bytes(b),
                                     f32::from_le_bytes(b),
-                                );
+                                ).unwrap();
                             }
                             }
                         }
                         }
                     }
                     }
@@ -158,7 +155,7 @@ impl PluginSettings {
                         let string: Result<String, FromUtf8Error> =
                         let string: Result<String, FromUtf8Error> =
                             String::from_utf8(sled_value.to_vec());
                             String::from_utf8(sled_value.to_vec());
                         if let Ok(s) = string {
                         if let Ok(s) = string {
-                            setting_node.set_property_str(atom, Role::User, "value", s);
+                            setting_node.set_property_str(atom, Role::User, "value", s).unwrap();
                         }
                         }
                     }
                     }
                 }
                 }
@@ -179,25 +176,25 @@ impl PluginSettings {
                 PropertyType::Bool => {
                 PropertyType::Bool => {
                     let value_bytes = if value.get_bool(0).unwrap() { 1u8 } else { 0u8 };
                     let value_bytes = if value.get_bool(0).unwrap() { 1u8 } else { 0u8 };
                     self.sled_tree
                     self.sled_tree
-                        .insert(setting_node.name.as_str(), sled::IVec::from(vec![value_bytes]));
+                        .insert(setting_node.name.as_str(), sled::IVec::from(vec![value_bytes])).unwrap();
                 }
                 }
                 PropertyType::Uint32 => {
                 PropertyType::Uint32 => {
                     self.sled_tree.insert(
                     self.sled_tree.insert(
                         setting_node.name.as_str(),
                         setting_node.name.as_str(),
                         sled::IVec::from(value.get_u32(0).unwrap().to_le_bytes().as_ref()),
                         sled::IVec::from(value.get_u32(0).unwrap().to_le_bytes().as_ref()),
-                    );
+                    ).unwrap();
                 }
                 }
                 PropertyType::Float32 => {
                 PropertyType::Float32 => {
                     self.sled_tree.insert(
                     self.sled_tree.insert(
                         setting_node.name.as_str(),
                         setting_node.name.as_str(),
                         sled::IVec::from(value.get_f32(0).unwrap().to_le_bytes().as_ref()),
                         sled::IVec::from(value.get_f32(0).unwrap().to_le_bytes().as_ref()),
-                    );
+                    ).unwrap();
                 }
                 }
                 PropertyType::Str => {
                 PropertyType::Str => {
                     self.sled_tree.insert(
                     self.sled_tree.insert(
                         setting_node.name.as_str(),
                         setting_node.name.as_str(),
                         sled::IVec::from(value.get_str(0).unwrap().as_bytes()),
                         sled::IVec::from(value.get_str(0).unwrap().as_bytes()),
-                    );
+                    ).unwrap();
                 }
                 }
                 _ => {}
                 _ => {}
             }
             }

+ 1 - 3
bin/app/src/prop/guard.rs

@@ -16,9 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use super::{ModifyAction, ModifyPublisher, PropertyPtr, Role};
-
-macro_rules! t { ($($arg:tt)*) => { trace!(target: "prop", $($arg)*); } }
+use super::{ModifyAction, PropertyPtr, Role};
 
 
 /// This schedules all property updates to happen at the end of the scope.
 /// This schedules all property updates to happen at the end of the scope.
 /// We can therefore have fine-grained control about when property updates are
 /// We can therefore have fine-grained control about when property updates are

+ 13 - 14
bin/app/src/prop/mod.rs

@@ -20,7 +20,6 @@ use crate::error::{Error, Result};
 use darkfi_serial::{async_trait, Encodable, FutAsyncWriteExt, SerialDecodable, SerialEncodable};
 use darkfi_serial::{async_trait, Encodable, FutAsyncWriteExt, SerialDecodable, SerialEncodable};
 use std::{
 use std::{
     io::Write,
     io::Write,
-    ops::Range,
     sync::{Arc, Mutex as SyncMutex, Weak},
     sync::{Arc, Mutex as SyncMutex, Weak},
 };
 };
 
 
@@ -34,7 +33,7 @@ mod guard;
 pub use guard::PropertyAtomicGuard;
 pub use guard::PropertyAtomicGuard;
 mod wrap;
 mod wrap;
 pub use wrap::{
 pub use wrap::{
-    PropertyBool, PropertyColor, PropertyDimension, PropertyFloat32, PropertyPoint, PropertyRect,
+    PropertyBool, PropertyColor, PropertyDimension, PropertyFloat32, PropertyRect,
     PropertyStr, PropertyUint32,
     PropertyStr, PropertyUint32,
 };
 };
 
 
@@ -371,7 +370,7 @@ impl Property {
         self.on_modify.notify((role, ModifyAction::Clear));
         self.on_modify.notify((role, ModifyAction::Clear));
     }
     }
 
 
-    pub fn set_raw_value(&self, role: Role, i: usize, val: PropertyValue) -> Result<()> {
+    fn set_raw_value(&self, i: usize, val: PropertyValue) -> Result<()> {
         if self.typ != val.as_type() {
         if self.typ != val.as_type() {
             return Err(Error::PropertyWrongType)
             return Err(Error::PropertyWrongType)
         }
         }
@@ -429,7 +428,7 @@ impl Property {
         i: usize,
         i: usize,
         val: bool,
         val: bool,
     ) -> Result<()> {
     ) -> Result<()> {
-        self.set_raw_value(role, i, PropertyValue::Bool(val))?;
+        self.set_raw_value(i, PropertyValue::Bool(val))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -452,7 +451,7 @@ impl Property {
                 return Err(Error::PropertyOutOfRange)
                 return Err(Error::PropertyOutOfRange)
             }
             }
         }
         }
-        self.set_raw_value(role, i, PropertyValue::Uint32(val))?;
+        self.set_raw_value(i, PropertyValue::Uint32(val))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -475,7 +474,7 @@ impl Property {
                 return Err(Error::PropertyOutOfRange)
                 return Err(Error::PropertyOutOfRange)
             }
             }
         }
         }
-        self.set_raw_value(role, i, PropertyValue::Float32(val))?;
+        self.set_raw_value(i, PropertyValue::Float32(val))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -486,7 +485,7 @@ impl Property {
         i: usize,
         i: usize,
         val: S,
         val: S,
     ) -> Result<()> {
     ) -> Result<()> {
-        self.set_raw_value(role, i, PropertyValue::Str(val.into()))?;
+        self.set_raw_value(i, PropertyValue::Str(val.into()))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -504,7 +503,7 @@ impl Property {
         if !self.enum_items.as_ref().unwrap().contains(&val) {
         if !self.enum_items.as_ref().unwrap().contains(&val) {
             return Err(Error::PropertyWrongEnumItem)
             return Err(Error::PropertyWrongEnumItem)
         }
         }
-        self.set_raw_value(role, i, PropertyValue::Enum(val.into()))?;
+        self.set_raw_value(i, PropertyValue::Enum(val.into()))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -515,7 +514,7 @@ impl Property {
         i: usize,
         i: usize,
         val: SceneNodeId,
         val: SceneNodeId,
     ) -> Result<()> {
     ) -> Result<()> {
-        self.set_raw_value(role, i, PropertyValue::SceneNodeId(val))?;
+        self.set_raw_value(i, PropertyValue::SceneNodeId(val))?;
         atom.add(self, role, ModifyAction::Set(i));
         atom.add(self, role, ModifyAction::Set(i));
         Ok(())
         Ok(())
     }
     }
@@ -552,7 +551,7 @@ impl Property {
         Ok(())
         Ok(())
     }
     }
 
 
-    fn set_cache(&self, role: Role, i: usize, val: PropertyValue) -> Result<()> {
+    fn set_cache(&self, i: usize, val: PropertyValue) -> Result<()> {
         if self.typ != val.as_type() {
         if self.typ != val.as_type() {
             return Err(Error::PropertyWrongType)
             return Err(Error::PropertyWrongType)
         }
         }
@@ -565,12 +564,12 @@ impl Property {
         Ok(())
         Ok(())
     }
     }
     pub fn set_cache_f32(&self, role: Role, i: usize, val: f32) -> Result<()> {
     pub fn set_cache_f32(&self, role: Role, i: usize, val: f32) -> Result<()> {
-        self.set_cache(role, i, PropertyValue::Float32(val))?;
+        self.set_cache(i, PropertyValue::Float32(val))?;
         self.on_modify.notify((role, ModifyAction::SetCache(vec![i])));
         self.on_modify.notify((role, ModifyAction::SetCache(vec![i])));
         Ok(())
         Ok(())
     }
     }
     pub fn set_cache_u32(&self, role: Role, i: usize, val: u32) -> Result<()> {
     pub fn set_cache_u32(&self, role: Role, i: usize, val: u32) -> Result<()> {
-        self.set_cache(role, i, PropertyValue::Uint32(val))?;
+        self.set_cache(i, PropertyValue::Uint32(val))?;
         self.on_modify.notify((role, ModifyAction::SetCache(vec![i])));
         self.on_modify.notify((role, ModifyAction::SetCache(vec![i])));
         Ok(())
         Ok(())
     }
     }
@@ -578,7 +577,7 @@ impl Property {
     pub fn set_cache_f32_multi(&self, role: Role, changes: Vec<(usize, f32)>) -> Result<()> {
     pub fn set_cache_f32_multi(&self, role: Role, changes: Vec<(usize, f32)>) -> Result<()> {
         let mut idxs = vec![];
         let mut idxs = vec![];
         for (idx, val) in changes {
         for (idx, val) in changes {
-            self.set_cache(role, idx, PropertyValue::Float32(val))?;
+            self.set_cache(idx, PropertyValue::Float32(val))?;
             idxs.push(idx);
             idxs.push(idx);
         }
         }
         self.on_modify.notify((role, ModifyAction::SetCache(idxs)));
         self.on_modify.notify((role, ModifyAction::SetCache(idxs)));
@@ -587,7 +586,7 @@ impl Property {
     pub fn set_cache_u32_range(&self, role: Role, changes: Vec<(usize, u32)>) -> Result<()> {
     pub fn set_cache_u32_range(&self, role: Role, changes: Vec<(usize, u32)>) -> Result<()> {
         let mut idxs = vec![];
         let mut idxs = vec![];
         for (idx, val) in changes {
         for (idx, val) in changes {
-            self.set_cache(role, idx, PropertyValue::Uint32(val))?;
+            self.set_cache(idx, PropertyValue::Uint32(val))?;
             idxs.push(idx);
             idxs.push(idx);
         }
         }
         self.on_modify.notify((role, ModifyAction::SetCache(idxs)));
         self.on_modify.notify((role, ModifyAction::SetCache(idxs)));

+ 11 - 5
bin/app/src/prop/wrap.rs

@@ -16,12 +16,10 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use std::ops::Range;
-
 use crate::{
 use crate::{
     error::{Error, Result},
     error::{Error, Result},
     expr::{SExprMachine, SExprVal},
     expr::{SExprMachine, SExprVal},
-    gfx::{Dimension, Point, Rectangle},
+    gfx::{Dimension, Rectangle},
     scene::SceneNode as SceneNode3,
     scene::SceneNode as SceneNode3,
 };
 };
 
 
@@ -66,12 +64,14 @@ pub struct PropertyUint32 {
 }
 }
 
 
 impl PropertyUint32 {
 impl PropertyUint32 {
+    /*
     pub fn from(prop: PropertyPtr, role: Role, idx: usize) -> Result<Self> {
     pub fn from(prop: PropertyPtr, role: Role, idx: usize) -> Result<Self> {
         // Test if it works
         // Test if it works
         let _ = prop.get_u32(idx)?;
         let _ = prop.get_u32(idx)?;
 
 
         Ok(Self { prop, role, idx })
         Ok(Self { prop, role, idx })
     }
     }
+    */
 
 
     pub fn wrap(node: &SceneNode3, role: Role, prop_name: &str, idx: usize) -> Result<Self> {
     pub fn wrap(node: &SceneNode3, role: Role, prop_name: &str, idx: usize) -> Result<Self> {
         let prop = node.get_property(prop_name).ok_or(Error::PropertyNotFound)?;
         let prop = node.get_property(prop_name).ok_or(Error::PropertyNotFound)?;
@@ -86,6 +86,7 @@ impl PropertyUint32 {
         self.prop.get_u32(self.idx).unwrap()
         self.prop.get_u32(self.idx).unwrap()
     }
     }
 
 
+    #[allow(dead_code)]
     pub fn set(&self, atom: &mut PropertyAtomicGuard, val: u32) {
     pub fn set(&self, atom: &mut PropertyAtomicGuard, val: u32) {
         self.prop().set_u32(atom, self.role, self.idx, val).unwrap()
         self.prop().set_u32(atom, self.role, self.idx, val).unwrap()
     }
     }
@@ -186,6 +187,7 @@ impl PropertyColor {
         ]
         ]
     }
     }
 
 
+    #[allow(dead_code)]
     pub fn set(&self, atom: &mut PropertyAtomicGuard, val: [f32; 4]) {
     pub fn set(&self, atom: &mut PropertyAtomicGuard, val: [f32; 4]) {
         self.prop().set_f32(atom, self.role, 0, val[0]).unwrap();
         self.prop().set_f32(atom, self.role, 0, val[0]).unwrap();
         self.prop().set_f32(atom, self.role, 1, val[1]).unwrap();
         self.prop().set_f32(atom, self.role, 1, val[1]).unwrap();
@@ -234,6 +236,7 @@ impl PropertyDimension {
     }
     }
 }
 }
 
 
+/*
 #[derive(Clone)]
 #[derive(Clone)]
 pub struct PropertyPoint {
 pub struct PropertyPoint {
     prop: PropertyPtr,
     prop: PropertyPtr,
@@ -268,6 +271,7 @@ impl PropertyPoint {
         self.prop.clone()
         self.prop.clone()
     }
     }
 }
 }
+*/
 
 
 #[derive(Clone)]
 #[derive(Clone)]
 pub struct PropertyRect {
 pub struct PropertyRect {
@@ -331,7 +335,7 @@ impl PropertyRect {
     }
     }
 
 
     pub fn get(&self) -> Rectangle {
     pub fn get(&self) -> Rectangle {
-        Rectangle::from_array([
+        Rectangle::from([
             self.prop.get_f32(0).unwrap(),
             self.prop.get_f32(0).unwrap(),
             self.prop.get_f32(1).unwrap(),
             self.prop.get_f32(1).unwrap(),
             self.prop.get_f32(2).unwrap(),
             self.prop.get_f32(2).unwrap(),
@@ -346,8 +350,9 @@ impl PropertyRect {
         self.prop.get_f32(3).unwrap()
         self.prop.get_f32(3).unwrap()
     }
     }
 
 
+    /*
     pub fn get_opt(&self) -> Option<Rectangle> {
     pub fn get_opt(&self) -> Option<Rectangle> {
-        Some(Rectangle::from_array([
+        Some(Rectangle::from([
             self.prop.get_f32(0).ok()?,
             self.prop.get_f32(0).ok()?,
             self.prop.get_f32(1).ok()?,
             self.prop.get_f32(1).ok()?,
             self.prop.get_f32(2).ok()?,
             self.prop.get_f32(2).ok()?,
@@ -361,6 +366,7 @@ impl PropertyRect {
         self.prop().set_f32(atom, self.role, 2, rect.y).unwrap();
         self.prop().set_f32(atom, self.role, 2, rect.y).unwrap();
         self.prop().set_f32(atom, self.role, 3, rect.y).unwrap();
         self.prop().set_f32(atom, self.role, 3, rect.y).unwrap();
     }
     }
+    */
 
 
     #[inline]
     #[inline]
     pub fn prop(&self) -> PropertyPtr {
     pub fn prop(&self) -> PropertyPtr {

+ 4 - 5
bin/app/src/scene.rs

@@ -17,7 +17,6 @@
  */
  */
 
 
 use async_channel::{Receiver, Sender};
 use async_channel::{Receiver, Sender};
-use async_lock::RwLock as AsyncRwLock;
 use async_trait::async_trait;
 use async_trait::async_trait;
 use darkfi_serial::{FutAsyncWriteExt, SerialDecodable, SerialEncodable};
 use darkfi_serial::{FutAsyncWriteExt, SerialDecodable, SerialEncodable};
 use futures::{stream::FuturesUnordered, StreamExt};
 use futures::{stream::FuturesUnordered, StreamExt};
@@ -161,7 +160,7 @@ impl SceneNode {
         F: FnOnce(SceneNodeWeak) -> Fut,
         F: FnOnce(SceneNodeWeak) -> Fut,
         Fut: Future<Output = Pimpl>,
         Fut: Future<Output = Pimpl>,
     {
     {
-        let mut self_ = Arc::new(self);
+        let self_ = Arc::new(self);
         let weak_self = Arc::downgrade(&self_);
         let weak_self = Arc::downgrade(&self_);
 
 
         // Initial props
         // Initial props
@@ -176,7 +175,7 @@ impl SceneNode {
     }
     }
 
 
     pub fn setup_null(self) -> Arc<Self> {
     pub fn setup_null(self) -> Arc<Self> {
-        let mut self_ = Arc::new(self);
+        let self_ = Arc::new(self);
         let weak_self = Arc::downgrade(&self_);
         let weak_self = Arc::downgrade(&self_);
 
 
         // Initial props
         // Initial props
@@ -185,7 +184,7 @@ impl SceneNode {
         }
         }
 
 
         assert_eq!(Arc::strong_count(&self_), 1);
         assert_eq!(Arc::strong_count(&self_), 1);
-        self_.pimpl.set(Pimpl::Null);
+        self_.pimpl.set(Pimpl::Null).unwrap();
         self_
         self_
     }
     }
 
 
@@ -541,7 +540,7 @@ pub enum Pimpl {
     Layer(ui::LayerPtr),
     Layer(ui::LayerPtr),
     VectorArt(ui::VectorArtPtr),
     VectorArt(ui::VectorArtPtr),
     Text(ui::TextPtr),
     Text(ui::TextPtr),
-    EditBox(ui::EditBoxPtr),
+    //EditBox(ui::EditBoxPtr),
     ChatEdit(ui::ChatEditPtr),
     ChatEdit(ui::ChatEditPtr),
     ChatView(ui::ChatViewPtr),
     ChatView(ui::ChatViewPtr),
     Image(ui::ImagePtr),
     Image(ui::ImagePtr),

+ 12 - 12
bin/app/src/shape/mod.rs

@@ -35,20 +35,20 @@ pub use netlogo2::create_netlogo2;
 mod netlogo3;
 mod netlogo3;
 pub use netlogo3::create_netlogo3;
 pub use netlogo3::create_netlogo3;
 
 
-mod settings;
-pub use settings::{create_right_border, create_settings};
+//mod settings;
+//pub use settings::{create_right_border, create_settings};
 
 
-mod switch;
-pub use switch::create_switch;
+//mod switch;
+//pub use switch::create_switch;
 
 
-mod confirm;
-pub use confirm::create_confirm;
+//mod confirm;
+//pub use confirm::create_confirm;
 
 
-mod circle;
-pub use circle::create_circle;
+//mod circle;
+//pub use circle::create_circle;
 
 
-mod logo;
-pub use logo::create_logo;
+//mod logo;
+//pub use logo::create_logo;
 
 
-mod reset;
-pub use reset::create_reset;
+//mod reset;
+//pub use reset::create_reset;

+ 2 - 3
bin/app/src/text/atlas.rs

@@ -17,13 +17,12 @@
  */
  */
 
 
 use crate::{
 use crate::{
-    error::Result,
-    gfx::{DebugTag, GfxTextureId, ManagedTexturePtr, Rectangle, RenderApi},
+    gfx::{DebugTag, ManagedTexturePtr, Rectangle, RenderApi},
 };
 };
 
 
 use super::{
 use super::{
     ft::{Sprite, SpritePtr},
     ft::{Sprite, SpritePtr},
-    glyph_str, Glyph,
+    Glyph,
 };
 };
 
 
 /// Prevents render artifacts from aliasing.
 /// Prevents render artifacts from aliasing.

+ 4 - 12
bin/app/src/text/mod.rs

@@ -16,17 +16,9 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use harfbuzz_sys::{
-    freetype::hb_ft_font_create_referenced, hb_buffer_add_utf8, hb_buffer_create,
-    hb_buffer_destroy, hb_buffer_get_glyph_infos, hb_buffer_get_glyph_positions,
-    hb_buffer_guess_segment_properties, hb_buffer_set_cluster_level, hb_buffer_set_content_type,
-    hb_font_destroy, hb_glyph_info_t, hb_glyph_position_t, hb_shape,
-    HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES, HB_BUFFER_CONTENT_TYPE_UNICODE,
-};
 use std::{
 use std::{
     collections::HashMap,
     collections::HashMap,
     ffi::OsStr,
     ffi::OsStr,
-    os,
     path::PathBuf,
     path::PathBuf,
     sync::{Arc, Mutex as SyncMutex, Weak},
     sync::{Arc, Mutex as SyncMutex, Weak},
 };
 };
@@ -40,7 +32,7 @@ use ft::{render_glyph, FreetypeFace, Sprite, SpritePtr};
 mod shape;
 mod shape;
 use shape::{set_face_size, shape};
 use shape::{set_face_size, shape};
 mod wrap;
 mod wrap;
-pub use wrap::{glyph_str, wrap};
+pub use wrap::wrap;
 
 
 // Upscale emoji relative to font size
 // Upscale emoji relative to font size
 pub const EMOJI_SCALE_FACT: f32 = 1.6;
 pub const EMOJI_SCALE_FACT: f32 = 1.6;
@@ -166,7 +158,7 @@ impl TextShaperInternal {
 
 
 pub struct TextShaper {
 pub struct TextShaper {
     intern: SyncMutex<TextShaperInternal>,
     intern: SyncMutex<TextShaperInternal>,
-    fonts_data: Vec<Vec<u8>>,
+    _fonts_data: Vec<Vec<u8>>,
 }
 }
 
 
 impl TextShaper {
 impl TextShaper {
@@ -226,7 +218,7 @@ impl TextShaper {
                 font_faces: FtFaces(faces),
                 font_faces: FtFaces(faces),
                 cache: HashMap::new(),
                 cache: HashMap::new(),
             }),
             }),
-            fonts_data,
+            _fonts_data: fonts_data,
         })
         })
     }
     }
 
 
@@ -237,7 +229,7 @@ impl TextShaper {
         ft_face
         ft_face
     }
     }
 
 
-    pub fn shape(&self, mut text: String, font_size: f32, window_scale: f32) -> Vec<Glyph> {
+    pub fn shape(&self, text: String, font_size: f32, window_scale: f32) -> Vec<Glyph> {
         //debug!(target: "text", "shape('{}', {})", text, font_size);
         //debug!(target: "text", "shape('{}', {})", text, font_size);
         if text.is_empty() {
         if text.is_empty() {
             return vec![]
             return vec![]

+ 0 - 24
bin/app/src/text/shape.rs

@@ -127,15 +127,6 @@ impl GlyphInfo {
     }
     }
 }
 }
 
 
-fn is_overlap(parent: &GlyphInfo, child: &GlyphInfo) -> bool {
-    assert!(child.cluster_start <= child.cluster_end);
-    // Handle this weird edgecase
-    if child.cluster_start == child.cluster_end {
-        return child.cluster_end <= parent.cluster_start
-    }
-    child.cluster_start < parent.cluster_end
-}
-
 struct ShapedGlyphs {
 struct ShapedGlyphs {
     glyphs: Vec<GlyphInfo>,
     glyphs: Vec<GlyphInfo>,
 }
 }
@@ -194,18 +185,6 @@ impl ShapedGlyphs {
     }
     }
 }
 }
 
 
-/// Count the number of leading zeros
-fn count_leading_null_glyphs(glyphs: &Vec<GlyphInfo>) -> usize {
-    let mut cnt = 0;
-    for glyph in glyphs {
-        if glyph.id != 0 {
-            break
-        }
-        cnt += 1;
-    }
-    cnt
-}
-
 /*
 /*
 fn print_glyphs(ctx: &str, glyphs: &Vec<GlyphInfo>, indent: usize) {
 fn print_glyphs(ctx: &str, glyphs: &Vec<GlyphInfo>, indent: usize) {
     let ws = " ".repeat(2 * indent);
     let ws = " ".repeat(2 * indent);
@@ -228,9 +207,6 @@ fn face_shape(face: &mut FreetypeFace, text: &str, face_idx: usize) -> Vec<Glyph
         let cluster = hbinf.info.cluster as usize;
         let cluster = hbinf.info.cluster as usize;
         //println!("  {i}: glyph_id = {glyph_id}, cluster = {cluster}");
         //println!("  {i}: glyph_id = {glyph_id}, cluster = {cluster}");
 
 
-        let remain_text = &text[cluster..];
-        //println!("     remain_text='{remain_text}'");
-
         if i != 0 {
         if i != 0 {
             glyphs.last_mut().unwrap().cluster_end = cluster;
             glyphs.last_mut().unwrap().cluster_end = cluster;
         }
         }

+ 1 - 1
bin/app/src/text/wrap.rs

@@ -26,7 +26,7 @@ enum TokenType {
     Whitespace,
     Whitespace,
 }
 }
 
 
-struct Token {
+pub struct Token {
     token_type: TokenType,
     token_type: TokenType,
     lhs: f32,
     lhs: f32,
     rhs: f32,
     rhs: f32,

+ 5 - 9
bin/app/src/text2/atlas.rs

@@ -16,11 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use crate::{
-    error::Result,
-    gfx::{DebugTag, GfxTextureId, ManagedTexturePtr, Rectangle, RenderApi},
-    mesh::Color,
-};
+use crate::gfx::{DebugTag, ManagedTexturePtr, Rectangle, RenderApi};
 
 
 /// Prevents render artifacts from aliasing.
 /// Prevents render artifacts from aliasing.
 /// Even with aliasing turned off, some bleed still appears possibly
 /// Even with aliasing turned off, some bleed still appears possibly
@@ -161,10 +157,11 @@ impl<'a> Atlas<'a> {
     }
     }
 
 
     /// Debug method
     /// Debug method
+    #[allow(dead_code)]
     pub fn dump(&self, output_path: &str) {
     pub fn dump(&self, output_path: &str) {
         let atlas = self.render();
         let atlas = self.render();
         let img = image::RgbaImage::from_raw(self.width as u32, self.height as u32, atlas).unwrap();
         let img = image::RgbaImage::from_raw(self.width as u32, self.height as u32, atlas).unwrap();
-        img.save(output_path);
+        img.save(output_path).unwrap();
     }
     }
 
 
     /// Invalidate this atlas and produce the finalized result.
     /// Invalidate this atlas and produce the finalized result.
@@ -237,9 +234,8 @@ fn copy_image(
             for (pixel_y, row) in sprite.data.chunks_exact(row_size).enumerate() {
             for (pixel_y, row) in sprite.data.chunks_exact(row_size).enumerate() {
                 for (pixel_x, pixel) in row.chunks_exact(4).enumerate() {
                 for (pixel_x, pixel) in row.chunks_exact(4).enumerate() {
                     assert_eq!(pixel.len(), 4);
                     assert_eq!(pixel.len(), 4);
-
-                    let src_y = pixel_y * sprite_width;
-                    let off_src = 4 * (src_y + pixel_x);
+                    //let src_y = pixel_y * sprite_width;
+                    //let off_src = 4 * (src_y + pixel_x);
 
 
                     let dest_y = (y + pixel_y) * atlas_width;
                     let dest_y = (y + pixel_y) * atlas_width;
                     let off_dest = 4 * (dest_y + pixel_x + x);
                     let off_dest = 4 * (dest_y + pixel_x + x);

+ 9 - 6
bin/app/src/text2/editor/parley.rs

@@ -23,8 +23,6 @@ use crate::{
     text2::{TextContext, FONT_STACK, TEXT_CTX},
     text2::{TextContext, FONT_STACK, TEXT_CTX},
 };
 };
 
 
-macro_rules! t { ($($arg:tt)*) => { trace!(target: "text::editor", $($arg)*); } }
-
 pub struct Editor {
 pub struct Editor {
     editor: parley::PlainEditor<Color>,
     editor: parley::PlainEditor<Color>,
 
 
@@ -43,14 +41,16 @@ impl Editor {
         window_scale: PropertyFloat32,
         window_scale: PropertyFloat32,
         lineheight: PropertyFloat32,
         lineheight: PropertyFloat32,
     ) -> Self {
     ) -> Self {
-        let mut editor = parley::PlainEditor::new(1.);
+        let editor = parley::PlainEditor::new(1.);
         //let atxt = "A berry is a small, pulpy, and often edible fruit. Typically, berries are juicy, rounded, brightly colored, sweet, sour or tart, and do not have a stone or pit, although many pips or seeds may be present. Common examples of berries in the culinary sense are strawberries, raspberries, blueberries, blackberries, white currants, blackcurrants, and redcurrants. In Britain, soft fruit is a horticultural term for such fruits. The common usage of the term berry is different from the scientific or botanical definition of a berry, which refers to a fruit produced from the ovary of a single flower where the outer layer of the ovary wall develops into an edible fleshy portion (pericarp). The botanical definition includes many fruits that are not commonly known or referred to as berries, such as grapes, tomatoes, cucumbers, eggplants, bananas, and chili peppers.";
         //let atxt = "A berry is a small, pulpy, and often edible fruit. Typically, berries are juicy, rounded, brightly colored, sweet, sour or tart, and do not have a stone or pit, although many pips or seeds may be present. Common examples of berries in the culinary sense are strawberries, raspberries, blueberries, blackberries, white currants, blackcurrants, and redcurrants. In Britain, soft fruit is a horticultural term for such fruits. The common usage of the term berry is different from the scientific or botanical definition of a berry, which refers to a fruit produced from the ovary of a single flower where the outer layer of the ovary wall develops into an edible fleshy portion (pericarp). The botanical definition includes many fruits that are not commonly known or referred to as berries, such as grapes, tomatoes, cucumbers, eggplants, bananas, and chili peppers.";
         //editor.set_text(atxt);
         //editor.set_text(atxt);
         Self { text, editor, font_size, text_color, window_scale, lineheight }
         Self { text, editor, font_size, text_color, window_scale, lineheight }
     }
     }
 
 
     // These are android specific
     // These are android specific
+    #[allow(dead_code)]
     pub fn init(&mut self) {}
     pub fn init(&mut self) {}
+    #[allow(dead_code)]
     pub fn setup(&mut self) {}
     pub fn setup(&mut self) {}
     pub fn focus(&self) {}
     pub fn focus(&self) {}
     pub fn unfocus(&self) {}
     pub fn unfocus(&self) {}
@@ -91,10 +91,10 @@ impl Editor {
         self.editor.try_layout().unwrap()
         self.editor.try_layout().unwrap()
     }
     }
 
 
-    pub fn move_to_pos(&self, pos: Point) {
+    pub fn move_to_pos(&self, _pos: Point) {
         unimplemented!()
         unimplemented!()
     }
     }
-    pub fn select_word_at_point(&self, pos: Point) {
+    pub fn select_word_at_point(&self, _pos: Point) {
         unimplemented!()
         unimplemented!()
     }
     }
 
 
@@ -133,8 +133,11 @@ impl Editor {
     pub fn selection(&self) -> parley::Selection {
     pub fn selection(&self) -> parley::Selection {
         *self.editor.raw_selection()
         *self.editor.raw_selection()
     }
     }
-    pub fn set_selection(&self, select_start: usize, select_end: usize) {}
+    pub fn set_selection(&self, _select_start: usize, _select_end: usize) {
+        unimplemented!()
+    }
 
 
+    #[allow(dead_code)]
     pub fn buffer(&self) -> String {
     pub fn buffer(&self) -> String {
         self.editor.raw_text().to_string()
         self.editor.raw_text().to_string()
     }
     }

+ 7 - 10
bin/app/src/text2/mod.rs

@@ -17,12 +17,9 @@
  */
  */
 
 
 use async_lock::Mutex as AsyncMutex;
 use async_lock::Mutex as AsyncMutex;
-use futures::stream::{FuturesUnordered, StreamExt};
 use std::{
 use std::{
-    cell::RefCell,
-    fmt::Debug,
     ops::Range,
     ops::Range,
-    sync::{atomic::AtomicBool, Arc, OnceLock},
+    sync::{Arc, OnceLock},
 };
 };
 
 
 use crate::mesh::Color;
 use crate::mesh::Color;
@@ -79,17 +76,17 @@ impl TextContext {
         let mut font_ctx = parley::FontContext::new();
         let mut font_ctx = parley::FontContext::new();
 
 
         let font_data = include_bytes!("../../ibm-plex-mono-regular.otf") as &[u8];
         let font_data = include_bytes!("../../ibm-plex-mono-regular.otf") as &[u8];
-        let font_inf =
+        let _font_inf =
             font_ctx.collection.register_fonts(peniko::Blob::new(Arc::new(font_data)), None);
             font_ctx.collection.register_fonts(peniko::Blob::new(Arc::new(font_data)), None);
 
 
         let font_data = include_bytes!("../../NotoColorEmoji.ttf") as &[u8];
         let font_data = include_bytes!("../../NotoColorEmoji.ttf") as &[u8];
-        let font_inf =
+        let _font_inf =
             font_ctx.collection.register_fonts(peniko::Blob::new(Arc::new(font_data)), None);
             font_ctx.collection.register_fonts(peniko::Blob::new(Arc::new(font_data)), None);
 
 
-        for (family_id, _) in font_inf {
-            let family_name = font_ctx.collection.family_name(family_id).unwrap();
-            trace!(target: "text", "Loaded font: {family_name}");
-        }
+        //for (family_id, _) in font_inf {
+        //    let family_name = font_ctx.collection.family_name(family_id).unwrap();
+        //    trace!(target: "text", "Loaded font: {family_name}");
+        //}
 
 
         Self { font_ctx, layout_ctx }
         Self { font_ctx, layout_ctx }
     }
     }

+ 8 - 8
bin/app/src/text2/render.rs

@@ -27,9 +27,9 @@ use super::atlas::{Atlas, RenderedAtlas};
 pub struct DebugRenderOptions(u32);
 pub struct DebugRenderOptions(u32);
 
 
 impl DebugRenderOptions {
 impl DebugRenderOptions {
-    pub const Off: DebugRenderOptions = DebugRenderOptions(0b00);
-    pub const Glyph: DebugRenderOptions = DebugRenderOptions(0b01);
-    pub const Baseline: DebugRenderOptions = DebugRenderOptions(0b10);
+    pub const OFF: DebugRenderOptions = DebugRenderOptions(0b00);
+    pub const GLYPH: DebugRenderOptions = DebugRenderOptions(0b01);
+    pub const BASELINE: DebugRenderOptions = DebugRenderOptions(0b10);
 
 
     pub fn has(self, other: Self) -> bool {
     pub fn has(self, other: Self) -> bool {
         (self.0 & other.0) == other.0
         (self.0 & other.0) == other.0
@@ -54,7 +54,7 @@ pub fn render_layout(
     render_api: &RenderApi,
     render_api: &RenderApi,
     tag: DebugTag,
     tag: DebugTag,
 ) -> Vec<GfxDrawInstruction> {
 ) -> Vec<GfxDrawInstruction> {
-    render_layout_with_opts(layout, DebugRenderOptions::Off, render_api, tag)
+    render_layout_with_opts(layout, DebugRenderOptions::OFF, render_api, tag)
 }
 }
 
 
 pub fn render_layout_with_opts(
 pub fn render_layout_with_opts(
@@ -85,7 +85,7 @@ pub fn render_layout_with_opts(
 fn render_glyph_run(
 fn render_glyph_run(
     scale_ctx: &mut swash::scale::ScaleContext,
     scale_ctx: &mut swash::scale::ScaleContext,
     glyph_run: &parley::GlyphRun<'_, Color>,
     glyph_run: &parley::GlyphRun<'_, Color>,
-    run_idx: usize,
+    _run_idx: usize,
     opts: DebugRenderOptions,
     opts: DebugRenderOptions,
     render_api: &RenderApi,
     render_api: &RenderApi,
     tag: DebugTag,
     tag: DebugTag,
@@ -118,7 +118,7 @@ fn render_glyph_run(
             glyph_inf.place.height as f32,
             glyph_inf.place.height as f32,
         );
         );
 
 
-        if opts.has(DebugRenderOptions::Glyph) {
+        if opts.has(DebugRenderOptions::GLYPH) {
             mesh.draw_outline(&glyph_rect, [0., 1., 0., 0.7], 1.);
             mesh.draw_outline(&glyph_rect, [0., 1., 0., 0.7], 1.);
         }
         }
 
 
@@ -126,7 +126,7 @@ fn render_glyph_run(
         mesh.draw_box(&glyph_rect, color, &glyph_inf.uv_rect);
         mesh.draw_box(&glyph_rect, color, &glyph_inf.uv_rect);
     }
     }
 
 
-    if opts.has(DebugRenderOptions::Baseline) {
+    if opts.has(DebugRenderOptions::BASELINE) {
         mesh.draw_filled_box(
         mesh.draw_filled_box(
             &Rectangle::new(glyph_run.offset(), glyph_run.baseline(), glyph_run.advance(), 1.),
             &Rectangle::new(glyph_run.offset(), glyph_run.baseline(), glyph_run.advance(), 1.),
             [0., 0., 1., 0.7],
             [0., 0., 1., 0.7],
@@ -179,7 +179,7 @@ fn create_atlas(
     let normalized_coords = run.normalized_coords();
     let normalized_coords = run.normalized_coords();
     let font_ref = swash::FontRef::from_index(font.data.as_ref(), font.index as usize).unwrap();
     let font_ref = swash::FontRef::from_index(font.data.as_ref(), font.index as usize).unwrap();
 
 
-    let mut scaler = scale_ctx
+    let scaler = scale_ctx
         .builder(font_ref)
         .builder(font_ref)
         .size(font_size)
         .size(font_size)
         .hint(true)
         .hint(true)

+ 7 - 12
bin/app/src/ui/button.rs

@@ -20,15 +20,13 @@ use async_trait::async_trait;
 use miniquad::{MouseButton, TouchPhase};
 use miniquad::{MouseButton, TouchPhase};
 use std::sync::{
 use std::sync::{
     atomic::{AtomicBool, Ordering},
     atomic::{AtomicBool, Ordering},
-    Arc, Weak,
+    Arc,
 };
 };
 
 
 use crate::{
 use crate::{
-    gfx::{GraphicsEventPublisherPtr, Point, Rectangle},
-    prop::{PropertyAtomicGuard, PropertyBool, PropertyPtr, PropertyRect, PropertyUint32, Role},
-    pubsub::Subscription,
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
-    ExecutorPtr,
+    gfx::{Point, Rectangle},
+    prop::{PropertyAtomicGuard, PropertyBool, PropertyRect, PropertyUint32, Role},
+    scene::{Pimpl, SceneNodeWeak},
 };
 };
 
 
 use super::{DrawUpdate, UIObject};
 use super::{DrawUpdate, UIObject};
@@ -43,27 +41,24 @@ pub struct Button {
 
 
     is_active: PropertyBool,
     is_active: PropertyBool,
     rect: PropertyRect,
     rect: PropertyRect,
-    z_index: PropertyUint32,
     priority: PropertyUint32,
     priority: PropertyUint32,
 
 
     mouse_btn_held: AtomicBool,
     mouse_btn_held: AtomicBool,
 }
 }
 
 
 impl Button {
 impl Button {
-    pub async fn new(node: SceneNodeWeak, ex: ExecutorPtr) -> Pimpl {
+    pub async fn new(node: SceneNodeWeak) -> Pimpl {
         t!("Button::new()");
         t!("Button::new()");
 
 
         let node_ref = &node.upgrade().unwrap();
         let node_ref = &node.upgrade().unwrap();
         let is_active = PropertyBool::wrap(node_ref, Role::Internal, "is_active", 0).unwrap();
         let is_active = PropertyBool::wrap(node_ref, Role::Internal, "is_active", 0).unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
-        let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
 
 
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             is_active,
             is_active,
             rect,
             rect,
-            z_index,
             priority,
             priority,
             mouse_btn_held: AtomicBool::new(false),
             mouse_btn_held: AtomicBool::new(false),
         });
         });
@@ -81,8 +76,8 @@ impl UIObject for Button {
     async fn draw(
     async fn draw(
         &self,
         &self,
         parent_rect: Rectangle,
         parent_rect: Rectangle,
-        trace_id: u32,
-        atom: &mut PropertyAtomicGuard,
+        _trace_id: u32,
+        _atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
         let _ = self.rect.eval(&parent_rect);
         let _ = self.rect.eval(&parent_rect);
         None
         None

+ 39 - 86
bin/app/src/ui/chatedit.rs

@@ -18,46 +18,40 @@
 
 
 use async_lock::Mutex as AsyncMutex;
 use async_lock::Mutex as AsyncMutex;
 use async_trait::async_trait;
 use async_trait::async_trait;
-use atomic_float::AtomicF32;
 use darkfi::system::msleep;
 use darkfi::system::msleep;
-use darkfi_serial::{deserialize, Decodable, Encodable, SerialDecodable, SerialEncodable};
-use miniquad::{window, KeyCode, KeyMods, MouseButton, TouchPhase};
+use darkfi_serial::Decodable;
+use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
 use parking_lot::Mutex as SyncMutex;
 use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
 use std::{
 use std::{
-    collections::HashMap,
     io::Cursor,
     io::Cursor,
     ops::{Deref, DerefMut},
     ops::{Deref, DerefMut},
     sync::{
     sync::{
         atomic::{AtomicBool, Ordering},
         atomic::{AtomicBool, Ordering},
         Arc, Weak,
         Arc, Weak,
     },
     },
-    time::Instant,
 };
 };
 
 
 use crate::{
 use crate::{
-    error::Result,
     gfx::{
     gfx::{
-        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId,
-        GraphicsEventPublisherPtr, Point, Rectangle, RenderApi, Vertex,
+        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh,
+        Point, Rectangle, RenderApi, Vertex,
     },
     },
-    mesh::{Color, MeshBuilder, MeshInfo, COLOR_BLUE, COLOR_RED, COLOR_WHITE},
+    mesh::MeshBuilder,
     prop::{
     prop::{
         PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr,
         PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr,
         PropertyRect, PropertyStr, PropertyUint32, Role,
         PropertyRect, PropertyStr, PropertyUint32, Role,
     },
     },
-    pubsub::Subscription,
     scene::{MethodCallSub, Pimpl, SceneNodePtr, SceneNodeWeak},
     scene::{MethodCallSub, Pimpl, SceneNodePtr, SceneNodeWeak},
-    text::{self, Glyph, GlyphPositionIter, TextShaperPtr},
     text2::{self, Editor},
     text2::{self, Editor},
-    util::{enumerate_ref, is_whitespace, min_f32, unixtime, zip4},
-    AndroidSuggestEvent, ExecutorPtr,
+    util::unixtime,
+    ExecutorPtr,
 };
 };
+#[cfg(target_os = "android")]
+use crate::AndroidSuggestEvent;
 
 
 use super::{
 use super::{
-    editbox::{
-        editable::{Editable, RenderedEditable, Selection, TextIdx, TextPos},
-        eol_nudge,
+    baseedit::{
         repeat::{PressedKey, PressedKeysSmoothRepeat},
         repeat::{PressedKey, PressedKeysSmoothRepeat},
         ALLOWED_KEYCODES, DISALLOWED_CHARS,
         ALLOWED_KEYCODES, DISALLOWED_CHARS,
     },
     },
@@ -76,31 +70,6 @@ const VERT_SCROLL_UPDATE_INC: f32 = 1.;
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::chatedit", $($arg)*); } }
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::chatedit", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatedit", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatedit", $($arg)*); } }
 
 
-// You must be careful working with string indexes in Java. They are UTF16 string indexs, not UTF8
-fn char16_to_byte_index(s: &str, char_idx: usize) -> Option<usize> {
-    let utf16_data: Vec<_> = s.encode_utf16().take(char_idx).collect();
-    let prestr = String::from_utf16(&utf16_data).ok()?;
-    Some(prestr.len())
-}
-fn byte_to_char16_index(s: &str, byte_idx: usize) -> Option<usize> {
-    if byte_idx > s.len() || !s.is_char_boundary(byte_idx) {
-        return None
-    }
-    Some(s[..byte_idx].encode_utf16().count())
-}
-
-#[derive(Clone)]
-struct TouchStartInfo {
-    pos: Point,
-    instant: std::time::Instant,
-}
-
-impl TouchStartInfo {
-    fn new(pos: Point) -> Self {
-        Self { pos, instant: std::time::Instant::now() }
-    }
-}
-
 #[derive(Clone)]
 #[derive(Clone)]
 enum TouchStateAction {
 enum TouchStateAction {
     Inactive,
     Inactive,
@@ -114,14 +83,12 @@ enum TouchStateAction {
 
 
 struct TouchInfo {
 struct TouchInfo {
     state: TouchStateAction,
     state: TouchStateAction,
-    start: Option<TouchStartInfo>,
-
     scroll: PropertyFloat32,
     scroll: PropertyFloat32,
 }
 }
 
 
 impl TouchInfo {
 impl TouchInfo {
     fn new(scroll: PropertyFloat32) -> Self {
     fn new(scroll: PropertyFloat32) -> Self {
-        Self { state: TouchStateAction::Inactive, start: None, scroll }
+        Self { state: TouchStateAction::Inactive, scroll }
     }
     }
 
 
     fn start(&mut self, pos: Point) {
     fn start(&mut self, pos: Point) {
@@ -227,7 +194,6 @@ pub struct ChatEdit {
     node: SceneNodeWeak,
     node: SceneNodeWeak,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
     render_api: RenderApi,
     render_api: RenderApi,
-    text_shaper: TextShaperPtr,
     key_repeat: SyncMutex<PressedKeysSmoothRepeat>,
     key_repeat: SyncMutex<PressedKeysSmoothRepeat>,
 
 
     // Moves the draw cursor and applies scroll
     // Moves the draw cursor and applies scroll
@@ -255,7 +221,7 @@ pub struct ChatEdit {
     text: PropertyStr,
     text: PropertyStr,
     text_color: PropertyColor,
     text_color: PropertyColor,
     text_hi_color: PropertyColor,
     text_hi_color: PropertyColor,
-    text_cmd_color: PropertyColor,
+    //text_cmd_color: PropertyColor,
     cursor_color: PropertyColor,
     cursor_color: PropertyColor,
     cursor_width: PropertyFloat32,
     cursor_width: PropertyFloat32,
     cursor_ascent: PropertyFloat32,
     cursor_ascent: PropertyFloat32,
@@ -263,7 +229,7 @@ pub struct ChatEdit {
     cursor_blink_time: PropertyUint32,
     cursor_blink_time: PropertyUint32,
     cursor_idle_time: PropertyUint32,
     cursor_idle_time: PropertyUint32,
     hi_bg_color: PropertyColor,
     hi_bg_color: PropertyColor,
-    cmd_bg_color: PropertyColor,
+    //cmd_bg_color: PropertyColor,
     select_ascent: PropertyFloat32,
     select_ascent: PropertyFloat32,
     select_descent: PropertyFloat32,
     select_descent: PropertyFloat32,
     handle_descent: PropertyFloat32,
     handle_descent: PropertyFloat32,
@@ -281,7 +247,6 @@ pub struct ChatEdit {
     touch_info: SyncMutex<TouchInfo>,
     touch_info: SyncMutex<TouchInfo>,
     is_phone_select: AtomicBool,
     is_phone_select: AtomicBool,
 
 
-    old_window_scale: AtomicF32,
     window_scale: PropertyFloat32,
     window_scale: PropertyFloat32,
     parent_rect: SyncMutex<Option<Rectangle>>,
     parent_rect: SyncMutex<Option<Rectangle>>,
     is_mouse_hover: AtomicBool,
     is_mouse_hover: AtomicBool,
@@ -294,8 +259,6 @@ impl ChatEdit {
         node: SceneNodeWeak,
         node: SceneNodeWeak,
         window_scale: PropertyFloat32,
         window_scale: PropertyFloat32,
         render_api: RenderApi,
         render_api: RenderApi,
-        text_shaper: TextShaperPtr,
-        ex: ExecutorPtr,
     ) -> Pimpl {
     ) -> Pimpl {
         t!("ChatEdit::new()");
         t!("ChatEdit::new()");
 
 
@@ -319,8 +282,8 @@ impl ChatEdit {
         let text = PropertyStr::wrap(node_ref, Role::Internal, "text", 0).unwrap();
         let text = PropertyStr::wrap(node_ref, Role::Internal, "text", 0).unwrap();
         let text_color = PropertyColor::wrap(node_ref, Role::Internal, "text_color").unwrap();
         let text_color = PropertyColor::wrap(node_ref, Role::Internal, "text_color").unwrap();
         let text_hi_color = PropertyColor::wrap(node_ref, Role::Internal, "text_hi_color").unwrap();
         let text_hi_color = PropertyColor::wrap(node_ref, Role::Internal, "text_hi_color").unwrap();
-        let text_cmd_color =
-            PropertyColor::wrap(node_ref, Role::Internal, "text_cmd_color").unwrap();
+        //let text_cmd_color =
+        //    PropertyColor::wrap(node_ref, Role::Internal, "text_cmd_color").unwrap();
         let cursor_color = PropertyColor::wrap(node_ref, Role::Internal, "cursor_color").unwrap();
         let cursor_color = PropertyColor::wrap(node_ref, Role::Internal, "cursor_color").unwrap();
         let cursor_width =
         let cursor_width =
             PropertyFloat32::wrap(node_ref, Role::Internal, "cursor_width", 0).unwrap();
             PropertyFloat32::wrap(node_ref, Role::Internal, "cursor_width", 0).unwrap();
@@ -329,7 +292,7 @@ impl ChatEdit {
         let cursor_descent =
         let cursor_descent =
             PropertyFloat32::wrap(node_ref, Role::Internal, "cursor_descent", 0).unwrap();
             PropertyFloat32::wrap(node_ref, Role::Internal, "cursor_descent", 0).unwrap();
         let hi_bg_color = PropertyColor::wrap(node_ref, Role::Internal, "hi_bg_color").unwrap();
         let hi_bg_color = PropertyColor::wrap(node_ref, Role::Internal, "hi_bg_color").unwrap();
-        let cmd_bg_color = PropertyColor::wrap(node_ref, Role::Internal, "cmd_bg_color").unwrap();
+        //let cmd_bg_color = PropertyColor::wrap(node_ref, Role::Internal, "cmd_bg_color").unwrap();
         let select_ascent =
         let select_ascent =
             PropertyFloat32::wrap(node_ref, Role::Internal, "select_ascent", 0).unwrap();
             PropertyFloat32::wrap(node_ref, Role::Internal, "select_ascent", 0).unwrap();
         let select_descent =
         let select_descent =
@@ -345,14 +308,10 @@ impl ChatEdit {
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap();
         let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             tasks: SyncMutex::new(vec![]),
             tasks: SyncMutex::new(vec![]),
             render_api,
             render_api,
-            text_shaper: text_shaper.clone(),
             key_repeat: SyncMutex::new(PressedKeysSmoothRepeat::new(400, 50)),
             key_repeat: SyncMutex::new(PressedKeysSmoothRepeat::new(400, 50)),
 
 
             root_dc_key: OsRng.gen(),
             root_dc_key: OsRng.gen(),
@@ -378,7 +337,7 @@ impl ChatEdit {
             text: text.clone(),
             text: text.clone(),
             text_color: text_color.clone(),
             text_color: text_color.clone(),
             text_hi_color,
             text_hi_color,
-            text_cmd_color,
+            //text_cmd_color,
             cursor_color,
             cursor_color,
             cursor_width,
             cursor_width,
             cursor_ascent,
             cursor_ascent,
@@ -386,7 +345,7 @@ impl ChatEdit {
             cursor_blink_time,
             cursor_blink_time,
             cursor_idle_time,
             cursor_idle_time,
             hi_bg_color,
             hi_bg_color,
-            cmd_bg_color,
+            //cmd_bg_color,
             select_ascent,
             select_ascent,
             select_descent,
             select_descent,
             handle_descent,
             handle_descent,
@@ -403,7 +362,6 @@ impl ChatEdit {
             touch_info: SyncMutex::new(TouchInfo::new(scroll)),
             touch_info: SyncMutex::new(TouchInfo::new(scroll)),
             is_phone_select: AtomicBool::new(false),
             is_phone_select: AtomicBool::new(false),
 
 
-            old_window_scale: AtomicF32::new(window_scale.get()),
             window_scale: window_scale.clone(),
             window_scale: window_scale.clone(),
             parent_rect: SyncMutex::new(None),
             parent_rect: SyncMutex::new(None),
             is_mouse_hover: AtomicBool::new(false),
             is_mouse_hover: AtomicBool::new(false),
@@ -658,7 +616,7 @@ impl ChatEdit {
             KeyCode::Enter | KeyCode::KpEnter => {
             KeyCode::Enter | KeyCode::KpEnter => {
                 if mods.shift {
                 if mods.shift {
                     drv.insert_or_replace_selection("\n");
                     drv.insert_or_replace_selection("\n");
-                    editor.on_buffer_changed(atom);
+                    editor.on_buffer_changed(atom).await;
                 } else {
                 } else {
                     //let node = self.node.upgrade().unwrap();
                     //let node = self.node.upgrade().unwrap();
                     //node.trigger("enter_pressed", vec![]).await.unwrap();
                     //node.trigger("enter_pressed", vec![]).await.unwrap();
@@ -671,7 +629,7 @@ impl ChatEdit {
                 } else {
                 } else {
                     drv.delete();
                     drv.delete();
                 }
                 }
-                editor.on_buffer_changed(atom);
+                editor.on_buffer_changed(atom).await;
             }
             }
             KeyCode::Backspace => {
             KeyCode::Backspace => {
                 if action_mod {
                 if action_mod {
@@ -679,7 +637,7 @@ impl ChatEdit {
                 } else {
                 } else {
                     drv.backdelete();
                     drv.backdelete();
                 }
                 }
-                editor.on_buffer_changed(atom);
+                editor.on_buffer_changed(atom).await;
             }
             }
             KeyCode::Home => {
             KeyCode::Home => {
                 if action_mod {
                 if action_mod {
@@ -746,7 +704,7 @@ impl ChatEdit {
         // }
         // }
     }
     }
 
 
-    async fn handle_touch_start(&self, mut touch_pos: Point) -> bool {
+    async fn handle_touch_start(&self, touch_pos: Point) -> bool {
         t!("handle_touch_start({touch_pos:?})");
         t!("handle_touch_start({touch_pos:?})");
 
 
         let rect = self.rect.get();
         let rect = self.rect.get();
@@ -845,8 +803,7 @@ impl ChatEdit {
             TouchStateAction::Inactive => return false,
             TouchStateAction::Inactive => return false,
             TouchStateAction::StartSelect => {
             TouchStateAction::StartSelect => {
                 if self.text.get().is_empty() {
                 if self.text.get().is_empty() {
-                    let node = self.node.upgrade().unwrap();
-                    node.trigger("paste_request", vec![]).await.unwrap();
+                    self.node().trigger("paste_request", vec![]).await.unwrap();
                 } else {
                 } else {
                     self.abs_to_local(&mut touch_pos);
                     self.abs_to_local(&mut touch_pos);
                     self.start_touch_select(touch_pos, atom).await;
                     self.start_touch_select(touch_pos, atom).await;
@@ -877,7 +834,7 @@ impl ChatEdit {
 
 
                 let layout = editor.layout();
                 let layout = editor.layout();
                 t!("select  (pre): {:?}", sel.text_range());
                 t!("select  (pre): {:?}", sel.text_range());
-                let mut cursor = parley::Cursor::from_point(layout, pos.x, pos.y).index();
+                let cursor = parley::Cursor::from_point(layout, pos.x, pos.y).index();
                 t!("cursor: {cursor}");
                 t!("cursor: {cursor}");
 
 
                 // The selection is NOT allowed to cross over itself.
                 // The selection is NOT allowed to cross over itself.
@@ -930,13 +887,12 @@ impl ChatEdit {
             _ => {}
             _ => {}
         }
         }
 
 
-        let node = self.node.upgrade().unwrap();
-        node.trigger("focus_request", vec![]).await.unwrap();
+        self.node().trigger("focus_request", vec![]).await.unwrap();
 
 
         true
         true
     }
     }
 
 
-    async fn touch_set_cursor_pos(&self, mut touch_pos: Point) {
+    async fn touch_set_cursor_pos(&self, touch_pos: Point) {
         t!("touch_set_cursor_pos({touch_pos:?})");
         t!("touch_set_cursor_pos({touch_pos:?})");
 
 
         let mut editor = self.lock_editor().await;
         let mut editor = self.lock_editor().await;
@@ -953,7 +909,7 @@ impl ChatEdit {
         self.hide_cursor.store(false, Ordering::Relaxed);
         self.hide_cursor.store(false, Ordering::Relaxed);
         self.select_text
         self.select_text
             .clone()
             .clone()
-            .set_null(&mut PropertyAtomicGuard::new(), Role::Internal, 0)
+            .set_null(atom, Role::Internal, 0)
             .unwrap();
             .unwrap();
     }
     }
 
 
@@ -1099,8 +1055,6 @@ impl ChatEdit {
     }
     }
 
 
     async fn regen_select_mesh(&self) -> Vec<GfxDrawInstruction> {
     async fn regen_select_mesh(&self) -> Vec<GfxDrawInstruction> {
-        let padding_top = self.padding_top();
-
         let mut instrs = vec![GfxDrawInstruction::Move(self.inner_pos())];
         let mut instrs = vec![GfxDrawInstruction::Move(self.inner_pos())];
 
 
         let editor = self.lock_editor().await;
         let editor = self.lock_editor().await;
@@ -1125,13 +1079,11 @@ impl ChatEdit {
             return vec![]
             return vec![]
         }
         }
         //t!("regen_phone_select_handle_mesh()");
         //t!("regen_phone_select_handle_mesh()");
-        let (mut first, mut last) = self.get_select_handles().await.unwrap();
+        let (first, last) = self.get_select_handles().await.unwrap();
 
 
         let scroll = self.scroll.get();
         let scroll = self.scroll.get();
 
 
         let editor = self.lock_editor().await;
         let editor = self.lock_editor().await;
-        let layout = editor.layout();
-
         let sel = editor.selection();
         let sel = editor.selection();
         assert!(!sel.is_collapsed());
         assert!(!sel.is_collapsed());
 
 
@@ -1175,7 +1127,7 @@ impl ChatEdit {
         self.content_height.set(atom, content_height);
         self.content_height.set(atom, content_height);
         let outer_height = content_height + self.padding_top() + self.padding_bottom();
         let outer_height = content_height + self.padding_top() + self.padding_bottom();
         let rect_h = self.bounded_height(outer_height);
         let rect_h = self.bounded_height(outer_height);
-        self.rect.prop().set_f32(atom, Role::Internal, 3, rect_h);
+        self.rect.prop().set_f32(atom, Role::Internal, 3, rect_h).unwrap();
 
 
         // Finally calculate the position
         // Finally calculate the position
         self.rect
         self.rect
@@ -1191,10 +1143,10 @@ impl ChatEdit {
             .unwrap();
             .unwrap();
     }
     }
 
 
-    async fn make_draw_calls(&self, trace_id: u32, atom: &mut PropertyAtomicGuard) -> DrawUpdate {
+    async fn make_draw_calls(&self, _trace_id: u32, atom: &mut PropertyAtomicGuard) -> DrawUpdate {
         self.eval_rect(atom).await;
         self.eval_rect(atom).await;
 
 
-        let mut rect = self.rect.get();
+        let rect = self.rect.get();
         let max_scroll = self.max_scroll();
         let max_scroll = self.max_scroll();
         let mut scroll = self.scroll.get();
         let mut scroll = self.scroll.get();
         if scroll > max_scroll {
         if scroll > max_scroll {
@@ -1311,7 +1263,7 @@ impl ChatEdit {
             panic!("self destroyed before insert_text_method_task was stopped!");
             panic!("self destroyed before insert_text_method_task was stopped!");
         };
         };
 
 
-        let mut editor = self_.lock_editor().await;
+        let editor = self_.lock_editor().await;
         editor.focus();
         editor.focus();
         true
         true
     }
     }
@@ -1330,11 +1282,12 @@ impl ChatEdit {
             panic!("self destroyed before insert_text_method_task was stopped!");
             panic!("self destroyed before insert_text_method_task was stopped!");
         };
         };
 
 
-        let mut editor = self_.lock_editor().await;
+        let editor = self_.lock_editor().await;
         editor.unfocus();
         editor.unfocus();
         true
         true
     }
     }
 
 
+    #[cfg(target_os = "android")]
     async fn handle_android_event(&self, ev: AndroidSuggestEvent) {
     async fn handle_android_event(&self, ev: AndroidSuggestEvent) {
         t!("handle_android_event({ev:?})");
         t!("handle_android_event({ev:?})");
         if !self.is_active.get() {
         if !self.is_active.get() {
@@ -1475,7 +1428,8 @@ impl UIObject for ChatEdit {
         on_modify.when_change(self.debug.prop(), redraw);
         on_modify.when_change(self.debug.prop(), redraw);
 
 
         async fn regen_cursor(self_: Arc<ChatEdit>) {
         async fn regen_cursor(self_: Arc<ChatEdit>) {
-            let mesh = std::mem::take(&mut *self_.cursor_mesh.lock());
+            // Free the cache
+            *self_.cursor_mesh.lock() = None;
         }
         }
         on_modify.when_change(self.cursor_color.prop(), regen_cursor);
         on_modify.when_change(self.cursor_color.prop(), regen_cursor);
         on_modify.when_change(self.cursor_ascent.prop(), regen_cursor);
         on_modify.when_change(self.cursor_ascent.prop(), regen_cursor);
@@ -1548,7 +1502,7 @@ impl UIObject for ChatEdit {
         trace_id: u32,
         trace_id: u32,
         atom: &mut PropertyAtomicGuard,
         atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
-        t!("ChatEdit::draw({:?}, {trace_id})", self.node.upgrade().unwrap());
+        t!("ChatEdit::draw({:?}, {trace_id})", self.node());
         *self.parent_rect.lock() = Some(parent_rect);
         *self.parent_rect.lock() = Some(parent_rect);
 
 
         Some(self.make_draw_calls(trace_id, atom).await)
         Some(self.make_draw_calls(trace_id, atom).await)
@@ -1637,8 +1591,7 @@ impl UIObject for ChatEdit {
         if btn != MouseButton::Left {
         if btn != MouseButton::Left {
             if btn == MouseButton::Right && rect.contains(mouse_pos) {
             if btn == MouseButton::Right && rect.contains(mouse_pos) {
                 if self.text.get().is_empty() {
                 if self.text.get().is_empty() {
-                    let node = self.node.upgrade().unwrap();
-                    node.trigger("paste_request", vec![]).await.unwrap();
+                    self.node().trigger("paste_request", vec![]).await.unwrap();
                 }
                 }
                 return true
                 return true
             }
             }
@@ -1682,7 +1635,7 @@ impl UIObject for ChatEdit {
         true
         true
     }
     }
 
 
-    async fn handle_mouse_btn_up(&self, btn: MouseButton, mouse_pos: Point) -> bool {
+    async fn handle_mouse_btn_up(&self, _btn: MouseButton, _mouse_pos: Point) -> bool {
         if !self.is_active.get() {
         if !self.is_active.get() {
             return false
             return false
         }
         }

+ 11 - 20
bin/app/src/ui/chatview/mod.rs

@@ -19,7 +19,6 @@
 use async_lock::Mutex as AsyncMutex;
 use async_lock::Mutex as AsyncMutex;
 use async_trait::async_trait;
 use async_trait::async_trait;
 use atomic_float::AtomicF32;
 use atomic_float::AtomicF32;
-use chrono::{Local, TimeZone};
 use darkfi::system::{msleep, CondVar};
 use darkfi::system::{msleep, CondVar};
 use darkfi_serial::{deserialize, Decodable, Encodable, SerialDecodable, SerialEncodable};
 use darkfi_serial::{deserialize, Decodable, Encodable, SerialDecodable, SerialEncodable};
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
@@ -28,7 +27,6 @@ use rand::{rngs::OsRng, Rng};
 use sled_overlay::sled;
 use sled_overlay::sled;
 use std::{
 use std::{
     collections::VecDeque,
     collections::VecDeque,
-    hash::{DefaultHasher, Hash, Hasher},
     io::Cursor,
     io::Cursor,
     sync::{
     sync::{
         atomic::{AtomicBool, Ordering},
         atomic::{AtomicBool, Ordering},
@@ -41,18 +39,16 @@ use page::MessageBuffer;
 
 
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GraphicsEventPublisherPtr, Point, Rectangle,
+        GfxDrawCall, GfxDrawInstruction, Point, Rectangle,
         RenderApi,
         RenderApi,
     },
     },
-    mesh::{Color, MeshBuilder, COLOR_BLUE, COLOR_GREEN},
     prop::{
     prop::{
-        PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr,
+        PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32,
         PropertyRect, PropertyUint32, Role,
         PropertyRect, PropertyUint32, Role,
     },
     },
-    pubsub::Subscription,
     scene::{MethodCallSub, Pimpl, SceneNodeWeak},
     scene::{MethodCallSub, Pimpl, SceneNodeWeak},
-    text::{self, Glyph, GlyphPositionIter, TextShaperPtr},
-    util::{enumerate, is_whitespace, unixtime},
+    text::TextShaperPtr,
+    util::unixtime,
     ExecutorPtr,
     ExecutorPtr,
 };
 };
 
 
@@ -154,7 +150,6 @@ pub struct ChatView {
     node: SceneNodeWeak,
     node: SceneNodeWeak,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
     render_api: RenderApi,
     render_api: RenderApi,
-    text_shaper: TextShaperPtr,
 
 
     tree: sled::Tree,
     tree: sled::Tree,
     msgbuf: AsyncMutex<MessageBuffer>,
     msgbuf: AsyncMutex<MessageBuffer>,
@@ -197,7 +192,6 @@ impl ChatView {
         window_scale: PropertyFloat32,
         window_scale: PropertyFloat32,
         render_api: RenderApi,
         render_api: RenderApi,
         text_shaper: TextShaperPtr,
         text_shaper: TextShaperPtr,
-        ex: ExecutorPtr,
     ) -> Pimpl {
     ) -> Pimpl {
         t!("ChatView::new()");
         t!("ChatView::new()");
 
 
@@ -239,11 +233,9 @@ impl ChatView {
             node: node.clone(),
             node: node.clone(),
             tasks: SyncMutex::new(vec![]),
             tasks: SyncMutex::new(vec![]),
             render_api: render_api.clone(),
             render_api: render_api.clone(),
-            text_shaper: text_shaper.clone(),
 
 
             tree,
             tree,
             msgbuf: AsyncMutex::new(MessageBuffer::new(
             msgbuf: AsyncMutex::new(MessageBuffer::new(
-                node,
                 font_size,
                 font_size,
                 timestamp_font_size,
                 timestamp_font_size,
                 timestamp_width,
                 timestamp_width,
@@ -636,7 +628,7 @@ impl ChatView {
         rect_h: f32,
         rect_h: f32,
     ) -> Option<f32> {
     ) -> Option<f32> {
         // We still wish to preload pages to fill the screen, so we just adjust it up to 0.
         // We still wish to preload pages to fill the screen, so we just adjust it up to 0.
-        let nonneg_scroll = max(scroll, 0.);
+        //let nonneg_scroll = max(scroll, 0.);
 
 
         if scroll < 0. {
         if scroll < 0. {
             return Some(0.)
             return Some(0.)
@@ -662,8 +654,7 @@ impl ChatView {
         rect: &Rectangle,
         rect: &Rectangle,
     ) -> Vec<GfxDrawInstruction> {
     ) -> Vec<GfxDrawInstruction> {
         let scroll = self.scroll.get();
         let scroll = self.scroll.get();
-
-        let total_height = msgbuf.calc_total_height().await;
+        //let total_height = msgbuf.calc_total_height().await;
 
 
         // Use this to start from the top
         // Use this to start from the top
         //let start_pos = if total_height < rect.h { total_height } else { rect.h };
         //let start_pos = if total_height < rect.h { total_height } else { rect.h };
@@ -675,14 +666,14 @@ impl ChatView {
 
 
         let meshes = msgbuf.gen_meshes(rect, scroll).await;
         let meshes = msgbuf.gen_meshes(rect, scroll).await;
 
 
-        for (i, (y_pos, mesh)) in enumerate(meshes) {
+        for (y_pos, mesh) in meshes {
             // Apply scroll and scissor
             // Apply scroll and scissor
             // We use the scissor for scrolling
             // We use the scissor for scrolling
             // Because we use the scissor, our actual rect is now rect instead of parent_rect
             // Because we use the scissor, our actual rect is now rect instead of parent_rect
             let off_x = 0.;
             let off_x = 0.;
             // This calc decides whether scroll is in terms of pages or pixels
             // This calc decides whether scroll is in terms of pages or pixels
-            let off_y = (scroll + start_pos - y_pos);
-            let pos = Point::from([0., off_y]);
+            let off_y = scroll + start_pos - y_pos;
+            let pos = Point::from([off_x, off_y]);
 
 
             instrs.push(GfxDrawInstruction::SetPos(pos));
             instrs.push(GfxDrawInstruction::SetPos(pos));
             instrs.push(GfxDrawInstruction::Draw(mesh));
             instrs.push(GfxDrawInstruction::Draw(mesh));
@@ -835,7 +826,7 @@ impl UIObject for ChatView {
         msgbuf.adjust_width(rect.w);
         msgbuf.adjust_width(rect.w);
         msgbuf.clear_meshes();
         msgbuf.clear_meshes();
 
 
-        let mut scroll = self.scroll.get();
+        let scroll = self.scroll.get();
         if let Some(scroll) = self.adjust_scroll(&mut msgbuf, scroll, rect.h).await {
         if let Some(scroll) = self.adjust_scroll(&mut msgbuf, scroll, rect.h).await {
             self.scroll.set(atom, scroll);
             self.scroll.set(atom, scroll);
         }
         }
@@ -859,7 +850,7 @@ impl UIObject for ChatView {
         })
         })
     }
     }
 
 
-    async fn handle_key_down(&self, key: KeyCode, mods: KeyMods, repeat: bool) -> bool {
+    async fn handle_key_down(&self, key: KeyCode, _mods: KeyMods, repeat: bool) -> bool {
         if repeat {
         if repeat {
             return false
             return false
         }
         }

+ 14 - 41
bin/app/src/ui/chatview/page.rs

@@ -17,36 +17,30 @@
  */
  */
 
 
 use async_gen::{gen as async_gen, AsyncIter};
 use async_gen::{gen as async_gen, AsyncIter};
-use async_lock::Mutex as AsyncMutex;
 use chrono::{Local, NaiveDate, TimeZone};
 use chrono::{Local, NaiveDate, TimeZone};
 use futures::stream::{Stream, StreamExt};
 use futures::stream::{Stream, StreamExt};
 use std::{
 use std::{
     collections::HashMap,
     collections::HashMap,
     hash::{DefaultHasher, Hash, Hasher},
     hash::{DefaultHasher, Hash, Hasher},
-    io::Cursor,
     pin::pin,
     pin::pin,
-    sync::{atomic::Ordering, Arc, Mutex as SyncMutex, Weak},
 };
 };
 
 
 use super::{max, MessageId, Timestamp};
 use super::{max, MessageId, Timestamp};
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        gfxtag, GfxBufferId, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId,
-        GraphicsEventPublisherPtr, ManagedTexturePtr, Point, Rectangle, RenderApi,
+        gfxtag, GfxDrawMesh,
+        Rectangle, RenderApi,
     },
     },
-    mesh::{Color, MeshBuilder, COLOR_BLUE, COLOR_GREEN, COLOR_PINK, COLOR_WHITE},
-    prop::{PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr, PropertyUint32, Role},
-    pubsub::Subscription,
-    scene::{SceneNodePtr, SceneNodeWeak},
-    text::{self, glyph_str, Glyph, GlyphPositionIter, TextShaper, TextShaperPtr},
-    util::{enumerate_mut, enumerate_ref},
-    ExecutorPtr,
+    mesh::{Color, MeshBuilder, COLOR_BLUE, COLOR_PINK, COLOR_WHITE},
+    prop::{PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr},
+    text::{self, Glyph, GlyphPositionIter, TextShaper, TextShaperPtr},
+    util::enumerate_mut,
 };
 };
 
 
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatview::message_buffer", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatview::message_buffer", $($arg)*); } }
 
 
-const PAGE_SIZE: usize = 10;
-const PRELOAD_PAGES: usize = 10;
+//const PAGE_SIZE: usize = 10;
+//const PRELOAD_PAGES: usize = 10;
 
 
 const UNCONF_COLOR: [f32; 4] = [0.4, 0.4, 0.4, 1.];
 const UNCONF_COLOR: [f32; 4] = [0.4, 0.4, 0.4, 1.];
 
 
@@ -244,7 +238,7 @@ impl PrivMessage {
         baseline: f32,
         baseline: f32,
         nick_color: Color,
         nick_color: Color,
         mut text_color: Color,
         mut text_color: Color,
-        debug_render: bool,
+        _debug_render: bool,
     ) {
     ) {
         //debug!(target: "ui::chatview", "render_line({})", glyph_str(line));
         //debug!(target: "ui::chatview", "render_line({})", glyph_str(line));
         // Keep track of the 'section'
         // Keep track of the 'section'
@@ -453,9 +447,9 @@ impl DateMessage {
         clip: &Rectangle,
         clip: &Rectangle,
         line_height: f32,
         line_height: f32,
         baseline: f32,
         baseline: f32,
-        nick_colors: &[Color],
+        _nick_colors: &[Color],
         timestamp_color: Color,
         timestamp_color: Color,
-        text_color: Color,
+        _text_color: Color,
         debug_render: bool,
         debug_render: bool,
         render_api: &RenderApi,
         render_api: &RenderApi,
     ) -> GfxDrawMesh {
     ) -> GfxDrawMesh {
@@ -495,7 +489,7 @@ impl std::fmt::Debug for DateMessage {
 
 
 /// Easier than fucking around with traits nonsense
 /// Easier than fucking around with traits nonsense
 #[derive(Debug)]
 #[derive(Debug)]
-enum Message {
+pub enum Message {
     Priv(PrivMessage),
     Priv(PrivMessage),
     Date(DateMessage),
     Date(DateMessage),
 }
 }
@@ -598,7 +592,7 @@ impl Message {
 
 
     fn is_date(&self) -> bool {
     fn is_date(&self) -> bool {
         match self {
         match self {
-            Self::Priv(m) => false,
+            Self::Priv(_) => false,
             Self::Date(_) => true,
             Self::Date(_) => true,
         }
         }
     }
     }
@@ -610,12 +604,6 @@ impl Message {
         }
         }
     }
     }
 
 
-    fn get_privmsg(&self) -> Option<&PrivMessage> {
-        match self {
-            Message::Priv(msg) => Some(msg),
-            _ => None,
-        }
-    }
     fn get_privmsg_mut(&mut self) -> Option<&mut PrivMessage> {
     fn get_privmsg_mut(&mut self) -> Option<&mut PrivMessage> {
         match self {
         match self {
             Message::Priv(msg) => Some(msg),
             Message::Priv(msg) => Some(msg),
@@ -633,8 +621,6 @@ fn select_nick_color(nick: &str, nick_colors: &[Color]) -> Color {
 }
 }
 
 
 pub struct MessageBuffer {
 pub struct MessageBuffer {
-    node: SceneNodeWeak,
-
     /// From most recent to older
     /// From most recent to older
     msgs: Vec<Message>,
     msgs: Vec<Message>,
     date_msgs: HashMap<NaiveDate, Message>,
     date_msgs: HashMap<NaiveDate, Message>,
@@ -663,7 +649,6 @@ pub struct MessageBuffer {
 
 
 impl MessageBuffer {
 impl MessageBuffer {
     pub fn new(
     pub fn new(
-        node: SceneNodeWeak,
         font_size: PropertyFloat32,
         font_size: PropertyFloat32,
         timestamp_font_size: PropertyFloat32,
         timestamp_font_size: PropertyFloat32,
         timestamp_width: PropertyFloat32,
         timestamp_width: PropertyFloat32,
@@ -681,8 +666,6 @@ impl MessageBuffer {
     ) -> Self {
     ) -> Self {
         let old_window_scale = window_scale.get();
         let old_window_scale = window_scale.get();
         Self {
         Self {
-            node,
-
             msgs: vec![],
             msgs: vec![],
             date_msgs: HashMap::new(),
             date_msgs: HashMap::new(),
             line_width: 0.,
             line_width: 0.,
@@ -712,10 +695,6 @@ impl MessageBuffer {
         self.date_msgs.clear();
         self.date_msgs.clear();
     }
     }
 
 
-    fn node(&self) -> SceneNodePtr {
-        self.node.upgrade().unwrap()
-    }
-
     pub fn adjust_window_scale(&mut self) {
     pub fn adjust_window_scale(&mut self) {
         let window_scale = self.window_scale.get();
         let window_scale = self.window_scale.get();
         if self.old_window_scale == window_scale {
         if self.old_window_scale == window_scale {
@@ -797,7 +776,7 @@ impl MessageBuffer {
     }
     }
 
 
     fn find_privmsg_mut(&mut self, msg_id: &MessageId) -> Option<&mut PrivMessage> {
     fn find_privmsg_mut(&mut self, msg_id: &MessageId) -> Option<&mut PrivMessage> {
-        for (idx, msg) in enumerate_mut(&mut self.msgs) {
+        for msg in &mut self.msgs {
             let Some(privmsg) = msg.get_privmsg_mut() else { continue };
             let Some(privmsg) = msg.get_privmsg_mut() else { continue };
             if privmsg.id == *msg_id {
             if privmsg.id == *msg_id {
                 return Some(privmsg)
                 return Some(privmsg)
@@ -843,7 +822,6 @@ impl MessageBuffer {
         );
         );
 
 
         if self.msgs.is_empty() {
         if self.msgs.is_empty() {
-            let msg_idx = self.msgs.len();
             self.msgs.push(msg);
             self.msgs.push(msg);
             return self.msgs.last_mut().unwrap().get_privmsg_mut()
             return self.msgs.last_mut().unwrap().get_privmsg_mut()
         }
         }
@@ -1033,11 +1011,6 @@ impl MessageBuffer {
         Some(last_msg.timestamp())
         Some(last_msg.timestamp())
     }
     }
 
 
-    pub fn latest_timestamp(&self) -> Option<Timestamp> {
-        let first_msg = &self.msgs.first()?;
-        Some(first_msg.timestamp())
-    }
-
     fn read_nick_colors(&self) -> Vec<Color> {
     fn read_nick_colors(&self) -> Vec<Color> {
         let mut colors = vec![];
         let mut colors = vec![];
         let mut color = [0f32; 4];
         let mut color = [0f32; 4];

+ 4 - 11
bin/app/src/ui/emoji_picker/emoji.rs

@@ -26,18 +26,11 @@ use std::{
 
 
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId, ManagedTexturePtr,
-        Point, Rectangle, RenderApi,
+        gfxtag, GfxDrawMesh,
+        Rectangle, RenderApi,
     },
     },
-    mesh::{MeshBuilder, MeshInfo, COLOR_WHITE},
-    prop::{
-        PropertyAtomicGuard, PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr,
-        PropertyUint32, Role,
-    },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
-    text::{self, GlyphPositionIter, TextShaper, TextShaperPtr},
-    util::unixtime,
-    ExecutorPtr,
+    mesh::{MeshBuilder, COLOR_WHITE},
+    text::{self, TextShaperPtr},
 };
 };
 
 
 use super::default;
 use super::default;

+ 11 - 24
bin/app/src/ui/emoji_picker/mod.rs

@@ -18,30 +18,24 @@
 
 
 use async_trait::async_trait;
 use async_trait::async_trait;
 use darkfi_serial::Encodable;
 use darkfi_serial::Encodable;
-use image::ImageReader;
 use miniquad::{MouseButton, TouchPhase};
 use miniquad::{MouseButton, TouchPhase};
 use parking_lot::Mutex as SyncMutex;
 use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
-use std::{
-    io::Cursor,
-    sync::{
+use std::sync::{
         atomic::{AtomicBool, Ordering},
         atomic::{AtomicBool, Ordering},
-        Arc, Weak,
-    },
-};
+        Arc,
+    };
 
 
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId, ManagedTexturePtr, Point,
+        GfxDrawCall, GfxDrawInstruction, Point,
         Rectangle, RenderApi,
         Rectangle, RenderApi,
     },
     },
-    mesh::{MeshBuilder, MeshInfo, COLOR_WHITE},
     prop::{
     prop::{
-        PropertyAtomicGuard, PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr,
+        PropertyAtomicGuard, PropertyFloat32, PropertyRect,
         PropertyUint32, Role,
         PropertyUint32, Role,
     },
     },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
-    text::{self, GlyphPositionIter, TextShaper, TextShaperPtr},
+    scene::{Pimpl, SceneNodeWeak},
     util::unixtime,
     util::unixtime,
     ExecutorPtr,
     ExecutorPtr,
 };
 };
@@ -78,7 +72,6 @@ pub struct EmojiPicker {
     emoji_size: PropertyFloat32,
     emoji_size: PropertyFloat32,
     mouse_scroll_speed: PropertyFloat32,
     mouse_scroll_speed: PropertyFloat32,
 
 
-    window_scale: PropertyFloat32,
     parent_rect: SyncMutex<Option<Rectangle>>,
     parent_rect: SyncMutex<Option<Rectangle>>,
     is_mouse_hover: AtomicBool,
     is_mouse_hover: AtomicBool,
     touch_info: SyncMutex<Option<TouchInfo>>,
     touch_info: SyncMutex<Option<TouchInfo>>,
@@ -87,10 +80,8 @@ pub struct EmojiPicker {
 impl EmojiPicker {
 impl EmojiPicker {
     pub async fn new(
     pub async fn new(
         node: SceneNodeWeak,
         node: SceneNodeWeak,
-        window_scale: PropertyFloat32,
         render_api: RenderApi,
         render_api: RenderApi,
         emoji_meshes: EmojiMeshesPtr,
         emoji_meshes: EmojiMeshesPtr,
-        ex: ExecutorPtr,
     ) -> Pimpl {
     ) -> Pimpl {
         t!("EmojiPicker::new()");
         t!("EmojiPicker::new()");
 
 
@@ -103,9 +94,6 @@ impl EmojiPicker {
         let mouse_scroll_speed =
         let mouse_scroll_speed =
             PropertyFloat32::wrap(node_ref, Role::Internal, "mouse_scroll_speed", 0).unwrap();
             PropertyFloat32::wrap(node_ref, Role::Internal, "mouse_scroll_speed", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             render_api,
             render_api,
@@ -121,7 +109,6 @@ impl EmojiPicker {
             emoji_size,
             emoji_size,
             mouse_scroll_speed,
             mouse_scroll_speed,
 
 
-            window_scale,
             parent_rect: SyncMutex::new(None),
             parent_rect: SyncMutex::new(None),
             is_mouse_hover: AtomicBool::new(false),
             is_mouse_hover: AtomicBool::new(false),
             touch_info: SyncMutex::new(None),
             touch_info: SyncMutex::new(None),
@@ -179,7 +166,7 @@ impl EmojiPicker {
         //d!("    = {idx}, emoji_len = {}", emoji::EMOJI_LIST.len());
         //d!("    = {idx}, emoji_len = {}", emoji::EMOJI_LIST.len());
 
 
         let emoji_selected = {
         let emoji_selected = {
-            let mut emoji_meshes = self.emoji_meshes.lock();
+            let emoji_meshes = self.emoji_meshes.lock();
             let emoji_list = emoji_meshes.get_list();
             let emoji_list = emoji_meshes.get_list();
 
 
             if idx < emoji_list.len() {
             if idx < emoji_list.len() {
@@ -219,7 +206,7 @@ impl EmojiPicker {
     fn get_draw_calls(
     fn get_draw_calls(
         &self,
         &self,
         parent_rect: Rectangle,
         parent_rect: Rectangle,
-        trace_id: u32,
+        _trace_id: u32,
         atom: &mut PropertyAtomicGuard,
         atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
         if let Err(e) = self.rect.eval(&parent_rect) {
         if let Err(e) = self.rect.eval(&parent_rect) {
@@ -310,7 +297,7 @@ impl UIObject for EmojiPicker {
         self.get_draw_calls(parent_rect, trace_id, atom)
         self.get_draw_calls(parent_rect, trace_id, atom)
     }
     }
 
 
-    async fn handle_mouse_move(&self, mut mouse_pos: Point) -> bool {
+    async fn handle_mouse_move(&self, mouse_pos: Point) -> bool {
         let rect = self.rect.get();
         let rect = self.rect.get();
         self.is_mouse_hover.store(rect.contains(mouse_pos), Ordering::Relaxed);
         self.is_mouse_hover.store(rect.contains(mouse_pos), Ordering::Relaxed);
         false
         false
@@ -333,7 +320,7 @@ impl UIObject for EmojiPicker {
         true
         true
     }
     }
 
 
-    async fn handle_mouse_btn_up(&self, btn: MouseButton, mut mouse_pos: Point) -> bool {
+    async fn handle_mouse_btn_up(&self, _btn: MouseButton, mut mouse_pos: Point) -> bool {
         let rect = self.rect.get();
         let rect = self.rect.get();
         if !rect.contains(mouse_pos) {
         if !rect.contains(mouse_pos) {
             return false
             return false
@@ -345,7 +332,7 @@ impl UIObject for EmojiPicker {
         true
         true
     }
     }
 
 
-    async fn handle_touch(&self, phase: TouchPhase, id: u64, mut touch_pos: Point) -> bool {
+    async fn handle_touch(&self, phase: TouchPhase, id: u64, touch_pos: Point) -> bool {
         // Ignore multi-touch
         // Ignore multi-touch
         if id != 0 {
         if id != 0 {
             return false
             return false

+ 1 - 2
bin/app/src/ui/gesture.rs

@@ -24,10 +24,9 @@ use std::sync::{Arc, Mutex as SyncMutex};
 use crate::{
 use crate::{
     gfx::Point,
     gfx::Point,
     prop::{
     prop::{
-        PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr,
         PropertyUint32, Role,
         PropertyUint32, Role,
     },
     },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
+    scene::{Pimpl, SceneNodeWeak},
 };
 };
 
 
 use super::UIObject;
 use super::UIObject;

+ 17 - 21
bin/app/src/ui/image.rs

@@ -22,24 +22,23 @@ use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
 use std::{
 use std::{
     io::Cursor,
     io::Cursor,
-    sync::{Arc, Weak},
+    sync::Arc,
 };
 };
 
 
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId, ManagedTexturePtr,
+        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, ManagedTexturePtr,
         Rectangle, RenderApi,
         Rectangle, RenderApi,
     },
     },
     mesh::{MeshBuilder, MeshInfo, COLOR_WHITE},
     mesh::{MeshBuilder, MeshInfo, COLOR_WHITE},
-    prop::{PropertyAtomicGuard, PropertyPtr, PropertyRect, PropertyStr, PropertyUint32, Role},
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
+    prop::{PropertyAtomicGuard, PropertyRect, PropertyStr, PropertyUint32, Role},
+    scene::{Pimpl, SceneNodeWeak},
     util::unixtime,
     util::unixtime,
     ExecutorPtr,
     ExecutorPtr,
 };
 };
 
 
-use super::{DrawUpdate, OnModify, UIObject};
+use super::{DrawTrace, DrawUpdate, OnModify, UIObject};
 
 
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::image", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::image", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::image", $($arg)*); } }
 
 
 pub type ImagePtr = Arc<Image>;
 pub type ImagePtr = Arc<Image>;
@@ -62,7 +61,7 @@ pub struct Image {
 }
 }
 
 
 impl Image {
 impl Image {
-    pub async fn new(node: SceneNodeWeak, render_api: RenderApi, ex: ExecutorPtr) -> Pimpl {
+    pub async fn new(node: SceneNodeWeak, render_api: RenderApi) -> Pimpl {
         t!("Image::new()");
         t!("Image::new()");
 
 
         let node_ref = &node.upgrade().unwrap();
         let node_ref = &node.upgrade().unwrap();
@@ -72,9 +71,6 @@ impl Image {
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let path = PropertyStr::wrap(node_ref, Role::Internal, "path", 0).unwrap();
         let path = PropertyStr::wrap(node_ref, Role::Internal, "path", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             render_api,
             render_api,
@@ -111,8 +107,8 @@ impl Image {
         miniquad::fs::load_file(&path.clone(), move |res| match res {
         miniquad::fs::load_file(&path.clone(), move |res| match res {
             Ok(res) => *data2.lock() = res,
             Ok(res) => *data2.lock() = res,
             Err(e) => {
             Err(e) => {
-                error!(target: "ui::image", "Unable to open image: {path}");
-                panic!("Resource not found!");
+                error!(target: "ui::image", "Unable to open image: {path}: {e}");
+                panic!("Resource not found! {e}");
             }
             }
         });
         });
         let data = std::mem::take(&mut *data.lock());
         let data = std::mem::take(&mut *data.lock());
@@ -130,17 +126,17 @@ impl Image {
     }
     }
 
 
     async fn redraw(self: Arc<Self>) {
     async fn redraw(self: Arc<Self>) {
-        let trace_id = rand::random();
+        let trace: DrawTrace = rand::random();
         let timest = unixtime();
         let timest = unixtime();
-        t!("redraw({:?}) [trace_id={trace_id}]", self.node.upgrade().unwrap());
+        t!("redraw({:?}) [trace={trace}]", self.node.upgrade().unwrap());
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
 
 
-        let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
+        let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
             error!(target: "ui::image", "Image failed to draw");
             error!(target: "ui::image", "Image failed to draw");
             return
             return
         };
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        t!("redraw() DONE [trace_id={trace_id}]");
+        t!("redraw() DONE [trace={trace}]");
     }
     }
 
 
     /// Called whenever any property changes.
     /// Called whenever any property changes.
@@ -153,7 +149,7 @@ impl Image {
         mesh.alloc(&self.render_api)
         mesh.alloc(&self.render_api)
     }
     }
 
 
-    async fn get_draw_calls(&self, parent_rect: Rectangle, _: u32) -> Option<DrawUpdate> {
+    async fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
         self.rect.eval(&parent_rect).ok()?;
         self.rect.eval(&parent_rect).ok()?;
         let rect = self.rect.get();
         let rect = self.rect.get();
         self.uv.eval(&rect).ok()?;
         self.uv.eval(&rect).ok()?;
@@ -214,12 +210,12 @@ impl UIObject for Image {
     async fn draw(
     async fn draw(
         &self,
         &self,
         parent_rect: Rectangle,
         parent_rect: Rectangle,
-        trace_id: u32,
-        atom: &mut PropertyAtomicGuard,
+        trace: DrawTrace,
+        _atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
-        t!("Image::draw() [trace_id={trace_id}]");
+        t!("Image::draw() [trace={trace}]");
         *self.parent_rect.lock() = Some(parent_rect);
         *self.parent_rect.lock() = Some(parent_rect);
-        self.get_draw_calls(parent_rect, trace_id).await
+        self.get_draw_calls(parent_rect).await
     }
     }
 }
 }
 
 

+ 6 - 10
bin/app/src/ui/layer.rs

@@ -16,30 +16,29 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
  */
 
 
-use async_recursion::async_recursion;
 use async_trait::async_trait;
 use async_trait::async_trait;
-use atomic_float::AtomicF32;
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
 use parking_lot::Mutex as SyncMutex;
 use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
-use std::sync::{atomic::Ordering, Arc, Weak};
+use std::sync::Arc;
 
 
 use crate::{
 use crate::{
     gfx::{GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
     gfx::{GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
     prop::{
     prop::{
-        PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyPtr, PropertyRect,
+        PropertyAtomicGuard, PropertyBool, PropertyRect,
         PropertyUint32, Role,
         PropertyUint32, Role,
     },
     },
     scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
     scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
     util::unixtime,
     util::unixtime,
-    AndroidSuggestEvent, ExecutorPtr,
+    ExecutorPtr,
 };
 };
+#[cfg(target_os = "android")]
+use crate::AndroidSuggestEvent;
 
 
 use super::{
 use super::{
     get_children_ordered, get_ui_object3, get_ui_object_ptr, DrawUpdate, OnModify, UIObject,
     get_children_ordered, get_ui_object3, get_ui_object_ptr, DrawUpdate, OnModify, UIObject,
 };
 };
 
 
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::layer", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::layer", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::layer", $($arg)*); } }
 
 
 pub type LayerPtr = Arc<Layer>;
 pub type LayerPtr = Arc<Layer>;
@@ -59,7 +58,7 @@ pub struct Layer {
 }
 }
 
 
 impl Layer {
 impl Layer {
-    pub async fn new(node: SceneNodeWeak, render_api: RenderApi, ex: ExecutorPtr) -> Pimpl {
+    pub async fn new(node: SceneNodeWeak, render_api: RenderApi) -> Pimpl {
         let node_ref = &node.upgrade().unwrap();
         let node_ref = &node.upgrade().unwrap();
         t!("Layer::new({node_ref:?})");
         t!("Layer::new({node_ref:?})");
         let is_visible = PropertyBool::wrap(node_ref, Role::Internal, "is_visible", 0).unwrap();
         let is_visible = PropertyBool::wrap(node_ref, Role::Internal, "is_visible", 0).unwrap();
@@ -67,9 +66,6 @@ impl Layer {
         let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
         let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             render_api,
             render_api,

+ 28 - 29
bin/app/src/ui/mod.rs

@@ -18,34 +18,31 @@
 
 
 use async_trait::async_trait;
 use async_trait::async_trait;
 use futures::stream::{FuturesUnordered, StreamExt};
 use futures::stream::{FuturesUnordered, StreamExt};
-use log::{log_enabled, Level::Trace};
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
 use miniquad::{KeyCode, KeyMods, MouseButton, TouchPhase};
-use std::{
-    fmt::Debug,
-    sync::{Arc, Weak},
-};
+use std::sync::{Arc, Weak};
 
 
 use crate::{
 use crate::{
-    error::{Error, Result},
-    expr::{SExprMachine, SExprVal},
-    gfx::{GfxBufferId, GfxDrawCall, GfxDrawMesh, GfxTextureId, Point, Rectangle},
+    gfx::{GfxDrawCall, Point, Rectangle},
     prop::{ModifyAction, PropertyAtomicGuard, PropertyPtr, Role},
     prop::{ModifyAction, PropertyAtomicGuard, PropertyPtr, Role},
-    scene::{Pimpl, SceneNode as SceneNode3, SceneNodeId, SceneNodePtr, SceneNodeWeak},
-    AndroidSuggestEvent, ExecutorPtr,
+    scene::{Pimpl, SceneNode as SceneNode3, SceneNodePtr, SceneNodeWeak},
+    ExecutorPtr,
 };
 };
+#[cfg(target_os = "android")]
+use crate::AndroidSuggestEvent;
 
 
 mod button;
 mod button;
 pub use button::{Button, ButtonPtr};
 pub use button::{Button, ButtonPtr};
 pub mod chatview;
 pub mod chatview;
 pub use chatview::{ChatView, ChatViewPtr};
 pub use chatview::{ChatView, ChatViewPtr};
+mod baseedit;
 mod chatedit;
 mod chatedit;
 pub use chatedit::{ChatEdit, ChatEditPtr};
 pub use chatedit::{ChatEdit, ChatEditPtr};
-mod editbox;
-pub use editbox::{EditBox, EditBoxPtr};
+//mod editbox;
+//pub use editbox::{EditBox, EditBoxPtr};
 pub mod emoji_picker;
 pub mod emoji_picker;
 pub use emoji_picker::{EmojiPicker, EmojiPickerPtr};
 pub use emoji_picker::{EmojiPicker, EmojiPickerPtr};
 mod gesture;
 mod gesture;
-pub use gesture::{Gesture, GesturePtr};
+pub use gesture::GesturePtr;
 mod image;
 mod image;
 pub use image::{Image, ImagePtr};
 pub use image::{Image, ImagePtr};
 mod vector_art;
 mod vector_art;
@@ -65,48 +62,50 @@ pub use win::{Window, WindowPtr};
 macro_rules! e { ($($arg:tt)*) => { error!(target: "scene::on_modify", $($arg)*); } }
 macro_rules! e { ($($arg:tt)*) => { error!(target: "scene::on_modify", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "scene::on_modify", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "scene::on_modify", $($arg)*); } }
 
 
+type DrawTrace = u32;
+
 #[async_trait]
 #[async_trait]
 pub trait UIObject: Sync {
 pub trait UIObject: Sync {
     fn priority(&self) -> u32;
     fn priority(&self) -> u32;
 
 
     fn init(&self) {}
     fn init(&self) {}
 
 
-    async fn start(self: Arc<Self>, ex: ExecutorPtr) {}
+    async fn start(self: Arc<Self>, _ex: ExecutorPtr) {}
 
 
     /// Clear all buffers and caches
     /// Clear all buffers and caches
     fn stop(&self) {}
     fn stop(&self) {}
 
 
     async fn draw(
     async fn draw(
         &self,
         &self,
-        parent_rect: Rectangle,
-        trace_id: u32,
-        atom: &mut PropertyAtomicGuard,
+        _parent_rect: Rectangle,
+        _trace: DrawTrace,
+        _atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
         None
         None
     }
     }
 
 
-    async fn handle_char(&self, key: char, mods: KeyMods, repeat: bool) -> bool {
+    async fn handle_char(&self, _key: char, _mods: KeyMods, _repeat: bool) -> bool {
         false
         false
     }
     }
-    async fn handle_key_down(&self, key: KeyCode, mods: KeyMods, repeat: bool) -> bool {
+    async fn handle_key_down(&self, _key: KeyCode, _mods: KeyMods, _repeat: bool) -> bool {
         false
         false
     }
     }
-    async fn handle_key_up(&self, key: KeyCode, mods: KeyMods) -> bool {
+    async fn handle_key_up(&self, _key: KeyCode, _mods: KeyMods) -> bool {
         false
         false
     }
     }
-    async fn handle_mouse_btn_down(&self, btn: MouseButton, mouse_pos: Point) -> bool {
+    async fn handle_mouse_btn_down(&self, _btn: MouseButton, _mouse_pos: Point) -> bool {
         false
         false
     }
     }
-    async fn handle_mouse_btn_up(&self, btn: MouseButton, mouse_pos: Point) -> bool {
+    async fn handle_mouse_btn_up(&self, _btn: MouseButton, _mouse_pos: Point) -> bool {
         false
         false
     }
     }
-    async fn handle_mouse_move(&self, mouse_pos: Point) -> bool {
+    async fn handle_mouse_move(&self, _mouse_pos: Point) -> bool {
         false
         false
     }
     }
-    async fn handle_mouse_wheel(&self, wheel_pos: Point) -> bool {
+    async fn handle_mouse_wheel(&self, _wheel_pos: Point) -> bool {
         false
         false
     }
     }
-    async fn handle_touch(&self, phase: TouchPhase, id: u64, touch_pos: Point) -> bool {
+    async fn handle_touch(&self, _phase: TouchPhase, _id: u64, _touch_pos: Point) -> bool {
         false
         false
     }
     }
 }
 }
@@ -118,6 +117,7 @@ pub struct DrawUpdate {
 
 
 pub struct OnModify<T> {
 pub struct OnModify<T> {
     ex: ExecutorPtr,
     ex: ExecutorPtr,
+    #[allow(dead_code)]
     node: SceneNodeWeak,
     node: SceneNodeWeak,
     me: Weak<T>,
     me: Weak<T>,
     pub tasks: Vec<smol::Task<()>>,
     pub tasks: Vec<smol::Task<()>>,
@@ -139,7 +139,6 @@ impl<T: Send + Sync + 'static> OnModify<T> {
         }
         }
 
 
         let me = self.me.clone();
         let me = self.me.clone();
-        let node = self.node.clone();
         let task = self.ex.spawn(async move {
         let task = self.ex.spawn(async move {
             loop {
             loop {
                 let mut poll_queues = FuturesUnordered::new();
                 let mut poll_queues = FuturesUnordered::new();
@@ -168,7 +167,7 @@ impl<T: Send + Sync + 'static> OnModify<T> {
                     }
                     }
                 }
                 }
 
 
-                if (idx == 0) {
+                if idx == 0 {
                     t!("Property {:?} modified [depend_idx={idx}, role={role:?}]", prop);
                     t!("Property {:?} modified [depend_idx={idx}, role={role:?}]", prop);
                 } else {
                 } else {
                     t!(
                     t!(
@@ -196,7 +195,7 @@ pub fn get_ui_object_ptr(node: &SceneNode3) -> Arc<dyn UIObject + Send> {
         Pimpl::Layer(obj) => obj.clone(),
         Pimpl::Layer(obj) => obj.clone(),
         Pimpl::VectorArt(obj) => obj.clone(),
         Pimpl::VectorArt(obj) => obj.clone(),
         Pimpl::Text(obj) => obj.clone(),
         Pimpl::Text(obj) => obj.clone(),
-        Pimpl::EditBox(obj) => obj.clone(),
+        //Pimpl::EditBox(obj) => obj.clone(),
         Pimpl::ChatEdit(obj) => obj.clone(),
         Pimpl::ChatEdit(obj) => obj.clone(),
         Pimpl::ChatView(obj) => obj.clone(),
         Pimpl::ChatView(obj) => obj.clone(),
         Pimpl::Image(obj) => obj.clone(),
         Pimpl::Image(obj) => obj.clone(),
@@ -212,7 +211,7 @@ pub fn get_ui_object3<'a>(node: &'a SceneNode3) -> &'a dyn UIObject {
         Pimpl::Layer(obj) => obj.as_ref(),
         Pimpl::Layer(obj) => obj.as_ref(),
         Pimpl::VectorArt(obj) => obj.as_ref(),
         Pimpl::VectorArt(obj) => obj.as_ref(),
         Pimpl::Text(obj) => obj.as_ref(),
         Pimpl::Text(obj) => obj.as_ref(),
-        Pimpl::EditBox(obj) => obj.as_ref(),
+        //Pimpl::EditBox(obj) => obj.as_ref(),
         Pimpl::ChatEdit(obj) => obj.as_ref(),
         Pimpl::ChatEdit(obj) => obj.as_ref(),
         Pimpl::ChatView(obj) => obj.as_ref(),
         Pimpl::ChatView(obj) => obj.as_ref(),
         Pimpl::Image(obj) => obj.as_ref(),
         Pimpl::Image(obj) => obj.as_ref(),

+ 2 - 2
bin/app/src/ui/shortcut.rs

@@ -22,10 +22,10 @@ use std::sync::Arc;
 
 
 use crate::{
 use crate::{
     prop::{
     prop::{
-        PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr,
+        PropertyPtr,
         PropertyUint32, Role,
         PropertyUint32, Role,
     },
     },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
+    scene::{Pimpl, SceneNodeWeak},
 };
 };
 
 
 use super::UIObject;
 use super::UIObject;

+ 18 - 37
bin/app/src/ui/text.rs

@@ -19,42 +19,32 @@
 use async_trait::async_trait;
 use async_trait::async_trait;
 use parking_lot::Mutex as SyncMutex;
 use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
-use std::sync::{Arc, Weak};
+use std::sync::Arc;
 
 
 use crate::{
 use crate::{
     gfx::{
     gfx::{
-        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, GfxTextureId, ManagedTexturePtr,
-        Point, Rectangle, RenderApi,
+        gfxtag, GfxDrawCall, GfxDrawInstruction,
+        Rectangle, RenderApi,
     },
     },
-    mesh::{Color, MeshBuilder, MeshInfo, COLOR_BLUE, COLOR_RED, COLOR_WHITE},
     prop::{
     prop::{
-        PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr,
+        PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32,
         PropertyRect, PropertyStr, PropertyUint32, Role,
         PropertyRect, PropertyStr, PropertyUint32, Role,
     },
     },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
-    text::{self, GlyphPositionIter, TextShaper, TextShaperPtr},
+    scene::{Pimpl, SceneNodeWeak},
     text2::{self, TEXT_CTX},
     text2::{self, TEXT_CTX},
     util::unixtime,
     util::unixtime,
     ExecutorPtr,
     ExecutorPtr,
 };
 };
 
 
-use super::{DrawUpdate, OnModify, UIObject};
+use super::{DrawTrace, DrawUpdate, OnModify, UIObject};
 
 
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::text", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::text", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::text", $($arg)*); } }
 
 
 pub type TextPtr = Arc<Text>;
 pub type TextPtr = Arc<Text>;
 
 
-#[derive(Clone)]
-struct TextRenderInfo {
-    mesh: MeshInfo,
-    texture: ManagedTexturePtr,
-}
-
 pub struct Text {
 pub struct Text {
     node: SceneNodeWeak,
     node: SceneNodeWeak,
     render_api: RenderApi,
     render_api: RenderApi,
-    text_shaper: TextShaperPtr,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
     tasks: SyncMutex<Vec<smol::Task<()>>>,
 
 
     dc_key: u64,
     dc_key: u64,
@@ -65,7 +55,6 @@ pub struct Text {
     text: PropertyStr,
     text: PropertyStr,
     font_size: PropertyFloat32,
     font_size: PropertyFloat32,
     text_color: PropertyColor,
     text_color: PropertyColor,
-    baseline: PropertyFloat32,
     lineheight: PropertyFloat32,
     lineheight: PropertyFloat32,
     debug: PropertyBool,
     debug: PropertyBool,
 
 
@@ -78,8 +67,6 @@ impl Text {
         node: SceneNodeWeak,
         node: SceneNodeWeak,
         window_scale: PropertyFloat32,
         window_scale: PropertyFloat32,
         render_api: RenderApi,
         render_api: RenderApi,
-        text_shaper: TextShaperPtr,
-        ex: ExecutorPtr,
     ) -> Pimpl {
     ) -> Pimpl {
         t!("Text::new()");
         t!("Text::new()");
 
 
@@ -90,17 +77,12 @@ impl Text {
         let text = PropertyStr::wrap(node_ref, Role::Internal, "text", 0).unwrap();
         let text = PropertyStr::wrap(node_ref, Role::Internal, "text", 0).unwrap();
         let font_size = PropertyFloat32::wrap(node_ref, Role::Internal, "font_size", 0).unwrap();
         let font_size = PropertyFloat32::wrap(node_ref, Role::Internal, "font_size", 0).unwrap();
         let text_color = PropertyColor::wrap(node_ref, Role::Internal, "text_color").unwrap();
         let text_color = PropertyColor::wrap(node_ref, Role::Internal, "text_color").unwrap();
-        let baseline = PropertyFloat32::wrap(node_ref, Role::Internal, "baseline", 0).unwrap();
         let lineheight = PropertyFloat32::wrap(node_ref, Role::Internal, "lineheight", 0).unwrap();
         let lineheight = PropertyFloat32::wrap(node_ref, Role::Internal, "lineheight", 0).unwrap();
         let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap();
         let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             render_api,
             render_api,
-            text_shaper,
             tasks: SyncMutex::new(vec![]),
             tasks: SyncMutex::new(vec![]),
             dc_key: OsRng.gen(),
             dc_key: OsRng.gen(),
 
 
@@ -110,7 +92,6 @@ impl Text {
             text,
             text,
             font_size,
             font_size,
             text_color,
             text_color,
-            baseline,
             lineheight,
             lineheight,
             debug,
             debug,
 
 
@@ -133,29 +114,29 @@ impl Text {
             txt_ctx.make_layout(&text, text_color, font_size, lineheight, window_scale, None, &[])
             txt_ctx.make_layout(&text, text_color, font_size, lineheight, window_scale, None, &[])
         };
         };
 
 
-        let mut debug_opts = text2::DebugRenderOptions::Off;
+        let mut debug_opts = text2::DebugRenderOptions::OFF;
         if self.debug.get() {
         if self.debug.get() {
-            debug_opts |= text2::DebugRenderOptions::Baseline;
+            debug_opts |= text2::DebugRenderOptions::BASELINE;
         }
         }
 
 
         text2::render_layout_with_opts(&layout, debug_opts, &self.render_api, gfxtag!("text"))
         text2::render_layout_with_opts(&layout, debug_opts, &self.render_api, gfxtag!("text"))
     }
     }
 
 
     async fn redraw(self: Arc<Self>) {
     async fn redraw(self: Arc<Self>) {
-        let trace_id = rand::random();
+        let trace: DrawTrace = rand::random();
         let timest = unixtime();
         let timest = unixtime();
-        t!("Text::redraw({:?}) [trace_id={trace_id}]", self.node.upgrade().unwrap());
+        t!("Text::redraw({:?}) [trace={trace}]", self.node.upgrade().unwrap());
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
 
 
-        let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
-            error!(target: "ui::text", "Text failed to draw [trace_id={trace_id}]");
+        let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
+            error!(target: "ui::text", "Text failed to draw [trace={trace}]");
             return
             return
         };
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        t!("Text::redraw() DONE [trace_id={trace_id}]");
+        t!("Text::redraw() DONE [trace={trace}]");
     }
     }
 
 
-    async fn get_draw_calls(&self, parent_rect: Rectangle, trace_id: u32) -> Option<DrawUpdate> {
+    async fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
         self.rect.eval(&parent_rect).ok()?;
         self.rect.eval(&parent_rect).ok()?;
         let rect = self.rect.get();
         let rect = self.rect.get();
 
 
@@ -200,12 +181,12 @@ impl UIObject for Text {
     async fn draw(
     async fn draw(
         &self,
         &self,
         parent_rect: Rectangle,
         parent_rect: Rectangle,
-        trace_id: u32,
-        atom: &mut PropertyAtomicGuard,
+        trace: DrawTrace,
+        _atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
-        t!("Text::draw({:?}) [trace_id={trace_id}]", self.node.upgrade().unwrap());
+        t!("Text::draw({:?}) [trace={trace}]", self.node.upgrade().unwrap());
         *self.parent_rect.lock() = Some(parent_rect);
         *self.parent_rect.lock() = Some(parent_rect);
-        self.get_draw_calls(parent_rect, trace_id).await
+        self.get_draw_calls(parent_rect).await
     }
     }
 }
 }
 
 

+ 16 - 25
bin/app/src/ui/vector_art/mod.rs

@@ -19,31 +19,26 @@
 use async_trait::async_trait;
 use async_trait::async_trait;
 use parking_lot::Mutex as SyncMutex;
 use parking_lot::Mutex as SyncMutex;
 use rand::{rngs::OsRng, Rng};
 use rand::{rngs::OsRng, Rng};
-use std::sync::{Arc, Weak};
+use std::sync::Arc;
 
 
 use crate::{
 use crate::{
-    error::{Error, Result},
-    expr::{Op, SExprCode, SExprMachine, SExprVal},
     gfx::{
     gfx::{
-        gfxtag, GfxBufferId, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, Rectangle, RenderApi,
-        Vertex,
+        gfxtag, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, Rectangle, RenderApi,
     },
     },
-    mesh::Color,
     prop::{
     prop::{
-        PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyPtr, PropertyRect,
+        PropertyAtomicGuard, PropertyBool, PropertyRect,
         PropertyUint32, Role,
         PropertyUint32, Role,
     },
     },
-    scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
-    util::{enumerate, unixtime},
+    scene::{Pimpl, SceneNodeWeak},
+    util::unixtime,
     ExecutorPtr,
     ExecutorPtr,
 };
 };
 
 
-use super::{DrawUpdate, OnModify, UIObject};
+use super::{DrawTrace, DrawUpdate, OnModify, UIObject};
 
 
 pub mod shape;
 pub mod shape;
 use shape::VectorShape;
 use shape::VectorShape;
 
 
-macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::vector_art", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::vector_art", $($arg)*); } }
 macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::vector_art", $($arg)*); } }
 
 
 pub type VectorArtPtr = Arc<VectorArt>;
 pub type VectorArtPtr = Arc<VectorArt>;
@@ -69,7 +64,6 @@ impl VectorArt {
         node: SceneNodeWeak,
         node: SceneNodeWeak,
         shape: VectorShape,
         shape: VectorShape,
         render_api: RenderApi,
         render_api: RenderApi,
-        ex: ExecutorPtr,
     ) -> Pimpl {
     ) -> Pimpl {
         t!("VectorArt::new()");
         t!("VectorArt::new()");
 
 
@@ -79,9 +73,6 @@ impl VectorArt {
         let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
         let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
         let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap();
 
 
-        let node_name = node_ref.name.clone();
-        let node_id = node_ref.id;
-
         let self_ = Arc::new(Self {
         let self_ = Arc::new(Self {
             node,
             node,
             render_api,
             render_api,
@@ -106,13 +97,13 @@ impl VectorArt {
     }
     }
 
 
     async fn redraw(self: Arc<Self>) {
     async fn redraw(self: Arc<Self>) {
-        let trace_id = rand::random();
+        let trace = rand::random();
         let timest = unixtime();
         let timest = unixtime();
-        trace!(target: "ui::vector_art", "VectorArt::redraw({}) [trace_id={trace_id}]", self.node_path());
+        trace!(target: "ui::vector_art", "VectorArt::redraw({}) [trace={trace}]", self.node_path());
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
         let Some(parent_rect) = self.parent_rect.lock().clone() else { return };
 
 
-        let Some(draw_update) = self.get_draw_calls(parent_rect, trace_id).await else {
-            error!(target: "ui::vector_art", "Mesh failed to draw [trace_id={trace_id}]");
+        let Some(draw_update) = self.get_draw_calls(parent_rect, trace).await else {
+            error!(target: "ui::vector_art", "Mesh failed to draw [trace={trace}]");
             return
             return
         };
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
@@ -141,9 +132,9 @@ impl VectorArt {
         vec![GfxDrawInstruction::Move(rect.pos()), GfxDrawInstruction::Draw(mesh)]
         vec![GfxDrawInstruction::Move(rect.pos()), GfxDrawInstruction::Draw(mesh)]
     }
     }
 
 
-    async fn get_draw_calls(&self, parent_rect: Rectangle, trace_id: u32) -> Option<DrawUpdate> {
+    async fn get_draw_calls(&self, parent_rect: Rectangle, trace: DrawTrace) -> Option<DrawUpdate> {
         if let Err(e) = self.rect.eval(&parent_rect) {
         if let Err(e) = self.rect.eval(&parent_rect) {
-            warn!(target: "ui::vector_art", "Rect eval failure: {e} [trace_id={trace_id}]");
+            warn!(target: "ui::vector_art", "Rect eval failure: {e} [trace={trace}]");
             return None
             return None
         }
         }
         let instrs = self.get_draw_instrs();
         let instrs = self.get_draw_instrs();
@@ -182,12 +173,12 @@ impl UIObject for VectorArt {
     async fn draw(
     async fn draw(
         &self,
         &self,
         parent_rect: Rectangle,
         parent_rect: Rectangle,
-        trace_id: u32,
-        atom: &mut PropertyAtomicGuard,
+        trace: DrawTrace,
+        _atom: &mut PropertyAtomicGuard,
     ) -> Option<DrawUpdate> {
     ) -> Option<DrawUpdate> {
-        t!("VectorArt::draw({}) [trace_id={trace_id}]", self.node_path());
+        t!("VectorArt::draw({}) [trace={trace}]", self.node_path());
         *self.parent_rect.lock() = Some(parent_rect);
         *self.parent_rect.lock() = Some(parent_rect);
-        self.get_draw_calls(parent_rect, trace_id).await
+        self.get_draw_calls(parent_rect, trace).await
     }
     }
 }
 }
 
 

+ 4 - 7
bin/app/src/ui/vector_art/shape.rs

@@ -17,13 +17,10 @@
  */
  */
 
 
 use crate::{
 use crate::{
-    error::{Error, Result},
+    error::Result,
     expr::{Op, SExprCode, SExprMachine, SExprVal},
     expr::{Op, SExprCode, SExprMachine, SExprVal},
-    gfx::{GfxBufferId, GfxDrawCall, GfxDrawInstruction, GfxDrawMesh, Rectangle, Vertex},
+    gfx::Vertex,
     mesh::Color,
     mesh::Color,
-    prop::{PropertyPtr, PropertyUint32, Role},
-    util::enumerate,
-    ExecutorPtr,
 };
 };
 
 
 #[derive(Debug)]
 #[derive(Debug)]
@@ -68,13 +65,13 @@ impl VectorShape {
         let mut verts = vec![];
         let mut verts = vec![];
         for shape_vert in &self.verts {
         for shape_vert in &self.verts {
             let mut pos = [0.; 2];
             let mut pos = [0.; 2];
-            for (i, shape_X) in [(0, &shape_vert.x), (1, &shape_vert.y)] {
+            for (i, shape_x) in [(0, &shape_vert.x), (1, &shape_vert.y)] {
                 let mut machine = SExprMachine {
                 let mut machine = SExprMachine {
                     globals: vec![
                     globals: vec![
                         ("w".to_string(), SExprVal::Float32(w)),
                         ("w".to_string(), SExprVal::Float32(w)),
                         ("h".to_string(), SExprVal::Float32(h)),
                         ("h".to_string(), SExprVal::Float32(h)),
                     ],
                     ],
-                    stmts: shape_X,
+                    stmts: shape_x,
                 };
                 };
                 pos[i] = machine.call()?.as_f32()?;
                 pos[i] = machine.call()?.as_f32()?;
             }
             }

+ 5 - 4
bin/app/src/ui/win.rs

@@ -25,14 +25,15 @@ use crate::{
         GfxDrawCall, GfxDrawInstruction, GraphicsEventCharSub, GraphicsEventKeyDownSub,
         GfxDrawCall, GfxDrawInstruction, GraphicsEventCharSub, GraphicsEventKeyDownSub,
         GraphicsEventKeyUpSub, GraphicsEventMouseButtonDownSub, GraphicsEventMouseButtonUpSub,
         GraphicsEventKeyUpSub, GraphicsEventMouseButtonDownSub, GraphicsEventMouseButtonUpSub,
         GraphicsEventMouseMoveSub, GraphicsEventMouseWheelSub, GraphicsEventPublisherPtr,
         GraphicsEventMouseMoveSub, GraphicsEventMouseWheelSub, GraphicsEventPublisherPtr,
-        GraphicsEventResizeSub, GraphicsEventTouchSub, Point, Rectangle, RenderApi,
+        GraphicsEventTouchSub, Point, Rectangle, RenderApi,
     },
     },
-    prop::{PropertyAtomicGuard, PropertyDimension, PropertyFloat32, PropertyPtr, Role},
-    pubsub::Subscription,
+    prop::{PropertyAtomicGuard, PropertyDimension, PropertyFloat32, Role},
     scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
     scene::{Pimpl, SceneNodePtr, SceneNodeWeak},
     util::unixtime,
     util::unixtime,
-    AndroidSuggestEvent, ExecutorPtr,
+    ExecutorPtr,
 };
 };
+#[cfg(target_os = "android")]
+use crate::AndroidSuggestEvent;
 
 
 use super::{get_children_ordered, get_ui_object3, get_ui_object_ptr, OnModify};
 use super::{get_children_ordered, get_ui_object3, get_ui_object_ptr, OnModify};
 
 

+ 3 - 12
bin/app/src/util/mod.rs

@@ -22,18 +22,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
 mod rt;
 mod rt;
 pub use rt::{AsyncRuntime, ExecutorPtr};
 pub use rt::{AsyncRuntime, ExecutorPtr};
 
 
-pub fn is_whitespace(s: &str) -> bool {
-    s.chars().all(char::is_whitespace)
-}
-
-pub fn min_f32(x: f32, y: f32) -> f32 {
-    if x < y {
-        x
-    } else {
-        y
-    }
-}
-
 /// Use src/util/time.rs Timestamp instead of this.
 /// Use src/util/time.rs Timestamp instead of this.
 pub fn unixtime() -> u64 {
 pub fn unixtime() -> u64 {
     let timest = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis();
     let timest = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis();
@@ -128,6 +116,7 @@ where
     }
     }
 }
 }
 
 
+#[allow(dead_code)]
 pub fn zip3<X1, X2, X3, I1, I2, I3>(i1: I1, i2: I2, i3: I3) -> TupleIterStruct3<I1, I2, I3>
 pub fn zip3<X1, X2, X3, I1, I2, I3>(i1: I1, i2: I2, i3: I3) -> TupleIterStruct3<I1, I2, I3>
 where
 where
     I1: Iterator<Item = X1>,
     I1: Iterator<Item = X1>,
@@ -183,9 +172,11 @@ where
     TupleIterStruct4 { idx: 0, i1, i2, i3, i4 }
     TupleIterStruct4 { idx: 0, i1, i2, i3, i4 }
 }
 }
 
 
+#[allow(dead_code)]
 pub fn enumerate<X>(v: Vec<X>) -> impl Iterator<Item = (usize, X)> {
 pub fn enumerate<X>(v: Vec<X>) -> impl Iterator<Item = (usize, X)> {
     v.into_iter().enumerate()
     v.into_iter().enumerate()
 }
 }
+#[allow(dead_code)]
 pub fn enumerate_ref<X>(v: &Vec<X>) -> impl Iterator<Item = (usize, &X)> {
 pub fn enumerate_ref<X>(v: &Vec<X>) -> impl Iterator<Item = (usize, &X)> {
     v.iter().enumerate()
     v.iter().enumerate()
 }
 }