Split merge_ui::wire into one function per section
The 312-line wire() registered the panorama page's callbacks in three comment-delimited sections. Lift each into its own fn: wire_start (the "Merge to panorama" press, its fetch, and the DARKROOM_START_MERGE dev entry point — all three only ever used together), wire_decision (confirm, projection and border chips, the fill knobs), and wire_stop_and_leave (abandon, close). wire() itself now just calls the three in order; S, C and F stay generic on wire_start since sources/context/on_done are used nowhere else.
This commit is contained in:
@@ -92,11 +92,28 @@ pub fn wire<S, C, F>(
|
||||
S: Fn() -> Vec<crate::export::Source> + 'static,
|
||||
C: Fn() -> Option<Context> + 'static,
|
||||
F: Fn(&AppWindow) + 'static,
|
||||
{
|
||||
wire_start(window, &ctl, gpu, sources, context, on_done);
|
||||
wire_decision(window, &ctl);
|
||||
wire_stop_and_leave(window, &ctl);
|
||||
}
|
||||
|
||||
/// Start.
|
||||
fn wire_start<S, C, F>(
|
||||
window: &AppWindow,
|
||||
ctl: &Rc<MergeController>,
|
||||
gpu: Option<dr_gpu::GpuContext>,
|
||||
sources: S,
|
||||
context: C,
|
||||
on_done: F,
|
||||
) where
|
||||
S: Fn() -> Vec<crate::export::Source> + 'static,
|
||||
C: Fn() -> Option<Context> + 'static,
|
||||
F: Fn(&AppWindow) + 'static,
|
||||
{
|
||||
let on_done = Rc::new(on_done);
|
||||
let gpu_for_start = gpu.clone();
|
||||
|
||||
// --- start -----------------------------------------------------------
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let ctl = ctl.clone();
|
||||
@@ -243,7 +260,7 @@ pub fn wire<S, C, F>(
|
||||
};
|
||||
start(
|
||||
window,
|
||||
&ctl,
|
||||
ctl,
|
||||
gpu,
|
||||
names,
|
||||
MergeDestination::Local(dir),
|
||||
@@ -265,8 +282,10 @@ pub fn wire<S, C, F>(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- the decision ----------------------------------------------------
|
||||
/// The decision.
|
||||
fn wire_decision(window: &AppWindow, ctl: &Rc<MergeController>) {
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let ctl = ctl.clone();
|
||||
@@ -360,8 +379,10 @@ pub fn wire<S, C, F>(
|
||||
w.set_merge_stage("Filling the preview".into());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- stopping and leaving --------------------------------------------
|
||||
/// Stopping and leaving.
|
||||
fn wire_stop_and_leave(window: &AppWindow, ctl: &Rc<MergeController>) {
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let ctl = ctl.clone();
|
||||
|
||||
Reference in New Issue
Block a user