PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge origin/main into fix/history-brush-source
David Mann3120afdbb2ee
diff --cc crates/engine/src/commands.rsindex 7713ae650,a32c5feb8..f9979e4b2--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@@ -1299,7 -1310,7 +1310,8 @@@ fn build() -> Vec<CommandSpec>v.extend(crate::analysis_cmds::specs());v.extend(crate::notes_cmds::specs());v.extend(crate::history_cmds::specs());+ v.extend(crate::history_source_cmds::specs());+ v.extend(crate::history_select_cmds::specs());v.extend(crate::proof_sim::specs());v.extend(crate::presets::specs());v.extend(crate::document_preset_cmds::specs());diff --cc crates/engine/src/inspect.rsindex eb35f487c,22c3d3a96..8bd55b24b--- a/crates/engine/src/inspect.rs+++ b/crates/engine/src/inspect.rs@@@ -38,9 -38,8 +38,9 @@@ pub fn document(d: &DocState) -> Value"isolatedLayers": d.isolated_layers.iter().map(|l| l.0).collect::<Vec<_>>(),"hasSelection": doc.selection.is_some(),"selectionBounds": doc.selection.as_ref().map(|s| { let r = s.content_bounds(); [r.x0, r.y0, r.width() as i32, r.height() as i32] }),- "layers": doc.layers.iter().rev().map(|l| layer_sel(l, &selected)).collect::<Vec<_>>(),+ "layers": doc.layers.iter().rev().map(|l| layer_sel(l, &selected, Some(&doc.metadata))).collect::<Vec<_>>(),"history": d.history.entries(),+ "historySource": crate::history_source_cmds::source_json(d),"snapshots": d.snapshots.iter().map(|snap| json!({"id": snap.id, "name": snap.name})).collect::<Vec<_>>(),"canUndo": d.history.can_undo(),"canRedo": d.history.can_redo(),diff --cc crates/engine/src/lib.rsindex 98131456e,ff3cde6e4..5a7101987--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@@ -54,7 -54,7 +54,8 @@@ pub mod group_view_cmdspub mod guide_layout;pub mod hidden_target;pub mod history_cmds;+pub mod history_source_cmds;+ pub mod history_select_cmds;pub mod image_cmds;pub mod inspect;pub mod installed_profiles;diff --cc crates/ui-egui/src/panels.rsindex 96f3ccabe,733f923c8..99cb6ecbc--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@@ -3093,8 -3107,7 +3108,8 @@@ fn history(app: &mut PhotocraftApp, uiui.painter().line_segment([rect.left_bottom(), rect.right_bottom()], Stroke::new(1.0, t.separator));}let mut snap_cmd = None;- let mut target: Option<isize> = None;+ let mut target: Option<usize> = None;+ let mut set_source: Option<usize> = None;let all = entries.iter().map(|e| (e.clone(), false)).chain(redo.iter().map(|e| (e.clone(), true)));// The dock gives History a fixed height: the rows scroll above the footer.let footer = if t.pro { widgets::footer_height(ui) + ui.spacing().item_spacing.y } else { 0.0 };@@@ -3127,11 -3141,8 +3143,11 @@@if is_redo { t.text_faint } else { t.icon },);ui.painter().text(pos2(rect.left() + 58.0, rect.center().y), Align2::LEFT_CENTER, &e, egui::FontId::proportional(12.0), color);+ if history_source_column(ui, rect, i, source == Some(i)) {+ set_source = Some(i);+ }- if resp.clicked() {- target = Some(i as isize - current as isize);+ if resp.clicked() && i != current {+ target = Some(i);}}});