|
@@ -28,7 +28,7 @@ use crate::{
|
|
|
},
|
|
},
|
|
|
expr,
|
|
expr,
|
|
|
gfx::gfxtag,
|
|
gfx::gfxtag,
|
|
|
- mesh::{COLOR_CYAN, COLOR_PALECYAN},
|
|
|
|
|
|
|
+ mesh::{COLOR_CYAN, COLOR_DARKTEAL, COLOR_PALECYAN, COLOR_TRANSTEAL},
|
|
|
prop::{PropertyAtomicGuard, PropertyBool, PropertyFloat32, Role},
|
|
prop::{PropertyAtomicGuard, PropertyBool, PropertyFloat32, Role},
|
|
|
scene::{Pimpl, SceneNodePtr, Slot},
|
|
scene::{Pimpl, SceneNodePtr, Slot},
|
|
|
shape,
|
|
shape,
|
|
@@ -171,29 +171,53 @@ pub async fn make(
|
|
|
|
|
|
|
|
y += PADDING_Y * 2. + SUBTITLE_FONTSIZE;
|
|
y += PADDING_Y * 2. + SUBTITLE_FONTSIZE;
|
|
|
|
|
|
|
|
- // Recipient input outline
|
|
|
|
|
- let node = create_vector_art("send_recipient_input_outline");
|
|
|
|
|
|
|
+ // Paste button
|
|
|
|
|
+ let node = create_vector_art("send_paste_btn_bg");
|
|
|
let prop = node.get_property("rect").unwrap();
|
|
let prop = node.get_property("rect").unwrap();
|
|
|
- prop.set_default_f32(0, RECIPIENT_INPUT_MARGIN).unwrap();
|
|
|
|
|
- prop.set_default_f32(1, y).unwrap();
|
|
|
|
|
- let code = cc.compile("w - RECIPIENT_INPUT_MARGIN * 2").unwrap();
|
|
|
|
|
- prop.set_default_expr(2, code).unwrap();
|
|
|
|
|
- prop.set_default_f32(3, RECIPIENT_INPUT_HEIGHT).unwrap();
|
|
|
|
|
|
|
+ let code = cc.compile("w - RECIPIENT_INPUT_MARGIN - PASTE_WIDTH / 2").unwrap();
|
|
|
|
|
+ prop.set_default_expr(0, code).unwrap();
|
|
|
|
|
+ prop.set_default_f32(1, y + RECIPIENT_INPUT_HEIGHT / 2.).unwrap();
|
|
|
|
|
+ prop.set_default_f32(2, 500.).unwrap();
|
|
|
|
|
+ prop.set_default_f32(3, 500.).unwrap();
|
|
|
node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
|
|
node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
|
|
|
- let mut shape = VectorShape::new();
|
|
|
|
|
- shape.add_outline(
|
|
|
|
|
- expr::const_f32(0.),
|
|
|
|
|
- expr::const_f32(0.),
|
|
|
|
|
- expr::load_var("w"),
|
|
|
|
|
- expr::load_var("h"),
|
|
|
|
|
- 1.,
|
|
|
|
|
- [0.2, 0.2745, 0.2784, 1.],
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ let shape = shape::create_paste(COLOR_CYAN).scaled(PASTE_SCALE);
|
|
|
node.set_property_shape(atom, Role::App, "shape", shape).unwrap();
|
|
node.set_property_shape(atom, Role::App, "shape", shape).unwrap();
|
|
|
let node =
|
|
let node =
|
|
|
node.setup(|me| VectorArt::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
node.setup(|me| VectorArt::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
|
send_step2_layer.link(node);
|
|
send_step2_layer.link(node);
|
|
|
|
|
|
|
|
|
|
+ let node = create_button("send_paste_btn");
|
|
|
|
|
+ node.set_property_bool(atom, Role::App, "is_active", true).unwrap();
|
|
|
|
|
+ let prop = node.get_property("rect").unwrap();
|
|
|
|
|
+ let code = cc.compile("w - RECIPIENT_INPUT_MARGIN - PASTE_WIDTH").unwrap();
|
|
|
|
|
+ prop.set_default_expr(0, code).unwrap();
|
|
|
|
|
+ prop.set_default_f32(1, y).unwrap();
|
|
|
|
|
+ prop.set_default_f32(2, PASTE_WIDTH).unwrap();
|
|
|
|
|
+ prop.set_default_f32(3, RECIPIENT_INPUT_HEIGHT).unwrap();
|
|
|
|
|
+ node.set_property_u32(atom, Role::App, "z_index", 3).unwrap();
|
|
|
|
|
+
|
|
|
|
|
+ let (slot, recvr) = Slot::new("send_paste_clicked");
|
|
|
|
|
+ node.register("click", slot).unwrap();
|
|
|
|
|
+ let send_step2_layer2 = send_step2_layer.clone();
|
|
|
|
|
+ let redraw_clone = app.redraw_trigger.clone();
|
|
|
|
|
+ let listen_click = app.ex.spawn(async move {
|
|
|
|
|
+ while let Ok(_) = recvr.recv().await {
|
|
|
|
|
+ let Some(recipient_input) = send_step2_layer2.lookup_node("/send_recipient_input")
|
|
|
|
|
+ else {
|
|
|
|
|
+ continue
|
|
|
|
|
+ };
|
|
|
|
|
+ if let Some(clipboard_text) = clipboard::get() {
|
|
|
|
|
+ let atom = &mut redraw_clone.make_guard(gfxtag!("step2 recipient paste"));
|
|
|
|
|
+ recipient_input.set_property_str(atom, Role::App, "text", clipboard_text).unwrap();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ app.tasks.lock().push(listen_click);
|
|
|
|
|
+
|
|
|
|
|
+ let node =
|
|
|
|
|
+ node.setup(|me| Button::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
|
|
|
+ send_step2_layer.link(node);
|
|
|
|
|
+
|
|
|
// Recipient input
|
|
// Recipient input
|
|
|
let recipient_input = create_singleline_edit("send_recipient_input");
|
|
let recipient_input = create_singleline_edit("send_recipient_input");
|
|
|
recipient_input.set_property_bool(atom, Role::App, "is_active", true).unwrap();
|
|
recipient_input.set_property_bool(atom, Role::App, "is_active", true).unwrap();
|
|
@@ -210,10 +234,10 @@ pub async fn make(
|
|
|
.set_property_f32(atom, Role::App, "font_size", RECIPIENT_INPUT_FONTSIZE)
|
|
.set_property_f32(atom, Role::App, "font_size", RECIPIENT_INPUT_FONTSIZE)
|
|
|
.unwrap();
|
|
.unwrap();
|
|
|
recipient_input
|
|
recipient_input
|
|
|
- .set_property_str(atom, Role::App, "placeholder_text", "recipient address...")
|
|
|
|
|
|
|
+ .set_property_str(atom, Role::App, "placeholder_text", "recipient address")
|
|
|
.unwrap();
|
|
.unwrap();
|
|
|
let prop = recipient_input.get_property("placeholder_color").unwrap();
|
|
let prop = recipient_input.get_property("placeholder_color").unwrap();
|
|
|
- prop.set_default_f32_multi(&[1., 1., 1., 0.45]).unwrap();
|
|
|
|
|
|
|
+ prop.set_default_f32_multi(&COLOR_DARKTEAL).unwrap();
|
|
|
let prop = recipient_input.get_property("text_color").unwrap();
|
|
let prop = recipient_input.get_property("text_color").unwrap();
|
|
|
prop.set_default_f32_multi(&[1., 1., 1., 1.]).unwrap();
|
|
prop.set_default_f32_multi(&[1., 1., 1., 1.]).unwrap();
|
|
|
let prop = recipient_input.get_property("hi_bg_color").unwrap();
|
|
let prop = recipient_input.get_property("hi_bg_color").unwrap();
|
|
@@ -250,49 +274,36 @@ pub async fn make(
|
|
|
.await;
|
|
.await;
|
|
|
send_step2_layer.link(recipient_input.clone());
|
|
send_step2_layer.link(recipient_input.clone());
|
|
|
|
|
|
|
|
- // Paste button
|
|
|
|
|
- let node = create_vector_art("send_paste_btn_bg");
|
|
|
|
|
|
|
+ // Recipient input outline
|
|
|
|
|
+ let node = create_vector_art("send_recipient_input_outline");
|
|
|
let prop = node.get_property("rect").unwrap();
|
|
let prop = node.get_property("rect").unwrap();
|
|
|
- let code = cc.compile("w - RECIPIENT_INPUT_MARGIN - PASTE_WIDTH / 2").unwrap();
|
|
|
|
|
- prop.set_default_expr(0, code).unwrap();
|
|
|
|
|
- prop.set_default_f32(1, y + RECIPIENT_INPUT_HEIGHT / 2.).unwrap();
|
|
|
|
|
- prop.set_default_f32(2, 500.).unwrap();
|
|
|
|
|
- prop.set_default_f32(3, 500.).unwrap();
|
|
|
|
|
|
|
+ prop.set_default_f32(0, RECIPIENT_INPUT_MARGIN).unwrap();
|
|
|
|
|
+ prop.set_default_f32(1, y).unwrap();
|
|
|
|
|
+ let code = cc.compile("w - RECIPIENT_INPUT_MARGIN * 2").unwrap();
|
|
|
|
|
+ prop.set_default_expr(2, code).unwrap();
|
|
|
|
|
+ prop.set_default_f32(3, RECIPIENT_INPUT_HEIGHT).unwrap();
|
|
|
node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
|
|
node.set_property_u32(atom, Role::App, "z_index", 2).unwrap();
|
|
|
- let shape = shape::create_paste(COLOR_CYAN).scaled(PASTE_SCALE);
|
|
|
|
|
|
|
+ let mut shape = VectorShape::new();
|
|
|
|
|
+ shape.add_filled_box(
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::load_var("w"),
|
|
|
|
|
+ expr::load_var("h"),
|
|
|
|
|
+ COLOR_TRANSTEAL,
|
|
|
|
|
+ );
|
|
|
|
|
+ shape.add_outline(
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::const_f32(0.),
|
|
|
|
|
+ expr::load_var("w"),
|
|
|
|
|
+ expr::load_var("h"),
|
|
|
|
|
+ 1.,
|
|
|
|
|
+ [0.2, 0.2745, 0.2784, 1.],
|
|
|
|
|
+ );
|
|
|
node.set_property_shape(atom, Role::App, "shape", shape).unwrap();
|
|
node.set_property_shape(atom, Role::App, "shape", shape).unwrap();
|
|
|
let node =
|
|
let node =
|
|
|
node.setup(|me| VectorArt::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
node.setup(|me| VectorArt::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
|
send_step2_layer.link(node);
|
|
send_step2_layer.link(node);
|
|
|
|
|
|
|
|
- let node = create_button("send_paste_btn");
|
|
|
|
|
- node.set_property_bool(atom, Role::App, "is_active", true).unwrap();
|
|
|
|
|
- let prop = node.get_property("rect").unwrap();
|
|
|
|
|
- let code = cc.compile("w - RECIPIENT_INPUT_MARGIN - PASTE_WIDTH").unwrap();
|
|
|
|
|
- prop.set_default_expr(0, code).unwrap();
|
|
|
|
|
- prop.set_default_f32(1, y).unwrap();
|
|
|
|
|
- prop.set_default_f32(2, PASTE_WIDTH).unwrap();
|
|
|
|
|
- prop.set_default_f32(3, RECIPIENT_INPUT_HEIGHT).unwrap();
|
|
|
|
|
- node.set_property_u32(atom, Role::App, "z_index", 3).unwrap();
|
|
|
|
|
-
|
|
|
|
|
- let (slot, recvr) = Slot::new("send_paste_clicked");
|
|
|
|
|
- node.register("click", slot).unwrap();
|
|
|
|
|
- let recipient_input2 = recipient_input.clone();
|
|
|
|
|
- let redraw_clone = app.redraw_trigger.clone();
|
|
|
|
|
- let listen_click = app.ex.spawn(async move {
|
|
|
|
|
- while let Ok(_) = recvr.recv().await {
|
|
|
|
|
- if let Some(clipboard_text) = clipboard::get() {
|
|
|
|
|
- let atom = &mut redraw_clone.make_guard(gfxtag!("step2 recipient paste"));
|
|
|
|
|
- recipient_input2.set_property_str(atom, Role::App, "text", clipboard_text).unwrap();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- app.tasks.lock().push(listen_click);
|
|
|
|
|
-
|
|
|
|
|
- let node =
|
|
|
|
|
- node.setup(|me| Button::new(me, app.renderer.clone(), app.redraw_trigger.clone())).await;
|
|
|
|
|
- send_step2_layer.link(node);
|
|
|
|
|
-
|
|
|
|
|
// Add recipient button
|
|
// Add recipient button
|
|
|
let (node, btn_bg_valid, btn_bg_invalid, add_recipient_label_node) =
|
|
let (node, btn_bg_valid, btn_bg_invalid, add_recipient_label_node) =
|
|
|
create_bottom_button_with_states(
|
|
create_bottom_button_with_states(
|