Use folder references for strings and dialogs.

This means I won't have to remember to explicitly add each new file to the build.
It also means they'll be automatically kept sorted.
This commit is contained in:
2014-12-01 22:46:56 -05:00
parent 73c3430f05
commit d64770b1e0
5 changed files with 13 additions and 621 deletions

84
rsrc/schemas/dialog.dtd Normal file
View File

@@ -0,0 +1,84 @@
<!ELEMENT dialog ((field | text | pict | button | led | group | stack)*)>
<!ELEMENT field EMPTY>
<!ELEMENT br EMPTY>
<!ELEMENT text (#PCDATA|br)*>
<!ELEMENT pict EMPTY>
<!ELEMENT key EMPTY>
<!ELEMENT button (#PCDATA|key)*>
<!ELEMENT led (CDATA)>
<!ELEMENT group (led+)>
<!ELEMENT stack ((field | text | pict | button | led | group)*)>
<!ENTITY % num '(NUMBER)'>
<!ENTITY % bool '(true|false)'>
<!ENTITY % picttype '(blank|ter|teranim|monst|dlog|talk|scen|item|pc|field|boom|missile|full|map|status)'>
<!ENTITY % btntype '(small|regular|large|help|left|right|up|down|tiny|done|tall|trait|push)'>
<!ENTITY % letter 'a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z'>
<!ENTITY % mod 'ctrl|shift|alt'>
<!ENTITY % key '%mod;|%letter;|left|right|up|down|esc|enter|return|tab|help|space'>
<!ENTITY % rect '
top %num; #REQUIRED
left %num; #REQUIRED
width %num; #IMPLIED
height %num; #IMPLIED
'>
<!ENTITY % font "
font (dungeon|geneva|silom|maidenword) 'silom'
size (small|large) 'small'
color CDATA #IMPLIED
colour CDATA #IMPLIED
">
<!ATTLIST dialog
skin (light|dark) 'dark'
debug %bool; 'false'
fore CDATA 'black'
defbtn IDREF #IMPLIED
>
<!ATTLIST field
name ID #IMPLIED
type (num|text) 'text'
%rect;
>
<!ATTLIST text
name ID #IMPLIED
framed %bool; 'true'
%font;
def-key (%key;|none) 'none'
clickable %bool; 'false'
fromlist (none|CDATA) 'none'
%rect;
>
<!ATTLIST pict
name ID #IMPLIED
type %picttype; #REQUIRED
custom %bool; 'false'
size (small|wide|tall|large) #IMPLIED
def-key (%key;|none) 'none'
clickable %bool; 'false'
num %num; #REQUIRED
%rect;
>
<!ATTLIST button
name ID #REQUIRED
type %btntype; #REQUIRED
wrap %bool; 'false'
def-key (%key;|none) 'none'
fromlist (none|CDATA) 'none'
%rect;
>
<!ATTLIST led
name ID #IMPLIED
state (red|green|off) 'off'
fromlist (none|CDATA) 'none'
%rect;
%font;
>
<!ATTLIST group
name ID #IMPLIED
fromlist (none|CDATA) 'none'
>
<!ATTLIST stack
name ID #IMPLIED
>

407
rsrc/schemas/dialog.rng Normal file
View File

@@ -0,0 +1,407 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<define name="element.dialog">
<element name="dialog">
<ref name="attlist.dialog"/>
<zeroOrMore>
<choice>
<ref name="element.field"/>
<ref name="element.text"/>
<ref name="element.pict"/>
<ref name="element.button"/>
<ref name="element.led"/>
<ref name="element.group"/>
<ref name="element.stack"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="element.field">
<element name="field">
<ref name="attlist.field"/>
<empty/>
</element>
</define>
<define name="element.br">
<element name="br">
<ref name="attlist.br"/>
<empty/>
</element>
</define>
<define name="attlist.br" combine="interleave">
<empty/>
</define>
<define name="element.text">
<element name="text">
<ref name="attlist.text"/>
<zeroOrMore>
<choice>
<text/>
<ref name="element.br"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="element.pict">
<element name="pict">
<ref name="attlist.pict"/>
<empty/>
</element>
</define>
<define name="element.key">
<element name="key">
<ref name="attlist.key"/>
<empty/>
</element>
</define>
<define name="attlist.key" combine="interleave">
<empty/>
</define>
<define name="element.button">
<element name="button">
<ref name="attlist.button"/>
<zeroOrMore>
<choice>
<text/>
<ref name="element.key"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="element.led">
<element name="led">
<ref name="attlist.led"/>
<ref name="element.CDATA"/>
</element>
</define>
<define name="element.group">
<element name="group">
<ref name="attlist.group"/>
<oneOrMore>
<ref name="element.led"/>
</oneOrMore>
</element>
</define>
<define name="element.stack">
<element name="stack">
<ref name="attlist.stack"/>
<zeroOrMore>
<choice>
<ref name="element.field"/>
<ref name="element.text"/>
<ref name="element.pict"/>
<ref name="element.button"/>
<ref name="element.led"/>
<ref name="element.group"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="num">
<choice>
<value>NUMBER</value>
</choice>
</define>
<define name="bool">
<choice>
<value>true</value>
<value>false</value>
</choice>
</define>
<define name="picttype">
<choice>
<value>blank</value>
<value>ter</value>
<value>teranim</value>
<value>monst</value>
<value>dlog</value>
<value>talk</value>
<value>scen</value>
<value>item</value>
<value>pc</value>
<value>field</value>
<value>boom</value>
<value>missile</value>
<value>full</value>
<value>map</value>
<value>status</value>
</choice>
</define>
<define name="btntype">
<choice>
<value>small</value>
<value>regular</value>
<value>large</value>
<value>help</value>
<value>left</value>
<value>right</value>
<value>up</value>
<value>down</value>
<value>tiny</value>
<value>done</value>
<value>tall</value>
<value>trait</value>
<value>push</value>
</choice>
</define>
<define name="key">
<choice>
<value>left</value>
<value>right</value>
<value>up</value>
<value>down</value>
<value>esc</value>
<value>enter</value>
<value>return</value>
<value>tab</value>
<value>help</value>
<value>space</value>
</choice>
</define>
<define name="rect">
<attribute name="top">
<ref name="num"/>
</attribute>
<attribute name="left">
<ref name="num"/>
</attribute>
<optional>
<attribute name="width">
<ref name="num"/>
</attribute>
</optional>
<optional>
<attribute name="height">
<ref name="num"/>
</attribute>
</optional>
</define>
<define name="font">
<optional>
<attribute name="font" a:defaultValue="silom">
<choice>
<value>dungeon</value>
<value>geneva</value>
<value>silom</value>
<value>maidenword</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="size" a:defaultValue="small">
<choice>
<value>small</value>
<value>large</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="color"/>
</optional>
<optional>
<attribute name="colour"/>
</optional>
</define>
<define name="attlist.dialog" combine="interleave">
<optional>
<attribute name="skin" a:defaultValue="dark">
<choice>
<value>light</value>
<value>dark</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="debug" a:defaultValue="false">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="fore" a:defaultValue="black"/>
</optional>
<optional>
<attribute name="defbtn">
<data type="IDREF"/>
</attribute>
</optional>
</define>
<define name="attlist.field" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="type" a:defaultValue="text">
<choice>
<value>num</value>
<value>text</value>
</choice>
</attribute>
</optional>
<ref name="rect"/>
</define>
<define name="attlist.text" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="framed" a:defaultValue="true">
<ref name="bool"/>
</attribute>
</optional>
<ref name="font"/>
<optional>
<attribute name="def-key" a:defaultValue="none">
<choice>
<ref name="key"/>
<value>none</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="clickable" a:defaultValue="false">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="fromlist" a:defaultValue="none">
<choice>
<value>none</value>
<value>CDATA</value>
</choice>
</attribute>
</optional>
<ref name="rect"/>
</define>
<define name="attlist.pict" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
<attribute name="type">
<ref name="picttype"/>
</attribute>
<optional>
<attribute name="custom" a:defaultValue="false">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="size">
<choice>
<value>small</value>
<value>wide</value>
<value>tall</value>
<value>large</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="def-key" a:defaultValue="none">
<choice>
<ref name="key"/>
<value>none</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="clickable" a:defaultValue="false">
<ref name="bool"/>
</attribute>
</optional>
<attribute name="num">
<ref name="num"/>
</attribute>
<ref name="rect"/>
</define>
<define name="attlist.button" combine="interleave">
<attribute name="name">
<data type="ID"/>
</attribute>
<attribute name="type">
<ref name="btntype"/>
</attribute>
<optional>
<attribute name="wrap" a:defaultValue="false">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="def-key" a:defaultValue="none">
<choice>
<ref name="key"/>
<value>none</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="fromlist" a:defaultValue="none">
<choice>
<value>none</value>
<value>CDATA</value>
</choice>
</attribute>
</optional>
<ref name="rect"/>
</define>
<define name="attlist.led" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="state" a:defaultValue="off">
<choice>
<value>red</value>
<value>green</value>
<value>off</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="fromlist" a:defaultValue="none">
<choice>
<value>none</value>
<value>CDATA</value>
</choice>
</attribute>
</optional>
<ref name="rect"/>
<ref name="font"/>
</define>
<define name="attlist.group" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
<optional>
<attribute name="fromlist" a:defaultValue="none">
<choice>
<value>none</value>
<value>CDATA</value>
</choice>
</attribute>
</optional>
</define>
<define name="attlist.stack" combine="interleave">
<optional>
<attribute name="name">
<data type="ID"/>
</attribute>
</optional>
</define>
<define name="element.CDATA" combine="choice">
<notAllowed/>
</define>
<start>
<choice>
<ref name="element.dialog"/>
</choice>
</start>
</grammar>

293
rsrc/schemas/dialog.xsd Normal file
View File

@@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="bool">
<xs:restriction base="xs:token">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="picttype">
<xs:restriction base="xs:token">
<xs:enumeration value="blank"/>
<xs:enumeration value="ter"/>
<xs:enumeration value="teranim"/>
<xs:enumeration value="monst"/>
<xs:enumeration value="dlog"/>
<xs:enumeration value="talk"/>
<xs:enumeration value="scen"/>
<xs:enumeration value="item"/>
<xs:enumeration value="pc"/>
<xs:enumeration value="field"/>
<xs:enumeration value="boom"/>
<xs:enumeration value="missile"/>
<xs:enumeration value="full"/>
<xs:enumeration value="map"/>
<xs:enumeration value="status"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="btntype">
<xs:restriction base="xs:token">
<xs:enumeration value="small"/>
<xs:enumeration value="regular"/>
<xs:enumeration value="large"/>
<xs:enumeration value="help"/>
<xs:enumeration value="left"/>
<xs:enumeration value="right"/>
<xs:enumeration value="up"/>
<xs:enumeration value="down"/>
<xs:enumeration value="tiny"/>
<xs:enumeration value="done"/>
<xs:enumeration value="tall"/>
<xs:enumeration value="trait"/>
<xs:enumeration value="push"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="key">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
<xs:enumeration value="3"/>
<xs:enumeration value="4"/>
<xs:enumeration value="5"/>
<xs:enumeration value="6"/>
<xs:enumeration value="7"/>
<xs:enumeration value="8"/>
<xs:enumeration value="9"/>
<xs:enumeration value="a"/>
<xs:enumeration value="b"/>
<xs:enumeration value="c"/>
<xs:enumeration value="d"/>
<xs:enumeration value="e"/>
<xs:enumeration value="f"/>
<xs:enumeration value="g"/>
<xs:enumeration value="h"/>
<xs:enumeration value="i"/>
<xs:enumeration value="j"/>
<xs:enumeration value="k"/>
<xs:enumeration value="l"/>
<xs:enumeration value="m"/>
<xs:enumeration value="n"/>
<xs:enumeration value="o"/>
<xs:enumeration value="p"/>
<xs:enumeration value="q"/>
<xs:enumeration value="r"/>
<xs:enumeration value="s"/>
<xs:enumeration value="t"/>
<xs:enumeration value="u"/>
<xs:enumeration value="v"/>
<xs:enumeration value="w"/>
<xs:enumeration value="x"/>
<xs:enumeration value="y"/>
<xs:enumeration value="z"/>
<xs:enumeration value="`"/>
<xs:enumeration value="-"/>
<xs:enumeration value="="/>
<xs:enumeration value="["/>
<xs:enumeration value="]"/>
<xs:enumeration value="\"/>
<xs:enumeration value=";"/>
<xs:enumeration value="'"/>
<xs:enumeration value=","/>
<xs:enumeration value="."/>
<xs:enumeration value="/"/>
<xs:enumeration value="left"/>
<xs:enumeration value="right"/>
<xs:enumeration value="up"/>
<xs:enumeration value="down"/>
<xs:enumeration value="esc"/>
<xs:enumeration value="enter"/>
<xs:enumeration value="return"/>
<xs:enumeration value="tab"/>
<xs:enumeration value="help"/>
<xs:enumeration value="space"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="mod">
<xs:list>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="ctrl"/>
<xs:enumeration value="shift"/>
<xs:enumeration value="alt"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
<xs:attributeGroup name="rect">
<xs:attribute name="top" use="required" type="xs:integer"/>
<xs:attribute name="left" use="required" type="xs:integer"/>
<xs:attribute name="width" type="xs:integer"/>
<xs:attribute name="height" type="xs:integer"/>
</xs:attributeGroup>
<xs:attributeGroup name="keys">
<xs:attribute name="def-key" type="key"/>
<xs:attribute name="key-mod" type="mod"/>
</xs:attributeGroup>
<xs:attributeGroup name="font">
<xs:attribute name="font" default="bold">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="dungeon"/>
<xs:enumeration value="plain"/>
<xs:enumeration value="bold"/>
<xs:enumeration value="maidenword"/>
</xs:restriction>
</xs:simpleType>
</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:simpleType>
</xs:attribute>
<xs:attribute name="color"/>
<xs:attribute name="colour"/>
</xs:attributeGroup>
<xs:element name="field">
<xs:complexType>
<xs:attribute name="name" type="xs:ID"/>
<xs:attribute name="type" default="text">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="num"/>
<xs:enumeration value="text"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tab-order" type="xs:integer"/>
<xs:attributeGroup ref="rect"/>
</xs:complexType>
</xs:element>
<xs:element name="text">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="br" minOccurs="0" maxOccurs="unbounded">
<xs:complexType/>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:ID"/>
<xs:attribute name="framed" default="false" type="bool"/>
<xs:attributeGroup ref="font"/>
<xs:attributeGroup ref="keys"/>
<xs:attribute name="clickable" default="false" type="bool"/>
<xs:attribute name="fromlist" default="none" type="xs:string"/>
<xs:attributeGroup ref="rect"/>
</xs:complexType>
</xs:element>
<xs:element name="pict">
<xs:complexType>
<xs:attribute name="name" type="xs:ID"/>
<xs:attribute name="type" use="required" type="picttype"/>
<xs:attribute name="custom" default="false" type="bool"/>
<xs:attribute name="framed" default="true" type="bool"/>
<xs:attribute name="size">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="small"/>
<xs:enumeration value="wide"/>
<xs:enumeration value="tall"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup ref="keys"/>
<xs:attribute name="clickable" default="false" type="bool"/>
<xs:attribute name="num" use="required" type="xs:integer"/>
<xs:attributeGroup ref="rect"/>
</xs:complexType>
</xs:element>
<xs:element name="button">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="key" minOccurs="0" maxOccurs="unbounded">
<xs:complexType/>
</xs:element>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:ID"/>
<xs:attribute name="type" use="required" type="btntype"/>
<xs:attribute name="wrap" default="false" type="bool"/>
<xs:attributeGroup ref="keys"/>
<xs:attribute name="fromlist" default="none" type="xs:string"/>
<xs:attributeGroup ref="rect"/>
</xs:complexType>
</xs:element>
<xs:element name="led">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" use="required" type="xs:ID"/>
<xs:attribute name="state" default="off">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="red"/>
<xs:enumeration value="green"/>
<xs:enumeration value="off"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup ref="rect"/>
<xs:attributeGroup ref="font"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="group">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="led"/>
</xs:sequence>
<xs:attribute name="name" type="xs:ID"/>
<xs:attribute name="fromlist" default="none" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="stack">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="field"/>
<xs:element ref="text"/>
<xs:element ref="pict"/>
<xs:element ref="button"/>
<xs:element ref="led"/>
<xs:element ref="group"/>
</xs:choice>
<xs:attribute name="name" type="xs:ID"/>
</xs:complexType>
</xs:element>
<xs:element name="dialog">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="field"/>
<xs:element ref="text"/>
<xs:element ref="pict"/>
<xs:element ref="button"/>
<xs:element ref="led"/>
<xs:element ref="group"/>
<xs:element ref="stack"/>
</xs:choice>
<xs:attribute name="skin" default="dark">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="light"/>
<xs:enumeration value="dark"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="debug" default="false" type="bool"/>
<xs:attribute name="fore" default="black"/>
<xs:attribute name="defbtn" type="xs:IDREF"/>
</xs:complexType>
<xs:unique name="FieldTabOrder">
<xs:selector xpath="*" />
<xs:field xpath="@tab-order" />
</xs:unique>
</xs:element>
</xs:schema>