fix: audio player interface issues
the video player doesn't draw when playing audio, so the logic for emitting new frame messages is broken.
This commit is contained in:
parent
6f5040a953
commit
2c6f8599ee
4 changed files with 312 additions and 406 deletions
42
src/menu.rs
42
src/menu.rs
|
|
@ -18,6 +18,7 @@ pub fn menu_bar<'a>(
|
|||
key_binds: &HashMap<KeyBind, Action>,
|
||||
projects: &[(String, PathBuf)],
|
||||
ab_repeat: &Option<(Option<f64>, Option<f64>)>,
|
||||
has_video: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let home_dir_opt = std::env::home_dir();
|
||||
let format_path = |path: &PathBuf| -> String {
|
||||
|
|
@ -88,6 +89,30 @@ pub fn menu_bar<'a>(
|
|||
));
|
||||
}
|
||||
|
||||
let mut playback = Vec::with_capacity(3);
|
||||
|
||||
if has_video {
|
||||
playback.push(menu::Item::Button(
|
||||
fl!("next-frame"),
|
||||
None,
|
||||
Action::NextFrame,
|
||||
));
|
||||
playback.push(menu::Item::Button(
|
||||
fl!("previous-frame"),
|
||||
None,
|
||||
Action::PreviousFrame,
|
||||
));
|
||||
}
|
||||
|
||||
playback.push(menu::Item::Button(
|
||||
match ab_repeat {
|
||||
None => fl!("ab-repeat-set-a"),
|
||||
Some((_, None)) => fl!("ab-repeat-set-b"),
|
||||
Some((_, Some(_))) => fl!("ab-repeat-clear"),
|
||||
},
|
||||
None,
|
||||
Action::AbRepeat,
|
||||
));
|
||||
MenuBar::new(vec![
|
||||
menu::Tree::with_children(
|
||||
RcElementWrapper::new(Element::from(menu::root(fl!("file")))),
|
||||
|
|
@ -108,22 +133,7 @@ pub fn menu_bar<'a>(
|
|||
),
|
||||
menu::Tree::with_children(
|
||||
RcElementWrapper::new(Element::from(menu::root(fl!("playback")))),
|
||||
menu::items(
|
||||
key_binds,
|
||||
vec![
|
||||
menu::Item::Button(fl!("next-frame"), None, Action::NextFrame),
|
||||
menu::Item::Button(fl!("previous-frame"), None, Action::PreviousFrame),
|
||||
menu::Item::Button(
|
||||
match ab_repeat {
|
||||
None => fl!("ab-repeat-set-a"),
|
||||
Some((_, None)) => fl!("ab-repeat-set-b"),
|
||||
Some((_, Some(_))) => fl!("ab-repeat-clear"),
|
||||
},
|
||||
None,
|
||||
Action::AbRepeat,
|
||||
),
|
||||
],
|
||||
),
|
||||
menu::items(key_binds, playback),
|
||||
),
|
||||
])
|
||||
.item_height(ItemHeight::Dynamic(40))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue