From 43590db8d0c6b78eb78b57c3667a48452fc54fab Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 13 Mar 2022 01:10:45 +0100 Subject: [PATCH] Document create_iced_editor() --- nih_plug_iced/src/lib.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/nih_plug_iced/src/lib.rs b/nih_plug_iced/src/lib.rs index 0741da44..e8532e12 100644 --- a/nih_plug_iced/src/lib.rs +++ b/nih_plug_iced/src/lib.rs @@ -12,17 +12,14 @@ use std::sync::Arc; /// Re-export for convenience. pub use iced_baseview::*; -/// FIXME: Document how this works once everything actually works. The below comment is from the -/// egui version. -/// -/// Create an [`Editor`] instance using an [`iced`][::iced] GUI. Using the user state parameter is -/// optional, but it can be useful for keeping track of some temporary GUI-only settings. See the -/// `gui_gain` example for more information on how to use this. The [`IcedState`] passed to this -/// function contains the GUI's intitial size, and this is kept in sync whenever the GUI gets -/// resized. You can also use this to know if the GUI is open, so you can avoid performing -/// potentially expensive calculations while the GUI is not open. If you want this size to be -/// persisted when restoring a plugin instance, then you can store it in a `#[persist = "key"]` -/// field on your parameters struct. +/// Create an [`Editor`] instance using [iced](https://github.com/iced-rs/iced). The rough idea is +/// that you implement [`IcedEditor`], which is roughly analogous to iced's regular [`Application`] +/// trait except that it receives the [`GuiContext`] alongside its initialization flags so it can +/// update the parameter values. The [`IcedState`] passed to this function contains the GUI's +/// intitial size, and this is kept in sync whenever the GUI gets resized. You can also use this to +/// know if the GUI is open, so you can avoid performing potentially expensive calculations while +/// the GUI is not open. If you want this size to be persisted when restoring a plugin instance, +/// then you can store it in a `#[persist = "key"]` field on your parameters struct. /// /// See [`IcedState::from_size()`]. pub fn create_iced_editor(