loaded_filename

This commit is contained in:
Martin Kavík 2024-06-17 19:36:44 +02:00
parent fc0dd43464
commit 4545656c31
3 changed files with 6 additions and 4 deletions

View file

@ -140,7 +140,7 @@ impl HeaderPanel {
platform::pick_and_load_waveform(Some(file)).await platform::pick_and_load_waveform(Some(file)).await
{ {
loaded_filename.set_neq(Some(filename)); loaded_filename.set_neq(Some(filename));
hierarchy.set(Some(Rc::new(platform::get_hierarchy().await))) hierarchy.set(Some(Arc::new(platform::get_hierarchy().await)))
} }
}) })
}) })

View file

@ -26,6 +26,7 @@ type Filename = String;
struct Store { struct Store {
selected_var_refs: MutableVec<wellen::VarRef>, selected_var_refs: MutableVec<wellen::VarRef>,
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>, hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
loaded_filename: Mutable<Option<Filename>>,
} }
static STORE: Lazy<Store> = lazy::default(); static STORE: Lazy<Store> = lazy::default();
@ -43,7 +44,7 @@ fn root() -> impl Element {
let hierarchy = STORE.hierarchy.clone(); let hierarchy = STORE.hierarchy.clone();
let selected_var_refs = STORE.selected_var_refs.clone(); let selected_var_refs = STORE.selected_var_refs.clone();
let layout: Mutable<Layout> = <_>::default(); let layout: Mutable<Layout> = <_>::default();
let loaded_filename: Mutable<Option<Filename>> = <_>::default(); let loaded_filename = STORE.loaded_filename.clone();
Column::new() Column::new()
.s(Height::fill()) .s(Height::fill())
.s(Scrollbars::y_and_clip_x()) .s(Scrollbars::y_and_clip_x())

View file

@ -49,8 +49,9 @@ impl FW {
0 0
} }
pub fn loaded_filename() -> String { /// JS: `FW.loaded_filename()` -> `simple.vcd`
format!("todo loaded filename") pub fn loaded_filename() -> Option<String> {
STORE.loaded_filename.get_cloned()
} }
/// JS: `FW.selected_vars()` -> `["simple_tb.s.A", "simple_tb.s.B"]` /// JS: `FW.selected_vars()` -> `["simple_tb.s.A", "simple_tb.s.B"]`