svghmi/gen_index_xhtml.xslt
author Edouard Tisserant <edouard.tisserant@gmail.com>
Wed, 05 Aug 2020 18:49:29 +0200
branchsvghmi
changeset 3005 ff9ae4f4e3be
parent 3004 705e34c6fe93
child 3008 dabad70db1bf
permissions -rw-r--r--
SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".

Because of allowing multiple variables per widget, we must distinguish if individual variables is relative to page, not the whole widget.
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
     1
<?xml version="1.0"?>
2994
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
     2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions">
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
     3
  <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
     4
  <xsl:variable name="svg" select="/svg:svg"/>
2879
58e6a91dc37f SVGHMI: Cosmetic changes
Edouard Tisserant
parents: 2878
diff changeset
     5
  <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
     6
  <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     7
  <xsl:variable name="_categories">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     8
    <noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     9
      <xsl:text>HMI_PLC_STATUS</xsl:text>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    10
    </noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    11
    <noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    12
      <xsl:text>HMI_CURRENT_PAGE</xsl:text>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    13
    </noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    14
  </xsl:variable>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    15
  <xsl:variable name="categories" select="exsl:node-set($_categories)"/>
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    16
  <xsl:variable name="_indexed_hmitree">
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    17
    <xsl:apply-templates mode="index" select="$hmitree"/>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    18
  </xsl:variable>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    19
  <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    20
  <preamble:hmi-tree/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    21
  <xsl:template match="preamble:hmi-tree">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    22
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    23
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    24
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    25
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    26
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    27
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    28
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    29
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    30
    <xsl:text>var hmi_hash = [</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    31
    <xsl:value-of select="$hmitree/@hash"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    32
    <xsl:text>];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    33
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    34
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    35
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    36
    <xsl:text>var heartbeat_index = </xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    37
    <xsl:value-of select="$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    38
    <xsl:text>;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    39
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    40
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    41
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    42
    <xsl:text>var hmitree_types = [
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    43
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    44
    <xsl:for-each select="$indexed_hmitree/*">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    45
      <xsl:text>    /* </xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    46
      <xsl:value-of select="@index"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    47
      <xsl:text>  </xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    48
      <xsl:value-of select="@hmipath"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    49
      <xsl:text> */ "</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    50
      <xsl:value-of select="substring(local-name(), 5)"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    51
      <xsl:text>"</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    52
      <xsl:if test="position()!=last()">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    53
        <xsl:text>,</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    54
      </xsl:if>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    55
      <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    56
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    57
    </xsl:for-each>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    58
    <xsl:text>]
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    59
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    60
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    61
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    62
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
    63
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    64
  </xsl:template>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    65
  <xsl:template mode="index" match="*">
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    66
    <xsl:param name="index" select="0"/>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    67
    <xsl:param name="parentpath" select="''"/>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    68
    <xsl:variable name="content">
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    69
      <xsl:variable name="path">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    70
        <xsl:choose>
2890
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    71
          <xsl:when test="count(ancestor::*)=0">
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    72
            <xsl:text>/</xsl:text>
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    73
          </xsl:when>
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    74
          <xsl:when test="count(ancestor::*)=1">
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    75
            <xsl:text>/</xsl:text>
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2889
diff changeset
    76
            <xsl:value-of select="@name"/>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    77
          </xsl:when>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    78
          <xsl:otherwise>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    79
            <xsl:value-of select="$parentpath"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    80
            <xsl:text>/</xsl:text>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    81
            <xsl:value-of select="@name"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    82
          </xsl:otherwise>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    83
        </xsl:choose>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    84
      </xsl:variable>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    85
      <xsl:choose>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    86
        <xsl:when test="not(local-name() = $categories/noindex)">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    87
          <xsl:copy>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    88
            <xsl:attribute name="index">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    89
              <xsl:value-of select="$index"/>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    90
            </xsl:attribute>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    91
            <xsl:attribute name="hmipath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    92
              <xsl:value-of select="$path"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    93
            </xsl:attribute>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    94
            <xsl:for-each select="@*">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    95
              <xsl:copy/>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    96
            </xsl:for-each>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    97
          </xsl:copy>
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    98
          <xsl:apply-templates mode="index" select="*[1]">
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    99
            <xsl:with-param name="index" select="$index + 1"/>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   100
            <xsl:with-param name="parentpath">
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   101
              <xsl:value-of select="$path"/>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   102
            </xsl:with-param>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   103
          </xsl:apply-templates>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   104
        </xsl:when>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   105
        <xsl:otherwise>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   106
          <xsl:apply-templates mode="index" select="*[1]">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   107
            <xsl:with-param name="index" select="$index"/>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   108
            <xsl:with-param name="parentpath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   109
              <xsl:value-of select="$path"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   110
            </xsl:with-param>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   111
          </xsl:apply-templates>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   112
        </xsl:otherwise>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   113
      </xsl:choose>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   114
    </xsl:variable>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   115
    <xsl:copy-of select="$content"/>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   116
    <xsl:apply-templates mode="index" select="following-sibling::*[1]">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   117
      <xsl:with-param name="index" select="$index + count(exsl:node-set($content)/*)"/>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   118
      <xsl:with-param name="parentpath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   119
        <xsl:value-of select="$parentpath"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   120
      </xsl:with-param>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   121
    </xsl:apply-templates>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   122
  </xsl:template>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   123
  <xsl:template mode="parselabel" match="*">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   124
    <xsl:variable name="label" select="@inkscape:label"/>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   125
    <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   126
    <xsl:variable name="_args" select="substring-before($description,'@')"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   127
    <xsl:variable name="args">
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   128
      <xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   129
        <xsl:when test="$_args">
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   130
          <xsl:value-of select="$_args"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   131
        </xsl:when>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   132
        <xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   133
          <xsl:value-of select="$description"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   134
        </xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   135
      </xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   136
    </xsl:variable>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   137
    <xsl:variable name="_type" select="substring-before($args,':')"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   138
    <xsl:variable name="type">
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   139
      <xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   140
        <xsl:when test="$_type">
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   141
          <xsl:value-of select="$_type"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   142
        </xsl:when>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   143
        <xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   144
          <xsl:value-of select="$args"/>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   145
        </xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   146
      </xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   147
    </xsl:variable>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   148
    <xsl:if test="$type">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   149
      <widget>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   150
        <xsl:attribute name="id">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   151
          <xsl:value-of select="@id"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   152
        </xsl:attribute>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   153
        <xsl:attribute name="type">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   154
          <xsl:value-of select="$type"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   155
        </xsl:attribute>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   156
        <xsl:for-each select="str:split(substring-after($args, ':'), ':')">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   157
          <arg>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   158
            <xsl:attribute name="value">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   159
              <xsl:value-of select="."/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   160
            </xsl:attribute>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   161
          </arg>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   162
        </xsl:for-each>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   163
        <xsl:variable name="paths" select="substring-after($description,'@')"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   164
        <xsl:for-each select="str:split($paths, '@')">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   165
          <xsl:if test="string-length(.) &gt; 0">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   166
            <path>
2793
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   167
              <xsl:attribute name="value">
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   168
                <xsl:value-of select="."/>
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   169
              </xsl:attribute>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   170
              <xsl:variable name="path" select="."/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   171
              <xsl:variable name="item" select="$indexed_hmitree/*[@hmipath = $path]"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   172
              <xsl:if test="count($item) = 1">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   173
                <xsl:attribute name="index">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   174
                  <xsl:value-of select="$item/@index"/>
2869
d9eb50c015d1 SVGHMI: take care of path given in HMI:Page and HMI:Jump, but do not apply subscription offset for now. Intermediate commit in a "working" state.
Edouard Tisserant
parents: 2867
diff changeset
   175
                </xsl:attribute>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   176
                <xsl:attribute name="type">
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   177
                  <xsl:value-of select="local-name($item)"/>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   178
                </xsl:attribute>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   179
              </xsl:if>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   180
            </path>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   181
          </xsl:if>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   182
        </xsl:for-each>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   183
      </widget>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   184
    </xsl:if>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   185
  </xsl:template>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   186
  <xsl:variable name="_parsed_widgets">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   187
    <xsl:apply-templates mode="parselabel" select="$hmi_elements"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   188
  </xsl:variable>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   189
  <xsl:variable name="parsed_widgets" select="exsl:node-set($_parsed_widgets)"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   190
  <func:function name="func:widget">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   191
    <xsl:param name="id"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   192
    <func:result select="$parsed_widgets/widget[@id = $id]"/>
2885
f398896b7ebf SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents: 2883
diff changeset
   193
  </func:function>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   194
  <func:function name="func:is_descendant_path">
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   195
    <xsl:param name="descend"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   196
    <xsl:param name="ancest"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   197
    <func:result select="string-length($ancest) &gt; 0 and starts-with($descend,$ancest)"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   198
  </func:function>
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   199
  <func:function name="func:same_class_paths">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   200
    <xsl:param name="a"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   201
    <xsl:param name="b"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   202
    <xsl:variable name="class_a" select="$indexed_hmitree/*[@hmipath = $a]/@class"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   203
    <xsl:variable name="class_b" select="$indexed_hmitree/*[@hmipath = $b]/@class"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   204
    <func:result select="$class_a and $class_b and $class_a = $class_b"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   205
  </func:function>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   206
  <xsl:template mode="testtree" match="*">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   207
    <xsl:param name="indent" select="''"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   208
    <xsl:value-of select="$indent"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   209
    <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   210
    <xsl:value-of select="local-name()"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   211
    <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   212
    <xsl:for-each select="@*">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   213
      <xsl:value-of select="local-name()"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   214
      <xsl:text>="</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   215
      <xsl:value-of select="."/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   216
      <xsl:text>" </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   217
    </xsl:for-each>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   218
    <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   219
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   220
    <xsl:apply-templates mode="testtree" select="*">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   221
      <xsl:with-param name="indent">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   222
        <xsl:value-of select="concat($indent,'&gt;')"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   223
      </xsl:with-param>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   224
    </xsl:apply-templates>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   225
  </xsl:template>
2940
034b6ce4f885 SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2939
diff changeset
   226
  <debug:hmi-tree/>
034b6ce4f885 SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2939
diff changeset
   227
  <xsl:template match="debug:hmi-tree">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   228
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   229
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   230
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   231
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   232
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   233
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   234
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   235
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   236
    <xsl:text>Raw HMI tree
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   237
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   238
    <xsl:apply-templates mode="testtree" select="$hmitree"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   239
    <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   240
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   241
    <xsl:text>Indexed HMI tree
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   242
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   243
    <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   244
    <xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   245
</xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   246
    <xsl:text>Parsed Widgets
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   247
</xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   248
    <xsl:copy-of select="_parsed_widgets"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   249
    <xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   250
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   251
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   252
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   253
  <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
   254
  <debug:geometry/>
2940
034b6ce4f885 SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2939
diff changeset
   255
  <xsl:template match="debug:geometry">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   256
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   257
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   258
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   259
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   260
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   261
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   262
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   263
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   264
    <xsl:text>ID, x, y, w, h
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   265
</xsl:text>
2879
58e6a91dc37f SVGHMI: Cosmetic changes
Edouard Tisserant
parents: 2878
diff changeset
   266
    <xsl:for-each select="$geometry">
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   267
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   268
      <xsl:value-of select="@Id"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   269
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   270
      <xsl:value-of select="@x"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   271
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   272
      <xsl:value-of select="@y"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   273
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   274
      <xsl:value-of select="@w"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   275
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   276
      <xsl:value-of select="@h"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   277
      <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   278
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   279
    </xsl:for-each>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   280
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   281
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   282
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   283
  <func:function name="func:intersect_1d">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   284
    <xsl:param name="a0"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   285
    <xsl:param name="a1"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   286
    <xsl:param name="b0"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   287
    <xsl:param name="b1"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   288
    <xsl:variable name="d0" select="$a0 &gt;= $b0"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   289
    <xsl:variable name="d1" select="$a1 &gt;= $b1"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   290
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   291
      <xsl:when test="not($d0) and $d1">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   292
        <func:result select="3"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   293
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   294
      <xsl:when test="$d0 and not($d1)">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   295
        <func:result select="2"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   296
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   297
      <xsl:when test="$d0 and $d1 and $a0 &lt; $b1">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   298
        <func:result select="1"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   299
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   300
      <xsl:when test="not($d0) and not($d1) and $b0 &lt; $a1">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   301
        <func:result select="1"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   302
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   303
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   304
        <func:result select="0"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   305
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   306
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   307
  </func:function>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   308
  <func:function name="func:intersect">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   309
    <xsl:param name="a"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   310
    <xsl:param name="b"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   311
    <xsl:variable name="x_intersect" select="func:intersect_1d($a/@x, $a/@x+$a/@w, $b/@x, $b/@x+$b/@w)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   312
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   313
      <xsl:when test="$x_intersect != 0">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   314
        <xsl:variable name="y_intersect" select="func:intersect_1d($a/@y, $a/@y+$a/@h, $b/@y, $b/@y+$b/@h)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   315
        <func:result select="$x_intersect * $y_intersect"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   316
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   317
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   318
        <func:result select="0"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   319
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   320
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   321
  </func:function>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   322
  <func:function name="func:overlapping_geometry">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   323
    <xsl:param name="elt"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   324
    <xsl:variable name="groups" select="/svg:svg | //svg:g"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   325
    <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   326
    <xsl:variable name="candidates" select="$geometry[@Id != $elt/@id]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   327
    <func:result select="$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or &#10;                          (not(@Id = $groups/@id) and (func:intersect($g, .) &gt; 0 ))]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   328
  </func:function>
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   329
  <xsl:variable name="hmi_pages_descs" select="$parsed_widgets/widget[@type = 'Page']"/>
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   330
  <xsl:variable name="hmi_pages" select="$hmi_elements[@id = $hmi_pages_descs/@id]"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   331
  <xsl:variable name="default_page">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   332
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   333
      <xsl:when test="count($hmi_pages) &gt; 1">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   334
        <xsl:choose>
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   335
          <xsl:when test="$hmi_pages_descs/arg[1]/@value = 'Home'">
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   336
            <xsl:text>Home</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   337
          </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   338
          <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   339
            <xsl:message terminate="yes">No Home page defined!</xsl:message>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   340
          </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   341
        </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   342
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   343
      <xsl:when test="count($hmi_pages) = 0">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   344
        <xsl:message terminate="yes">No page defined!</xsl:message>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   345
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   346
      <xsl:otherwise>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   347
        <xsl:value-of select="func:widget($hmi_pages/@id)/arg[1]/@value"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   348
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   349
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   350
  </xsl:variable>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   351
  <preamble:default-page/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   352
  <xsl:template match="preamble:default-page">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   353
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   354
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   355
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   356
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   357
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   358
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   359
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   360
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   361
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   362
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   363
    <xsl:text>var default_page = "</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   364
    <xsl:value-of select="$default_page"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   365
    <xsl:text>";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   366
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   367
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   368
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   369
  </xsl:template>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   370
  <xsl:variable name="keypads_descs" select="$parsed_widgets/widget[@type = 'Keypad']"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   371
  <xsl:variable name="keypads" select="$hmi_elements[@id = $keypads_descs/@id]"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   372
  <func:function name="func:refered_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   373
    <xsl:param name="elems"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   374
    <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   375
    <xsl:variable name="clones" select="$descend[self::svg:use]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   376
    <xsl:variable name="originals" select="//svg:*[concat('#',@id) = $clones/@xlink:href]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   377
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   378
      <xsl:when test="$originals">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   379
        <func:result select="$descend | func:refered_elements($originals)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   380
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   381
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   382
        <func:result select="$descend"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   383
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   384
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   385
  </func:function>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   386
  <func:function name="func:all_related_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   387
    <xsl:param name="page"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   388
    <xsl:variable name="page_overlapping_geometry" select="func:overlapping_geometry($page)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   389
    <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   390
    <xsl:variable name="page_sub_elements" select="func:refered_elements($page | $page_overlapping_elements)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   391
    <func:result select="$page_sub_elements"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   392
  </func:function>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   393
  <func:function name="func:required_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   394
    <xsl:param name="pages"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   395
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   396
      <xsl:when test="$pages">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   397
        <func:result select="func:all_related_elements($pages[1])&#10;                      | func:required_elements($pages[position()!=1])"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   398
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   399
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   400
        <func:result select="/.."/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   401
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   402
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   403
  </func:function>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   404
  <xsl:variable name="required_elements" select="//svg:defs/descendant-or-self::svg:*&#10;       | func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   405
  <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   406
  <func:function name="func:sumarized_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   407
    <xsl:param name="elements"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   408
    <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   409
    <xsl:variable name="filled_groups" select="$short_list/parent::svg:*[&#10;        not(descendant::*[&#10;            not(self::svg:g) and&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)&#10;        ])]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   410
    <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   411
    <func:result select="$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   412
  </func:function>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   413
  <func:function name="func:detachable_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   414
    <xsl:param name="pages"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   415
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   416
      <xsl:when test="$pages">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   417
        <func:result select="func:sumarized_elements(func:all_related_elements($pages[1]))&#10;                      | func:detachable_elements($pages[position()!=1])"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   418
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   419
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   420
        <func:result select="/.."/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   421
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   422
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   423
  </func:function>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   424
  <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages | $keypads)"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   425
  <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   426
  <declarations:detachable-elements/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   427
  <xsl:template match="declarations:detachable-elements">
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   428
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   429
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   430
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   431
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   432
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   433
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   434
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   435
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   436
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   437
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   438
    <xsl:text>var detachable_elements = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   439
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   440
    <xsl:for-each select="$detachable_elements">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   441
      <xsl:text>    "</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   442
      <xsl:value-of select="@id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   443
      <xsl:text>":[id("</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   444
      <xsl:value-of select="@id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   445
      <xsl:text>"), id("</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   446
      <xsl:value-of select="../@id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   447
      <xsl:text>")]</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   448
      <xsl:if test="position()!=last()">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   449
        <xsl:text>,</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   450
      </xsl:if>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   451
      <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   452
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   453
    </xsl:for-each>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   454
    <xsl:text>}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   455
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   456
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   457
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   458
  </xsl:template>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   459
  <xsl:variable name="forEach_widgets_ids" select="$parsed_widgets/widget[@type = 'ForEach']/@id"/>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   460
  <xsl:variable name="forEach_widgets" select="$hmi_elements[@id = $forEach_widgets_ids]"/>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   461
  <xsl:variable name="in_forEach_widget_ids" select="func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   462
  <xsl:template mode="page_desc" match="svg:*">
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   463
    <xsl:variable name="desc" select="func:widget(@id)"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   464
    <xsl:variable name="page" select="."/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   465
    <xsl:variable name="p" select="$geometry[@Id = $page/@id]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   466
    <xsl:variable name="page_all_elements" select="func:all_related_elements($page)"/>
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   467
    <xsl:variable name="all_page_widgets" select="$hmi_elements[@id = $page_all_elements/@id and @id != $page/@id]"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   468
    <xsl:variable name="page_managed_widgets" select="$all_page_widgets[not(@id=$in_forEach_widget_ids)]"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   469
    <xsl:variable name="page_relative_widgets" select="$page_managed_widgets[func:is_descendant_path(func:widget(@id)/path/@value, $desc/path/@value)]"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   470
    <xsl:variable name="required_detachables" select="func:sumarized_elements($page_all_elements)/&#10;           ancestor-or-self::*[@id = $detachable_elements/@id]"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   471
    <xsl:text>  "</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   472
    <xsl:value-of select="$desc/arg[1]/@value"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   473
    <xsl:text>": {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   474
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   475
    <xsl:text>    bbox: [</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   476
    <xsl:value-of select="$p/@x"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   477
    <xsl:text>, </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   478
    <xsl:value-of select="$p/@y"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   479
    <xsl:text>, </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   480
    <xsl:value-of select="$p/@w"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   481
    <xsl:text>, </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   482
    <xsl:value-of select="$p/@h"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   483
    <xsl:text>],
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   484
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   485
    <xsl:if test="$desc/path/@value">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   486
      <xsl:if test="count($desc/path/@index)=0">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   487
        <xsl:message terminate="no">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   488
          <xsl:text>Page id="</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   489
          <xsl:value-of select="$page/@id"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   490
          <xsl:text>" : No match for path "</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   491
          <xsl:value-of select="$desc/path/@value"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   492
          <xsl:text>" in HMI tree</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   493
        </xsl:message>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   494
      </xsl:if>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   495
      <xsl:text>    page_index: </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   496
      <xsl:value-of select="$desc/path/@index"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   497
      <xsl:text>,
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   498
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   499
    </xsl:if>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   500
    <xsl:text>    widgets: [
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   501
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   502
    <xsl:for-each select="$page_managed_widgets">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   503
      <xsl:variable name="widget_paths_relativeness">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   504
        <xsl:for-each select="func:widget(@id)/path">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   505
          <xsl:value-of select="func:is_descendant_path(@value, $desc/path/@value)"/>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   506
          <xsl:if test="position()!=last()">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   507
            <xsl:text>,</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   508
          </xsl:if>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   509
        </xsl:for-each>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   510
      </xsl:variable>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   511
      <xsl:text>        [hmi_widgets["</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   512
      <xsl:value-of select="@id"/>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   513
      <xsl:text>"], [</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   514
      <xsl:value-of select="$widget_paths_relativeness"/>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   515
      <xsl:text>]]</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   516
      <xsl:if test="position()!=last()">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   517
        <xsl:text>,</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   518
      </xsl:if>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   519
      <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   520
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   521
    </xsl:for-each>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   522
    <xsl:text>    ],
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   523
</xsl:text>
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   524
    <xsl:text>    jumps: [
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   525
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   526
    <xsl:for-each select="$parsed_widgets/widget[@id = $all_page_widgets/@id and @type='Jump']">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   527
      <xsl:variable name="_id" select="@id"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   528
      <xsl:variable name="opts">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   529
        <xsl:call-template name="jump_widget_activity">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   530
          <xsl:with-param name="hmi_element" select="$hmi_elements[@id=$_id]"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   531
        </xsl:call-template>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   532
      </xsl:variable>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   533
      <xsl:if test="string-length($opts)&gt;0">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   534
        <xsl:text>        hmi_widgets["</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   535
        <xsl:value-of select="@id"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   536
        <xsl:text>"]</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   537
        <xsl:if test="position()!=last()">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   538
          <xsl:text>,</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   539
        </xsl:if>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   540
        <xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   541
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   542
      </xsl:if>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   543
    </xsl:for-each>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   544
    <xsl:text>    ],
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
   545
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   546
    <xsl:text>    required_detachables: {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   547
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   548
    <xsl:for-each select="$required_detachables">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   549
      <xsl:text>        "</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   550
      <xsl:value-of select="@id"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   551
      <xsl:text>": detachable_elements["</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   552
      <xsl:value-of select="@id"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   553
      <xsl:text>"]</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   554
      <xsl:if test="position()!=last()">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   555
        <xsl:text>,</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   556
      </xsl:if>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   557
      <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   558
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   559
    </xsl:for-each>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   560
    <xsl:text>    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   561
</xsl:text>
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   562
    <xsl:apply-templates mode="per_page_widget_template" select="$parsed_widgets/widget[@id = $all_page_widgets/@id]">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   563
      <xsl:with-param name="page_desc" select="$desc"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   564
    </xsl:apply-templates>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   565
    <xsl:text>  }</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   566
    <xsl:if test="position()!=last()">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   567
      <xsl:text>,</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   568
    </xsl:if>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   569
    <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   570
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   571
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   572
  <declarations:page-desc/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   573
  <xsl:template match="declarations:page-desc">
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   574
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   575
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   576
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   577
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   578
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   579
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   580
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   581
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   582
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   583
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   584
    <xsl:text>var page_desc = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   585
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   586
    <xsl:apply-templates mode="page_desc" select="$hmi_pages"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   587
    <xsl:text>}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   588
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   589
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   590
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   591
  </xsl:template>
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
   592
  <xsl:template mode="per_page_widget_template" match="*"/>
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
   593
  <debug:detachable-pages/>
2940
034b6ce4f885 SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2939
diff changeset
   594
  <xsl:template match="debug:detachable-pages">
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   595
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   596
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   597
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   598
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   599
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   600
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   601
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   602
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   603
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   604
</xsl:text>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   605
    <xsl:text>DETACHABLES:
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   606
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   607
    <xsl:for-each select="$detachable_elements">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   608
      <xsl:text> </xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   609
      <xsl:value-of select="@id"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   610
      <xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   611
</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   612
    </xsl:for-each>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   613
    <xsl:text>In Foreach:
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   614
</xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   615
    <xsl:for-each select="$in_forEach_widget_ids">
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   616
      <xsl:text> </xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   617
      <xsl:value-of select="."/>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   618
      <xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   619
</xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   620
    </xsl:for-each>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   621
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   622
</xsl:text>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   623
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   624
  <xsl:template mode="inline_svg" match="@* | node()">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   625
    <xsl:if test="not(@id = $discardable_elements/@id)">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   626
      <xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   627
        <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   628
      </xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   629
    </xsl:if>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   630
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   631
  <xsl:template mode="inline_svg" match="svg:svg/@width"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   632
  <xsl:template mode="inline_svg" match="svg:svg/@height"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   633
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:svg">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   634
    <svg>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   635
      <xsl:attribute name="preserveAspectRatio">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   636
        <xsl:text>none</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   637
      </xsl:attribute>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   638
      <xsl:attribute name="height">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   639
        <xsl:text>100vh</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   640
      </xsl:attribute>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   641
      <xsl:attribute name="width">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   642
        <xsl:text>100vw</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   643
      </xsl:attribute>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   644
      <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   645
    </svg>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   646
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   647
  <xsl:template mode="inline_svg" match="svg:svg[@viewBox!=concat('0 0 ', @width, ' ', @height)]">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   648
    <xsl:message terminate="yes">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   649
      <xsl:text>ViewBox settings other than X=0, Y=0 and Scale=1 are not supported</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   650
    </xsl:message>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   651
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   652
  <xsl:template mode="inline_svg" match="sodipodi:namedview[@units!='px' or @inkscape:document-units!='px']">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   653
    <xsl:message terminate="yes">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   654
      <xsl:text>All units must be set to "px" in Inkscape's document properties</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   655
    </xsl:message>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   656
  </xsl:template>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   657
  <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   658
  <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   659
  <xsl:variable name="targets_not_to_unlink" select="$hmi_elements[@id = $hmi_lists/@id]/descendant::svg:*"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   660
  <xsl:variable name="to_unlink" select="$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   661
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:use">
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   662
    <xsl:variable name="targetid" select="substring-after(@xlink:href,'#')"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   663
    <xsl:choose>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   664
      <xsl:when test="@id = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   665
        <xsl:call-template name="unlink_clone">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   666
          <xsl:with-param name="targetid" select="$targetid"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   667
        </xsl:call-template>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   668
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   669
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   670
        <xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   671
          <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   672
        </xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   673
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   674
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   675
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   676
  <xsl:variable name="_excluded_use_attrs">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   677
    <name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   678
      <xsl:text>href</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   679
    </name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   680
    <name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   681
      <xsl:text>width</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   682
    </name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   683
    <name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   684
      <xsl:text>height</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   685
    </name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   686
    <name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   687
      <xsl:text>x</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   688
    </name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   689
    <name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   690
      <xsl:text>y</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   691
    </name>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   692
  </xsl:variable>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   693
  <xsl:variable name="excluded_use_attrs" select="exsl:node-set($_excluded_use_attrs)"/>
2969
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   694
  <xsl:variable name="_merge_use_attrs">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   695
    <name>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   696
      <xsl:text>transform</xsl:text>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   697
    </name>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   698
    <name>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   699
      <xsl:text>style</xsl:text>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   700
    </name>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   701
  </xsl:variable>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   702
  <xsl:variable name="merge_use_attrs" select="exsl:node-set($_merge_use_attrs)"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   703
  <xsl:template xmlns="http://www.w3.org/2000/svg" name="unlink_clone">
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   704
    <xsl:param name="targetid"/>
2969
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   705
    <xsl:variable name="target" select="//svg:*[@id = $targetid]"/>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   706
    <g>
2969
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   707
      <xsl:choose>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   708
        <xsl:when test="$target[self::svg:g]">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   709
          <xsl:for-each select="@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   710
            <xsl:attribute name="{name()}">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   711
              <xsl:value-of select="."/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   712
            </xsl:attribute>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   713
          </xsl:for-each>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   714
          <xsl:if test="@style | $target/@style">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   715
            <xsl:attribute name="style">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   716
              <xsl:value-of select="@style"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   717
              <xsl:if test="@style and $target/@style">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   718
                <xsl:text>;</xsl:text>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   719
              </xsl:if>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   720
              <xsl:value-of select="$target/@style"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   721
            </xsl:attribute>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   722
          </xsl:if>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   723
          <xsl:if test="@transform | $target/@transform">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   724
            <xsl:attribute name="transform">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   725
              <xsl:value-of select="@transform"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   726
              <xsl:if test="@transform and $target/@transform">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   727
                <xsl:text> </xsl:text>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   728
              </xsl:if>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   729
              <xsl:value-of select="$target/@transform"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   730
            </xsl:attribute>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   731
          </xsl:if>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   732
          <xsl:apply-templates mode="unlink_clone" select="$target/*">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   733
            <xsl:with-param name="seed" select="@id"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   734
          </xsl:apply-templates>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   735
        </xsl:when>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   736
        <xsl:otherwise>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   737
          <xsl:for-each select="@*[not(local-name() = $excluded_use_attrs/name)]">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   738
            <xsl:attribute name="{name()}">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   739
              <xsl:value-of select="."/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   740
            </xsl:attribute>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   741
          </xsl:for-each>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   742
          <xsl:apply-templates mode="unlink_clone" select="$target">
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   743
            <xsl:with-param name="seed" select="@id"/>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   744
          </xsl:apply-templates>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   745
        </xsl:otherwise>
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
   746
      </xsl:choose>
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   747
    </g>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   748
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   749
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="@id">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   750
    <xsl:param name="seed"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   751
    <xsl:attribute name="id">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   752
      <xsl:value-of select="$seed"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   753
      <xsl:text>_</xsl:text>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   754
      <xsl:value-of select="."/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   755
    </xsl:attribute>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   756
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   757
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="@*">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   758
    <xsl:copy/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   759
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   760
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="svg:*">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   761
    <xsl:param name="seed"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   762
    <xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   763
      <xsl:when test="@id = $hmi_elements/@id">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   764
        <use>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   765
          <xsl:attribute name="xlink:href">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   766
            <xsl:value-of select="concat('#',@id)"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   767
          </xsl:attribute>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   768
        </use>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   769
      </xsl:when>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   770
      <xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   771
        <xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   772
          <xsl:apply-templates mode="unlink_clone" select="@* | node()">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   773
            <xsl:with-param name="seed" select="$seed"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   774
          </xsl:apply-templates>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   775
        </xsl:copy>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   776
      </xsl:otherwise>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   777
    </xsl:choose>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   778
  </xsl:template>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   779
  <xsl:variable name="result_svg">
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   780
    <xsl:apply-templates mode="inline_svg" select="/"/>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   781
  </xsl:variable>
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   782
  <xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   783
  <preamble:inline-svg/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   784
  <xsl:template match="preamble:inline-svg">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   785
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   786
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   787
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   788
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   789
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   790
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   791
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   792
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   793
    <xsl:text>let id = document.getElementById.bind(document);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   794
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   795
    <xsl:text>var svg_root = id("</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   796
    <xsl:value-of select="$svg/@id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   797
    <xsl:text>");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   798
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   799
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   800
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   801
  </xsl:template>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   802
  <debug:clone-unlinking/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   803
  <xsl:template match="debug:clone-unlinking">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   804
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   805
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   806
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   807
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   808
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   809
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   810
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   811
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   812
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   813
</xsl:text>
2904
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2903
diff changeset
   814
    <xsl:text>Unlinked :
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2903
diff changeset
   815
</xsl:text>
2878
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   816
    <xsl:for-each select="$to_unlink">
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   817
      <xsl:value-of select="@id"/>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   818
      <xsl:text>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   819
</xsl:text>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   820
    </xsl:for-each>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   821
    <xsl:text>Not to unlink :
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   822
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   823
    <xsl:for-each select="$targets_not_to_unlink">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   824
      <xsl:value-of select="@id"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   825
      <xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   826
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
   827
    </xsl:for-each>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   828
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   829
</xsl:text>
2878
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
   830
  </xsl:template>
2955
64e603b84aa3 SVGHMI: Exclude non-widget HMI:* labeled elements from hmi_widget. Namely : HMI:Page HMI:Lang and HMI:List have been excluded.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2954
diff changeset
   831
  <xsl:template mode="hmi_widgets" match="svg:*">
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   832
    <xsl:variable name="widget" select="func:widget(@id)"/>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   833
    <xsl:variable name="eltid" select="@id"/>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   834
    <xsl:variable name="args">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   835
      <xsl:for-each select="$widget/arg">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   836
        <xsl:text>"</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   837
        <xsl:value-of select="@value"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   838
        <xsl:text>"</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   839
        <xsl:if test="position()!=last()">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   840
          <xsl:text>,</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   841
        </xsl:if>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   842
      </xsl:for-each>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   843
    </xsl:variable>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   844
    <xsl:variable name="indexes">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   845
      <xsl:for-each select="$widget/path">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   846
        <xsl:choose>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   847
          <xsl:when test="not(@index)">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   848
            <xsl:message terminate="no">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   849
              <xsl:text>Widget </xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   850
              <xsl:value-of select="$widget/@type"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   851
              <xsl:text> id="</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   852
              <xsl:value-of select="$eltid"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   853
              <xsl:text>" : No match for path "</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   854
              <xsl:value-of select="@value"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   855
              <xsl:text>" in HMI tree</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   856
            </xsl:message>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   857
          </xsl:when>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   858
          <xsl:otherwise>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   859
            <xsl:value-of select="@index"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   860
            <xsl:if test="position()!=last()">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   861
              <xsl:text>,</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   862
            </xsl:if>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   863
          </xsl:otherwise>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   864
        </xsl:choose>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   865
      </xsl:for-each>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   866
    </xsl:variable>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   867
    <xsl:text>  "</xsl:text>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   868
    <xsl:value-of select="@id"/>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   869
    <xsl:text>": new </xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   870
    <xsl:value-of select="$widget/@type"/>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   871
    <xsl:text>Widget ("</xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   872
    <xsl:value-of select="@id"/>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   873
    <xsl:text>",[</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   874
    <xsl:value-of select="$args"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   875
    <xsl:text>],[</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   876
    <xsl:value-of select="$indexes"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   877
    <xsl:text>],{
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   878
</xsl:text>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   879
    <xsl:apply-templates mode="widget_defs" select="$widget">
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   880
      <xsl:with-param name="hmi_element" select="."/>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   881
    </xsl:apply-templates>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   882
    <xsl:text>  })</xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   883
    <xsl:if test="position()!=last()">
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   884
      <xsl:text>,</xsl:text>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   885
    </xsl:if>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
   886
    <xsl:text>
2793
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   887
</xsl:text>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   888
  </xsl:template>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   889
  <func:function name="func:unique_types">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   890
    <xsl:param name="elts_with_type"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   891
    <xsl:choose>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   892
      <xsl:when test="count($elts_with_type) &gt; 1">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   893
        <xsl:variable name="prior_results" select="func:unique_types($elts_with_type[position()!=last()])"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   894
        <xsl:choose>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   895
          <xsl:when test="$elts_with_type[last()][@type = $prior_results/@type]">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   896
            <func:result select="$prior_results"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   897
          </xsl:when>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   898
          <xsl:otherwise>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   899
            <func:result select="$prior_results | $elts_with_type[last()]"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   900
          </xsl:otherwise>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   901
        </xsl:choose>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   902
      </xsl:when>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   903
      <xsl:otherwise>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   904
        <func:result select="$elts_with_type"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   905
      </xsl:otherwise>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   906
    </xsl:choose>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   907
  </func:function>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   908
  <preamble:widget-base-class/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   909
  <xsl:template match="preamble:widget-base-class">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   910
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   911
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   912
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   913
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   914
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   915
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   916
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   917
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   918
    <xsl:text>class Widget {
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   919
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
   920
    <xsl:text>    offset = 0;
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
   921
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
   922
    <xsl:text>    frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
   923
</xsl:text>
2980
2a21d6060d64 SVGHMI: add "unsubscribable" property to widgets in order to generalize what already happens for jump buttons.
Edouard Tisserant
parents: 2979
diff changeset
   924
    <xsl:text>    unsubscribable = false;
2a21d6060d64 SVGHMI: add "unsubscribable" property to widgets in order to generalize what already happens for jump buttons.
Edouard Tisserant
parents: 2979
diff changeset
   925
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   926
    <xsl:text>    constructor(elt_id,args,indexes,members){
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   927
</xsl:text>
2961
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   928
    <xsl:text>        this.element_id = elt_id;
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   929
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   930
    <xsl:text>        this.element = id(elt_id);
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   931
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   932
    <xsl:text>        this.args = args;
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   933
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   934
    <xsl:text>        this.indexes = indexes;
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   935
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   936
    <xsl:text>        Object.keys(members).forEach(prop =&gt; this[prop]=members[prop]);
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   937
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   938
    <xsl:text>    }
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
   939
</xsl:text>
2961
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   940
    <xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   941
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   942
    <xsl:text>    unsub(){
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   943
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   944
    <xsl:text>        /* remove subsribers */
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   945
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   946
    <xsl:text>        if(!this.unsubscribable)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   947
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   948
    <xsl:text>            for(let i = 0; i &lt; this.indexes.length; i++) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   949
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   950
    <xsl:text>                let index = this.indexes[i];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   951
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   952
    <xsl:text>                if(this.relativeness[i])
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   953
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   954
    <xsl:text>                    index += this.offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   955
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   956
    <xsl:text>                subscribers[index].delete(this);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   957
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   958
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   959
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   960
    <xsl:text>        this.offset = 0;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   961
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   962
    <xsl:text>        this.relativeness = undefined;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   963
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   964
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   965
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   966
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   967
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   968
    <xsl:text>    sub(new_offset=0, relativeness){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   969
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   970
    <xsl:text>        this.offset = new_offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   971
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   972
    <xsl:text>        this.relativeness = relativeness;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   973
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   974
    <xsl:text>        /* add this's subsribers */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   975
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   976
    <xsl:text>        if(!this.unsubscribable)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   977
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   978
    <xsl:text>            for(let i = 0; i &lt; this.indexes.length; i++) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   979
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   980
    <xsl:text>                let index = this.indexes[i];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   981
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   982
    <xsl:text>                if(relativeness[i])
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   983
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   984
    <xsl:text>                    index += new_offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   985
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   986
    <xsl:text>                subscribers[index].add(this);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   987
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   988
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   989
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   990
    <xsl:text>        need_cache_apply.push(this); 
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   991
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   992
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   993
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   994
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   995
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   996
    <xsl:text>    apply_cache() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
   997
</xsl:text>
2980
2a21d6060d64 SVGHMI: add "unsubscribable" property to widgets in order to generalize what already happens for jump buttons.
Edouard Tisserant
parents: 2979
diff changeset
   998
    <xsl:text>        if(!this.unsubscribable) for(let index of this.indexes){
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
   999
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1000
    <xsl:text>            /* dispatch current cache in newly opened page widgets */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1001
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1002
    <xsl:text>            let realindex = index+this.offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1003
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1004
    <xsl:text>            let cached_val = cache[realindex];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1005
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1006
    <xsl:text>            if(cached_val != undefined)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1007
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1008
    <xsl:text>                this.new_hmi_value(realindex, cached_val, cached_val);
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1009
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1010
    <xsl:text>        }
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1011
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1012
    <xsl:text>    }
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1013
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1014
    <xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1015
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1016
    <xsl:text>    get_idx(index) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1017
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1018
    <xsl:text>         let orig = this.indexes[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1019
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1020
    <xsl:text>         return this.relativeness[index] ? orig + this.offset : orig;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1021
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1022
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1023
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1024
    <xsl:text>    change_hmi_value(index,opstr) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1025
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1026
    <xsl:text>        return change_hmi_value(this.get_idx(index), opstr);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1027
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1028
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1029
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1030
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1031
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1032
    <xsl:text>    apply_hmi_value(index, new_val) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1033
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1034
    <xsl:text>        return apply_hmi_value(this.get_idx(0), new_val);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1035
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1036
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1037
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1038
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1039
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1040
    <xsl:text>    new_hmi_value(index, value, oldval) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1041
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1042
    <xsl:text>        try {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1043
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1044
    <xsl:text>            // TODO avoid searching, store index at sub()
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1045
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1046
    <xsl:text>            for(let i = 0; i &lt; this.indexes.length; i++) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1047
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1048
    <xsl:text>                let refindex = this.indexes[i];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1049
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1050
    <xsl:text>                if(this.relativeness[i])
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1051
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1052
    <xsl:text>                    refindex += this.offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1053
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1054
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1055
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1056
    <xsl:text>                if(index == refindex) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1057
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1058
    <xsl:text>                    let d = this.dispatch;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1059
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1060
    <xsl:text>                    if(typeof(d) == "function"){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1061
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1062
    <xsl:text>                        d.call(this, value, oldval, i);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1063
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1064
    <xsl:text>                    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1065
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1066
    <xsl:text>                    else if(typeof(d) == "object"){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1067
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1068
    <xsl:text>                        d[i].call(this, value, oldval);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1069
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1070
    <xsl:text>                    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1071
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1072
    <xsl:text>                    /* else dispatch_0, ..., dispatch_n ? */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1073
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1074
    <xsl:text>                    /*else {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1075
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1076
    <xsl:text>                        throw new Error("Dunno how to dispatch to widget at index = " + index);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1077
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1078
    <xsl:text>                    }*/
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1079
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1080
    <xsl:text>                    break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1081
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1082
    <xsl:text>                }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1083
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1084
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1085
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1086
    <xsl:text>        } catch(err) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1087
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1088
    <xsl:text>            console.log(err);
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1089
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1090
    <xsl:text>        }
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1091
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  1092
    <xsl:text>    }
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  1093
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1094
    <xsl:text>}
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1095
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1096
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1097
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1098
  </xsl:template>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1099
  <preamble:hmi-classes/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1100
  <xsl:template match="preamble:hmi-classes">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1101
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1102
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1103
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1104
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1105
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1106
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1107
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1108
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1109
    <xsl:variable name="used_widget_types" select="func:unique_types($parsed_widgets/widget)"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1110
    <xsl:apply-templates mode="widget_class" select="$used_widget_types"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1111
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1112
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1113
  </xsl:template>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1114
  <xsl:template mode="widget_class" match="widget">
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1115
    <xsl:text>class </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1116
    <xsl:value-of select="@type"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1117
    <xsl:text>Widget extends Widget{
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1118
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1119
    <xsl:text>    /* empty class, as </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1120
    <xsl:value-of select="@type"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1121
    <xsl:text> widget didn't provide any */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1122
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1123
    <xsl:text>}
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1124
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1125
  </xsl:template>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  1126
  <xsl:variable name="excluded_types" select="str:split('Page Lang')"/>
2955
64e603b84aa3 SVGHMI: Exclude non-widget HMI:* labeled elements from hmi_widget. Namely : HMI:Page HMI:Lang and HMI:List have been excluded.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2954
diff changeset
  1127
  <xsl:variable name="excluded_ids" select="$parsed_widgets/widget[not(@type = $excluded_types)]/@id"/>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1128
  <preamble:hmi-elements/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1129
  <xsl:template match="preamble:hmi-elements">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1130
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1131
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1132
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1133
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1134
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1135
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1136
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1137
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1138
    <xsl:text>var hmi_widgets = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1139
</xsl:text>
2955
64e603b84aa3 SVGHMI: Exclude non-widget HMI:* labeled elements from hmi_widget. Namely : HMI:Page HMI:Lang and HMI:List have been excluded.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2954
diff changeset
  1140
    <xsl:apply-templates mode="hmi_widgets" select="$hmi_elements[@id = $excluded_ids]"/>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1141
    <xsl:text>}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1142
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1143
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  1144
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  1145
  </xsl:template>
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
  1146
  <xsl:template name="defs_by_labels">
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
  1147
    <xsl:param name="labels" select="''"/>
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
  1148
    <xsl:param name="mandatory" select="'yes'"/>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1149
    <xsl:param name="subelements" select="/.."/>
2800
68cee1366b9c SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents: 2799
diff changeset
  1150
    <xsl:param name="hmi_element"/>
2834
6ac6a9dff594 SVGHMI: be a bit more tolerant with missing HMI paths or missing elements in widgets : continue build (with warning) and fail silently at runtime.
Edouard Tisserant
parents: 2833
diff changeset
  1151
    <xsl:variable name="widget_type" select="@type"/>
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
  1152
    <xsl:for-each select="str:split($labels)">
2807
7fa21b3b5f9f SVGHMI - added simple Meter widget.
Edouard Tisserant
parents: 2806
diff changeset
  1153
      <xsl:variable name="name" select="."/>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1154
      <xsl:variable name="elt" select="$result_svg_ns//*[@id = $hmi_element/@id]//*[@inkscape:label=$name][1]"/>
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1155
      <xsl:choose>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1156
        <xsl:when test="not($elt/@id)">
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1157
          <xsl:if test="$mandatory='yes'">
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1158
            <xsl:message terminate="yes">
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1159
              <xsl:value-of select="$widget_type"/>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1160
              <xsl:text> widget must have a </xsl:text>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1161
              <xsl:value-of select="$name"/>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1162
              <xsl:text> element</xsl:text>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1163
            </xsl:message>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1164
          </xsl:if>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1165
        </xsl:when>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1166
        <xsl:otherwise>
2852
f7349ca820c9 SVGHMI: completely fixed indentation of generated widget description. Lets try to keep it as-is until we can use yslt indentation.
Edouard Tisserant
parents: 2851
diff changeset
  1167
          <xsl:text>    </xsl:text>
2807
7fa21b3b5f9f SVGHMI - added simple Meter widget.
Edouard Tisserant
parents: 2806
diff changeset
  1168
          <xsl:value-of select="$name"/>
2847
dffade5c83d3 SVGHMI: fix some JS + add generation of detachable elements, to be continued
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2846
diff changeset
  1169
          <xsl:text>_elt: id("</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1170
          <xsl:value-of select="$elt/@id"/>
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1171
          <xsl:text>"),
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1172
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1173
          <xsl:if test="$subelements">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1174
            <xsl:text>    </xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1175
            <xsl:value-of select="$name"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1176
            <xsl:text>_sub: {
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1177
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1178
            <xsl:for-each select="str:split($subelements)">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1179
              <xsl:variable name="subname" select="."/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1180
              <xsl:variable name="subelt" select="$elt/*[@inkscape:label=$subname][1]"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1181
              <xsl:choose>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1182
                <xsl:when test="not($subelt/@id)">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1183
                  <xsl:if test="$mandatory='yes'">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1184
                    <xsl:message terminate="yes">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1185
                      <xsl:value-of select="$widget_type"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1186
                      <xsl:text> widget must have a </xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1187
                      <xsl:value-of select="$name"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1188
                      <xsl:text>/</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1189
                      <xsl:value-of select="$subname"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1190
                      <xsl:text> element</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1191
                    </xsl:message>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1192
                  </xsl:if>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1193
                  <xsl:text>        /* missing </xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1194
                  <xsl:value-of select="$name"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1195
                  <xsl:text>/</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1196
                  <xsl:value-of select="$subname"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1197
                  <xsl:text> element */
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1198
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1199
                </xsl:when>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1200
                <xsl:otherwise>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1201
                  <xsl:text>        "</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1202
                  <xsl:value-of select="$subname"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1203
                  <xsl:text>": id("</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1204
                  <xsl:value-of select="$subelt/@id"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1205
                  <xsl:text>")</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1206
                  <xsl:if test="position()!=last()">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1207
                    <xsl:text>,</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1208
                  </xsl:if>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1209
                  <xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1210
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1211
                </xsl:otherwise>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1212
              </xsl:choose>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1213
            </xsl:for-each>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1214
            <xsl:text>    },
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1215
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  1216
          </xsl:if>
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1217
        </xsl:otherwise>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  1218
      </xsl:choose>
2807
7fa21b3b5f9f SVGHMI - added simple Meter widget.
Edouard Tisserant
parents: 2806
diff changeset
  1219
    </xsl:for-each>
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
  1220
  </xsl:template>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1221
  <func:function name="func:escape_quotes">
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1222
    <xsl:param name="txt"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1223
    <xsl:variable name="frst" select="substring-before($txt,'&quot;')"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1224
    <xsl:variable name="frstln" select="string-length($frst)"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1225
    <xsl:choose>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1226
      <xsl:when test="$frstln &gt; 0 and string-length($txt) &gt; $frstln">
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1227
        <func:result select="concat($frst,'\&quot;',func:escape_quotes(substring-after($txt,'&quot;')))"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1228
      </xsl:when>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1229
      <xsl:otherwise>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1230
        <func:result select="$txt"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1231
      </xsl:otherwise>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1232
    </xsl:choose>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  1233
  </func:function>
2961
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1234
  <xsl:template mode="widget_class" match="widget[@type='Back']">
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1235
    <xsl:text>class BackWidget extends Widget{
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1236
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1237
    <xsl:text>    on_click(evt) {
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1238
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1239
    <xsl:text>        if(jump_history.length &gt; 1){
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1240
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1241
    <xsl:text>           jump_history.pop();
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1242
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1243
    <xsl:text>           let [page_name, index] = jump_history.pop();
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1244
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1245
    <xsl:text>           switch_page(page_name, index);
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1246
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1247
    <xsl:text>        }
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  1248
</xsl:text>
2961
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1249
    <xsl:text>    }
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1250
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1251
    <xsl:text>    init() {
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1252
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1253
    <xsl:text>        this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1254
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1255
    <xsl:text>    }
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1256
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1257
    <xsl:text>}
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1258
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1259
  </xsl:template>
2976
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1260
  <xsl:template mode="widget_defs" match="widget[@type='Button']">
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1261
    <xsl:param name="hmi_element"/>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1262
    <xsl:call-template name="defs_by_labels">
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1263
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1264
      <xsl:with-param name="labels">
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1265
        <xsl:text>active inactive</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1266
      </xsl:with-param>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1267
      <xsl:with-param name="mandatory" select="'no'"/>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1268
    </xsl:call-template>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1269
    <xsl:text>frequency: 5,
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1270
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1271
    <xsl:text>on_mouse_down: function(evt) {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1272
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1273
    <xsl:text>    if (this.active_style &amp;&amp; this.inactive_style) {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1274
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1275
    <xsl:text>        this.active_elt.setAttribute("style", this.active_style);
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1276
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1277
    <xsl:text>        this.inactive_elt.setAttribute("style", "display:none");
2961
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1278
</xsl:text>
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1279
    <xsl:text>    }
00825316ed00 SVGHMI: Update Button widget to class declaration, and add a button widget in tests/svghmi.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
  1280
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  1281
    <xsl:text>    this.apply_hmi_value(0, 1);
2976
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1282
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1283
    <xsl:text>},
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1284
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1285
    <xsl:text>on_mouse_up: function(evt) {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1286
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1287
    <xsl:text>    if (this.active_style &amp;&amp; this.inactive_style) {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1288
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1289
    <xsl:text>        this.active_elt.setAttribute("style", "display:none");
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1290
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1291
    <xsl:text>        this.inactive_elt.setAttribute("style", this.inactive_style);
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1292
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1293
    <xsl:text>    }
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1294
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  1295
    <xsl:text>    this.apply_hmi_value(0, 0);
2976
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1296
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1297
    <xsl:text>},
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1298
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1299
    <xsl:text>active_style: undefined,
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1300
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1301
    <xsl:text>inactive_style: undefined,
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1302
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1303
    <xsl:text>init: function() {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1304
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1305
    <xsl:text>  this.active_style = this.active_elt ? this.active_elt.style.cssText : undefined;
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1306
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1307
    <xsl:text>  this.inactive_style = this.inactive_elt ? this.inactive_elt.style.cssText : undefined;
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1308
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1309
    <xsl:text>  if (this.active_style &amp;&amp; this.inactive_style) {
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1310
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1311
    <xsl:text>      this.active_elt.setAttribute("style", "display:none");
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1312
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1313
    <xsl:text>      this.inactive_elt.setAttribute("style", this.inactive_style);
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1314
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1315
    <xsl:text>  }
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1316
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1317
    <xsl:text>  this.element.setAttribute("onmousedown", "hmi_widgets['</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1318
    <xsl:value-of select="$hmi_element/@id"/>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1319
    <xsl:text>'].on_mouse_down(evt)");
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1320
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1321
    <xsl:text>  this.element.setAttribute("onmouseup", "hmi_widgets['</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1322
    <xsl:value-of select="$hmi_element/@id"/>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1323
    <xsl:text>'].on_mouse_up(evt)");
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1324
</xsl:text>
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  1325
    <xsl:text>},
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1326
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1327
  </xsl:template>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1328
  <xsl:template mode="widget_defs" match="widget[@type='CircularBar']">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1329
    <xsl:param name="hmi_element"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1330
    <xsl:text>frequency: 10,
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1331
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1332
    <xsl:call-template name="defs_by_labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1333
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1334
      <xsl:with-param name="labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1335
        <xsl:text>path</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1336
      </xsl:with-param>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1337
    </xsl:call-template>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1338
    <xsl:call-template name="defs_by_labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1339
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1340
      <xsl:with-param name="labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1341
        <xsl:text>value min max</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1342
      </xsl:with-param>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1343
      <xsl:with-param name="mandatory" select="'no'"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1344
    </xsl:call-template>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1345
    <xsl:text>dispatch: function(value) {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1346
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1347
    <xsl:text>    if(this.value_elt)
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1348
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1349
    <xsl:text>        this.value_elt.textContent = String(value);
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1350
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1351
    <xsl:text>    let [min,max,start,end] = this.range;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1352
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1353
    <xsl:text>    let [cx,cy] = this.center;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1354
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1355
    <xsl:text>    let [rx,ry] = this.proportions;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1356
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1357
    <xsl:text>    let tip = start + (end-start)*Number(value)/(max-min);
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1358
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1359
    <xsl:text>    let size = 0;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1360
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1361
    <xsl:text>    if (tip-start &gt; Math.PI) {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1362
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1363
    <xsl:text>        size = 1;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1364
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1365
    <xsl:text>    } else {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1366
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1367
    <xsl:text>        size = 0;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1368
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1369
    <xsl:text>    }
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1370
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1371
    <xsl:text>    this.path_elt.setAttribute('d', "M "+(cx+rx*Math.cos(start))+","+(cy+ry*Math.sin(start))+" A "+rx+","+ry+" 0 "+size+" 1 "+(cx+rx*Math.cos(tip))+","+(cy+ry*Math.sin(tip)));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1372
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1373
    <xsl:text>},
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1374
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1375
    <xsl:text>range: undefined,
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1376
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1377
    <xsl:text>init: function() {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1378
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1379
    <xsl:text>    let start = Number(this.path_elt.getAttribute('sodipodi:start'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1380
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1381
    <xsl:text>    let end = Number(this.path_elt.getAttribute('sodipodi:end'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1382
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1383
    <xsl:text>    let cx = Number(this.path_elt.getAttribute('sodipodi:cx'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1384
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1385
    <xsl:text>    let cy = Number(this.path_elt.getAttribute('sodipodi:cy'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1386
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1387
    <xsl:text>    let rx = Number(this.path_elt.getAttribute('sodipodi:rx'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1388
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1389
    <xsl:text>    let ry = Number(this.path_elt.getAttribute('sodipodi:ry'));
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1390
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1391
    <xsl:text>    if (ry == 0) {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1392
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1393
    <xsl:text>        ry = rx;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1394
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1395
    <xsl:text>    }
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1396
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1397
    <xsl:text>    if (start &gt; end) {
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1398
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1399
    <xsl:text>        end = end + 2*Math.PI;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1400
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1401
    <xsl:text>    }
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1402
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1403
    <xsl:text>    let min = this.min_elt ?
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1404
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1405
    <xsl:text>              Number(this.min_elt.textContent) :
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1406
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1407
    <xsl:text>              this.args.length &gt;= 1 ? this.args[0] : 0;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1408
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1409
    <xsl:text>    let max = this.max_elt ?
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1410
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1411
    <xsl:text>              Number(this.max_elt.textContent) :
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1412
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1413
    <xsl:text>              this.args.length &gt;= 2 ? this.args[1] : 100;
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1414
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1415
    <xsl:text>    this.range = [min, max, start, end];
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1416
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1417
    <xsl:text>    this.center = [cx, cy];
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1418
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1419
    <xsl:text>    this.proportions = [rx, ry];
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1420
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1421
    <xsl:text>},
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1422
</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  1423
  </xsl:template>
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1424
  <xsl:template mode="widget_class" match="widget[@type='Display']">
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1425
    <xsl:text>class DisplayWidget extends Widget{
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1426
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1427
    <xsl:text>    frequency = 5;
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1428
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1429
    <xsl:text>    dispatch(value) {
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1430
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1431
    <xsl:text>        this.element.textContent = String(value);
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1432
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1433
    <xsl:text>    }
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1434
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1435
    <xsl:text>}
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1436
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1437
  </xsl:template>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  1438
  <xsl:template mode="widget_defs" match="widget[@type='Display']">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  1439
    <xsl:param name="hmi_element"/>
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1440
    <xsl:if test="$hmi_element[not(self::svg:text)]">
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1441
      <xsl:message terminate="yes">
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1442
        <xsl:text>Display Widget id="</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1443
        <xsl:value-of select="$hmi_element/@id"/>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1444
        <xsl:text>" is not a svg::text element</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1445
      </xsl:message>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  1446
    </xsl:if>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  1447
  </xsl:template>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1448
  <xsl:template mode="widget_defs" match="widget[@type='DropDown']">
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1449
    <xsl:param name="hmi_element"/>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1450
    <xsl:call-template name="defs_by_labels">
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1451
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1452
      <xsl:with-param name="labels">
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1453
        <xsl:text>text box button</xsl:text>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1454
      </xsl:with-param>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1455
    </xsl:call-template>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1456
    <xsl:text>    dispatch: function(value) {
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1457
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1458
    <xsl:text>        if(!this.opened) this.set_selection(value);
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1459
</xsl:text>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1460
    <xsl:text>    },
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1461
</xsl:text>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1462
    <xsl:text>    init: function() {
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1463
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1464
    <xsl:text>        this.button_elt.setAttribute("onclick", "hmi_widgets['</xsl:text>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1465
    <xsl:value-of select="$hmi_element/@id"/>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1466
    <xsl:text>'].on_button_click()");
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1467
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1468
    <xsl:text>        // Save original size of rectangle
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1469
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1470
    <xsl:text>        this.box_bbox = this.box_elt.getBBox()
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1471
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1472
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1473
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1474
    <xsl:text>        // Compute margins
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1475
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1476
    <xsl:text>        text_bbox = this.text_elt.getBBox()
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1477
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1478
    <xsl:text>        lmargin = text_bbox.x - this.box_bbox.x;
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1479
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1480
    <xsl:text>        tmargin = text_bbox.y - this.box_bbox.y;
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1481
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1482
    <xsl:text>        this.margins = [lmargin, tmargin].map(x =&gt; Math.max(x,0));
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1483
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1484
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1485
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1486
    <xsl:text>        // It is assumed that list content conforms to Array interface.
2931
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1487
</xsl:text>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1488
    <xsl:text>        this.content = [
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1489
</xsl:text>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1490
    <xsl:for-each select="arg">
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1491
      <xsl:text>"</xsl:text>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1492
      <xsl:value-of select="@value"/>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1493
      <xsl:text>",
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1494
</xsl:text>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1495
    </xsl:for-each>
f51c0e2e0bcb SVGHMI: HMI:DropDown now temporarily takes content from widget's arguments, until HMI:List is implemented.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2930
diff changeset
  1496
    <xsl:text>        ];
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1497
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1498
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1499
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1500
    <xsl:text>        // Index of first visible element in the menu, when opened
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1501
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1502
    <xsl:text>        this.menu_offset = 0;
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1503
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1504
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1505
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1506
    <xsl:text>        // How mutch to lift the menu vertically so that it does not cross bottom border
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1507
</xsl:text>
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1508
    <xsl:text>        this.lift = 0;
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1509
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1510
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1511
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1512
    <xsl:text>        // Event handlers cannot be object method ('this' is unknown)
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1513
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1514
    <xsl:text>        // as a workaround, handler given to addEventListener is bound in advance.
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1515
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1516
    <xsl:text>        this.bound_close_on_click_elsewhere = this.close_on_click_elsewhere.bind(this);
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1517
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1518
    <xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1519
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1520
    <xsl:text>        this.opened = false;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1521
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1522
    <xsl:text>    },
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1523
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1524
    <xsl:text>    // Called when a menu entry is clicked
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1525
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1526
    <xsl:text>    on_selection_click: function(selection) {
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1527
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1528
    <xsl:text>        this.close();
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1529
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  1530
    <xsl:text>        this.apply_hmi_value(0, selection);
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1531
</xsl:text>
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1532
    <xsl:text>    },
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1533
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1534
    <xsl:text>    on_button_click: function() {
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1535
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1536
    <xsl:text>        this.open();
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1537
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1538
    <xsl:text>    },
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1539
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1540
    <xsl:text>    on_backward_click: function(){
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1541
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1542
    <xsl:text>        this.scroll(false);
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1543
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1544
    <xsl:text>    },
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1545
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1546
    <xsl:text>    on_forward_click:function(){
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1547
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1548
    <xsl:text>        this.scroll(true);
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1549
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1550
    <xsl:text>    },
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1551
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1552
    <xsl:text>    set_selection: function(value) {
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1553
</xsl:text>
2934
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1554
    <xsl:text>        let display_str;
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1555
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1556
    <xsl:text>        if(value &gt;= 0 &amp;&amp; value &lt; this.content.length){
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1557
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1558
    <xsl:text>            // if valid selection resolve content
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1559
</xsl:text>
2934
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1560
    <xsl:text>            display_str = this.content[value];
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1561
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1562
    <xsl:text>            this.last_selection = value;
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1563
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1564
    <xsl:text>        } else {
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1565
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1566
    <xsl:text>            // otherwise show problem
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1567
</xsl:text>
2934
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1568
    <xsl:text>            display_str = "?"+String(value)+"?";
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1569
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1570
    <xsl:text>        }
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1571
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1572
    <xsl:text>        // It is assumed that first span always stays,
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1573
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1574
    <xsl:text>        // and contains selection when menu is closed
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1575
</xsl:text>
2934
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1576
    <xsl:text>        this.text_elt.firstElementChild.textContent = display_str;
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1577
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1578
    <xsl:text>    },
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1579
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1580
    <xsl:text>    grow_text: function(up_to) {
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1581
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1582
    <xsl:text>        let count = 1;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1583
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1584
    <xsl:text>        let txt = this.text_elt; 
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1585
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1586
    <xsl:text>        let first = txt.firstElementChild;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1587
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1588
    <xsl:text>        // Real world (pixels) boundaries of current page
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1589
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1590
    <xsl:text>        let bounds = svg_root.getBoundingClientRect(); 
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1591
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1592
    <xsl:text>        this.lift = 0;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1593
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1594
    <xsl:text>        while(count &lt; up_to) {
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1595
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1596
    <xsl:text>            let next = first.cloneNode();
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1597
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1598
    <xsl:text>            // relative line by line text flow instead of absolute y coordinate
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1599
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1600
    <xsl:text>            next.removeAttribute("y");
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1601
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1602
    <xsl:text>            next.setAttribute("dy", "1.1em");
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1603
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1604
    <xsl:text>            // default content to allow computing text element bbox
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1605
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1606
    <xsl:text>            next.textContent = "...";
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1607
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1608
    <xsl:text>            // append new span to text element
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1609
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1610
    <xsl:text>            txt.appendChild(next);
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1611
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1612
    <xsl:text>            // now check if text extended by one row fits to page
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1613
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1614
    <xsl:text>            // FIXME : exclude margins to be more accurate on box size
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1615
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1616
    <xsl:text>            let rect = txt.getBoundingClientRect();
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1617
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1618
    <xsl:text>            if(rect.bottom &gt; bounds.bottom){
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1619
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1620
    <xsl:text>                // in case of overflow at the bottom, lift up one row
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1621
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1622
    <xsl:text>                let backup = first.getAttribute("dy");
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1623
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1624
    <xsl:text>                // apply lift asr a dy added too first span (y attrib stays)
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1625
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1626
    <xsl:text>                first.setAttribute("dy", "-"+String((this.lift+1)*1.1)+"em");
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1627
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1628
    <xsl:text>                rect = txt.getBoundingClientRect();
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1629
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1630
    <xsl:text>                if(rect.top &gt; bounds.top){
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1631
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1632
    <xsl:text>                    this.lift += 1;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1633
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1634
    <xsl:text>                } else {
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1635
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1636
    <xsl:text>                    // if it goes over the top, then backtrack
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1637
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1638
    <xsl:text>                    // restore dy attribute on first span
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1639
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1640
    <xsl:text>                    if(backup)
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1641
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1642
    <xsl:text>                        first.setAttribute("dy", backup);
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1643
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1644
    <xsl:text>                    else
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1645
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1646
    <xsl:text>                        first.removeAttribute("dy");
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1647
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1648
    <xsl:text>                    // remove unwanted child
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1649
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1650
    <xsl:text>                    txt.removeChild(next);
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1651
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1652
    <xsl:text>                    return count;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1653
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1654
    <xsl:text>                }
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1655
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1656
    <xsl:text>            }
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1657
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1658
    <xsl:text>            count++;
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1659
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1660
    <xsl:text>        }
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1661
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1662
    <xsl:text>        return count;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1663
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1664
    <xsl:text>    },
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1665
</xsl:text>
2933
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1666
    <xsl:text>    close_on_click_elsewhere: function(e) {
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1667
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1668
    <xsl:text>        // inhibit events not targetting spans (menu items)
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1669
</xsl:text>
2933
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1670
    <xsl:text>        if(e.target.parentNode !== this.text_elt){
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1671
</xsl:text>
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1672
    <xsl:text>            e.stopPropagation();
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1673
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1674
    <xsl:text>            // close menu in case click is outside box
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1675
</xsl:text>
2933
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1676
    <xsl:text>            if(e.target !== this.box_elt)
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1677
</xsl:text>
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1678
    <xsl:text>                this.close();
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1679
</xsl:text>
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1680
    <xsl:text>        }
ed3f712a8eef SVGHMI: When clicking outside of opened HMI:DropDown box, close it.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2932
diff changeset
  1681
</xsl:text>
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1682
    <xsl:text>    },
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1683
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1684
    <xsl:text>    close: function(){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1685
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1686
    <xsl:text>        // Stop hogging all click events
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1687
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1688
    <xsl:text>        svg_root.removeEventListener("click", this.bound_close_on_click_elsewhere, true);
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1689
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1690
    <xsl:text>        // Restore position and sixe of widget elements
2932
abb995a30088 SVGHMI: Fix HMI:DropDown flicker on close.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2931
diff changeset
  1691
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1692
    <xsl:text>        this.reset_text();
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1693
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1694
    <xsl:text>        this.reset_box();
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1695
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1696
    <xsl:text>        // Put the button back in place
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1697
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1698
    <xsl:text>        this.element.appendChild(this.button_elt);
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1699
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1700
    <xsl:text>        // Mark as closed (to allow dispatch)
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1701
</xsl:text>
2932
abb995a30088 SVGHMI: Fix HMI:DropDown flicker on close.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2931
diff changeset
  1702
    <xsl:text>        this.opened = false;
abb995a30088 SVGHMI: Fix HMI:DropDown flicker on close.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2931
diff changeset
  1703
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1704
    <xsl:text>        // Dispatch last cached value
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1705
</xsl:text>
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1706
    <xsl:text>        this.apply_cache();
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1707
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1708
    <xsl:text>    },
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1709
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1710
    <xsl:text>    // Set text content when content is smaller than menu (no scrolling)
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1711
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1712
    <xsl:text>    set_complete_text: function(){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1713
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1714
    <xsl:text>        let spans = this.text_elt.children; 
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1715
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1716
    <xsl:text>        let c = 0;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1717
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1718
    <xsl:text>        for(let item of this.content){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1719
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1720
    <xsl:text>            let span=spans[c];
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1721
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1722
    <xsl:text>            span.textContent = item;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1723
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1724
    <xsl:text>            span.setAttribute("onclick", "hmi_widgets['</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1725
    <xsl:value-of select="$hmi_element/@id"/>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1726
    <xsl:text>'].on_selection_click("+c+")");
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1727
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1728
    <xsl:text>            c++;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1729
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1730
    <xsl:text>        }
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1731
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1732
    <xsl:text>    },
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1733
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1734
    <xsl:text>    // Move partial view :
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1735
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1736
    <xsl:text>    // false : upward, lower value
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1737
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1738
    <xsl:text>    // true  : downward, higher value
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1739
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1740
    <xsl:text>    scroll: function(forward){
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1741
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1742
    <xsl:text>        let contentlength = this.content.length;
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1743
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1744
    <xsl:text>        let spans = this.text_elt.children; 
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1745
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1746
    <xsl:text>        let spanslength = spans.length;
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1747
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1748
    <xsl:text>        // reduce accounted menu size according to jumps
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1749
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1750
    <xsl:text>        if(this.menu_offset != 0) spanslength--;
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1751
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1752
    <xsl:text>        if(this.menu_offset &lt; contentlength - 1) spanslength--;
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1753
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1754
    <xsl:text>        if(forward){
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1755
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1756
    <xsl:text>            this.menu_offset = Math.min(
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1757
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1758
    <xsl:text>                contentlength - spans.length + 1, 
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1759
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1760
    <xsl:text>                this.menu_offset + spanslength);
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1761
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1762
    <xsl:text>        }else{
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1763
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1764
    <xsl:text>            this.menu_offset = Math.max(
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1765
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1766
    <xsl:text>                0, 
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1767
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1768
    <xsl:text>                this.menu_offset - spanslength);
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1769
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1770
    <xsl:text>        }
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1771
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1772
    <xsl:text>        console.log(this.menu_offset);
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1773
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1774
    <xsl:text>        this.set_partial_text();
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1775
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1776
    <xsl:text>    },
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1777
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1778
    <xsl:text>    // Setup partial view text content
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1779
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1780
    <xsl:text>    // with jumps at first and last entry when appropriate
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1781
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1782
    <xsl:text>    set_partial_text: function(){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1783
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1784
    <xsl:text>        let spans = this.text_elt.children; 
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1785
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1786
    <xsl:text>        let contentlength = this.content.length;
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1787
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1788
    <xsl:text>        let spanslength = spans.length;
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1789
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1790
    <xsl:text>        let i = this.menu_offset, c = 0;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1791
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1792
    <xsl:text>        while(c &lt; spanslength){
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1793
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1794
    <xsl:text>            let span=spans[c];
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1795
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1796
    <xsl:text>            // backward jump only present if not exactly at start
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1797
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1798
    <xsl:text>            if(c == 0 &amp;&amp; i != 0){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1799
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1800
    <xsl:text>                span.textContent = "&#x2191;  &#x2191;  &#x2191;";
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1801
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1802
    <xsl:text>                span.setAttribute("onclick", "hmi_widgets['</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1803
    <xsl:value-of select="$hmi_element/@id"/>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1804
    <xsl:text>'].on_backward_click()");
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1805
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1806
    <xsl:text>            // presence of forward jump when not right at the end
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1807
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1808
    <xsl:text>            }else if(c == spanslength-1 &amp;&amp; i &lt; contentlength - 1){
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1809
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1810
    <xsl:text>                span.textContent = "&#x2193;  &#x2193;  &#x2193;";
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1811
</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1812
    <xsl:text>                span.setAttribute("onclick", "hmi_widgets['</xsl:text>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1813
    <xsl:value-of select="$hmi_element/@id"/>
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1814
    <xsl:text>'].on_forward_click()");
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1815
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1816
    <xsl:text>            // otherwise normal content
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1817
</xsl:text>
2925
220172cbdcff SVGHMI: HMI:DropDown now scrolls forward and backward
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2924
diff changeset
  1818
    <xsl:text>            }else{
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1819
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1820
    <xsl:text>                span.textContent = this.content[i];
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1821
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1822
    <xsl:text>                span.setAttribute("onclick", "hmi_widgets['</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1823
    <xsl:value-of select="$hmi_element/@id"/>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1824
    <xsl:text>'].on_selection_click("+i+")");
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1825
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1826
    <xsl:text>                i++;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1827
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1828
    <xsl:text>            }
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1829
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1830
    <xsl:text>            c++;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1831
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1832
    <xsl:text>        }
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1833
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1834
    <xsl:text>    },
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1835
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1836
    <xsl:text>    open: function(){
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1837
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1838
    <xsl:text>        let length = this.content.length;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1839
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1840
    <xsl:text>        // systematically reset text, to strip eventual whitespace spans
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1841
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1842
    <xsl:text>        this.reset_text();
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1843
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1844
    <xsl:text>        // grow as much as needed or possible
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1845
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1846
    <xsl:text>        let slots = this.grow_text(length);
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1847
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1848
    <xsl:text>        // Depending on final size
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1849
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1850
    <xsl:text>        if(slots == length) {
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1851
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1852
    <xsl:text>            // show all at once
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1853
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1854
    <xsl:text>            this.set_complete_text();
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1855
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1856
    <xsl:text>        } else {
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1857
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1858
    <xsl:text>            // eventualy align menu to current selection, compensating for lift
2934
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1859
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1860
    <xsl:text>            let offset = this.last_selection - this.lift;
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1861
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1862
    <xsl:text>            if(offset &gt; 0)
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1863
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1864
    <xsl:text>                this.menu_offset = Math.min(offset + 1, length - slots + 1);
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1865
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1866
    <xsl:text>            else
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1867
</xsl:text>
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1868
    <xsl:text>                this.menu_offset = 0;
ee483e8346f5 SVGHMI: HMI:DropDown menu aligns to selected when opening
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2933
diff changeset
  1869
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1870
    <xsl:text>            // show surrounding values
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1871
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1872
    <xsl:text>            this.set_partial_text();
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1873
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1874
    <xsl:text>        }
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1875
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1876
    <xsl:text>        // Now that text size is known, we can set the box around it
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1877
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1878
    <xsl:text>        this.adjust_box_to_text();
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1879
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1880
    <xsl:text>        // Take button out until menu closed
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1881
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1882
    <xsl:text>        this.element.removeChild(this.button_elt);
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1883
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1884
    <xsl:text>        // Rise widget to top by moving it to last position among siblings
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1885
</xsl:text>
2930
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1886
    <xsl:text>        this.element.parentNode.appendChild(this.element.parentNode.removeChild(this.element));
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1887
</xsl:text>
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1888
    <xsl:text>        // disable interaction with background
41edcb8e0a01 SVGHMI: Connect HMI:DropDown to value in HMI Tree, in svghmi test as well.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2926
diff changeset
  1889
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1890
    <xsl:text>        svg_root.addEventListener("click", this.bound_close_on_click_elsewhere, true);
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1891
</xsl:text>
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1892
    <xsl:text>        // mark as open
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1893
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1894
    <xsl:text>        this.opened = true;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1895
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1896
    <xsl:text>    },
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1897
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1898
    <xsl:text>    // Put text element in normalized state
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1899
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1900
    <xsl:text>    reset_text: function(){
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1901
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1902
    <xsl:text>        let txt = this.text_elt; 
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1903
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1904
    <xsl:text>        let first = txt.firstElementChild;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1905
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1906
    <xsl:text>        // remove attribute eventually added to first text line while opening
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1907
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1908
    <xsl:text>        first.removeAttribute("onclick");
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1909
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1910
    <xsl:text>        first.removeAttribute("dy");
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1911
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1912
    <xsl:text>        // keep only the first line of text
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1913
</xsl:text>
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1914
    <xsl:text>        for(let span of Array.from(txt.children).slice(1)){
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1915
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1916
    <xsl:text>            txt.removeChild(span)
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1917
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1918
    <xsl:text>        }
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1919
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1920
    <xsl:text>    },
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1921
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1922
    <xsl:text>    // Put rectangle element in saved original state
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1923
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1924
    <xsl:text>    reset_box: function(){
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1925
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1926
    <xsl:text>        let m = this.box_bbox;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1927
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1928
    <xsl:text>        let b = this.box_elt;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1929
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1930
    <xsl:text>        b.x.baseVal.value = m.x;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1931
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1932
    <xsl:text>        b.y.baseVal.value = m.y;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1933
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1934
    <xsl:text>        b.width.baseVal.value = m.width;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1935
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1936
    <xsl:text>        b.height.baseVal.value = m.height;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1937
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1938
    <xsl:text>    },
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1939
</xsl:text>
2936
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1940
    <xsl:text>    // Use margin and text size to compute box size
53fb11263ff1 SVGHMI: HMI:DropDown: more documentation.
Edouard Tisserant
parents: 2934
diff changeset
  1941
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1942
    <xsl:text>    adjust_box_to_text: function(){
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1943
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1944
    <xsl:text>        let [lmargin, tmargin] = this.margins;
2923
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1945
</xsl:text>
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1946
    <xsl:text>        let m = this.text_elt.getBBox();
5ec1c07ce582 SVGHMI: HMI:DropDown work in progress, intermediate commit. Now menu's rectangle grows up to viewport borders.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2922
diff changeset
  1947
</xsl:text>
2924
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1948
    <xsl:text>        let b = this.box_elt;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1949
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1950
    <xsl:text>        b.x.baseVal.value = m.x - lmargin;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1951
</xsl:text>
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1952
    <xsl:text>        b.y.baseVal.value = m.y - tmargin;
69bb58eb0eac SVGHMI: progress on HMI:DropDown - now selects some value on click, and close
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2923
diff changeset
  1953
</xsl:text>
2926
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1954
    <xsl:text>        b.width.baseVal.value = 2 * lmargin + m.width;
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1955
</xsl:text>
90f9d9782632 SVGHMI: Add button element to HMI:DropDown, also fix problem with computed box margins.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2925
diff changeset
  1956
    <xsl:text>        b.height.baseVal.value = 2 * tmargin + m.height;
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1957
</xsl:text>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1958
    <xsl:text>    },
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1959
</xsl:text>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  1960
  </xsl:template>
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  1961
  <xsl:template mode="widget_defs" match="widget[@type='ForEach']">
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  1962
    <xsl:param name="hmi_element"/>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1963
    <xsl:if test="count(path) != 1">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1964
      <xsl:message terminate="yes">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1965
        <xsl:text>ForEach widget </xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1966
        <xsl:value-of select="$hmi_element/@id"/>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1967
        <xsl:text> must have one HMI path given.</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1968
      </xsl:message>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1969
    </xsl:if>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1970
    <xsl:if test="count(arg) != 1">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1971
      <xsl:message terminate="yes">
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1972
        <xsl:text>ForEach widget </xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1973
        <xsl:value-of select="$hmi_element/@id"/>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1974
        <xsl:text> must have one argument given : a class name.</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1975
      </xsl:message>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  1976
    </xsl:if>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1977
    <xsl:variable name="class" select="arg[1]/@value"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1978
    <xsl:variable name="base_path" select="path/@value"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1979
    <xsl:variable name="hmi_index_base" select="$indexed_hmitree/*[@hmipath = $base_path]"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1980
    <xsl:variable name="hmi_tree_base" select="$hmitree/descendant-or-self::*[@path = $hmi_index_base/@path]"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1981
    <xsl:variable name="hmi_tree_items" select="$hmi_tree_base/*[@class = $class]"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1982
    <xsl:variable name="hmi_index_items" select="$indexed_hmitree/*[@path = $hmi_tree_items/@path]"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1983
    <xsl:variable name="items_paths" select="$hmi_index_items/@hmipath"/>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1984
    <xsl:text>    index_pool: [
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1985
</xsl:text>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1986
    <xsl:for-each select="$hmi_index_items">
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1987
      <xsl:text>      </xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1988
      <xsl:value-of select="@index"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1989
      <xsl:if test="position()!=last()">
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1990
        <xsl:text>,</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1991
      </xsl:if>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1992
      <xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1993
</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  1994
    </xsl:for-each>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1995
    <xsl:text>    ],
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1996
</xsl:text>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  1997
    <xsl:text>    init: function() {
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1998
</xsl:text>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  1999
    <xsl:variable name="prefix" select="concat($class,':')"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2000
    <xsl:variable name="buttons_regex" select="concat('^',$prefix,'[+\-][0-9]+')"/>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2001
    <xsl:variable name="buttons" select="$hmi_element/*[regexp:test(@inkscape:label, $buttons_regex)]"/>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2002
    <xsl:for-each select="$buttons">
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2003
      <xsl:variable name="op" select="substring-after(@inkscape:label, $prefix)"/>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2004
      <xsl:text>        id("</xsl:text>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2005
      <xsl:value-of select="@id"/>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2006
      <xsl:text>").setAttribute("onclick", "hmi_widgets['</xsl:text>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2007
      <xsl:value-of select="$hmi_element/@id"/>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2008
      <xsl:text>'].on_click('</xsl:text>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2009
      <xsl:value-of select="$op"/>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2010
      <xsl:text>', evt)");
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2011
</xsl:text>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2012
    </xsl:for-each>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2013
    <xsl:text>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2014
</xsl:text>
2895
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2015
    <xsl:text>        this.items = [
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2016
</xsl:text>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2017
    <xsl:variable name="items_regex" select="concat('^',$prefix,'[0-9]+')"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2018
    <xsl:variable name="unordered_items" select="$hmi_element//*[regexp:test(@inkscape:label, $items_regex)]"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2019
    <xsl:for-each select="$unordered_items">
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2020
      <xsl:variable name="elt_label" select="concat($prefix, string(position()))"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2021
      <xsl:variable name="elt" select="$unordered_items[@inkscape:label = $elt_label]"/>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2022
      <xsl:variable name="pos" select="position()"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2023
      <xsl:variable name="item_path" select="$items_paths[$pos]"/>
2895
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2024
      <xsl:text>          [ /* item="</xsl:text>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2025
      <xsl:value-of select="$elt_label"/>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2026
      <xsl:text>" path="</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2027
      <xsl:value-of select="$item_path"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2028
      <xsl:text>" */
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2029
</xsl:text>
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2030
      <xsl:if test="count($elt)=0">
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2031
        <xsl:message terminate="yes">
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2032
          <xsl:text>Missing item labeled </xsl:text>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2033
          <xsl:value-of select="$elt_label"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2034
          <xsl:text> in ForEach widget </xsl:text>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2035
          <xsl:value-of select="$hmi_element/@id"/>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2036
        </xsl:message>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2037
      </xsl:if>
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2892
diff changeset
  2038
      <xsl:for-each select="func:refered_elements($elt)[@id = $hmi_elements/@id][not(@id = $elt/@id)]">
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2039
        <xsl:if test="not(func:is_descendant_path(func:widget(@id)/path/@value, $item_path))">
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2040
          <xsl:message terminate="yes">
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2041
            <xsl:text>Widget id="</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2042
            <xsl:value-of select="@id"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2043
            <xsl:text>" label="</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2044
            <xsl:value-of select="@inkscape:label"/>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2045
            <xsl:text>" is having wrong path. Accroding to ForEach widget ancestor id="</xsl:text>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2046
            <xsl:value-of select="$hmi_element/@id"/>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2047
            <xsl:text>", path should be descendant of "</xsl:text>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2048
            <xsl:value-of select="$item_path"/>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  2049
            <xsl:text>".</xsl:text>
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2050
          </xsl:message>
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
  2051
        </xsl:if>
2895
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2052
        <xsl:text>            hmi_widgets["</xsl:text>
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2053
        <xsl:value-of select="@id"/>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2054
        <xsl:text>"]</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2055
        <xsl:if test="position()!=last()">
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2056
          <xsl:text>,</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2057
        </xsl:if>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2058
        <xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2059
</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2060
      </xsl:for-each>
2895
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2061
      <xsl:text>          ]</xsl:text>
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2062
      <xsl:if test="position()!=last()">
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2063
        <xsl:text>,</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2064
      </xsl:if>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2065
      <xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2066
</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2067
    </xsl:for-each>
2895
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2068
    <xsl:text>        ]
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2069
</xsl:text>
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2070
    <xsl:text>    },
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2071
</xsl:text>
89c02b452717 SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents: 2894
diff changeset
  2072
    <xsl:text>    item_offset: 0,
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  2073
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2074
  </xsl:template>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2075
  <xsl:template mode="widget_class" match="widget[@type='ForEach']">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2076
    <xsl:text>class ForEachWidget extends Widget{
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2077
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2078
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2079
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2080
    <xsl:text>    unsub_items(){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2081
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2082
    <xsl:text>        for(let item of this.items){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2083
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2084
    <xsl:text>            for(let widget of item) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2085
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2086
    <xsl:text>                widget.unsub();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2087
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2088
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2089
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2090
    <xsl:text>        }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2091
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2092
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2093
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2094
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2095
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2096
    <xsl:text>    unsub(){
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2097
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2098
    <xsl:text>        this.unsub_items();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2099
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2100
    <xsl:text>        this.offset = 0;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2101
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2102
    <xsl:text>        this.relativeness = undefined;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2103
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2104
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2105
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2106
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2107
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2108
    <xsl:text>    sub_items(){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2109
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2110
    <xsl:text>        for(let i = 0; i &lt; this.items.length; i++) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2111
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2112
    <xsl:text>            let item = this.items[i];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2113
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2114
    <xsl:text>            let orig_item_index = this.index_pool[i];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2115
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2116
    <xsl:text>            let item_index = this.index_pool[i+this.item_offset];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2117
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2118
    <xsl:text>            let item_index_offset = item_index - orig_item_index;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2119
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2120
    <xsl:text>            if(this.relativeness[0])
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2121
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2122
    <xsl:text>                item_index_offset += this.offset;
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2123
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2124
    <xsl:text>            for(let widget of item) {
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2125
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2126
    <xsl:text>                /* all variables of all widgets in a ForEach are all relative. 
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2127
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2128
    <xsl:text>                   Really.
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2129
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2130
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2131
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2132
    <xsl:text>                   TODO: allow absolute variables in ForEach widgets
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2133
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2134
    <xsl:text>                */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2135
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2136
    <xsl:text>                widget.sub(item_index_offset, widget.indexes.map(_=&gt;true));
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2137
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2138
    <xsl:text>            }
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2139
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2140
    <xsl:text>        }
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2141
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2142
    <xsl:text>    }
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2143
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2144
    <xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2145
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2146
    <xsl:text>    sub(new_offset=0, relativeness=[]){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2147
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2148
    <xsl:text>        this.offset = new_offset;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2149
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2150
    <xsl:text>        this.relativeness = relativeness;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2151
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2152
    <xsl:text>        this.sub_items();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2153
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2154
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2155
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2156
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2157
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2158
    <xsl:text>    apply_cache() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2159
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2160
    <xsl:text>        this.items.forEach(item=&gt;item.forEach(widget=&gt;widget.apply_cache()));
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2161
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2162
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2163
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2164
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2165
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2166
    <xsl:text>    on_click(opstr, evt) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2167
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2168
    <xsl:text>        let new_item_offset = eval(String(this.item_offset)+opstr);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2169
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2170
    <xsl:text>        if(new_item_offset + this.items.length &gt; this.index_pool.length) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2171
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2172
    <xsl:text>            if(this.item_offset + this.items.length == this.index_pool.length)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2173
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2174
    <xsl:text>                new_item_offset = 0;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2175
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2176
    <xsl:text>            else
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2177
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2178
    <xsl:text>                new_item_offset = this.index_pool.length - this.items.length;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2179
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2180
    <xsl:text>        } else if(new_item_offset &lt; 0) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2181
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2182
    <xsl:text>            if(this.item_offset == 0)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2183
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2184
    <xsl:text>                new_item_offset = this.index_pool.length - this.items.length;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2185
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2186
    <xsl:text>            else
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2187
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2188
    <xsl:text>                new_item_offset = 0;
3003
9771a724af09 SVGHMI: Better JS code semantic in ForEach widget class. Update lagging generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2998
diff changeset
  2189
</xsl:text>
9771a724af09 SVGHMI: Better JS code semantic in ForEach widget class. Update lagging generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2998
diff changeset
  2190
    <xsl:text>        }
9771a724af09 SVGHMI: Better JS code semantic in ForEach widget class. Update lagging generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2998
diff changeset
  2191
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2192
    <xsl:text>        this.item_offset = new_item_offset;
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2193
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2194
    <xsl:text>        this.unsub_items();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2195
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2196
    <xsl:text>        this.sub_items();
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2197
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2198
    <xsl:text>        update_subscriptions();
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2199
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2200
    <xsl:text>        need_cache_apply.push(this);
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2201
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2202
    <xsl:text>        jumps_need_update = true;
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2203
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2204
    <xsl:text>        requestHMIAnimation();
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2205
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2206
    <xsl:text>    }
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2207
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2208
    <xsl:text>}
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2209
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2210
  </xsl:template>
2800
68cee1366b9c SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents: 2799
diff changeset
  2211
  <xsl:template mode="widget_defs" match="widget[@type='Input']">
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2212
    <xsl:param name="hmi_element"/>
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2213
    <xsl:variable name="value_elt">
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2214
      <xsl:call-template name="defs_by_labels">
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2215
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2216
        <xsl:with-param name="labels">
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2217
          <xsl:text>value</xsl:text>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2218
        </xsl:with-param>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2219
        <xsl:with-param name="mandatory" select="'no'"/>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2220
      </xsl:call-template>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2221
    </xsl:variable>
2861
84c16ece8e10 SVGHMI: fixed repeated error when Input widget is missing 'value' element
Edouard Tisserant
parents: 2859
diff changeset
  2222
    <xsl:variable name="have_value" select="string-length($value_elt)&gt;0"/>
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2223
    <xsl:value-of select="$value_elt"/>
2861
84c16ece8e10 SVGHMI: fixed repeated error when Input widget is missing 'value' element
Edouard Tisserant
parents: 2859
diff changeset
  2224
    <xsl:if test="$have_value">
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2225
      <xsl:text>    frequency: 5,
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2226
</xsl:text>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2227
    </xsl:if>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2228
    <xsl:text>    last_val: undefined,
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2229
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2230
    <xsl:text>    dispatch: function(value) {
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2231
</xsl:text>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2232
    <xsl:text>        this.last_val = value;
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2233
</xsl:text>
2861
84c16ece8e10 SVGHMI: fixed repeated error when Input widget is missing 'value' element
Edouard Tisserant
parents: 2859
diff changeset
  2234
    <xsl:if test="$have_value">
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2235
      <xsl:text>        this.value_elt.textContent = String(value);
2836
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2236
</xsl:text>
ce6cecdb7320 SVGHMI : still behave, even if important things are missing in SVG widget definitions (ex: needle missing for Meter widget)
Edouard Tisserant
parents: 2834
diff changeset
  2237
    </xsl:if>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2238
    <xsl:text>    },
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2239
</xsl:text>
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2240
    <xsl:variable name="edit_elt_id" select="$hmi_element/*[@inkscape:label='edit'][1]/@id"/>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2241
    <xsl:text>    init: function() {
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2242
</xsl:text>
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2243
    <xsl:if test="$edit_elt_id">
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2244
      <xsl:text>        id("</xsl:text>
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2245
      <xsl:value-of select="$edit_elt_id"/>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2246
      <xsl:text>").setAttribute("onclick", "hmi_widgets['</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2247
      <xsl:value-of select="$hmi_element/@id"/>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2248
      <xsl:text>'].on_edit_click()");
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2249
</xsl:text>
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2250
    </xsl:if>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2251
    <xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]">
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2252
      <xsl:text>        id("</xsl:text>
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2253
      <xsl:value-of select="@id"/>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2254
      <xsl:text>").setAttribute("onclick", "hmi_widgets['</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2255
      <xsl:value-of select="$hmi_element/@id"/>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2256
      <xsl:text>'].on_op_click('</xsl:text>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2257
      <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2258
      <xsl:text>')");
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2259
</xsl:text>
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2260
    </xsl:for-each>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  2261
    <xsl:text>    },
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2262
</xsl:text>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2263
    <xsl:text>    on_op_click: function(opstr) {
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2264
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  2265
    <xsl:text>        let new_val = this.change_hmi_value(0, opstr);
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2266
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2267
    <xsl:text>    },
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2268
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2269
    <xsl:text>    on_edit_click: function(opstr) {
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2270
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2271
    <xsl:text>        edit_value("</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2272
    <xsl:value-of select="path/@value"/>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2273
    <xsl:text>", "</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2274
    <xsl:value-of select="path/@type"/>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2275
    <xsl:text>", this, this.last_val);
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2276
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2277
    <xsl:text>    },
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2278
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2279
    <xsl:text>    edit_callback: function(new_val) {
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2280
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  2281
    <xsl:text>        this.apply_hmi_value(0, new_val);
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2282
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2283
    <xsl:text>    },
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2284
</xsl:text>
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  2285
  </xsl:template>
2994
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2286
  <xsl:template mode="widget_class" match="widget[@type='JsonTable']">
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2287
    <xsl:text>class JsonTableWidget extends Widget{
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2288
</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2289
    <xsl:text>    do_http_request() {
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2290
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2291
    <xsl:text>        const query = {
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2292
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2293
    <xsl:text>             offset: '42',
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2294
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2295
    <xsl:text>             filter: '*powerloss*',
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2296
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2297
    <xsl:text>             args: this.args
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2298
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2299
    <xsl:text>        };
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2300
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2301
    <xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2302
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2303
    <xsl:text>        const options = {
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2304
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2305
    <xsl:text>             method: 'POST',
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2306
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2307
    <xsl:text>             body: JSON.stringify(query),
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2308
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2309
    <xsl:text>             headers: {'Content-Type': 'application/json'}
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2310
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2311
    <xsl:text>        }
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2312
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2313
    <xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2314
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2315
    <xsl:text>        fetch(this.args[0], options)
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2316
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2317
    <xsl:text>            .then(res =&gt; res.json())
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2318
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2319
    <xsl:text>            .then(this.spread_json_data);
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2320
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2321
    <xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2322
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2323
    <xsl:text>    }
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2324
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2325
    <xsl:text>    dispatch(value) {
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2326
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2327
    <xsl:text>        this.do_http_request();
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2328
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2329
    <xsl:text>    }
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2330
</xsl:text>
2994
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2331
    <xsl:text>    on_click(evt) {
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2332
</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2333
    <xsl:text>        this.do_http_request();
2994
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2334
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2335
    <xsl:text>    }
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2336
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2337
    <xsl:text>    init() {
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2338
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2339
    <xsl:text>        this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2340
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2341
    <xsl:text>    }
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2342
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2343
    <xsl:text>}
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2344
</xsl:text>
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  2345
  </xsl:template>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2346
  <xsl:template mode="json_table_elt_render" match="svg:*">
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2347
    <xsl:message terminate="yes">
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2348
      <xsl:text>JsonTable Widget can't contain element of type </xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2349
      <xsl:value-of select="local-name()"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2350
      <xsl:text>.</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2351
    </xsl:message>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2352
  </xsl:template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2353
  <xsl:template mode="json_table_elt_render" match="svg:use">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2354
    <xsl:param name="value_expr"/>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2355
    <xsl:variable name="targetid" select="substring-after(@xlink:href,'#')"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2356
    <xsl:variable name="from_list" select="$hmi_lists[(@id | */@id) = $targetid]"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2357
    <xsl:if test="count($from_list) = 0">
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2358
      <xsl:message terminate="yes">
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2359
        <xsl:text>Clones (svg:use) in JsonTable Widget must point to a valid HMI:List widget or HMI:List item. Reference "</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2360
        <xsl:value-of select="@xlink:href"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2361
        <xsl:text>" is not valid.</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2362
      </xsl:message>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2363
    </xsl:if>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2364
    <xsl:text>        console.log("</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2365
    <xsl:value-of select="@id"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2366
    <xsl:text>", "</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2367
    <xsl:value-of select="$value_expr"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2368
    <xsl:text>", </xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2369
    <xsl:value-of select="$value_expr"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2370
    <xsl:text>);
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2371
</xsl:text>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2372
    <xsl:text>        id("</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2373
    <xsl:value-of select="@id"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2374
    <xsl:text>").setAttribute("xlink:href", 
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2375
</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2376
    <xsl:text>            "#"+hmi_widgets["</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2377
    <xsl:value-of select="$from_list/@id"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2378
    <xsl:text>"].items[</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2379
    <xsl:value-of select="$value_expr"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2380
    <xsl:text>]);
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2381
</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2382
  </xsl:template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2383
  <xsl:template mode="json_table_elt_render" match="svg:text">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2384
    <xsl:param name="value_expr"/>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2385
    <xsl:text>        console.log("</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2386
    <xsl:value-of select="@id"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2387
    <xsl:text>", "</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2388
    <xsl:value-of select="$value_expr"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2389
    <xsl:text>", </xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2390
    <xsl:value-of select="$value_expr"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2391
    <xsl:text>);
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2392
</xsl:text>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2393
    <xsl:text>        id("</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2394
    <xsl:value-of select="@id"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2395
    <xsl:text>").textContent = String(</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2396
    <xsl:value-of select="$value_expr"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2397
    <xsl:text>);
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2398
</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2399
  </xsl:template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2400
  <xsl:template mode="json_table_render" match="svg:*">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2401
    <xsl:param name="objname"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2402
    <xsl:apply-templates mode="json_table_elt_render" select=".">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2403
      <xsl:with-param name="value_expr">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2404
        <xsl:value-of select="$objname"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2405
        <xsl:value-of select="@inkscape:label"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2406
      </xsl:with-param>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2407
    </xsl:apply-templates>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2408
  </xsl:template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2409
  <xsl:template mode="json_table_render" match="svg:g">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2410
    <xsl:param name="objname"/>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2411
    <xsl:text>        let obj_</xsl:text>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2412
    <xsl:value-of select="@id"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2413
    <xsl:text> = </xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2414
    <xsl:value-of select="$objname"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2415
    <xsl:value-of select="@inkscape:label"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2416
    <xsl:text>;
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2417
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2418
    <xsl:apply-templates mode="json_table_render" select="*[@inkscape:label]">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2419
      <xsl:with-param name="objname">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2420
        <xsl:text>obj_</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2421
        <xsl:value-of select="@id"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2422
      </xsl:with-param>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2423
    </xsl:apply-templates>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2424
  </xsl:template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2425
  <xsl:template mode="widget_defs" match="widget[@type='JsonTable']">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2426
    <xsl:param name="hmi_element"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2427
    <xsl:call-template name="defs_by_labels">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2428
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2429
      <xsl:with-param name="labels">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2430
        <xsl:text>data</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2431
      </xsl:with-param>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2432
    </xsl:call-template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2433
    <xsl:call-template name="defs_by_labels">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2434
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2435
      <xsl:with-param name="labels">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2436
        <xsl:text>forward backward cursor</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2437
      </xsl:with-param>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2438
      <xsl:with-param name="mandatory" select="'no'"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2439
    </xsl:call-template>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2440
    <xsl:variable name="data_elt" select="$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"/>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2441
    <xsl:text>    spread_json_data: function(jdata) {
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2442
</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2443
    <xsl:text>        console.log(jdata);
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2444
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2445
    <xsl:apply-templates mode="json_table_render" select="$data_elt/*">
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2446
      <xsl:with-param name="objname" select="'jdata'"/>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2447
    </xsl:apply-templates>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2448
    <xsl:text>    }
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2449
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  2450
  </xsl:template>
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2451
  <xsl:template name="jump_widget_activity">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2452
    <xsl:param name="hmi_element"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2453
    <xsl:call-template name="defs_by_labels">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2454
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2455
      <xsl:with-param name="labels">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2456
        <xsl:text>active inactive</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2457
      </xsl:with-param>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2458
      <xsl:with-param name="mandatory" select="'no'"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2459
    </xsl:call-template>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2460
  </xsl:template>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2461
  <xsl:template name="jump_widget_disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2462
    <xsl:param name="hmi_element"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2463
    <xsl:call-template name="defs_by_labels">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2464
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2465
      <xsl:with-param name="labels">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2466
        <xsl:text>disabled</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2467
      </xsl:with-param>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2468
      <xsl:with-param name="mandatory" select="'no'"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2469
    </xsl:call-template>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2470
  </xsl:template>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2471
  <xsl:template mode="widget_defs" match="widget[@type='Jump']">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2472
    <xsl:param name="hmi_element"/>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2473
    <xsl:variable name="activity">
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2474
      <xsl:call-template name="jump_widget_activity">
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2475
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2476
      </xsl:call-template>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2477
    </xsl:variable>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2478
    <xsl:variable name="have_activity" select="string-length($activity)&gt;0"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2479
    <xsl:value-of select="$activity"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2480
    <xsl:variable name="disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2481
      <xsl:call-template name="jump_widget_disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2482
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2483
      </xsl:call-template>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2484
    </xsl:variable>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2485
    <xsl:variable name="have_disability" select="$have_activity and string-length($disability)&gt;0"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2486
    <xsl:value-of select="$disability"/>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2487
    <xsl:if test="$have_activity">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2488
      <xsl:text>    active: false,
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2489
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2490
      <xsl:if test="$have_disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2491
        <xsl:text>    disabled: false,
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2492
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2493
        <xsl:text>    frequency: 2,
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2494
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2495
        <xsl:text>    dispatch: function(value) {
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2496
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2497
        <xsl:text>        this.disabled = !Number(value);
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2498
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2499
        <xsl:text>        this.update();
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2500
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2501
        <xsl:text>    },
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2502
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2503
      </xsl:if>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2504
      <xsl:text>    update: function(){
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2505
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2506
      <xsl:if test="$have_disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2507
        <xsl:text>      if(this.disabled) {
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2508
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2509
        <xsl:text>        /* show disabled */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2510
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2511
        <xsl:text>        this.disabled_elt.setAttribute("style", this.active_elt_style);
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2512
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2513
        <xsl:text>        /* hide inactive */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2514
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2515
        <xsl:text>        this.inactive_elt.setAttribute("style", "display:none");
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2516
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2517
        <xsl:text>        /* hide active */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2518
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2519
        <xsl:text>        this.active_elt.setAttribute("style", "display:none");
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2520
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2521
        <xsl:text>      } else {
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2522
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2523
        <xsl:text>        /* hide disabled */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2524
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2525
        <xsl:text>        this.disabled_elt.setAttribute("style", "display:none");
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2526
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2527
      </xsl:if>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2528
      <xsl:text>        if(this.active) {
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2529
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2530
      <xsl:text>             /* show active */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2531
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2532
      <xsl:text>             this.active_elt.setAttribute("style", this.active_elt_style);
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2533
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2534
      <xsl:text>             /* hide inactive */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2535
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2536
      <xsl:text>             this.inactive_elt.setAttribute("style", "display:none");
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2537
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2538
      <xsl:text>        } else {
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2539
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2540
      <xsl:text>             /* show inactive */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2541
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2542
      <xsl:text>             this.inactive_elt.setAttribute("style", this.inactive_elt_style);
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2543
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2544
      <xsl:text>             /* hide active */ 
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2545
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2546
      <xsl:text>             this.active_elt.setAttribute("style", "display:none");
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2547
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2548
      <xsl:text>        }
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2549
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2550
      <xsl:if test="$have_disability">
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2551
        <xsl:text>      }
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2552
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2553
      </xsl:if>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2554
      <xsl:text>    },
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2555
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2556
    </xsl:if>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2557
    <xsl:text>    on_click: function(evt) {
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2558
</xsl:text>
2898
a2910281fcb5 SVGHMI: Alow relative relative Jump. (i.e, relative jump from a foreach widget)
Edouard Tisserant
parents: 2897
diff changeset
  2559
    <xsl:text>        const index = this.indexes.length &gt; 0 ? this.indexes[0] + this.offset : undefined;
a2910281fcb5 SVGHMI: Alow relative relative Jump. (i.e, relative jump from a foreach widget)
Edouard Tisserant
parents: 2897
diff changeset
  2560
</xsl:text>
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2561
    <xsl:text>        const name = this.args[0];
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2562
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2563
    <xsl:text>        switch_page(name, index);
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2564
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2565
    <xsl:text>    },
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2566
</xsl:text>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2567
    <xsl:if test="$have_activity">
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2568
      <xsl:text>    notify_page_change: function(page_name, index){
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2569
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2570
      <xsl:text>        const ref_index = this.indexes.length &gt; 0 ? this.indexes[0] + this.offset : undefined;
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2571
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2572
      <xsl:text>        const ref_name = this.args[0];
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2573
</xsl:text>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2574
      <xsl:text>        this.active =((ref_name == undefined || ref_name == page_name) &amp;&amp; index == ref_index);
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2575
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2576
      <xsl:text>        this.update();
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2577
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2578
      <xsl:text>    },
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2579
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2580
    </xsl:if>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2581
    <xsl:text>    init: function() {
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2582
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2583
    <xsl:text>        this.element.setAttribute("onclick", "hmi_widgets['</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2584
    <xsl:value-of select="$hmi_element/@id"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2585
    <xsl:text>'].on_click(evt)");
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2586
</xsl:text>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2587
    <xsl:if test="$have_activity">
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2588
      <xsl:text>        this.active_elt_style = this.active_elt.getAttribute("style");
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2589
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2590
      <xsl:text>        this.inactive_elt_style = this.inactive_elt.getAttribute("style");
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2591
</xsl:text>
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2902
diff changeset
  2592
    </xsl:if>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2593
    <xsl:choose>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2594
      <xsl:when test="$have_disability">
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2595
        <xsl:text>        this.disabled_elt_style = this.disabled_elt.getAttribute("style");
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2596
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2597
      </xsl:when>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2598
      <xsl:otherwise>
2980
2a21d6060d64 SVGHMI: add "unsubscribable" property to widgets in order to generalize what already happens for jump buttons.
Edouard Tisserant
parents: 2979
diff changeset
  2599
        <xsl:text>        this.unsubscribable = true;
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2600
</xsl:text>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2601
      </xsl:otherwise>
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2602
    </xsl:choose>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2603
    <xsl:text>    },
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  2604
</xsl:text>
2906
3b4a1319da09 SVGHMI: Jump widget, if it has a 'disabled' labeled element, reflects value of the pointed HMITree variable by showing this element when value is False, and behaving normaly otherwise.
Edouard Tisserant
parents: 2905
diff changeset
  2605
  </xsl:template>
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2606
  <xsl:template mode="per_page_widget_template" match="widget[@type='Jump']">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2607
    <xsl:param name="page_desc"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2608
    <xsl:if test="path">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2609
      <xsl:variable name="target_page_name">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2610
        <xsl:choose>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2611
          <xsl:when test="arg">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2612
            <xsl:value-of select="arg[1]/@value"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2613
          </xsl:when>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2614
          <xsl:otherwise>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2615
            <xsl:value-of select="$page_desc/arg[1]/@value"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2616
          </xsl:otherwise>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2617
        </xsl:choose>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2618
      </xsl:variable>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2619
      <xsl:variable name="target_page_path">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2620
        <xsl:choose>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2621
          <xsl:when test="arg">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2622
            <xsl:value-of select="$hmi_pages_descs[arg[1]/@value = $target_page_name]/path[1]/@value"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2623
          </xsl:when>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2624
          <xsl:otherwise>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2625
            <xsl:value-of select="$page_desc/path[1]/@value"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2626
          </xsl:otherwise>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2627
        </xsl:choose>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2628
      </xsl:variable>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2629
      <xsl:if test="not(func:same_class_paths($target_page_path, path[1]/@value))">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2630
        <xsl:message terminate="yes">
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2631
          <xsl:text>Jump id="</xsl:text>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2632
          <xsl:value-of select="@id"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2633
          <xsl:text>" to page "</xsl:text>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2634
          <xsl:value-of select="$target_page_name"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2635
          <xsl:text>" with incompatible path "</xsl:text>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2636
          <xsl:value-of select="path[1]/@value"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2637
          <xsl:text> (must be same class as "</xsl:text>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2638
          <xsl:value-of select="$target_page_path"/>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2639
          <xsl:text>")</xsl:text>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2640
        </xsl:message>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2641
      </xsl:if>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2642
    </xsl:if>
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2899
diff changeset
  2643
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  2644
  <declarations:jump/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  2645
  <xsl:template match="declarations:jump">
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2646
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2647
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2648
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2649
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2650
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2651
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2652
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2653
</xsl:text>
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2654
    <xsl:text>var jumps_need_update = false;
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2655
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2656
    <xsl:text>var jump_history = [[default_page, undefined]];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2657
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2658
    <xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2659
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2660
    <xsl:text>function update_jumps() {
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2661
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2662
    <xsl:text>    page_desc[current_visible_page].jumps.map(w=&gt;w.notify_page_change(current_visible_page,current_page_index));
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2663
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2664
    <xsl:text>    jumps_need_update = false;
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2665
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2666
    <xsl:text>};
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2667
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2668
    <xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2669
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2670
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2671
</xsl:text>
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  2672
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  2673
  <declarations:keypad/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  2674
  <xsl:template match="declarations:keypad">
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2675
    <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2676
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2677
    <xsl:text>/* </xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2678
    <xsl:value-of select="local-name()"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2679
    <xsl:text> */
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2680
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2681
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2682
</xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2683
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2684
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2685
    <xsl:text>var keypads = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2686
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2687
    <xsl:for-each select="$keypads_descs">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2688
      <xsl:variable name="keypad_id" select="@id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2689
      <xsl:for-each select="arg">
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2690
        <xsl:variable name="g" select="$geometry[@Id = $keypad_id]"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2691
        <xsl:text>    "</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2692
        <xsl:value-of select="@value"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2693
        <xsl:text>":["</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2694
        <xsl:value-of select="$keypad_id"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2695
        <xsl:text>", </xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2696
        <xsl:value-of select="$g/@x"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2697
        <xsl:text>, </xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2698
        <xsl:value-of select="$g/@y"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2699
        <xsl:text>],
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2700
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2701
      </xsl:for-each>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2702
    </xsl:for-each>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2703
    <xsl:text>}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2704
</xsl:text>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2705
    <xsl:text>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  2706
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  2707
  </xsl:template>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2708
  <xsl:template mode="widget_defs" match="widget[@type='Keypad']">
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2709
    <xsl:param name="hmi_element"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2710
    <xsl:call-template name="defs_by_labels">
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2711
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2712
      <xsl:with-param name="labels">
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2713
        <xsl:text>Esc Enter BackSpace Keys Info Value</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2714
      </xsl:with-param>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2715
    </xsl:call-template>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2716
    <xsl:call-template name="defs_by_labels">
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2717
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2718
      <xsl:with-param name="labels">
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2719
        <xsl:text>Sign Space NumDot</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2720
      </xsl:with-param>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2721
      <xsl:with-param name="mandatory" select="'no'"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2722
    </xsl:call-template>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2723
    <xsl:call-template name="defs_by_labels">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2724
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2725
      <xsl:with-param name="labels">
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2726
        <xsl:text>CapsLock Shift</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2727
      </xsl:with-param>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2728
      <xsl:with-param name="mandatory" select="'no'"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2729
      <xsl:with-param name="subelements" select="'active inactive'"/>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2730
    </xsl:call-template>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2731
    <xsl:text>    init: function() {
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2732
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2733
    <xsl:for-each select="$hmi_element/*[@inkscape:label = 'Keys']/*">
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2734
      <xsl:text>        id("</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2735
      <xsl:value-of select="@id"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2736
      <xsl:text>").setAttribute("onclick", "hmi_widgets['</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2737
      <xsl:value-of select="$hmi_element/@id"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2738
      <xsl:text>'].on_key_click('</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2739
      <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2740
      <xsl:text>')");
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2741
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2742
    </xsl:for-each>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2743
    <xsl:for-each select="str:split('Esc Enter BackSpace Sign Space NumDot CapsLock Shift')">
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2744
      <xsl:text>        if(this.</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2745
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2746
      <xsl:text>_elt)
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2747
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2748
      <xsl:text>            this.</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2749
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2750
      <xsl:text>_elt.setAttribute("onclick", "hmi_widgets['</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2751
      <xsl:value-of select="$hmi_element/@id"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2752
      <xsl:text>'].on_</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2753
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2754
      <xsl:text>_click()");
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2755
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2756
    </xsl:for-each>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2757
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2758
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2759
    <xsl:text>    on_key_click: function(symbols) {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2760
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2761
    <xsl:text>        var syms = symbols.split(" ");
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2762
</xsl:text>
2919
c6e6051898f5 SVGHMI: fixed keypad JS regarding shift/capslock and other details
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2917
diff changeset
  2763
    <xsl:text>        this.shift |= this.caps;
c6e6051898f5 SVGHMI: fixed keypad JS regarding shift/capslock and other details
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2917
diff changeset
  2764
</xsl:text>
c6e6051898f5 SVGHMI: fixed keypad JS regarding shift/capslock and other details
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2917
diff changeset
  2765
    <xsl:text>        this.editstr += syms[this.shift?syms.length-1:0];
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2766
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2767
    <xsl:text>        this.shift = false;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2768
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2769
    <xsl:text>        this.update();
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2770
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2771
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2772
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2773
    <xsl:text>    on_Esc_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2774
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2775
    <xsl:text>        end_modal.call(this);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2776
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2777
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2778
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2779
    <xsl:text>    on_Enter_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2780
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2781
    <xsl:text>        end_modal.call(this);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2782
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2783
    <xsl:text>        callback_obj = this.result_callback_obj;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2784
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2785
    <xsl:text>        callback_obj.edit_callback(this.editstr);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2786
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2787
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2788
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2789
    <xsl:text>    on_BackSpace_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2790
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2791
    <xsl:text>        this.editstr = this.editstr.slice(0,this.editstr.length-1);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2792
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2793
    <xsl:text>        this.update();
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2794
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2795
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2796
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2797
    <xsl:text>    on_Sign_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2798
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2799
    <xsl:text>        if(this.editstr[0] == "-")
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2800
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2801
    <xsl:text>            this.editstr = this.editstr.slice(1,this.editstr.length);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2802
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2803
    <xsl:text>        else
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2804
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2805
    <xsl:text>            this.editstr = "-" + this.editstr;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2806
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2807
    <xsl:text>        this.update();
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2808
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2809
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2810
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2811
    <xsl:text>    on_NumDot_click: function() {
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2812
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2813
    <xsl:text>        if(this.editstr.indexOf(".") == "-1"){
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2814
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2815
    <xsl:text>            this.editstr += ".";
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2816
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2817
    <xsl:text>            this.update();
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2818
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2819
    <xsl:text>        }
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2820
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2821
    <xsl:text>    },
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2822
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2823
    <xsl:text>    on_Space_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2824
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2825
    <xsl:text>        this.editstr += " ";
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2826
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2827
    <xsl:text>        this.update();
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2828
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2829
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2830
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2831
    <xsl:text>    caps: false,
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2832
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2833
    <xsl:text>    _caps: undefined,
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2834
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2835
    <xsl:text>    on_CapsLock_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2836
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2837
    <xsl:text>        this.caps = !this.caps;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2838
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2839
    <xsl:text>        this.update();
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2840
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2841
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2842
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2843
    <xsl:text>    shift: false,
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2844
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2845
    <xsl:text>    _shift: undefined,
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2846
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2847
    <xsl:text>    on_Shift_click: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2848
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2849
    <xsl:text>        this.shift = !this.shift;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2850
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2851
    <xsl:text>        this.caps = false;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2852
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2853
    <xsl:text>        this.update();
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2854
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2855
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2856
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2857
    <xsl:variable name="g" select="$geometry[@Id = $hmi_element/@id]"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2858
    <xsl:text>    coordinates: [</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2859
    <xsl:value-of select="$g/@x"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2860
    <xsl:text>, </xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2861
    <xsl:value-of select="$g/@y"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2862
    <xsl:text>],
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2863
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2864
    <xsl:text>    editstr: "",
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2865
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2866
    <xsl:text>    _editstr: undefined,
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2867
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2868
    <xsl:text>    result_callback_obj: undefined,
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2869
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2870
    <xsl:text>    start_edit: function(info, valuetype, callback_obj, initial) {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2871
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2872
    <xsl:text>        show_modal.call(this);
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2873
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2874
    <xsl:text>        this.editstr = initial;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2875
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2876
    <xsl:text>        this.result_callback_obj = callback_obj;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2877
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2878
    <xsl:text>        this.Info_elt.textContent = info;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2879
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2880
    <xsl:text>        this.shift = false;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2881
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2882
    <xsl:text>        this.caps = false;
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2883
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2884
    <xsl:text>        this.update();
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2885
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2886
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2887
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2888
    <xsl:text>    update: function() {
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2889
</xsl:text>
2920
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2890
    <xsl:text>        if(this.editstr != this._editstr){
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2891
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2892
    <xsl:text>            this._editstr = this.editstr;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2893
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2894
    <xsl:text>            this.Value_elt.textContent = this.editstr;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2895
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2896
    <xsl:text>        }
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2897
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2898
    <xsl:text>        if(this.shift != this._shift){
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2899
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2900
    <xsl:text>            this._shift = this.shift;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2901
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2902
    <xsl:text>            (this.shift?widget_active_activable:widget_inactive_activable)(this.Shift_sub);
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2903
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2904
    <xsl:text>        }
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2905
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2906
    <xsl:text>        if(this.caps != this._caps){
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2907
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2908
    <xsl:text>            this._caps = this.caps;
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2909
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2910
    <xsl:text>            (this.caps?widget_active_activable:widget_inactive_activable)(this.CapsLock_sub);
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2911
</xsl:text>
3ee337c8c769 SVGHMI: finished shift and capslock support n keypad widget. Added a helper in widgets_common to collect subelements likle active/inactive/disabled...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2919
diff changeset
  2912
    <xsl:text>        }
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  2913
</xsl:text>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2914
    <xsl:text>    },
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2915
</xsl:text>
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  2916
  </xsl:template>
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2917
  <xsl:template mode="widget_defs" match="widget[@type='List']">
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2918
    <xsl:param name="hmi_element"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2919
    <xsl:text>    items: {
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2920
</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2921
    <xsl:for-each select="$hmi_element/*[@inkscape:label]">
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2922
      <xsl:text>        </xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2923
      <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2924
      <xsl:text>: "</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2925
      <xsl:value-of select="@id"/>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2926
      <xsl:text>",
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2927
</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2928
    </xsl:for-each>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2929
    <xsl:text>    },
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2930
</xsl:text>
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2996
diff changeset
  2931
  </xsl:template>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2932
  <xsl:template mode="widget_defs" match="widget[@type='Meter']">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2933
    <xsl:param name="hmi_element"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2934
    <xsl:text>    frequency: 10,
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2935
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2936
    <xsl:call-template name="defs_by_labels">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2937
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2938
      <xsl:with-param name="labels">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2939
        <xsl:text>needle range</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2940
      </xsl:with-param>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2941
    </xsl:call-template>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2942
    <xsl:call-template name="defs_by_labels">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2943
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2944
      <xsl:with-param name="labels">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2945
        <xsl:text>value min max</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2946
      </xsl:with-param>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2947
      <xsl:with-param name="mandatory" select="'no'"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2948
    </xsl:call-template>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2949
    <xsl:text>    dispatch: function(value) {
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2950
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2951
    <xsl:text>        if(this.value_elt)
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2952
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2953
    <xsl:text>            this.value_elt.textContent = String(value);
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2954
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2955
    <xsl:text>        let [min,max,totallength] = this.range;
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2956
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2957
    <xsl:text>        let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min)));
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2958
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2959
    <xsl:text>        let tip = this.range_elt.getPointAtLength(length);
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2960
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2961
    <xsl:text>        this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y);
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2962
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2963
    <xsl:text>    },
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2964
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2965
    <xsl:text>    origin: undefined,
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2966
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2967
    <xsl:text>    range: undefined,
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2968
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2969
    <xsl:text>    init: function() {
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2970
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2971
    <xsl:text>        let min = this.min_elt ?
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2972
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2973
    <xsl:text>                    Number(this.min_elt.textContent) :
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2974
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2975
    <xsl:text>                    this.args.length &gt;= 1 ? this.args[0] : 0;
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2976
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2977
    <xsl:text>        let max = this.max_elt ?
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2978
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2979
    <xsl:text>                    Number(this.max_elt.textContent) :
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2980
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2981
    <xsl:text>                    this.args.length &gt;= 2 ? this.args[1] : 100;
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2982
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2983
    <xsl:text>        this.range = [min, max, this.range_elt.getTotalLength()]
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2984
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2985
    <xsl:text>        this.origin = this.needle_elt.getPointAtLength(0);
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2986
</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  2987
    <xsl:text>    },
2800
68cee1366b9c SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents: 2799
diff changeset
  2988
</xsl:text>
2797
c5ba1e77f054 SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents: 2796
diff changeset
  2989
  </xsl:template>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2990
  <xsl:template mode="widget_class" match="widget[@type='Switch']">
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2991
    <xsl:text>class SwitchWidget extends Widget{
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2992
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2993
    <xsl:text>    frequency = 5;
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2994
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2995
    <xsl:text>    dispatch(value) {
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2996
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2997
    <xsl:text>        for(let choice of this.choices){
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2998
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  2999
    <xsl:text>            if(value != choice.value){
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3000
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3001
    <xsl:text>                choice.elt.setAttribute("style", "display:none");
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3002
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3003
    <xsl:text>            } else {
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3004
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3005
    <xsl:text>                choice.elt.setAttribute("style", choice.style);
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3006
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3007
    <xsl:text>            }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3008
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3009
    <xsl:text>        }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3010
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3011
    <xsl:text>    }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3012
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3013
    <xsl:text>}
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3014
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  3015
  </xsl:template>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3016
  <xsl:template mode="widget_defs" match="widget[@type='Switch']">
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3017
    <xsl:param name="hmi_element"/>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3018
    <xsl:text>    choices: [
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3019
</xsl:text>
2907
1695122a5e16 SVGHMI: HMI:Switch now accepts boolean values 'true' and 'false'
Edouard Tisserant
parents: 2906
diff changeset
  3020
    <xsl:variable name="regex" select="'^(&quot;[^&quot;].*&quot;|\-?[0-9]+|false|true)(#.*)?$'"/>
2969
88988edb2e93 SVGHMI: Switch widget was picking sub-elements from original SVG, not the result SVG ehwe clones are unlinked, thus making problems with svg:use based widgets.
Edouard Tisserant
parents: 2962
diff changeset
  3021
    <xsl:for-each select="$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]">
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3022
      <xsl:variable name="literal" select="regexp:match(@inkscape:label,$regex)[2]"/>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3023
      <xsl:text>        {
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3024
</xsl:text>
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3025
      <xsl:text>            elt:id("</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3026
      <xsl:value-of select="@id"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3027
      <xsl:text>"),
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3028
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3029
      <xsl:text>            style:"</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3030
      <xsl:value-of select="@style"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3031
      <xsl:text>",
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3032
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3033
      <xsl:text>            value:</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3034
      <xsl:value-of select="$literal"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3035
      <xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3036
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3037
      <xsl:text>        }</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3038
      <xsl:if test="position()!=last()">
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3039
        <xsl:text>,</xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3040
      </xsl:if>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3041
      <xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3042
</xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  3043
    </xsl:for-each>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  3044
    <xsl:text>    ],
2801
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  3045
</xsl:text>
390acff12755 SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents: 2800
diff changeset
  3046
  </xsl:template>
2977
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3047
  <xsl:template mode="widget_defs" match="widget[@type='ToggleButton']">
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3048
    <xsl:param name="hmi_element"/>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3049
    <xsl:call-template name="defs_by_labels">
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3050
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3051
      <xsl:with-param name="labels">
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3052
        <xsl:text>active inactive</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3053
      </xsl:with-param>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3054
    </xsl:call-template>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3055
    <xsl:text>    frequency: 5,
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3056
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3057
    <xsl:text>    state: 0,
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3058
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3059
    <xsl:text>    dispatch: function(value) {
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3060
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3061
    <xsl:text>        this.state = value;
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3062
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3063
    <xsl:text>        if (this.state) {
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3064
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3065
    <xsl:text>            this.active_elt.setAttribute("style", this.active_style);
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3066
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3067
    <xsl:text>            this.inactive_elt.setAttribute("style", "display:none");
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3068
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3069
    <xsl:text>            this.state = 0;
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3070
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3071
    <xsl:text>        } else {
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3072
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3073
    <xsl:text>            this.inactive_elt.setAttribute("style", this.inactive_style);
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3074
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3075
    <xsl:text>            this.active_elt.setAttribute("style", "display:none");
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3076
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3077
    <xsl:text>            this.state = 1;
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3078
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3079
    <xsl:text>        }
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3080
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3081
    <xsl:text>    },
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3082
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3083
    <xsl:text>    on_click: function(evt) {
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3084
</xsl:text>
3004
705e34c6fe93 SVGHMI: More JS code refactoring : change_hmi_value and apply_hmi_value now methods of widget class.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3003
diff changeset
  3085
    <xsl:text>        this.apply_hmi_value(0, this.state);
2977
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3086
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3087
    <xsl:text>    },
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3088
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3089
    <xsl:text>    active_style: undefined,
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3090
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3091
    <xsl:text>    inactive_style: undefined,
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3092
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3093
    <xsl:text>    init: function() {
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3094
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3095
    <xsl:text>        this.active_style = this.active_elt.style.cssText;
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3096
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3097
    <xsl:text>        this.inactive_style = this.inactive_elt.style.cssText;
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3098
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3099
    <xsl:text>        this.element.setAttribute("onclick", "hmi_widgets['</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3100
    <xsl:value-of select="$hmi_element/@id"/>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3101
    <xsl:text>'].on_click(evt)");
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3102
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3103
    <xsl:text>    },
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3104
</xsl:text>
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  3105
  </xsl:template>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3106
  <xsl:template match="/">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3107
    <xsl:comment>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3108
      <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3109
    </xsl:comment>
2949
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  3110
    <xsl:comment>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  3111
      <xsl:apply-templates select="document('')/*/debug:*"/>
e50908ddec60 SVGHMI: One class per widget type, widget objects are instances of these classes, and members are passed through constructor. This allows to keep compatible with previous widget_defs template used in most widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2944
diff changeset
  3112
    </xsl:comment>
2994
b6a9ef7f7e43 SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2980
diff changeset
  3113
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3114
      <head/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3115
      <body style="margin:0;overflow:hidden;">
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3116
        <xsl:copy-of select="$result_svg"/>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  3117
        <script>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3118
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3119
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3120
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3121
// Early independent declarations 
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3122
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3123
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3124
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3125
          <xsl:apply-templates select="document('')/*/preamble:*"/>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3126
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3127
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3128
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3129
// Declarations depending on preamble 
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3130
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3131
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3132
</xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3133
          <xsl:apply-templates select="document('')/*/declarations:*"/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3134
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3135
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3136
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3137
// Order independent declaration and code 
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3138
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3139
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3140
</xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3141
          <xsl:apply-templates select="document('')/*/definitions:*"/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3142
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3143
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3144
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3145
// Statements that needs to be at the end 
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3146
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3147
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  3148
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3149
          <xsl:apply-templates select="document('')/*/epilogue:*"/>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3150
          <xsl:text>// svghmi.js
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3151
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3152
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3153
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3154
          <xsl:text>var cache = hmitree_types.map(_ignored =&gt; undefined);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3155
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3156
          <xsl:text>var updates = {};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3157
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3158
          <xsl:text>var need_cache_apply = []; 
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3159
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3160
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3161
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3162
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3163
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3164
          <xsl:text>function dispatch_value(index, value) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3165
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3166
          <xsl:text>    let widgets = subscribers[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3167
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3168
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3169
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3170
          <xsl:text>    let oldval = cache[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3171
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3172
          <xsl:text>    cache[index] = value;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3173
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3174
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3175
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3176
          <xsl:text>    if(widgets.size &gt; 0) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3177
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3178
          <xsl:text>        for(let widget of widgets){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3179
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3180
          <xsl:text>            widget.new_hmi_value(index, value, oldval);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3181
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3182
          <xsl:text>        }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3183
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3184
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3185
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3186
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3187
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3188
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3189
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3190
          <xsl:text>function init_widgets() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3191
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3192
          <xsl:text>    Object.keys(hmi_widgets).forEach(function(id) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3193
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3194
          <xsl:text>        let widget = hmi_widgets[id];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3195
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3196
          <xsl:text>        let init = widget.init;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3197
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3198
          <xsl:text>        if(typeof(init) == "function"){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3199
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3200
          <xsl:text>            try {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3201
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3202
          <xsl:text>                init.call(widget);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3203
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3204
          <xsl:text>            } catch(err) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3205
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3206
          <xsl:text>                console.log(err);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3207
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3208
          <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3209
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3210
          <xsl:text>        }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3211
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3212
          <xsl:text>    });
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3213
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3214
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3215
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3216
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3217
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3218
          <xsl:text>// Open WebSocket to relative "/ws" address
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3219
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3220
          <xsl:text>var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'));
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3221
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3222
          <xsl:text>ws.binaryType = 'arraybuffer';
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3223
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3224
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3225
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3226
          <xsl:text>const dvgetters = {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3227
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3228
          <xsl:text>    INT: (dv,offset) =&gt; [dv.getInt16(offset, true), 2],
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3229
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3230
          <xsl:text>    BOOL: (dv,offset) =&gt; [dv.getInt8(offset, true), 1],
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3231
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3232
          <xsl:text>    NODE: (dv,offset) =&gt; [dv.getInt8(offset, true), 1],
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3233
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3234
          <xsl:text>    STRING: (dv, offset) =&gt; {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3235
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3236
          <xsl:text>        size = dv.getInt8(offset);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3237
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3238
          <xsl:text>        return [
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3239
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3240
          <xsl:text>            String.fromCharCode.apply(null, new Uint8Array(
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3241
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3242
          <xsl:text>                dv.buffer, /* original buffer */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3243
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3244
          <xsl:text>                offset + 1, /* string starts after size*/
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3245
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3246
          <xsl:text>                size /* size of string */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3247
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3248
          <xsl:text>            )), size + 1]; /* total increment */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3249
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3250
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3251
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3252
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3253
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3254
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3255
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3256
          <xsl:text>// Apply updates recieved through ws.onmessage to subscribed widgets
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3257
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3258
          <xsl:text>function apply_updates() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3259
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3260
          <xsl:text>    for(let index in updates){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3261
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3262
          <xsl:text>        // serving as a key, index becomes a string
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3263
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3264
          <xsl:text>        // -&gt; pass Number(index) instead
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3265
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3266
          <xsl:text>        dispatch_value(Number(index), updates[index]);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3267
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3268
          <xsl:text>        delete updates[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3269
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3270
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3271
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3272
          <xsl:text>}
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3273
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3274
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3275
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3276
          <xsl:text>// Called on requestAnimationFrame, modifies DOM
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3277
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3278
          <xsl:text>var requestAnimationFrameID = null;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3279
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3280
          <xsl:text>function animate() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3281
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3282
          <xsl:text>    // Do the page swith if any one pending
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3283
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3284
          <xsl:text>    if(current_subscribed_page != current_visible_page){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3285
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3286
          <xsl:text>        switch_visible_page(current_subscribed_page);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3287
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3288
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3289
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3290
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3291
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3292
          <xsl:text>    while(widget = need_cache_apply.pop()){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3293
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3294
          <xsl:text>        widget.apply_cache();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3295
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3296
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3297
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3298
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3299
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3300
          <xsl:text>    if(jumps_need_update) update_jumps();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3301
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3302
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3303
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3304
          <xsl:text>    apply_updates();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3305
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3306
          <xsl:text>    requestAnimationFrameID = null;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3307
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3308
          <xsl:text>}
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3309
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3310
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3311
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3312
          <xsl:text>function requestHMIAnimation() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3313
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3314
          <xsl:text>    if(requestAnimationFrameID == null){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3315
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3316
          <xsl:text>        requestAnimationFrameID = window.requestAnimationFrame(animate);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3317
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3318
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3319
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3320
          <xsl:text>}
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3321
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3322
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3323
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3324
          <xsl:text>// Message reception handler
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3325
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3326
          <xsl:text>// Hash is verified and HMI values updates resulting from binary parsing
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3327
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3328
          <xsl:text>// are stored until browser can compute next frame, DOM is left untouched
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3329
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3330
          <xsl:text>ws.onmessage = function (evt) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3331
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3332
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3333
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3334
          <xsl:text>    let data = evt.data;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3335
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3336
          <xsl:text>    let dv = new DataView(data);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3337
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3338
          <xsl:text>    let i = 0;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3339
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3340
          <xsl:text>    try {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3341
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3342
          <xsl:text>        for(let hash_int of hmi_hash) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3343
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3344
          <xsl:text>            if(hash_int != dv.getUint8(i)){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3345
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3346
          <xsl:text>                throw new Error("Hash doesn't match");
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3347
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3348
          <xsl:text>            };
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3349
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3350
          <xsl:text>            i++;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3351
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3352
          <xsl:text>        };
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3353
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3354
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3355
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3356
          <xsl:text>        while(i &lt; data.byteLength){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3357
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3358
          <xsl:text>            let index = dv.getUint32(i, true);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3359
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3360
          <xsl:text>            i += 4;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3361
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3362
          <xsl:text>            let iectype = hmitree_types[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3363
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3364
          <xsl:text>            if(iectype != undefined){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3365
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3366
          <xsl:text>                let dvgetter = dvgetters[iectype];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3367
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3368
          <xsl:text>                let [value, bytesize] = dvgetter(dv,i);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3369
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3370
          <xsl:text>                updates[index] = value;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3371
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3372
          <xsl:text>                i += bytesize;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3373
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3374
          <xsl:text>            } else {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3375
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3376
          <xsl:text>                throw new Error("Unknown index "+index);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3377
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3378
          <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3379
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3380
          <xsl:text>        };
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3381
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3382
          <xsl:text>        // register for rendering on next frame, since there are updates
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3383
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3384
          <xsl:text>        requestHMIAnimation();
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3385
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3386
          <xsl:text>    } catch(err) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3387
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3388
          <xsl:text>        // 1003 is for "Unsupported Data"
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3389
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3390
          <xsl:text>        // ws.close(1003, err.message);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3391
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3392
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3393
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3394
          <xsl:text>        // TODO : remove debug alert ?
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3395
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3396
          <xsl:text>        alert("Error : "+err.message+"\nHMI will be reloaded.");
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3397
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3398
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3399
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3400
          <xsl:text>        // force reload ignoring cache
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3401
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3402
          <xsl:text>        location.reload(true);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3403
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3404
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3405
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3406
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3407
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3408
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3409
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3410
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3411
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3412
          <xsl:text>function send_blob(data) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3413
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3414
          <xsl:text>    if(data.length &gt; 0) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3415
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3416
          <xsl:text>        ws.send(new Blob([new Uint8Array(hmi_hash)].concat(data)));
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3417
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3418
          <xsl:text>    };
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3419
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3420
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3421
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3422
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3423
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3424
          <xsl:text>const typedarray_types = {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3425
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3426
          <xsl:text>    INT: (number) =&gt; new Int16Array([number]),
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3427
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3428
          <xsl:text>    BOOL: (truth) =&gt; new Int16Array([truth]),
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3429
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3430
          <xsl:text>    NODE: (truth) =&gt; new Int16Array([truth]),
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3431
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3432
          <xsl:text>    STRING: (str) =&gt; {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3433
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3434
          <xsl:text>        // beremiz default string max size is 128
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3435
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3436
          <xsl:text>        str = str.slice(0,128);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3437
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3438
          <xsl:text>        binary = new Uint8Array(str.length + 1);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3439
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3440
          <xsl:text>        binary[0] = str.length;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3441
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3442
          <xsl:text>        for(var i = 0; i &lt; str.length; i++){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3443
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3444
          <xsl:text>            binary[i+1] = str.charCodeAt(i);
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3445
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3446
          <xsl:text>        }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3447
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3448
          <xsl:text>        return binary;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3449
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3450
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3451
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3452
          <xsl:text>    /* TODO */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3453
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3454
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3455
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3456
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3457
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3458
          <xsl:text>function send_reset() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3459
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3460
          <xsl:text>    send_blob(new Uint8Array([1])); /* reset = 1 */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3461
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3462
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3463
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3464
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3465
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3466
          <xsl:text>// subscription state, as it should be in hmi server
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3467
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3468
          <xsl:text>// hmitree indexed array of integers
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3469
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3470
          <xsl:text>var subscriptions =  hmitree_types.map(_ignored =&gt; 0);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3471
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3472
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3473
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3474
          <xsl:text>// subscription state as needed by widget now
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3475
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3476
          <xsl:text>// hmitree indexed array of Sets of widgets objects
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3477
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3478
          <xsl:text>var subscribers = hmitree_types.map(_ignored =&gt; new Set());
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3479
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3480
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3481
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3482
          <xsl:text>// artificially subscribe the watchdog widget to "/heartbeat" hmi variable
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3483
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3484
          <xsl:text>// Since dispatch directly calls change_hmi_value,
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3485
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3486
          <xsl:text>// PLC will periodically send variable at given frequency
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3487
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3488
          <xsl:text>subscribers[heartbeat_index].add({
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3489
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3490
          <xsl:text>    /* type: "Watchdog", */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3491
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3492
          <xsl:text>    frequency: 1,
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3493
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3494
          <xsl:text>    indexes: [heartbeat_index],
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3495
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3496
          <xsl:text>    new_hmi_value: function(index, value, oldval) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3497
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3498
          <xsl:text>        apply_hmi_value(heartbeat_index, value+1);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3499
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3500
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3501
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3502
          <xsl:text>});
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3503
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3504
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3505
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3506
          <xsl:text>function update_subscriptions() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3507
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3508
          <xsl:text>    let delta = [];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3509
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3510
          <xsl:text>    for(let index = 0; index &lt; subscribers.length; index++){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3511
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3512
          <xsl:text>        let widgets = subscribers[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3513
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3514
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3515
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3516
          <xsl:text>        // periods are in ms
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3517
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3518
          <xsl:text>        let previous_period = subscriptions[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3519
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3520
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3521
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3522
          <xsl:text>        // subscribing with a zero period is unsubscribing
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3523
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3524
          <xsl:text>        let new_period = 0;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3525
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3526
          <xsl:text>        if(widgets.size &gt; 0) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3527
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3528
          <xsl:text>            let maxfreq = 0;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3529
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3530
          <xsl:text>            for(let widget of widgets){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3531
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3532
          <xsl:text>                let wf = widget.frequency;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3533
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3534
          <xsl:text>                if(wf != undefined &amp;&amp; maxfreq &lt; wf)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3535
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3536
          <xsl:text>                    maxfreq = wf;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3537
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3538
          <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3539
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3540
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3541
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3542
          <xsl:text>            if(maxfreq != 0)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3543
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3544
          <xsl:text>                new_period = 1000/maxfreq;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3545
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3546
          <xsl:text>        }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3547
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3548
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3549
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3550
          <xsl:text>        if(previous_period != new_period) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3551
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3552
          <xsl:text>            subscriptions[index] = new_period;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3553
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3554
          <xsl:text>            delta.push(
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3555
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3556
          <xsl:text>                new Uint8Array([2]), /* subscribe = 2 */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3557
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3558
          <xsl:text>                new Uint32Array([index]),
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3559
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3560
          <xsl:text>                new Uint16Array([new_period]));
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3561
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3562
          <xsl:text>        }
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3563
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3564
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3565
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3566
          <xsl:text>    send_blob(delta);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3567
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3568
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3569
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3570
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3571
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3572
          <xsl:text>function send_hmi_value(index, value) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3573
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3574
          <xsl:text>    let iectype = hmitree_types[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3575
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3576
          <xsl:text>    let tobinary = typedarray_types[iectype];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3577
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3578
          <xsl:text>    send_blob([
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3579
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3580
          <xsl:text>        new Uint8Array([0]),  /* setval = 0 */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3581
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3582
          <xsl:text>        new Uint32Array([index]),
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3583
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3584
          <xsl:text>        tobinary(value)]);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3585
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3586
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3587
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3588
          <xsl:text>    // DON'T DO THAT unless read_iterator in svghmi.c modifies wbuf as well, not only rbuf
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3589
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3590
          <xsl:text>    // cache[index] = value;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3591
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3592
          <xsl:text>};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3593
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3594
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3595
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3596
          <xsl:text>function apply_hmi_value(index, new_val) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3597
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3598
          <xsl:text>    let old_val = cache[index]
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3599
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3600
          <xsl:text>    if(new_val != undefined &amp;&amp; old_val != new_val)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3601
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3602
          <xsl:text>        send_hmi_value(index, new_val);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3603
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3604
          <xsl:text>    return new_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3605
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3606
          <xsl:text>}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3607
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3608
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3609
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3610
          <xsl:text>quotes = {"'":null, '"':null};
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3611
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3612
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3613
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3614
          <xsl:text>function change_hmi_value(index, opstr) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3615
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3616
          <xsl:text>    let op = opstr[0];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3617
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3618
          <xsl:text>    let given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3619
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3620
          <xsl:text>    if(opstr.length &lt; 2) 
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3621
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3622
          <xsl:text>        return undefined; // TODO raise
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3623
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3624
          <xsl:text>    if(opstr[1] in quotes){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3625
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3626
          <xsl:text>        if(opstr.length &lt; 3) 
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3627
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3628
          <xsl:text>            return undefined; // TODO raise
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3629
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3630
          <xsl:text>        if(opstr[opstr.length-1] == opstr[1]){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3631
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3632
          <xsl:text>            given_val = opstr.slice(2,opstr.length-1);
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3633
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3634
          <xsl:text>        }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3635
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3636
          <xsl:text>    } else {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3637
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3638
          <xsl:text>        given_val = Number(opstr.slice(1));
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3639
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3640
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3641
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3642
          <xsl:text>    let old_val = cache[index];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3643
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3644
          <xsl:text>    let new_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3645
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3646
          <xsl:text>    switch(op){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3647
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3648
          <xsl:text>      case "=":
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3649
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3650
          <xsl:text>        new_val = given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3651
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3652
          <xsl:text>        break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3653
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3654
          <xsl:text>      case "+":
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3655
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3656
          <xsl:text>        new_val = old_val + given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3657
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3658
          <xsl:text>        break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3659
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3660
          <xsl:text>      case "-":
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3661
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3662
          <xsl:text>        new_val = old_val - given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3663
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3664
          <xsl:text>        break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3665
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3666
          <xsl:text>      case "*":
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3667
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3668
          <xsl:text>        new_val = old_val * given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3669
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3670
          <xsl:text>        break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3671
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3672
          <xsl:text>      case "/":
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3673
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3674
          <xsl:text>        new_val = old_val / given_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3675
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3676
          <xsl:text>        break;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3677
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3678
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3679
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3680
          <xsl:text>    if(new_val != undefined &amp;&amp; old_val != new_val)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3681
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3682
          <xsl:text>        send_hmi_value(index, new_val);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3683
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3684
          <xsl:text>    // TODO else raise
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3685
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3686
          <xsl:text>    return new_val;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3687
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3688
          <xsl:text>}
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3689
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3690
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3691
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3692
          <xsl:text>var current_visible_page;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3693
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3694
          <xsl:text>var current_subscribed_page;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3695
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3696
          <xsl:text>var current_page_index;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3697
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3698
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3699
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3700
          <xsl:text>function prepare_svg() {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3701
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3702
          <xsl:text>    for(let eltid in detachable_elements){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3703
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3704
          <xsl:text>        let [element,parent] = detachable_elements[eltid];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3705
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3706
          <xsl:text>        parent.removeChild(element);
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3707
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3708
          <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3709
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3710
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3711
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3712
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3713
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3714
          <xsl:text>function switch_page(page_name, page_index) {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3715
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3716
          <xsl:text>    if(current_subscribed_page != current_visible_page){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3717
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3718
          <xsl:text>        /* page switch already going */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3719
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3720
          <xsl:text>        /* TODO LOG ERROR */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3721
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3722
          <xsl:text>        return false;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3723
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3724
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3725
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3726
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3727
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3728
          <xsl:text>    if(page_name == undefined)
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3729
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3730
          <xsl:text>        page_name = current_subscribed_page;
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3731
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3732
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3733
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3734
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3735
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3736
          <xsl:text>    let old_desc = page_desc[current_subscribed_page];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3737
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3738
          <xsl:text>    let new_desc = page_desc[page_name];
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3739
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3740
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3741
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3742
          <xsl:text>    if(new_desc == undefined){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3743
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3744
          <xsl:text>        /* TODO LOG ERROR */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3745
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3746
          <xsl:text>        return false;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3747
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3748
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3749
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3750
          <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3751
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3752
          <xsl:text>    if(page_index == undefined){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3753
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3754
          <xsl:text>        page_index = new_desc.page_index;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3755
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3756
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3757
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3758
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3759
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3760
          <xsl:text>    if(old_desc){
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3761
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3762
          <xsl:text>        old_desc.widgets.map(([widget,relativeness])=&gt;widget.unsub());
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3763
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3764
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3765
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3766
          <xsl:text>    var new_offset = page_index == undefined ? 0 : page_index - new_desc.page_index;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3767
</xsl:text>
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  3768
          <xsl:text>    new_desc.widgets.map(([widget,relativeness])=&gt;widget.sub(new_offset,relativeness));
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3769
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3770
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3771
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3772
          <xsl:text>    update_subscriptions();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3773
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3774
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3775
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3776
          <xsl:text>    current_subscribed_page = page_name;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3777
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3778
          <xsl:text>    current_page_index = page_index;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3779
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3780
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3781
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3782
          <xsl:text>    jumps_need_update = true;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3783
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3784
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3785
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3786
          <xsl:text>    requestHMIAnimation();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3787
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3788
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3789
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3790
          <xsl:text>    jump_history.push([page_name, page_index]);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3791
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3792
          <xsl:text>    if(jump_history.length &gt; 42)
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3793
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3794
          <xsl:text>        jump_history.shift();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3795
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3796
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3797
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3798
          <xsl:text>    return true;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3799
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3800
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3801
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3802
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3803
</xsl:text>
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3804
          <xsl:text>function switch_visible_page(page_name) {
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3805
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3806
          <xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3807
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3808
          <xsl:text>    let old_desc = page_desc[current_visible_page];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3809
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3810
          <xsl:text>    let new_desc = page_desc[page_name];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3811
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3812
          <xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3813
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3814
          <xsl:text>    if(old_desc){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3815
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3816
          <xsl:text>        for(let eltid in old_desc.required_detachables){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3817
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3818
          <xsl:text>            if(!(eltid in new_desc.required_detachables)){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3819
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3820
          <xsl:text>                let [element, parent] = old_desc.required_detachables[eltid];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3821
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3822
          <xsl:text>                parent.removeChild(element);
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3823
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3824
          <xsl:text>            }
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3825
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3826
          <xsl:text>        }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3827
</xsl:text>
2942
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3828
          <xsl:text>        for(let eltid in new_desc.required_detachables){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3829
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3830
          <xsl:text>            if(!(eltid in old_desc.required_detachables)){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3831
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3832
          <xsl:text>                let [element, parent] = new_desc.required_detachables[eltid];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3833
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3834
          <xsl:text>                parent.appendChild(element);
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3835
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3836
          <xsl:text>            }
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3837
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3838
          <xsl:text>        }
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3839
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3840
          <xsl:text>    }else{
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3841
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3842
          <xsl:text>        for(let eltid in new_desc.required_detachables){
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3843
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3844
          <xsl:text>            let [element, parent] = new_desc.required_detachables[eltid];
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3845
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3846
          <xsl:text>            parent.appendChild(element);
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3847
</xsl:text>
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3848
          <xsl:text>        }
b07ad97e6019 SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
  3849
</xsl:text>
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3850
          <xsl:text>    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3851
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3852
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3853
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3854
          <xsl:text>    svg_root.setAttribute('viewBox',new_desc.bbox.join(" "));
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3855
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3856
          <xsl:text>    current_visible_page = page_name;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3857
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3858
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3859
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3860
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3861
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3862
          <xsl:text>// Once connection established
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3863
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3864
          <xsl:text>ws.onopen = function (evt) {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3865
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3866
          <xsl:text>    init_widgets();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3867
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3868
          <xsl:text>    send_reset();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3869
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3870
          <xsl:text>    // show main page
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3871
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3872
          <xsl:text>    prepare_svg();
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3873
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3874
          <xsl:text>    switch_page(default_page);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3875
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3876
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3877
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3878
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3879
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3880
          <xsl:text>ws.onclose = function (evt) {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3881
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3882
          <xsl:text>    // TODO : add visible notification while waiting for reload
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3883
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3884
          <xsl:text>    console.log("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+" Reload in 10s.");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3885
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3886
          <xsl:text>    // TODO : re-enable auto reload when not in debug
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3887
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3888
          <xsl:text>    //window.setTimeout(() =&gt; location.reload(true), 10000);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3889
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3890
          <xsl:text>    alert("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+".");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3891
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3892
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3893
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3894
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3895
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3896
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3897
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3898
          <xsl:text>var xmlns = "http://www.w3.org/2000/svg";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3899
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3900
          <xsl:text>var edit_callback;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3901
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3902
          <xsl:text>function edit_value(path, valuetype, callback, initial) {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3903
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3904
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3905
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3906
          <xsl:text>    let [keypadid, xcoord, ycoord] = keypads[valuetype];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3907
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3908
          <xsl:text>    console.log('XXX TODO : Edit value', path, valuetype, callback, initial, keypadid);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3909
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3910
          <xsl:text>    edit_callback = callback;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3911
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3912
          <xsl:text>    let widget = hmi_widgets[keypadid];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3913
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3914
          <xsl:text>    widget.start_edit(path, valuetype, callback, initial);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3915
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3916
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3917
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3918
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3919
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3920
          <xsl:text>var current_modal; /* TODO stack ?*/
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3921
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3922
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3923
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3924
          <xsl:text>function show_modal() {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3925
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3926
          <xsl:text>    let [element, parent] = detachable_elements[this.element.id];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3927
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3928
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3929
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3930
          <xsl:text>    tmpgrp = document.createElementNS(xmlns,"g");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3931
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3932
          <xsl:text>    tmpgrpattr = document.createAttribute("transform");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3933
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3934
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3935
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3936
          <xsl:text>    let [xcoord,ycoord] = this.coordinates;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3937
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3938
          <xsl:text>    let [xdest,ydest] = page_desc[current_visible_page].bbox;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3939
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3940
          <xsl:text>    tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3941
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3942
          <xsl:text>    tmpgrp.setAttributeNode(tmpgrpattr);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3943
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3944
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3945
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3946
          <xsl:text>    tmpgrp.appendChild(element);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3947
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3948
          <xsl:text>    parent.appendChild(tmpgrp);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3949
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3950
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3951
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3952
          <xsl:text>    current_modal = [this.element.id, tmpgrp];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3953
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3954
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3955
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3956
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3957
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3958
          <xsl:text>function end_modal() {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3959
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3960
          <xsl:text>    let [eltid, tmpgrp] = current_modal;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3961
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3962
          <xsl:text>    let [element, parent] = detachable_elements[this.element.id];
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3963
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3964
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3965
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3966
          <xsl:text>    parent.removeChild(tmpgrp);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3967
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3968
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3969
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3970
          <xsl:text>    current_modal = undefined;
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3971
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3972
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3973
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3974
          <xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3975
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3976
          <xsl:text>function widget_active_activable(eltsub) {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3977
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3978
          <xsl:text>    if(eltsub.inactive_style === undefined)
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3979
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3980
          <xsl:text>        eltsub.inactive_style = eltsub.inactive.getAttribute("style");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3981
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3982
          <xsl:text>    eltsub.inactive.setAttribute("style", "display:none");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3983
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3984
          <xsl:text>    if(eltsub.active_style !== undefined)
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3985
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3986
          <xsl:text>            eltsub.active.setAttribute("style", eltsub.active_style);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3987
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3988
          <xsl:text>    console.log("active", eltsub);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3989
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3990
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3991
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3992
          <xsl:text>function widget_inactive_activable(eltsub) {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3993
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3994
          <xsl:text>    if(eltsub.active_style === undefined)
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3995
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3996
          <xsl:text>        eltsub.active_style = eltsub.active.getAttribute("style");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3997
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3998
          <xsl:text>    eltsub.active.setAttribute("style", "display:none");
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  3999
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4000
          <xsl:text>    if(eltsub.inactive_style !== undefined)
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4001
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4002
          <xsl:text>            eltsub.inactive.setAttribute("style", eltsub.inactive_style);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4003
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4004
          <xsl:text>    console.log("inactive", eltsub);
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4005
</xsl:text>
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4006
          <xsl:text>};
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
  4007
</xsl:text>
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  4008
        </script>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  4009
      </body>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  4010
    </html>
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2881
diff changeset
  4011
  </xsl:template>
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
  4012
</xsl:stylesheet>