summaryrefslogtreecommitdiff
path: root/server/xml/macros/example.xml
blob: 635dea2902fb5be1beef534f64966527dc71e6e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version='1.0' encoding='UTF-8'?>
<macro name="example" version="1.0" resume="Axis: ${axis}\nCylinder: ${cyl}\nSphere: ${sphere}\n">
  <queries>
    <query class="lensmeter" ttl="10000" automap="true"/>
  </queries>
  <maps>
    <map name="axis">
      -- LUA program
      return math.pi, 1234567890
    </map>
    <map name="cyl">
      -- LUA program
      return lensmeter.right.cyl.value, lensmeter.right.cyl.timestamp
    </map>
  </maps>
  <luaprograms>
    <luaprogram name="theanswer">
      sphere = tonumber(getValue('sphere'))
      axis = tonumber(getValue('axis'))
      if( sphere == axis )
      then
        setValue('cyl', name)
        return true
      else
        return false
      end
    </luaprogram>
  </luaprograms>
  <window name="mainwindow"
          caption="Example Window"
          width="300"
          height="400"
          layout="vbox">
    <frame name="linse_frame" caption="Linser:" layout="vbox">
      <frame name="linse_framea" layout="hbox">
        <label name="a" width="100" caption="Akse rotation:"/>
        <lineedit name="axis" regexp="[24]*" map="axis" lua="theanswer" value="244"/>
      </frame>
      <frame name="linse_frameb" layout="hbox">
        <label name="b" width="100" caption="Sphere:"/>
        <lineedit name="sphere" regexp="[24]*" lua="theanswer" value="42"/>
      </frame>
      <frame name="linse_framec" layout="hbox">
        <label name="c" width="100" caption="Cyl:"/>
        <lineedit name="cyl" regexp="[24]*" map="cyl" value=""/>
      </frame>
    </frame>
    <frame name="linse_frame" caption="FlereLinser:" layout="vbox">
      <frame name="linse_framea" layout="hbox">
        <label name="a" width="100" caption="Akse rotation2:"/>
        <lineedit name="axis2" regexp="[24]*" map="axis" lua="theanswer" value="244"/>
      </frame>
      <frame name="linse_frameb" layout="hbox">
        <label name="b" width="100" caption="Sphere2:"/>
        <lineedit name="sphere2" regexp="[24]*" lua="theanswer" value="42"/>
      </frame>
      <frame name="linse_framec" layout="hbox">
        <label name="c" width="100" caption="Cyl2:"/>
        <lineedit name="cyl2" regexp="[24]*" map="cyl" value=""/>
      </frame>
    </frame>
    <frame name="buttons" layout="hbox">
      <button name="cancel" caption="Annuller" action="cancel"/>
      <button name="commit" caption="Godkend" action="commit"/>
    </frame>
  </window>
</macro>