~raph/interp-toy

e811bfe0dc464963771a4b44edc67e0b1e978cc4 — Raph Levien 2 years ago 70cf15d
Snap druid

Get latest druid (with style and layout fixes), tweak UI a bit.
4 files changed, 26 insertions(+), 24 deletions(-)

M Cargo.lock
M Cargo.toml
M src/app_state.rs
M src/main.rs
M Cargo.lock => Cargo.lock +6 -6
@@ 183,9 183,9 @@ dependencies = [
[[package]]
name = "druid"
version = "0.3.0"
source = "git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397#2962b3579b7e1dbad79ccd87bf0c8333c4b1d397"
source = "git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34#6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34"
dependencies = [
 "druid-shell 0.3.0 (git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397)",
 "druid-shell 0.3.0 (git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34)",
 "fluent-bundle 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-locale 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-syntax 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",


@@ 197,7 197,7 @@ dependencies = [
[[package]]
name = "druid-shell"
version = "0.3.0"
source = "git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397#2962b3579b7e1dbad79ccd87bf0c8333c4b1d397"
source = "git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34#6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34"
dependencies = [
 "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)",


@@ 315,7 315,7 @@ dependencies = [
name = "interp-toy"
version = "0.1.0"
dependencies = [
 "druid 0.3.0 (git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397)",
 "druid 0.3.0 (git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34)",
 "nalgebra 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "rbf-interp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]


@@ 1048,8 1048,8 @@ dependencies = [
"checksum direct2d 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fa6ff10857eb253d1ae16987ebfd27372f4129b0c7a3fa41466fbdf7e453e75"
"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa"
"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d"
"checksum druid 0.3.0 (git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397)" = "<none>"
"checksum druid-shell 0.3.0 (git+https://github.com/xi-editor/druid?rev=2962b3579b7e1dbad79ccd87bf0c8333c4b1d397)" = "<none>"
"checksum druid 0.3.0 (git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34)" = "<none>"
"checksum druid-shell 0.3.0 (git+https://github.com/xi-editor/druid?rev=6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34)" = "<none>"
"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091"
"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"

M Cargo.toml => Cargo.toml +1 -1
@@ 7,6 7,6 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
druid = {git = "https://github.com/xi-editor/druid", rev = "2962b3579b7e1dbad79ccd87bf0c8333c4b1d397" }
druid = {git = "https://github.com/xi-editor/druid", rev = "6fc687e39f01a4f0aeda8cbbd919ccd28a9e9f34" }
rbf-interp = "0.1.2"
nalgebra = "0.18"

M src/app_state.rs => src/app_state.rs +3 -1
@@ 105,7 105,9 @@ pub mod lenses {
impl AppState {
    pub fn add_new_master(&mut self) {
        let mut masters = self.masters.deref().to_owned();
        masters.push(Master { weight: self.weight });
        masters.push(Master {
            weight: self.weight,
        });
        self.masters = masters.into();
        println!("adding new master");
    }

M src/main.rs => src/main.rs +16 -16
@@ 21,33 21,33 @@ fn build_master_ui() -> impl Widget<Master> {
fn build_ui() -> impl Widget<AppState> {
    let pane = InterpPane::default();
    let mut col = Column::new();
    let label = DynLabel::new(|data: &AppState, _env| format!("weight: {:.2}", data.weight));
    let new_master_button = Button::new("New Master");
    col.add_child(Padding::uniform(5.0, label), 0.0);
    let new_master_button = ActionWrapper::new(new_master_button, |data: &mut AppState, _env| {
        data.add_new_master()
    });
    col.add_child(Padding::uniform(5.0, new_master_button), 0.0);
    col.add_child(
        Padding::uniform(
            5.0,
            LensWrap::new(Slider::default(), lenses::calc_state::Weight),
            LensWrap::new(Slider::new(), lenses::calc_state::Weight),
        ),
        1.0,
        0.0,
    );
    let label = DynLabel::new(|data: &AppState, _env| format!("weight: {:.2}", data.weight));
    col.add_child(Padding::uniform(5.0, label), 0.0);
    col.add_child(
        Padding::uniform(
            5.0,
            LensWrap::new(Slider::default(), lenses::calc_state::Width),
        ),
        1.0,
        Padding::uniform(5.0, LensWrap::new(Slider::new(), lenses::calc_state::Width)),
        0.0,
    );
    let label_wdth = DynLabel::new(|data: &AppState, _env| format!("width: {:.2}", data.width));
    col.add_child(Padding::uniform(5.0, label_wdth), 0.0);
    let new_master_button = Button::new("New Master");
    let new_master_button = ActionWrapper::new(new_master_button, |data: &mut AppState, _env| {
        data.add_new_master()
    });
    col.add_child(Padding::uniform(5.0, new_master_button), 0.0);
    col.add_child(
        Scroll::new(LensWrap::new(
            List::new(|| Box::new(build_master_ui())),
            lenses::calc_state::Masters,
        )),
        5.0,
        ))
        .vertical(),
        1.0,
    );
    let col = ActionWrapper::new(col, |data: &mut AppState, _env| data.width += 0.1);
    let mut row = Row::new();