UI.9: share docking transactions and preserve viewer lifecycle
Preserve legacy selection repair, modifier routing, viewer lifecycle and workspace persistence through the shared docking integration. Qualify the complete workspace gate by refreshing the 18 stale Audio Spectrum hashes for the existing linear renderer, with an independent synthetic-tone regression.
This commit is contained in:
@@ -13,6 +13,7 @@ pub mod bench;
|
||||
pub mod control;
|
||||
pub mod credits;
|
||||
pub mod dock;
|
||||
mod dock_shared;
|
||||
pub mod dock_ui;
|
||||
pub mod frames;
|
||||
pub mod gpu_failure;
|
||||
@@ -27,6 +28,7 @@ pub mod prefs_live;
|
||||
pub mod state;
|
||||
pub mod theme;
|
||||
pub mod widgets;
|
||||
mod workspace_state;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
@@ -210,6 +212,7 @@ impl Playback {
|
||||
pub struct EffectcraftApp {
|
||||
pub session: Session,
|
||||
pub ui: UiState,
|
||||
workspace_store: workspace_state::WorkspaceStore,
|
||||
pub tokens: Tokens,
|
||||
pub auto: automation::Registry,
|
||||
pub frames: Frames,
|
||||
@@ -297,9 +300,12 @@ pub struct EffectcraftApp {
|
||||
|
||||
impl EffectcraftApp {
|
||||
pub fn new(session: Session) -> Self {
|
||||
let mut ui = UiState::default();
|
||||
let workspace_store = workspace_state::WorkspaceStore::load(session.config.as_deref(), &mut ui);
|
||||
EffectcraftApp {
|
||||
session,
|
||||
ui: UiState::default(),
|
||||
ui,
|
||||
workspace_store,
|
||||
tokens: Tokens::for_kind(Default::default()),
|
||||
auto: Default::default(),
|
||||
frames: Frames::default(),
|
||||
@@ -484,8 +490,8 @@ impl EffectcraftApp {
|
||||
/// without moving the focus (a comp opening brings up its viewer, an effect applied brings up
|
||||
/// Effect Controls).
|
||||
pub fn raise_panel(&mut self, p: PanelKind) {
|
||||
if let Some(f) = self.ui.floating.iter_mut().find(|f| f.panels.contains(&p)) {
|
||||
f.active = f.panels.iter().position(|x| *x == p).unwrap_or(0);
|
||||
if self.ui.floating.iter().any(|group| group.panels.contains(&p)) {
|
||||
self.edit_layout(|layout| layout.apply(craft_ui::docking::Action::Activate { panel: p }).is_ok());
|
||||
return;
|
||||
}
|
||||
if !self.ui.dock.contains(p) {
|
||||
@@ -1485,6 +1491,7 @@ impl EffectcraftApp {
|
||||
}
|
||||
self.command_inbox = Some(rx);
|
||||
}
|
||||
let tab_had_widget_focus = ctx.egui_wants_keyboard_input();
|
||||
menus::handle_shortcuts(self, &ctx);
|
||||
if !ctx.input(|i| i.pointer.primary_down()) {
|
||||
self.ui.viewer.property_interacting = false;
|
||||
@@ -1510,6 +1517,9 @@ impl EffectcraftApp {
|
||||
self.dock_area(ui, body);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
prefs_live::dropped_files(self, ui, full);
|
||||
if !tab_had_widget_focus {
|
||||
menus::handle_tab_shortcut(self, &ctx);
|
||||
}
|
||||
panels::precomp::mini_flowchart(self, &ctx);
|
||||
panels::home::capture_thumbnail(self);
|
||||
panels::dialogs::show(self, &ctx);
|
||||
@@ -1518,6 +1528,24 @@ impl EffectcraftApp {
|
||||
panels::learn::coach(self, &ctx);
|
||||
let lift = panels::media_panels::import_card(self, ui, full);
|
||||
self.draw_toast(ui, full, lift);
|
||||
if self.session.config.is_some() && self.workspace_store.has_changes(&self.ui) && !ctx.input(|i| i.pointer.any_down()) {
|
||||
if self.workspace_store.due(ctx.input(|i| i.time)) {
|
||||
self.save_workspace_state();
|
||||
}
|
||||
if self.workspace_store.has_changes(&self.ui) {
|
||||
ctx.request_repaint_after(std::time::Duration::from_secs(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn save_workspace_state(&mut self) {
|
||||
if let Err(error) = self.workspace_store.save(self.session.config.as_deref(), &self.ui) {
|
||||
if self.workspace_store.error.as_ref() != Some(&error) {
|
||||
log::warn!("{error}");
|
||||
self.ui.status = error.clone();
|
||||
}
|
||||
self.workspace_store.error = Some(error);
|
||||
}
|
||||
}
|
||||
|
||||
/// The status message or the latest toast, bottom left (`lift` points higher while the
|
||||
@@ -1621,6 +1649,7 @@ impl EffectcraftApp {
|
||||
|
||||
impl eframe::App for EffectcraftApp {
|
||||
fn on_exit(&mut self) {
|
||||
self.save_workspace_state();
|
||||
// Clean exit: no crash recovery next launch.
|
||||
self.session.end_recovery();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user