EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
UI: show an open padlock on an unlocked Composition / Timeline viewer lock
pravdomila56a42c09622
diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rsindex 054aa3598..ac6ed92f9 100644--- a/crates/ui-egui/src/dock.rs+++ b/crates/ui-egui/src/dock.rs@@ -654,7 +654,8 @@ pub fn doc_tabs(out}-/// A viewer lock button (Composition viewers and the Timeline keep their comp while locked).+/// A viewer lock button (Composition viewers and the Timeline keep their comp while locked): a+/// closed padlock while locked, an open one while unlocked./// Returns true when clicked. Automation: `panel.tab.<panel>.lock`.pub fn lock_button(ui: &mut egui::Ui, rect: Rect, panel: PanelKind, locked: bool, t: &Tokens, reg: &mut crate::automation::Registry) -> bool {let resp = ui.interact(rect, egui::Id::unique(("tab-lock", panel.id())), Sense::click());@@ -665,7 +666,7 @@ pub fn lock_button(ui: &mut egui::Ui, rect: Rect, panel: PanelKind, locked: bool} else {t.text_faint};- icons::paint(ui.painter(), rect.shrink(2.0), Icon::Lock, color);+ icons::paint(ui.painter(), rect.shrink(2.0), if locked { Icon::Lock } else { Icon::LockOpen }, color);reg.add_response(&format!("panel.tab.{}.lock", panel.id()), &resp, if locked { "Unlock" } else { "Lock" });crate::widgets::focus_outline(ui, &resp, t);resp.clicked()diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rsindex 949ea3771..385a6b1ca 100644--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@ -48,6 +48,8 @@ pub enum Icon {Speaker,Solo,Lock,+ /// An open padlock: the shackle lifted clear of the body on the right.+ LockOpen,Shy,Collapse,Quality,@@ -402,6 +404,12 @@ pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32) {pen.arc(8.0, 7.0, 3.0, 180.0, 360.0);pen.dot(8.0, 10.5, 1.0);}+ LockOpen => {+ pen.rect(3.5, 7.0, 12.5, 14.0);+ pen.arc(8.0, 4.0, 3.0, 180.0, 360.0);+ pen.line(&[(5.0, 4.0), (5.0, 7.0)]);+ pen.dot(8.0, 10.5, 1.0);+ }Shy => {pen.circle(8.0, 8.0, 5.8);pen.dot(6.0, 7.0, 0.8);