use folder manager for load, save and sound

This commit is contained in:
2025-08-19 17:45:42 +02:00
parent b258d86e47
commit e2902f91e3
9 changed files with 743 additions and 161 deletions

View File

@@ -40,10 +40,14 @@ pub fn music_view(app: &Polymusic) -> iced::Element<Message> {
Message::CancelColor(i),
move |color| Message::ChooseColor(i, color)
),
pick_list(entries.clone(), Some(&polygon.sound_name), move |s| {
Message::ChangeSound(current_index, s)
})
.text_size(20),
button(text(
polygon
.sound_name
.rsplit(['/', '\\'])
.next()
.unwrap_or(&polygon.sound_name)
))
.on_press(Message::ChangeSound(current_index)),
]
.spacing(20),
row![
@@ -183,11 +187,6 @@ pub fn music_view(app: &Polymusic) -> iced::Element<Message> {
]
.spacing(20),
column![
/*
slider(0.0..=app.music.length, self.current_delta, move |f| {
Message::ChangeDelta(f)
})
.step(&app.music.length / 10_000.),*/
canvas(&app.music)
.height(Length::FillPortion(1))
.width(Length::FillPortion(1))
@@ -208,40 +207,16 @@ pub fn load_file_view(app: &Polymusic) -> iced::Element<Message> {
column![
text("Polymusic").size(42),
row![
column![
TextInput::new("Name File", &app.file_name_to_creat)
.on_input(|new_value| Message::SetFileNameCreat(new_value)),
button("Create File").on_press(Message::CreatFile),
text(if app.show_warning_message_creat {
"Warning: File already exists. Delete it or change the file name!"
} else {
""
})
.style(|theme: &Theme| {
let palette = theme.extended_palette();
text::Style {
color: Some(palette.danger.strong.color),
}
},)
]
.spacing(10)
.width(200)
.height(200)
.align_x(Horizontal::Center),
column![
pick_list(
app.all_saves.clone(),
Some(&app.music.file_name),
move |s| Message::FileNameChanged(s),
),
button("Load File").on_press(Message::Load),
text("")
]
.spacing(10)
.width(200)
.height(200)
.align_x(Horizontal::Center)
column![button("Create File").on_press(Message::CreatFile),]
.spacing(10)
.width(200)
.height(200)
.align_x(Horizontal::Center),
column![button("Load File").on_press(Message::Load),]
.spacing(10)
.width(200)
.height(200)
.align_x(Horizontal::Center)
]
.spacing(32)
.align_y(Vertical::Center),