Allow int value for text size in dialogxml

This commit is contained in:
2025-02-09 11:16:24 -06:00
parent e81cde113c
commit c079d0f5a9
2 changed files with 22 additions and 6 deletions

View File

@@ -125,11 +125,18 @@
</xs:attribute>
<xs:attribute name="size" default="small">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="small"/>
<xs:enumeration value="large"/>
<xs:enumeration value="title"/>
</xs:restriction>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="small"/>
<xs:enumeration value="large"/>
<xs:enumeration value="title"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:integer"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="color"/>

View File

@@ -535,7 +535,16 @@ bool cControl::parseAttribute(ticpp::Attribute& attr, std::string tagName, std::
if(val == "small") setFormat(TXT_SIZE, 10);
else if(val == "large") setFormat(TXT_SIZE, 12);
else if(val == "title") setFormat(TXT_SIZE, 18);
else throw xBadVal(tagName, name, val, attr.Row(), attr.Column(), fname);
else{
auto err = xBadVal(tagName, name, val, attr.Row(), attr.Column(), fname);
try{
setFormat(TXT_SIZE, std::stoi(val));
}catch(std::invalid_argument& e){
throw err;
}catch(std::out_of_range& e){
throw err;
}
}
return true;
}
if(name == "wrap" && canFormat(TXT_WRAP)) {