mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 02:54:25 +00:00
HistoryEvent::rename/new_snapshot and SwatchEdit::move_group constructors
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user