AudioPlayer sets a song's cover, title and artist over a scrubber with the time played and left, the transport and the volume. AudioWaveform draws peaks gathered to the bars that fit, dark as far as it has played, and seeks by press, drag and keys, with the time tip the scrubber shares. AudioSpectrum shows levels by pitch. VolumeControl mutes from its speaker, and moving its slider while muted unmutes. PlaybackSpeedControl picks from a menu. MediaControls holds shuffle, back, play, forward and repeat. Playlist builds on SelectableList: the song under way is lit with moving bars, and Enter or a double press plays another. The video player's bar now rests while the stage itself holds focus, a key it takes wakes the bar, and a press on a resting bar only wakes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
use gpui::Rems;
|
|
|
|
use super::{Theme, tokens::px_to_rems};
|
|
|
|
/// Media tools' measures.
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
pub struct MediaSizes {
|
|
/// A crop box's handle, square.
|
|
pub crop_handle: Rems,
|
|
/// A mark's line on a picture.
|
|
pub mark_stroke: Rems,
|
|
/// An arrow's head, from its tip.
|
|
pub arrow_head: Rems,
|
|
/// A numbered pin, round.
|
|
pub pin: Rems,
|
|
/// A strip of video frames, tall.
|
|
pub strip: Rems,
|
|
/// A trim's handle, wide.
|
|
pub trim_handle: Rems,
|
|
/// A waveform's bar, wide.
|
|
pub wave_bar: Rems,
|
|
/// The gap between a waveform's bars.
|
|
pub wave_gap: Rems,
|
|
/// A waveform or a spectrum, tall.
|
|
pub waveform: Rems,
|
|
/// A song's cover, square.
|
|
pub artwork: Rems,
|
|
}
|
|
|
|
impl Theme {
|
|
pub fn media(&self) -> MediaSizes {
|
|
MediaSizes {
|
|
crop_handle: px_to_rems(10.0),
|
|
mark_stroke: px_to_rems(2.0),
|
|
arrow_head: px_to_rems(12.0),
|
|
pin: px_to_rems(20.0),
|
|
strip: px_to_rems(48.0),
|
|
trim_handle: px_to_rems(8.0),
|
|
wave_bar: px_to_rems(3.0),
|
|
wave_gap: px_to_rems(2.0),
|
|
waveform: px_to_rems(48.0),
|
|
artwork: px_to_rems(64.0),
|
|
}
|
|
}
|
|
}
|