mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 22:37:12 +00:00
wip
This commit is contained in:
@@ -37,6 +37,14 @@ impl<'a> BlurPinsPanel<'a> {
|
||||
Self { pins }
|
||||
}
|
||||
|
||||
/// Inside a modal body, declares the canvas gesture each pass, so the pins on the canvas keep their presses while
|
||||
/// the Blur Gallery dialog is modal.
|
||||
#[must_use]
|
||||
pub fn canvas(self, canvas: egui::Id) -> Self {
|
||||
let _ = canvas;
|
||||
todo!("dl.K62")
|
||||
}
|
||||
|
||||
/// Draws the rows and returns the response and any amount edit.
|
||||
pub fn show(self, ui: &mut Ui) -> BlurPinsPanelOutput {
|
||||
// pc: crates/ui-egui/src/dialogs/blur_pins.rs:398 `body` (the slider, the hints).
|
||||
|
||||
@@ -323,8 +323,22 @@ fn plan(kind: Option<ChannelKind>) -> Vec<Plan> {
|
||||
lines
|
||||
}
|
||||
|
||||
/// Photoshop's fixed panel menu list: New Channel…, Duplicate Channel, Delete Channel, New Spot Channel…, Merge Spot
|
||||
/// Channel, Channel Options…, Split Channels, Merge Channels…, with separators between the groups.
|
||||
pub fn panel_rows() -> Vec<PanelRow> {
|
||||
todo!("pn.C30")
|
||||
}
|
||||
|
||||
/// Each command greyed by the targeted row's kind, the one rule the panel's publish loop and the dock's panel menu share.
|
||||
pub fn states<K>(rows: &[ChannelRow<K>]) -> Vec<(ChannelsCommands, craft_ui::runtime::commands::CommandState)> {
|
||||
let _ = rows;
|
||||
todo!("pn.C30")
|
||||
}
|
||||
|
||||
/// The rows the panel adds to its panel menu, for the targeted row of `rows`: the commands of its row menu.
|
||||
pub fn panel_rows<K>(rows: &[ChannelRow<K>], words: &ChannelsWords) -> Vec<PanelRow> {
|
||||
// P3(panels-w6): pn.C30 — the old `panel_rows(rows, words)`; phase 3 removes it with its readers.
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn panel_rows_for<K>(rows: &[ChannelRow<K>], words: &ChannelsWords) -> Vec<PanelRow> {
|
||||
let command = |c: ChannelsCommands| PanelRow::Command(CommandRef::from(c));
|
||||
let kind = targeted_row(rows).map(|row| row.kind);
|
||||
let mut out = Vec::new();
|
||||
|
||||
@@ -12,6 +12,6 @@ pub(crate) mod stories;
|
||||
|
||||
pub use footer::ChannelsFooterButton;
|
||||
pub use labels::ChannelsWords;
|
||||
pub use menu::{ChannelsCommands, panel_rows};
|
||||
pub use menu::{ChannelsCommands, panel_rows, states};
|
||||
pub use model::{ChannelKind, ChannelRow, ChannelsEvent, ChannelsOutput, ColorIndicates, OVERLAY_OPACITIES, OverlayPreset, targeted_row};
|
||||
pub use panel::ChannelsPanel;
|
||||
|
||||
@@ -108,7 +108,7 @@ impl FillSource for StorySource {
|
||||
}
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
}
|
||||
Ok(PreviewDone { timing: Duration::ZERO })
|
||||
Ok(PreviewDone::new(Duration::ZERO) /* P3(dialogs-w10): dl.K60 */)
|
||||
}),
|
||||
Preview::Failed => Job::new(|_, _| Err("nothing to sample from: the sampling area has no pixels outside the fill area".to_owned())),
|
||||
}
|
||||
|
||||
@@ -74,17 +74,32 @@ pub enum WideAngleTool {
|
||||
pub struct PreviewDone {
|
||||
/// How long the solve and warp took.
|
||||
pub timing: Duration,
|
||||
/// What rendered it ("GPU", "CPU"), shown with the time.
|
||||
pub backend: Option<Label>,
|
||||
}
|
||||
|
||||
impl PreviewDone {
|
||||
/// Names what rendered the preview.
|
||||
#[must_use]
|
||||
pub fn backend(mut self, label: impl Into<Label>) -> Self {
|
||||
self.backend = Some(label.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// A finished preview that took `timing`.
|
||||
pub fn new(timing: Duration) -> Self {
|
||||
Self { timing }
|
||||
Self { timing, backend: None }
|
||||
}
|
||||
}
|
||||
|
||||
/// What the app gives the workspace to show each pass.
|
||||
pub trait WideAngleSource {
|
||||
pub trait WideAngleSource: Send + Sync {
|
||||
/// The lens model the constraints curve by.
|
||||
// P3(dialogs-w10): dl.K60 — default body until the app's sources implement it.
|
||||
fn geometry(&self) -> &dyn WideAngleGeometry {
|
||||
todo!("dl.K60")
|
||||
}
|
||||
|
||||
/// The layer as it is (a proxy of at most 800 px in PhotoCraft).
|
||||
fn source(&self) -> &dyn RasterSource;
|
||||
|
||||
@@ -515,3 +530,35 @@ fn add_constraint_params(words: &WideAngleWords) -> Vec<Param> {
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
// P3(dialogs-w10): dl.K60 — the workspace's trait surface; `show` and the automation fields are written in phase 3.
|
||||
impl craft_ui::dialog::FullWindowWorkspace for WideAngleWorkspace {
|
||||
type Source = dyn WideAngleSource;
|
||||
type Event = WideAngleEvent;
|
||||
type Result = WideAngleSession;
|
||||
|
||||
const KEY: &'static str = "filter.adaptiveWideAngle";
|
||||
|
||||
fn show(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
cx: craft_ui::dialog::WorkspaceCx<'_, Self::Source>,
|
||||
) -> craft_ui::dialog::WorkspacePass<Self::Event, Self::Result> {
|
||||
let _ = (ui, cx);
|
||||
todo!("dl.K60")
|
||||
}
|
||||
|
||||
fn json_fields(&self) -> Option<serde_json::Value> {
|
||||
todo!("dl.K60")
|
||||
}
|
||||
|
||||
fn set_json_field(&mut self, ctx: &egui::Context, source: &Self::Source, field: &str, value: serde_json::Value) -> Result<(), String> {
|
||||
let _ = (ctx, source, field, value);
|
||||
todo!("dl.K60")
|
||||
}
|
||||
|
||||
fn confirm(&mut self, ctx: &egui::Context, source: &Self::Source) -> Option<Self::Result> {
|
||||
let _ = (ctx, source);
|
||||
todo!("dl.K60")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user