Show form references using tree sub command

This commit is contained in:
2023-09-03 17:31:38 +02:00
parent 31eda3efc9
commit 8edd50feb4
5 changed files with 136 additions and 6 deletions

View File

@@ -74,6 +74,32 @@ impl OnkostarEditor {
}
}
pub fn find_data_form<'a>(&'a self, name: &str) -> Option<&'a DataForm> {
match self
.editor
.data_form
.iter()
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
.nth(0)
{
Some(x) => Some(x),
_ => None,
}
}
pub fn find_unterformular<'a>(&'a self, name: &str) -> Option<&'a Unterformular> {
match self
.editor
.unterformular
.iter()
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
.nth(0)
{
Some(x) => Some(x),
_ => None,
}
}
pub fn apply_profile(&mut self, profile: &Profile) {
self.editor
.data_form