diff --git a/crates/ui-patterns/src/patterns/panels/history.rs b/crates/ui-patterns/src/patterns/panels/history.rs index 812313030..283eeeca1 100644 --- a/crates/ui-patterns/src/patterns/panels/history.rs +++ b/crates/ui-patterns/src/patterns/panels/history.rs @@ -1,11 +1,34 @@ //! `HistoryPanel`: the undo history as a list of states and named snapshots, with a footer of snapshot buttons. -use crate::contract::{NoValue, Outcome, Pattern}; -use crate::primitives::textures::{ThumbSource, Thumbnails}; -use crate::runtime::env::Label; -use craft_behavior::IconId; +use super::words::PanelWords; +use crate::contract::{ + Bind, CollectionEvent, ColumnSpec, ListDrag, NoValue, Outcome, Pattern, Props as _, SelectMode, ShowCollection as _, ShowContainer as _, Sizing, + ToggleColumn, request_rename, +}; +use crate::layout_components::Stack; +use crate::list::{List, ListRow, RowInk, ThumbSize, ToggleCell, ToggleState}; +use crate::menu::{Menu, MenuItem}; +use crate::primitives::IconSpec; +use crate::primitives::textures::{Priority, ThumbPaint, ThumbRequest, ThumbSource, Thumbnails}; +use crate::runtime::env::{Env, Label}; +use crate::sections::{FooterAction, FooterBar}; +use craft_behavior::{ColumnKey, ColumnWidth, GesturePhase, IconId, Selection, SelectionChange, keyed}; use craft_keymap::Mods; use egui::{Response, Ui}; +use std::cell::RefCell; +use std::collections::HashSet; +use std::hash::{DefaultHasher, Hash, Hasher}; +use std::sync::Arc; + +#[cfg(feature = "testing")] +mod stories; + +/// The column of the source marks. +const SOURCE: ColumnKey = ColumnKey::new("historySource"); +/// The column of the names. +const NAME: ColumnKey = ColumnKey::new("historyName"); +/// The width in points a snapshot's picture is requested for. +const THUMB_POINTS: f32 = 32.0; /// What a history row stands for: a named snapshot or a state of the undo stack, by number. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] @@ -31,30 +54,32 @@ pub struct HistoryRow { } impl HistoryRow { + fn new(key: HistoryKey, label: Label) -> Self { + HistoryRow { key, label, icon: None, redo: false } + } + /// A row for the snapshot `id` named `label`. pub fn snapshot(id: u64, label: impl Into