Projektmodule und vollständiges TBC-Kompilat umsetzen und Change archivieren

This commit is contained in:
2026-09-05 23:06:56 +02:00
parent 58b1f620ea
commit 815825dde7
40 changed files with 4177 additions and 555 deletions

View File

@@ -252,12 +252,7 @@ impl FormsModel {
return Ok(PropertyValue::Integer(value.saturating_sub(2)));
}
if spec.name == "PARENT" {
let parent = obj.description.parent_form.as_deref().and_then(|name| {
self.objects
.iter()
.position(|candidate| candidate.description.name.eq_ignore_ascii_case(name))
.map(|id| (id as u16, None))
});
let parent = obj.description.parent.map(|id| (id, None));
return Ok(PropertyValue::Object(parent));
}
Ok(obj.properties[property as usize].clone())
@@ -834,12 +829,7 @@ impl FormsModel {
if obj.description.class == ObjectClass::Form {
return Some(current);
}
let parent = obj.description.parent_form.as_deref()?;
current = self
.objects
.iter()
.position(|candidate| candidate.description.name.eq_ignore_ascii_case(parent))?
as u16;
current = obj.description.parent?;
}
None
}
@@ -959,7 +949,7 @@ impl FormsModel {
}
fn select_option(&mut self, key: ObjectKey) -> Result<(), RuntimeError> {
let parent = self.instance(key)?.description.parent_form.clone();
let parent = self.instance(key)?.description.parent;
let value_id = forms::property(ObjectClass::OptionButton, "VALUE")
.unwrap()
.0 as usize;
@@ -969,7 +959,7 @@ impl FormsModel {
}
let same_group = self.instance(other).is_ok_and(|obj| {
obj.description.class == ObjectClass::OptionButton
&& obj.description.parent_form == parent
&& obj.description.parent == parent
});
if same_group {
self.instance_mut(other)?.properties[value_id] = PropertyValue::Integer(0);
@@ -1006,12 +996,8 @@ impl FormsModel {
&& self
.instance(key)
.ok()
.and_then(|obj| obj.description.parent_form.as_deref())
.and_then(|parent| {
self.objects
.iter()
.find(|obj| obj.description.name.eq_ignore_ascii_case(parent))
})
.and_then(|obj| obj.description.parent)
.and_then(|parent| self.objects.get(parent as usize))
.is_some_and(|parent| parent.description.class == ObjectClass::Form);
if invalid || title_shortcut {
Err(RuntimeError::ILLEGAL_FUNCTION_CALL)
@@ -1325,19 +1311,12 @@ impl FormsModel {
}
fn menu_children(&self, parent: ObjectKey) -> Vec<ObjectKey> {
let Ok(parent) = self.instance(parent) else {
return Vec::new();
};
self.keys()
.into_iter()
.filter(|key| {
self.instance(*key).is_ok_and(|object| {
object.description.class == ObjectClass::Menu
&& object
.description
.parent_form
.as_deref()
.is_some_and(|name| name.eq_ignore_ascii_case(&parent.description.name))
&& object.description.parent == Some(parent.0)
}) && self.boolean(*key, "VISIBLE")
})
.collect()
@@ -1385,23 +1364,15 @@ impl FormsModel {
}
if shift & umschalt::ALT != 0 {
if let Some(ch) = key.chars().next().map(|ch| ch.to_ascii_uppercase()) {
if let Some(target) =
self.form_controls(form).into_iter().find(|candidate| {
Self::access_key(&self.string(*candidate, "CAPTION")) == Some(ch)
&& self.boolean(*candidate, "ENABLED")
&& self.boolean(*candidate, "VISIBLE")
&& self.instance(*candidate).is_ok_and(|obj| {
obj.description.class != ObjectClass::Menu
|| obj.description.parent_form.as_deref().is_some_and(
|parent| {
parent.eq_ignore_ascii_case(
&self.objects[form as usize].description.name,
)
},
)
})
})
{
if let Some(target) = self.form_controls(form).into_iter().find(|candidate| {
Self::access_key(&self.string(*candidate, "CAPTION")) == Some(ch)
&& self.boolean(*candidate, "ENABLED")
&& self.boolean(*candidate, "VISIBLE")
&& self.instance(*candidate).is_ok_and(|obj| {
obj.description.class != ObjectClass::Menu
|| obj.description.parent == Some(form)
})
}) {
if self
.instance(target)
.is_ok_and(|obj| obj.description.class == ObjectClass::Menu)
@@ -1580,21 +1551,14 @@ impl FormsModel {
let mut top = self.integer(key, "TOP").unwrap_or(0).max(0) as usize + 1;
let width = self.integer(key, "WIDTH").unwrap_or(1).max(1) as usize;
let height = self.integer(key, "HEIGHT").unwrap_or(1).max(1) as usize;
let mut parent = obj.description.parent_form.as_deref();
let mut parent = obj.description.parent;
for _ in 0..self.objects.len() {
let Some(name) = parent else { break };
let Some((id, parent_obj)) = self
.objects
.iter()
.enumerate()
.find(|(_, candidate)| candidate.description.name.eq_ignore_ascii_case(name))
else {
break;
};
let parent_key = (id as u16, None);
let Some(id) = parent else { break };
let parent_obj = self.objects.get(id as usize)?;
let parent_key = (id, None);
left += self.integer(parent_key, "LEFT").unwrap_or(0).max(0) as usize;
top += self.integer(parent_key, "TOP").unwrap_or(0).max(0) as usize;
parent = parent_obj.description.parent_form.as_deref();
parent = parent_obj.description.parent;
}
Some((left, top, width, height))
}
@@ -2357,12 +2321,7 @@ impl FormsModel {
&& self
.instance(key)
.ok()
.and_then(|obj| obj.description.parent_form.as_deref())
.is_some_and(|parent| {
parent.eq_ignore_ascii_case(
&self.objects[form as usize].description.name,
)
})
.is_some_and(|obj| obj.description.parent == Some(form))
{
if self.boolean(key, "VISIBLE") {
let caption = format!(" {} ", self.caption(key));
@@ -2419,20 +2378,12 @@ impl FormsModel {
.is_some_and(|root| self.root_form(*root) == Some(form))
{
let mut popup_left = left + 1;
for root in
self.form_controls(form).into_iter().filter(|key| {
self.instance(*key).is_ok_and(|object| {
object.description.class == ObjectClass::Menu
&& object.description.parent_form.as_deref().is_some_and(
|parent| {
parent.eq_ignore_ascii_case(
&self.objects[form as usize].description.name,
)
},
)
}) && self.boolean(*key, "VISIBLE")
})
{
for root in self.form_controls(form).into_iter().filter(|key| {
self.instance(*key).is_ok_and(|object| {
object.description.class == ObjectClass::Menu
&& object.description.parent == Some(form)
}) && self.boolean(*key, "VISIBLE")
}) {
if Some(&root) == self.menu_path.first() {
break;
}