Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/editor/settings/editor_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Default for ESGeneralSettings {
import_reassign_channels: false,
import_reassign_channel_10_as_11: false,
import_max_ppq_override: false,
import_max_ppq_override_value: NumericField::new(960, Some(96), Some(7680)),
import_max_ppq_override_value: NumericField::new(960, Some(1), Some(0x7FFF)),
import_remove_overlaps: false,

export_discard_empty_tracks: true
Expand Down
16 changes: 14 additions & 2 deletions src/editor/settings/project_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ use eframe::egui::{self, RichText};
use crate::{app::ui::dialog::Dialog, editor::{midi_bar_cacher::BarCacher, project::{project_data::ProjectData, project_manager::ProjectManager}}};
use core::f32;
use std::sync::{Arc, RwLock, Mutex};
use crate::app::custom_widgets::{NumberField, NumericField};

pub struct ProjectSettings {
pub project_manager: Arc<RwLock<ProjectManager>>,
is_showing: bool,

custom_ppq_field: NumericField<u16>,
}

impl Default for ProjectSettings {
fn default() -> Self {
Self {
project_manager: Default::default(),
is_showing: false
is_showing: false,
custom_ppq_field: NumericField::new(960, Some(1), Some(0x7FFF))
}
}
}
Expand All @@ -22,7 +26,8 @@ impl ProjectSettings {
pub fn new(project_data: &Arc<RwLock<ProjectManager>>) -> Self {
Self {
project_manager: project_data.clone(),
is_showing: false
is_showing: false,
custom_ppq_field: NumericField::new(project_data.read().unwrap().project_data.ppq, Some(1), Some(0x7FFF))
}
}
}
Expand Down Expand Up @@ -88,8 +93,15 @@ impl Dialog for ProjectSettings {

if new_value != old_value {
project_manager.change_ppq(new_value);
self.custom_ppq_field.set_value(new_value);
}
});

if self.custom_ppq_field.show("Or custom value", ui, None).lost_focus() {
if ppq != self.custom_ppq_field.value() {
project_manager.change_ppq(self.custom_ppq_field.value());
}
}
});

ui.horizontal(|ui| {
Expand Down