merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
Showing only changes of commit 2399903cda - Show all commits

View File

@ -1,3 +1,4 @@
use gio::glib::Object;
use gtk4 as gtk; use gtk4 as gtk;
use std::str::FromStr; use std::str::FromStr;
@ -9,7 +10,7 @@ use crate::{
}; };
use gtk::{ use gtk::{
prelude::{Cast, CastNone, EditableExt, ListItemExt, ObjectExt, WidgetExt}, prelude::{Cast, CastNone, EditableExt, ListItemExt, WidgetExt},
ColumnView, Entry, Label, ListItem, SignalListItemFactory, ColumnView, Entry, Label, ListItem, SignalListItemFactory,
}; };
@ -47,7 +48,7 @@ pub fn update_column_view(column_view: &ColumnView) {
} }
#[inline] #[inline]
pub fn column_view_setup_factory(_factory: &SignalListItemFactory, list_item: &ListItem) { pub fn column_view_setup_factory(_factory: &SignalListItemFactory, list_item: &Object) {
list_item list_item
.downcast_ref::<ListItem>() .downcast_ref::<ListItem>()
.expect("Needs to be ListItem") .expect("Needs to be ListItem")
@ -56,7 +57,7 @@ pub fn column_view_setup_factory(_factory: &SignalListItemFactory, list_item: &L
pub fn column_view_bind_factory( pub fn column_view_bind_factory(
_factory: &SignalListItemFactory, _factory: &SignalListItemFactory,
list_item: &ListItem, list_item: &Object,
values: SignalReduce, values: SignalReduce,
label: &str, label: &str,
) { ) {
@ -74,29 +75,19 @@ pub fn column_view_bind_factory(
.and_downcast::<Label>() .and_downcast::<Label>()
.expect("The child has to be a `Label`."); .expect("The child has to be a `Label`.");
cell_value
.bind_property("frequency", &cell_label, "label")
.sync_create()
.build();
if cell_value.reactive_resist() == 0.0 {
cell_value.set_reactive_resist(reactive_resistance_of_capacitor( cell_value.set_reactive_resist(reactive_resistance_of_capacitor(
values.wire_capacity * 10f64.powi(-12), values.wire_capacity * 10f64.powi(-12),
values.length, values.length,
cell_value.frequency() * 10f64.powi(6), cell_value.frequency() * 10f64.powi(6),
)); ));
}
if cell_value.full_resistance() == 0.0 {
cell_value.set_full_resistance(full_resistance_of_capacitor( cell_value.set_full_resistance(full_resistance_of_capacitor(
cell_value.reactive_resist(), cell_value.reactive_resist(),
values.source_resistance, values.source_resistance,
values.wire_resistance, values.wire_resistance,
values.length, values.length,
)); ));
}
if cell_value.signal_source_voltage() == 0.0 {
cell_value.set_signal_source_voltage( cell_value.set_signal_source_voltage(
voltage_from_signal_source( voltage_from_signal_source(
values.source_voltage * 10f64.powi(-3), values.source_voltage * 10f64.powi(-3),
@ -104,7 +95,6 @@ pub fn column_view_bind_factory(
cell_value.full_resistance(), cell_value.full_resistance(),
) * 1000.0, ) * 1000.0,
); );
}
match label { match label {
"f, МГц" => { "f, МГц" => {