merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
2 changed files with 17 additions and 7 deletions
Showing only changes of commit a7cf11737a - Show all commits

View File

@ -33,3 +33,19 @@ pub fn coef_of_signal_reduce(Vs: f64, V: f64) -> f64 {
Vs / V
}
}
pub fn set_default_values(model: &ListStore) {
for number in (0..=100).step_by(5) {
if number == 0 {
model.append(&Frequency::new(1.0));
} else if (number >= 70 && number % 10 == 0) || (number < 70 && number % 5 == 0) {
model.append(&Frequency::new(number as f64));
}
}
}
pub fn find_by_frequency_value(model: &ListStore, new_elem: &Frequency) -> Option<u32> {
model.find_with_equal_func(|elem| {
elem.downcast_ref::<Frequency>().unwrap().frequency() == new_elem.frequency()
})
}

View File

@ -66,13 +66,7 @@ pub fn signal_reducing_page(wrapper: &Box) {
let model_for_events = model.clone();
for number in (0..=100).step_by(5) {
if number == 0 {
model.append(&Frequency::new(1.0));
} else if (number >= 70 && number % 10 == 0) || (number < 70 && number % 5 == 0) {
model.append(&Frequency::new(number as f64));
}
}
set_default_values(&model);
let numeric_sorter = CustomSorter::new(|a, b| {
let a = a.downcast_ref::<Frequency>().unwrap().frequency();