HistoryEvent::rename/new_snapshot and SwatchEdit::move_group constructors

This commit is contained in:
aiongg
2026-11-16 13:44:24 +00:00
parent f647f41e82
commit c02478d2b1
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -486,6 +486,11 @@ impl SwatchEdit {
pub fn delete(swatch: String) -> Self {
SwatchEdit::Delete { swatch }
}
/// Moves the group named `group` to position `to`.
pub fn move_group(group: String, to: usize) -> Self {
SwatchEdit::MoveGroup { group, to }
}
}
impl SwatchLibrary {
@@ -144,6 +144,18 @@ pub enum HistoryEvent {
NewDocument,
}
impl HistoryEvent {
/// Renames snapshot `snapshot` to `text`.
pub fn rename(snapshot: u64, text: impl Into<String>) -> Self {
HistoryEvent::Rename { snapshot, text: text.into() }
}
/// Asks for a new snapshot with `mods` held.
pub const fn new_snapshot(mods: Mods) -> Self {
HistoryEvent::NewSnapshot { mods }
}
}
/// What [`HistoryPanel`] reports.
#[non_exhaustive]
pub struct HistoryPanelOutput {