PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge upstream main into Layers Panel part 1
abc2cb7fc98eb769d2
diff --cc crates/engine/src/commands.rsindex 9bb9ed37d,5524388c7..15ff131f9--- a/crates/engine/src/commands.rs+++ b/crates/engine/src/commands.rs@@@ -1420,14 -1422,12 +1429,14 @@@ pub(crate) fn translate_layer(doc: &Doc/// A copy of layer `id` as Layer › Duplicate Layer makes it, not yet in the document: a fresh id,/// "… copy" appended to the name, and a copy of the Background layer is an ordinary, unlocked/// layer (Photoshop).-pub(crate) fn layer_copy(doc: &Document, id: LayerId) -> Result<Layer> {+pub(crate) fn layer_copy(doc: &Document, id: LayerId, add_copy: bool) -> Result<Layer> {let src = doc.layer(id).ok_or(EngineError::NoLayer(id))?;// A copy of the Background layer is an ordinary, unlocked layer (Photoshop).- let from_background = src.name == "Background" && src.locks.transparency && doc.layers.first().is_some_and(|b| b.id == id);+ let from_background = doc.is_background(id);let mut dup = src.duplicate();- dup.name = doc.copy_name(&dup.name);+ if add_copy {+ dup.name = doc.copy_name(&dup.name);+ }if from_background {dup.locks = Default::default();}diff --cc crates/ui-egui/src/panels.rsindex 87336ce04,0f6a1b83b..9e1a5191f--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@@ -2681,9 -2711,9 +2722,9 @@@ fn layer_rowlet name_color = if l.visible { t.text } else { t.text_faint };let font = if selected && !t.pro { theme::medium(13.0) } else { egui::FontId::proportional(if t.pro { 12.0 } else { 13.0 }) };// Photoshop before 2026 set the Background layer's name in italics; 2026 sets it upright.- let italic = !t.pro && l.name == "Background" && l.locks.transparency;+ let italic = !t.pro && doc.is_background(l.id);// Photoshop rows show only the name; the kind sub-label is a Studio-theme addition.- let is_pixel = t.pro || matches!(l.content, LayerContent::Raster(_));+ let is_pixel = t.pro || ts == 0.0 || matches!(l.content, LayerContent::Raster(_));let name_rect = crate::layer_row_ui::truncated(&painter, &l.name, font, name_color, italic, name_right - x).map(|galley| {let text_pos = pos2(x, rect.center().y - galley.size().y / 2.0 - if is_pixel { 0.0 } else { 7.0 });let r = Rect::from_min_size(text_pos, galley.size());