svghmi/gen_index_xhtml.xslt
author Edouard Tisserant
Wed, 23 Nov 2022 11:34:15 +0100
changeset 3687 747ffdafbe31
parent 3684 2239f8e3de48
child 3688 c2992796a859
child 3709 7fbcc7b741b7
permissions -rw-r--r--
SVGHMI: update generated xslt
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"?>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
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:cssdefs="cssdefs" 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">
3264
51645afeded9 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3242
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:')]"/>
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
     6
  <xsl:param name="instance_name"/>
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
     7
  <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     8
  <xsl:variable name="_categories">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     9
    <noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    10
      <xsl:text>HMI_PLC_STATUS</xsl:text>
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
    <noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    13
      <xsl:text>HMI_CURRENT_PAGE</xsl:text>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    14
    </noindex>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    15
  </xsl:variable>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    16
  <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
    17
  <xsl:variable name="_indexed_hmitree">
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
    18
    <xsl:apply-templates mode="index" select="$hmitree"/>
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    19
  </xsl:variable>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
    20
  <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
    21
  <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
    22
  <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
    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>
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: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
    26
    <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
    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>
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
    30
</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
    31
    <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
    32
    <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
    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>
ef13a4007538 SVGHMI: spread JS code 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: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
    38
    <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
    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>
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    43
    <xsl:text>var current_page_var_index = </xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    44
    <xsl:value-of select="$indexed_hmitree/*[@hmipath = concat('/CURRENT_PAGE_', $instance_name)]/@index"/>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    45
    <xsl:text>;
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    46
</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    47
    <xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    48
</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
    49
    <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
    50
</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
    51
    <xsl:for-each select="$indexed_hmitree/*">
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    52
      <xsl:text>    "</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
    53
      <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
    54
      <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
    55
      <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
    56
        <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
    57
      </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
    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:for-each>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    61
    <xsl:text>];
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    62
</xsl:text>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    63
    <xsl:text>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
    64
</xsl:text>
3206
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    65
    <xsl:text>var hmitree_paths = [
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    66
</xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    67
    <xsl:for-each select="$indexed_hmitree/*">
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    68
      <xsl:text>    "</xsl:text>
3206
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    69
      <xsl:value-of select="@hmipath"/>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    70
      <xsl:text>"</xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    71
      <xsl:if test="position()!=last()">
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    72
        <xsl:text>,</xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    73
      </xsl:if>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    74
      <xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    75
</xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    76
    </xsl:for-each>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    77
    <xsl:text>];
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    78
</xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    79
    <xsl:text>
4fd7bd10e606 SVGHMI: added "page_node" variable that reflects the HMI tree path of current relative page
Edouard Tisserant
parents: 3199
diff changeset
    80
</xsl:text>
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    81
    <xsl:text>var hmitree_nodes = {
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    82
</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    83
    <xsl:for-each select="$indexed_hmitree/*[local-name() = 'HMI_NODE']">
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    84
      <xsl:text>    "</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    85
      <xsl:value-of select="@hmipath"/>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    86
      <xsl:text>" : [</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    87
      <xsl:value-of select="@index"/>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    88
      <xsl:text>, "</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    89
      <xsl:value-of select="@class"/>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    90
      <xsl:text>"]</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    91
      <xsl:if test="position()!=last()">
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    92
        <xsl:text>,</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    93
      </xsl:if>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    94
      <xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    95
</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    96
    </xsl:for-each>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    97
    <xsl:text>};
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    98
</xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
    99
    <xsl:text>
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
   100
</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
   101
    <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
   102
</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
   103
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   104
  <xsl:template mode="index" match="*">
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   105
    <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
   106
    <xsl:param name="parentpath" select="''"/>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   107
    <xsl:variable name="content">
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   108
      <xsl:variable name="path">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   109
        <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
   110
          <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
   111
            <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
   112
          </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
   113
          <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
   114
            <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
   115
            <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
   116
          </xsl:when>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   117
          <xsl:otherwise>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   118
            <xsl:value-of select="$parentpath"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   119
            <xsl:text>/</xsl:text>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   120
            <xsl:value-of select="@name"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   121
          </xsl:otherwise>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   122
        </xsl:choose>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   123
      </xsl:variable>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   124
      <xsl:choose>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   125
        <xsl:when test="not(local-name() = $categories/noindex)">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   126
          <xsl:copy>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   127
            <xsl:attribute name="index">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   128
              <xsl:value-of select="$index"/>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   129
            </xsl:attribute>
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   130
            <xsl:attribute name="hmipath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   131
              <xsl:value-of select="$path"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   132
            </xsl:attribute>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   133
            <xsl:for-each select="@*">
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   134
              <xsl:copy/>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   135
            </xsl:for-each>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   136
          </xsl:copy>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   137
          <xsl:apply-templates mode="index" select="*[1]">
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   138
            <xsl:with-param name="index" select="$index + 1"/>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   139
            <xsl:with-param name="parentpath">
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   140
              <xsl:value-of select="$path"/>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   141
            </xsl:with-param>
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2865
diff changeset
   142
          </xsl:apply-templates>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   143
        </xsl:when>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   144
        <xsl:otherwise>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   145
          <xsl:apply-templates mode="index" select="*[1]">
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   146
            <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
   147
            <xsl:with-param name="parentpath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   148
              <xsl:value-of select="$path"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   149
            </xsl:with-param>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   150
          </xsl:apply-templates>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   151
        </xsl:otherwise>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   152
      </xsl:choose>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   153
    </xsl:variable>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   154
    <xsl:copy-of select="$content"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   155
    <xsl:apply-templates mode="index" select="following-sibling::*[1]">
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   156
      <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
   157
      <xsl:with-param name="parentpath">
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   158
        <xsl:value-of select="$parentpath"/>
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
   159
      </xsl:with-param>
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   160
    </xsl:apply-templates>
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   161
  </xsl:template>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   162
  <xsl:variable name="pathregex" select="'^(\w+=)?([^,=]+)([-.\d,]*)$'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   163
  <xsl:variable name="newline">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   164
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   165
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   166
  </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   167
  <xsl:variable name="twonewlines" select="concat($newline,$newline)"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   168
  <xsl:template mode="parselabel" match="*">
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   169
    <xsl:variable name="label" select="@inkscape:label"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   170
    <xsl:variable name="desc" select="svg:desc"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   171
    <xsl:variable name="len" select="string-length($label)"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   172
    <xsl:variable name="has_continuation" select="substring($label,$len,1)='\'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   173
    <xsl:variable name="full_decl">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   174
      <xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   175
        <xsl:when test="$has_continuation">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   176
          <xsl:variable name="_continuation" select="substring-before($desc, $twonewlines)"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   177
          <xsl:variable name="continuation">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   178
            <xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   179
              <xsl:when test="$_continuation">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   180
                <xsl:value-of select="$_continuation"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   181
              </xsl:when>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   182
              <xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   183
                <xsl:value-of select="$desc"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   184
              </xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   185
            </xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   186
          </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   187
          <xsl:value-of select="concat(substring($label,1,$len - 1),translate($continuation,$newline,''))"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   188
        </xsl:when>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   189
        <xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   190
          <xsl:value-of select="$label"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   191
        </xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   192
      </xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   193
    </xsl:variable>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   194
    <xsl:variable name="id" select="@id"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   195
    <xsl:variable name="declaration" select="substring-after($full_decl,'HMI:')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   196
    <xsl:variable name="_args" select="substring-before($declaration,'@')"/>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   197
    <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
   198
      <xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   199
        <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
   200
          <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
   201
        </xsl:when>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   202
        <xsl:otherwise>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   203
          <xsl:value-of select="$declaration"/>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   204
        </xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   205
      </xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   206
    </xsl:variable>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   207
    <xsl:variable name="_typefreq" select="substring-before($args,':')"/>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   208
    <xsl:variable name="typefreq">
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   209
      <xsl:choose>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   210
        <xsl:when test="$_typefreq">
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   211
          <xsl:value-of select="$_typefreq"/>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   212
        </xsl:when>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   213
        <xsl:otherwise>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   214
          <xsl:value-of select="$args"/>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   215
        </xsl:otherwise>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   216
      </xsl:choose>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   217
    </xsl:variable>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
   218
    <xsl:variable name="freq" select="substring-after($typefreq,'|')"/>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   219
    <xsl:variable name="_type" select="substring-before($typefreq,'|')"/>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   220
    <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
   221
      <xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   222
        <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
   223
          <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
   224
        </xsl:when>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   225
        <xsl:otherwise>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   226
          <xsl:value-of select="$typefreq"/>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   227
        </xsl:otherwise>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   228
      </xsl:choose>
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
   229
    </xsl:variable>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   230
    <xsl:if test="$type">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   231
      <widget>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   232
        <xsl:attribute name="id">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   233
          <xsl:value-of select="$id"/>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   234
        </xsl:attribute>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   235
        <xsl:attribute name="type">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   236
          <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
   237
        </xsl:attribute>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
   238
        <xsl:if test="$freq">
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   239
          <xsl:if test="not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]?'))">
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   240
            <xsl:message terminate="yes">
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   241
              <xsl:text>Widget id:</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   242
              <xsl:value-of select="$id"/>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   243
              <xsl:text> label:</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   244
              <xsl:value-of select="$full_decl"/>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   245
              <xsl:text> has wrong syntax of frequency forcing </xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   246
              <xsl:value-of select="$freq"/>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   247
            </xsl:message>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
   248
          </xsl:if>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
   249
          <xsl:attribute name="freq">
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   250
            <xsl:value-of select="$freq"/>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   251
          </xsl:attribute>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
   252
        </xsl:if>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   253
        <xsl:variable name="tail" select="substring-after($declaration,'@')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   254
        <xsl:variable name="taillen" select="string-length($tail)"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   255
        <xsl:variable name="has_enable" select="contains($tail, '#')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   256
        <xsl:variable name="paths">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   257
          <xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   258
            <xsl:when test="$has_enable">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   259
              <xsl:value-of select="substring-before($tail,'#')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   260
            </xsl:when>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   261
            <xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   262
              <xsl:value-of select="$tail"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   263
            </xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   264
          </xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   265
        </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   266
        <xsl:if test="$has_enable">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   267
          <xsl:variable name="enable_expr" select="substring-after($tail,'#')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   268
          <xsl:attribute name="enable_expr">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   269
            <xsl:value-of select="$enable_expr"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   270
          </xsl:attribute>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   271
        </xsl:if>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   272
        <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
   273
          <arg>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   274
            <xsl:attribute name="value">
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   275
              <xsl:value-of select="."/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   276
            </xsl:attribute>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   277
          </arg>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   278
        </xsl:for-each>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   279
        <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
   280
          <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
   281
            <path>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   282
              <xsl:variable name="path_match" select="regexp:match(.,$pathregex)"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   283
              <xsl:variable name="pathassign" select="substring-before($path_match[2],'=')"/>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   284
              <xsl:variable name="pathminmax" select="str:split($path_match[4],',')"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   285
              <xsl:variable name="path" select="$path_match[3]"/>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   286
              <xsl:variable name="pathminmaxcount" select="count($pathminmax)"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   287
              <xsl:if test="not($path)">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   288
                <xsl:message terminate="yes">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   289
                  <xsl:text>Widget id:</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   290
                  <xsl:value-of select="$id"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   291
                  <xsl:text> label:</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   292
                  <xsl:value-of select="$full_decl"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   293
                  <xsl:text> has wrong syntax</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   294
                </xsl:message>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   295
              </xsl:if>
2793
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   296
              <xsl:attribute name="value">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   297
                <xsl:value-of select="$path"/>
2793
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
   298
              </xsl:attribute>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   299
              <xsl:if test="$pathassign">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   300
                <xsl:attribute name="assign">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   301
                  <xsl:value-of select="$pathassign"/>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   302
                </xsl:attribute>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   303
              </xsl:if>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
   304
              <xsl:choose>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   305
                <xsl:when test="$pathminmaxcount = 2">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   306
                  <xsl:attribute name="min">
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   307
                    <xsl:value-of select="$pathminmax[1]"/>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   308
                  </xsl:attribute>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   309
                  <xsl:attribute name="max">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   310
                    <xsl:value-of select="$pathminmax[2]"/>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
   311
                  </xsl:attribute>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   312
                </xsl:when>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   313
                <xsl:when test="$pathminmaxcount = 1 or $pathminmaxcount &gt; 2">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   314
                  <xsl:message terminate="yes">
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   315
                    <xsl:text>Widget id:</xsl:text>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   316
                    <xsl:value-of select="$id"/>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   317
                    <xsl:text> label:</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   318
                    <xsl:value-of select="$full_decl"/>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   319
                    <xsl:text> has wrong syntax of path section </xsl:text>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   320
                    <xsl:value-of select="$pathminmax"/>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   321
                  </xsl:message>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   322
                </xsl:when>
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   323
              </xsl:choose>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   324
              <xsl:if test="$indexed_hmitree">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   325
                <xsl:choose>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   326
                  <xsl:when test="regexp:test($path,'^\.[a-zA-Z0-9_]+$')">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   327
                    <xsl:attribute name="type">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   328
                      <xsl:text>PAGE_LOCAL</xsl:text>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   329
                    </xsl:attribute>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   330
                  </xsl:when>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   331
                  <xsl:when test="regexp:test($path,'^[a-zA-Z0-9_]+$')">
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   332
                    <xsl:attribute name="type">
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   333
                      <xsl:text>HMI_LOCAL</xsl:text>
3097
a098b2dd9dff SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3094
diff changeset
   334
                    </xsl:attribute>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   335
                  </xsl:when>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   336
                  <xsl:otherwise>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   337
                    <xsl:variable name="item" select="$indexed_hmitree/*[@hmipath = $path]"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   338
                    <xsl:variable name="pathtype" select="local-name($item)"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   339
                    <xsl:if test="$pathminmaxcount = 3 and not($pathtype = 'HMI_INT' or $pathtype = 'HMI_REAL')">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   340
                      <xsl:message terminate="yes">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   341
                        <xsl:text>Widget id:</xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   342
                        <xsl:value-of select="$id"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   343
                        <xsl:text> label:</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   344
                        <xsl:value-of select="$full_decl"/>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   345
                        <xsl:text> path section </xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   346
                        <xsl:value-of select="$pathminmax"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   347
                        <xsl:text> use min and max on non mumeric value</xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   348
                      </xsl:message>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   349
                    </xsl:if>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   350
                    <xsl:if test="count($item) = 1">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   351
                      <xsl:attribute name="index">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   352
                        <xsl:value-of select="$item/@index"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   353
                      </xsl:attribute>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   354
                      <xsl:attribute name="type">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   355
                        <xsl:value-of select="$pathtype"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   356
                      </xsl:attribute>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   357
                    </xsl:if>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   358
                  </xsl:otherwise>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   359
                </xsl:choose>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   360
              </xsl:if>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   361
            </path>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   362
          </xsl:if>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   363
        </xsl:for-each>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   364
        <xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   365
          <xsl:when test="$has_continuation">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   366
            <xsl:variable name="_continuation" select="substring-after($desc, $twonewlines)"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   367
            <xsl:if test="$_continuation">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   368
              <desc>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   369
                <xsl:value-of select="$_continuation"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   370
              </desc>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   371
            </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   372
          </xsl:when>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   373
          <xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   374
            <xsl:if test="$desc">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   375
              <desc>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   376
                <xsl:value-of select="$desc/text()"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   377
              </desc>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   378
            </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   379
          </xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   380
        </xsl:choose>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   381
      </widget>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   382
    </xsl:if>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   383
  </xsl:template>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   384
  <xsl:template mode="genlabel" match="arg">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   385
    <xsl:text>:</xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   386
    <xsl:value-of select="@value"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   387
  </xsl:template>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   388
  <xsl:template mode="genlabel" match="path">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   389
    <xsl:text>@</xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   390
    <xsl:value-of select="@value"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   391
    <xsl:if test="string-length(@min)&gt;0 or string-length(@max)&gt;0">
3240
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
   392
      <xsl:text>,</xsl:text>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   393
      <xsl:value-of select="@min"/>
3240
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
   394
      <xsl:text>,</xsl:text>
3229
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   395
      <xsl:value-of select="@max"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   396
    </xsl:if>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   397
  </xsl:template>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   398
  <xsl:template mode="genlabel" match="widget">
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   399
    <xsl:text>HMI:</xsl:text>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   400
    <xsl:value-of select="@type"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   401
    <xsl:apply-templates mode="genlabel" select="arg"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   402
    <xsl:apply-templates mode="genlabel" select="path"/>
c5be4fd425e7 SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3222
diff changeset
   403
  </xsl:template>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   404
  <xsl:variable name="_parsed_widgets">
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
   405
    <widget type="VarInitPersistent">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
   406
      <arg value="0"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
   407
      <path value="lang"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
   408
    </widget>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   409
    <xsl:apply-templates mode="parselabel" select="$hmi_elements"/>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   410
  </xsl:variable>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   411
  <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
   412
  <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
   413
    <xsl:param name="id"/>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   414
    <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
   415
  </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
   416
  <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
   417
    <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
   418
    <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
   419
    <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
   420
  </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
   421
  <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
   422
    <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
   423
    <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
   424
    <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
   425
    <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
   426
    <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
   427
  </func:function>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   428
  <xsl:template mode="testtree" match="*">
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
   429
    <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
   430
    <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
   431
    <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
   432
    <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
   433
    <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
   434
    <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
   435
      <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
   436
      <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
   437
      <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
   438
      <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
   439
    </xsl:for-each>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   440
    <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
   441
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   442
    <xsl:if test="text()">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   443
      <xsl:value-of select="text()"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   444
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   445
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
   446
    </xsl:if>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   447
    <xsl:apply-templates mode="testtree" select="*">
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
   448
      <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
   449
        <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
   450
      </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
   451
    </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
   452
  </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
   453
  <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
   454
  <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
   455
    <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
   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>/* </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
   458
    <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
   459
    <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
   460
</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
   461
    <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
   462
</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
   463
    <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
   464
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   465
    <xsl:apply-templates mode="testtree" select="$hmitree"/>
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
   466
    <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
   467
</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
   468
    <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
   469
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   470
    <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
   471
    <xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   472
</xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   473
    <xsl:text>Parsed Widgets
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   474
</xsl:text>
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   475
    <xsl:copy-of select="_parsed_widgets"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   476
    <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
   477
    <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
   478
</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
   479
  </xsl:template>
3199
1582753e409b SVGHMI: Filter unseen geometry from inkscape CSV output.
Edouard Tisserant
parents: 3195
diff changeset
   480
  <xsl:variable name="all_geometry" select="ns:GetSVGGeometry()"/>
1582753e409b SVGHMI: Filter unseen geometry from inkscape CSV output.
Edouard Tisserant
parents: 3195
diff changeset
   481
  <xsl:variable name="defs" select="//svg:defs/descendant-or-self::svg:*"/>
1582753e409b SVGHMI: Filter unseen geometry from inkscape CSV output.
Edouard Tisserant
parents: 3195
diff changeset
   482
  <xsl:variable name="geometry" select="$all_geometry[not(@Id = $defs/@id)]"/>
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
   483
  <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
   484
  <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
   485
    <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
   486
</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
   487
    <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
   488
    <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
   489
    <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
   490
</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
   491
    <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
   492
</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
   493
    <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
   494
</xsl:text>
2879
58e6a91dc37f SVGHMI: Cosmetic changes
Edouard Tisserant
parents: 2878
diff changeset
   495
    <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
   496
      <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
   497
      <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
   498
      <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
   499
      <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
   500
      <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
   501
      <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
   502
      <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
   503
      <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
   504
      <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
   505
      <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
   506
      <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
   507
</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
   508
    </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
   509
    <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
   510
</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
   511
  </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
   512
  <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
   513
    <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
   514
    <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
   515
    <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
   516
    <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
   517
    <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
   518
    <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
   519
    <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
   520
      <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
   521
        <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
   522
      </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
   523
      <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
   524
        <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
   525
      </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
   526
      <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
   527
        <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
   528
      </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
   529
      <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
   530
        <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
   531
      </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
   532
      <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
   533
        <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
   534
      </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
   535
    </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
   536
  </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
   537
  <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
   538
    <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
   539
    <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
   540
    <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
   541
    <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
   542
      <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
   543
        <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
   544
        <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
   545
      </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
   546
      <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
   547
        <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
   548
      </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
   549
    </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
   550
  </func:function>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   551
  <xsl:variable name="groups" select="/svg:svg | //svg:g"/>
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
   552
  <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
   553
    <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
   554
    <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
   555
    <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
   556
    <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
   557
  </func:function>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   558
  <func:function name="func:offset">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   559
    <xsl:param name="elt1"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   560
    <xsl:param name="elt2"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   561
    <xsl:variable name="g1" select="$geometry[@Id = $elt1/@id]"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   562
    <xsl:variable name="g2" select="$geometry[@Id = $elt2/@id]"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   563
    <xsl:variable name="result">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   564
      <vector>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   565
        <xsl:attribute name="x">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   566
          <xsl:value-of select="$g2/@x - $g1/@x"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   567
        </xsl:attribute>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   568
        <xsl:attribute name="y">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   569
          <xsl:value-of select="$g2/@y - $g1/@y"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   570
        </xsl:attribute>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   571
      </vector>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   572
    </xsl:variable>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   573
    <func:result select="exsl:node-set($result)"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   574
  </func:function>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   575
  <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   576
  <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   577
  <xsl:variable name="hmi_textlists_descs" select="$parsed_widgets/widget[@type = 'TextList']"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   578
  <xsl:variable name="hmi_textlists" select="$hmi_elements[@id = $hmi_textlists_descs/@id]"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   579
  <xsl:variable name="hmi_textstylelists_descs" select="$parsed_widgets/widget[@type = 'TextStyleList']"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   580
  <xsl:variable name="hmi_textstylelists" select="$hmi_elements[@id = $hmi_textstylelists_descs/@id]"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   581
  <xsl:variable name="textstylelist_related">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   582
    <xsl:for-each select="$hmi_textstylelists">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   583
      <list>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   584
        <xsl:attribute name="listid">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   585
          <xsl:value-of select="@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   586
        </xsl:attribute>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   587
        <xsl:for-each select="func:refered_elements(.)">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   588
          <elt>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   589
            <xsl:attribute name="eltid">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   590
              <xsl:value-of select="@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   591
            </xsl:attribute>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   592
          </elt>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   593
        </xsl:for-each>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   594
      </list>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   595
    </xsl:for-each>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   596
  </xsl:variable>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
   597
  <xsl:variable name="textstylelist_related_ns" select="exsl:node-set($textstylelist_related)"/>
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   598
  <xsl:variable name="hmi_pages_descs" select="$parsed_widgets/widget[@type = 'Page']"/>
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   599
  <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
   600
  <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
   601
    <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
   602
      <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
   603
        <xsl:choose>
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
   604
          <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
   605
            <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
   606
          </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
   607
          <xsl:otherwise>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   608
            <xsl:message terminate="yes">
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   609
              <xsl:text>No Home page defined!</xsl:text>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   610
            </xsl:message>
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
   611
          </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
   612
        </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
   613
      </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
   614
      <xsl:when test="count($hmi_pages) = 0">
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   615
        <xsl:message terminate="yes">
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   616
          <xsl:text>No page defined!</xsl:text>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   617
        </xsl:message>
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
   618
      </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
   619
      <xsl:otherwise>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   620
        <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
   621
      </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
   622
    </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
   623
  </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
   624
  <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
   625
  <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
   626
    <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
   627
</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
   628
    <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
   629
    <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
   630
    <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
   631
</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
   632
    <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
   633
</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
   634
    <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
   635
</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
   636
    <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
   637
    <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
   638
    <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
   639
</xsl:text>
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   640
    <xsl:variable name="screensaverpage" select="$hmi_pages_descs[arg[1]/@value = 'ScreenSaver']"/>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   641
    <xsl:variable name="delay">
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   642
      <xsl:choose>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   643
        <xsl:when test="$screensaverpage">
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   644
          <xsl:variable name="delaystr" select="$screensaverpage/arg[2]/@value"/>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   645
          <xsl:if test="not(regexp:test($delaystr,'^[0-9]+$'))">
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   646
            <xsl:message terminate="yes">
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   647
              <xsl:text>ScreenSaver page has missing or malformed delay argument.</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   648
            </xsl:message>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   649
          </xsl:if>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   650
          <xsl:value-of select="$delaystr"/>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   651
        </xsl:when>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   652
        <xsl:otherwise>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   653
          <xsl:text>null</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   654
        </xsl:otherwise>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   655
      </xsl:choose>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   656
    </xsl:variable>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   657
    <xsl:text>var screensaver_delay = </xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   658
    <xsl:value-of select="$delay"/>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   659
    <xsl:text>;
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
   660
</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
   661
    <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
   662
</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
   663
  </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
   664
  <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
   665
  <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
   666
  <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
   667
    <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
   668
    <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
   669
    <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
   670
    <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
   671
    <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
   672
      <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
   673
        <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
   674
      </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
   675
      <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
   676
        <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
   677
      </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
   678
    </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
   679
  </func:function>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   680
  <xsl:variable name="_overlapping_geometry">
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   681
    <xsl:for-each select="$hmi_pages | $keypads">
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   682
      <xsl:variable name="k" select="concat('overlapping:', @id)"/>
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   683
      <xsl:value-of select="ns:ProgressStart($k, concat('collecting membership of ', @inkscape:label))"/>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   684
      <elt>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   685
        <xsl:attribute name="id">
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   686
          <xsl:value-of select="@id"/>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   687
        </xsl:attribute>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   688
        <xsl:copy-of select="func:overlapping_geometry(.)"/>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   689
      </elt>
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   690
      <xsl:value-of select="ns:ProgressEnd($k)"/>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   691
    </xsl:for-each>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   692
  </xsl:variable>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   693
  <xsl:variable name="overlapping_geometry" select="exsl:node-set($_overlapping_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
   694
  <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
   695
    <xsl:param name="page"/>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   696
    <xsl:variable name="page_overlapping_geometry" select="$overlapping_geometry/elt[@id = $page/@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
   697
    <xsl:variable name="page_overlapping_elements" select="//svg:*[@id = $page_overlapping_geometry/@Id]"/>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   698
    <xsl:variable name="page_widgets_elements" select="&#10;        $hmi_elements[not(@id=$page/@id)&#10;                      and descendant-or-self::svg:*/@id = $page_overlapping_elements/@id]&#10;        /descendant-or-self::svg:*"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   699
    <xsl:variable name="page_sub_elements" select="func:refered_elements($page | $page_overlapping_elements | $page_widgets_elements)"/>
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
   700
    <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
   701
  </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
   702
  <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
   703
    <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
   704
    <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
   705
      <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
   706
        <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
   707
      </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
   708
      <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
   709
        <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
   710
      </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
   711
    </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
   712
  </func:function>
3186
1e9b9d7451cd SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
Edouard Tisserant
parents: 3181
diff changeset
   713
  <xsl:variable name="required_page_elements" select="func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
   714
  <xsl:variable name="required_list_elements" select="func:refered_elements(($hmi_lists | $hmi_textlists)[@id = $required_page_elements/@id])/ancestor-or-self::svg:*"/>
3199
1582753e409b SVGHMI: Filter unseen geometry from inkscape CSV output.
Edouard Tisserant
parents: 3195
diff changeset
   715
  <xsl:variable name="required_elements" select="$defs | $required_list_elements | $required_page_elements"/>
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
   716
  <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
   717
  <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
   718
    <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
   719
    <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
3161
edd558965f58 SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3156
diff changeset
   720
    <xsl:variable name="filled_groups" select="$short_list/parent::*[&#10;        not(child::*[&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/@id)&#10;        ])]"/>
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
   721
    <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/>
3161
edd558965f58 SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3156
diff changeset
   722
    <func:result select="$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@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
   723
  </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
   724
  <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
   725
    <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
   726
    <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
   727
      <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
   728
        <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
   729
      </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
   730
      <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
   731
        <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
   732
      </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
   733
    </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
   734
  </func:function>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
   735
  <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
   736
  <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   737
  <declarations:page-class/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   738
  <xsl:template match="declarations:page-class">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   739
    <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   740
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   741
    <xsl:text>/* </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   742
    <xsl:value-of select="local-name()"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   743
    <xsl:text> */
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   744
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   745
    <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   746
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   747
    <xsl:text>class PageWidget extends Widget{}
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   748
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   749
    <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   750
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   751
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   752
  <declarations:detachable-elements/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
   753
  <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
   754
    <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
   755
</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
   756
    <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
   757
    <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
   758
    <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
   759
</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
   760
    <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
   761
</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
   762
    <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
   763
</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
   764
    <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
   765
</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
   766
    <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
   767
      <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
   768
      <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
   769
      <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
   770
      <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
   771
      <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
   772
      <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
   773
      <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
   774
      <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
   775
        <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
   776
      </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
   777
      <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
   778
</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
   779
    </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
   780
    <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
   781
</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
   782
    <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
   783
</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
   784
  </xsl:template>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   785
  <xsl:variable name="forEach_widgets_ids" select="$parsed_widgets/widget[@type = 'ForEach']/@id"/>
3124
f263359d8108 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
   786
  <xsl:variable name="forEach_widgets" select="$hmi_widgets[@id = $forEach_widgets_ids]"/>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   787
  <xsl:variable name="in_forEach_widget_ids" select="func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   788
  <xsl:template mode="page_desc" match="svg:*">
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   789
    <xsl:if test="ancestor::*[@id = $hmi_pages/@id]">
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   790
      <xsl:message terminate="yes">
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   791
        <xsl:text>HMI:Page </xsl:text>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   792
        <xsl:value-of select="@id"/>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   793
        <xsl:text> is nested in another HMI:Page</xsl:text>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   794
      </xsl:message>
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
   795
    </xsl:if>
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   796
    <xsl:variable name="desc" select="func:widget(@id)"/>
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   797
    <xsl:variable name="pagename" select="$desc/arg[1]/@value"/>
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   798
    <xsl:variable name="msg" select="concat('generating page description ', $pagename)"/>
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   799
    <xsl:value-of select="ns:ProgressStart($pagename, $msg)"/>
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
   800
    <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
   801
    <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
   802
    <xsl:variable name="page_all_elements" select="func:all_related_elements($page)"/>
3124
f263359d8108 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
   803
    <xsl:variable name="all_page_widgets" select="$hmi_widgets[@id = $page_all_elements/@id and @id != $page/@id]"/>
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
   804
    <xsl:variable name="page_managed_widgets" select="$all_page_widgets[not(@id=$in_forEach_widget_ids)]"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   805
    <xsl:variable name="page_root_path" select="$desc/path[not(@assign)]"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   806
    <xsl:if test="count($page_root_path)&gt;1">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   807
      <xsl:message terminate="yes">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   808
        <xsl:text>Page id="</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   809
        <xsl:value-of select="$page/@id"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   810
        <xsl:text>" : only one root path can be declared</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   811
      </xsl:message>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   812
    </xsl:if>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   813
    <xsl:variable name="page_relative_widgets" select="$page_managed_widgets[func:is_descendant_path(func:widget(@id)/path/@value, $page_root_path/@value)]"/>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   814
    <xsl:variable name="sumarized_page" select="func:sumarized_elements($page_all_elements)"/>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   815
    <xsl:variable name="required_detachables" select="$sumarized_page/&#10;           ancestor-or-self::*[@id = $detachable_elements/@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
   816
    <xsl:text>  "</xsl:text>
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   817
    <xsl:value-of select="$pagename"/>
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
   818
    <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
   819
</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
   820
    <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
   821
    <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
   822
    <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
   823
    <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
   824
    <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
   825
    <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
   826
    <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
   827
    <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
   828
    <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
   829
</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   830
    <xsl:if test="count($page_root_path)=1">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   831
      <xsl:if test="count($page_root_path/@index)=0">
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
   832
        <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
   833
          <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
   834
          <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
   835
          <xsl:text>" : No match for path "</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   836
          <xsl:value-of select="$page_root_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
   837
          <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
   838
        </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
   839
      </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
   840
      <xsl:text>    page_index: </xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   841
      <xsl:value-of select="$page_root_path/@index"/>
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
   842
      <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
   843
</xsl:text>
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
   844
      <xsl:text>    page_class: "</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   845
      <xsl:value-of select="$indexed_hmitree/*[@hmipath = $page_root_path/@value]/@class"/>
3383
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
   846
      <xsl:text>",
a3b8cfd89648 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3362
diff changeset
   847
</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
   848
    </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
   849
    <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
   850
</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   851
    <xsl:text>        [hmi_widgets["</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   852
    <xsl:value-of select="$page/@id"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   853
    <xsl:text>"], []],
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   854
</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
   855
    <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
   856
      <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
   857
        <xsl:for-each select="func:widget(@id)/path">
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
   858
          <xsl:value-of select="func:is_descendant_path(@value, $page_root_path/@value)"/>
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
   859
          <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
   860
            <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
   861
          </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
   862
        </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
   863
      </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
   864
      <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
   865
      <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
   866
      <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
   867
      <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
   868
      <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
   869
      <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
   870
        <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
   871
      </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
   872
      <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
   873
</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
   874
    </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
   875
    <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
   876
</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
   877
    <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
   878
</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
   879
    <xsl:for-each select="$parsed_widgets/widget[@id = $all_page_widgets/@id and @type='Jump']">
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   880
      <xsl:text>        hmi_widgets["</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   881
      <xsl:value-of select="@id"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   882
      <xsl:text>"]</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   883
      <xsl:if test="position()!=last()">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   884
        <xsl:text>,</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
   885
      </xsl:if>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   886
      <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
   887
</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
   888
    </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
   889
    <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
   890
</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
   891
    <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
   892
</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
   893
    <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
   894
      <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
   895
      <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
   896
      <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
   897
      <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
   898
      <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
   899
      <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
   900
        <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
   901
      </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
   902
      <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
   903
</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
   904
    </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
   905
    <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
   906
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   907
    <xsl:apply-templates mode="widget_page" select="$parsed_widgets/widget[@id = $all_page_widgets/@id]">
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
   908
      <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
   909
    </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
   910
    <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
   911
    <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
   912
      <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
   913
    </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
   914
    <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
   915
</xsl:text>
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   916
    <xsl:value-of select="ns:ProgressEnd($pagename)"/>
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
   917
  </xsl:template>
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
   918
  <definitions:page-desc/>
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
   919
  <xsl:template match="definitions: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
   920
    <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
   921
</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
   922
    <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
   923
    <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
   924
    <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
   925
</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
   926
    <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
   927
</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
   928
    <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
   929
</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
   930
    <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
   931
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   932
    <xsl:apply-templates mode="page_desc" select="$hmi_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
   933
    <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
   934
</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
   935
    <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
   936
</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
   937
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
   938
  <xsl:template mode="widget_page" 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
   939
  <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
   940
  <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
   941
    <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
   942
</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
   943
    <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
   944
    <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
   945
    <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
   946
</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
   947
    <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
   948
</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
   949
    <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
   950
</xsl:text>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   951
    <xsl:text>DETACHABLES:
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   952
</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
   953
    <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
   954
      <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
   955
      <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
   956
      <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
   957
</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
   958
    </xsl:for-each>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   959
    <xsl:text>DISCARDABLES:
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   960
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   961
    <xsl:for-each select="$discardable_elements">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   962
      <xsl:text> </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   963
      <xsl:value-of select="@id"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   964
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   965
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
   966
    </xsl:for-each>
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   967
    <xsl:text>In Foreach:
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   968
</xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   969
    <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
   970
      <xsl:text> </xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   971
      <xsl:value-of select="."/>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   972
      <xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   973
</xsl:text>
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   974
    </xsl:for-each>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   975
    <xsl:text>Overlapping 
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   976
</xsl:text>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   977
    <xsl:apply-templates mode="testtree" select="$overlapping_geometry"/>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   978
    <xsl:text>
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   979
</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
   980
  </xsl:template>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
   981
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="@*">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
   982
    <xsl:copy/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
   983
  </xsl:template>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
   984
  <xsl:template mode="inline_svg" match="node()">
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
   985
    <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
   986
      <xsl:copy>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   987
        <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
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
   988
      </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
   989
    </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
   990
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   991
  <xsl:template mode="inline_svg" match="svg:svg/@width"/>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   992
  <xsl:template mode="inline_svg" match="svg:svg/@height"/>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
   993
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg: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
   994
    <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
   995
      <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
   996
        <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
   997
      </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
   998
      <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
   999
        <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
  1000
      </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
  1001
      <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
  1002
        <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
  1003
      </xsl:attribute>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1004
      <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
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
  1005
    </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
  1006
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1007
  <xsl:template mode="inline_svg" match="svg:svg[@viewBox!=concat('0 0 ', @width, ' ', @height)]">
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
  1008
    <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
  1009
      <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
  1010
    </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
  1011
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1012
  <xsl:template mode="inline_svg" match="sodipodi:namedview[@units!='px' or @inkscape:document-units!='px']">
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
  1013
    <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
  1014
      <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
  1015
    </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
  1016
  </xsl:template>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1017
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:text/@inkscape:label[starts-with(., '_')]">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1018
    <xsl:attribute name="{name()}">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1019
      <xsl:value-of select="substring(., 2)"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1020
    </xsl:attribute>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1021
  </xsl:template>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1022
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:rect[@inkscape:label='reference' or @inkscape:label='frame']"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1023
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:g[svg:rect/@inkscape:label='frame']">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1024
    <xsl:variable name="reference_rect" select="(../svg:rect | ../svg:g/svg:rect)[@inkscape:label='reference']"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1025
    <xsl:variable name="frame_rect" select="svg:rect[@inkscape:label='frame']"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1026
    <xsl:variable name="offset" select="func:offset($frame_rect, $reference_rect)"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1027
    <xsl:copy>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1028
      <xsl:attribute name="svghmi_x_offset">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1029
        <xsl:value-of select="$offset/vector/@x"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1030
      </xsl:attribute>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1031
      <xsl:attribute name="svghmi_y_offset">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1032
        <xsl:value-of select="$offset/vector/@y"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1033
      </xsl:attribute>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1034
      <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1035
    </xsl:copy>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1036
  </xsl:template>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1037
  <xsl:variable name="targets_not_to_unlink" select="$hmi_lists/descendant-or-self::svg:*"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  1038
  <xsl:variable name="to_unlink" select="$hmi_widgets/descendant-or-self::svg:use"/>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1039
  <func:function name="func:is_unlinkable">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1040
    <xsl:param name="targetid"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1041
    <xsl:param name="eltid"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1042
    <func:result select="$eltid = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1043
  </func:function>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1044
  <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
  1045
    <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
  1046
    <xsl:choose>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1047
      <xsl:when test="func:is_unlinkable($targetid, @id)">
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  1048
        <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
  1049
          <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
  1050
        </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
  1051
      </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
  1052
      <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
  1053
        <xsl:copy>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1054
          <xsl:apply-templates mode="inline_svg" select="@*"/>
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
  1055
        </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
  1056
      </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
  1057
    </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
  1058
  </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
  1059
  <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
  1060
    <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
  1061
      <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
  1062
    </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
  1063
    <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
  1064
      <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
  1065
    </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
  1066
    <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
  1067
      <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
  1068
    </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
  1069
    <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
  1070
      <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
  1071
    </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
  1072
    <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
  1073
      <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
  1074
    </name>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1075
    <name>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1076
      <xsl:text>id</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1077
    </name>
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
  1078
  </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
  1079
  <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
  1080
  <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
  1081
    <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
  1082
      <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
  1083
    </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
  1084
    <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
  1085
      <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
  1086
    </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
  1087
  </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
  1088
  <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
  1089
  <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
  1090
    <xsl:param name="targetid"/>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1091
    <xsl:param name="seed" select="''"/>
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
  1092
    <xsl:variable name="target" select="//svg:*[@id = $targetid]"/>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1093
    <xsl:variable name="seeded_id">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1094
      <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1095
        <xsl:when test="string-length($seed) &gt; 0">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1096
          <xsl:value-of select="$seed"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1097
          <xsl:text>_</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1098
          <xsl:value-of select="@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1099
        </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1100
        <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1101
          <xsl:value-of select="@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1102
        </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1103
      </xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1104
    </xsl:variable>
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
  1105
    <g>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1106
      <xsl:attribute name="id">
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1107
        <xsl:value-of select="$seeded_id"/>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1108
      </xsl:attribute>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1109
      <xsl:attribute name="original">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1110
        <xsl:value-of select="@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1111
      </xsl:attribute>
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
  1112
      <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
  1113
        <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
  1114
          <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
  1115
            <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
  1116
              <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
  1117
            </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
  1118
          </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
  1119
          <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
  1120
            <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
  1121
              <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
  1122
              <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
  1123
                <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
  1124
              </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
  1125
              <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
  1126
            </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
  1127
          </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
  1128
          <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
  1129
            <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
  1130
              <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
  1131
              <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
  1132
                <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
  1133
              </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
  1134
              <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
  1135
            </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
  1136
          </xsl:if>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1137
          <xsl:apply-templates mode="unlink_clone" select="$target/*">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1138
            <xsl:with-param name="seed" select="$seeded_id"/>
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
  1139
          </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
  1140
        </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
  1141
        <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
  1142
          <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
  1143
            <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
  1144
              <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
  1145
            </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
  1146
          </xsl:for-each>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1147
          <xsl:apply-templates mode="unlink_clone" select="$target">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1148
            <xsl:with-param name="seed" select="$seeded_id"/>
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
  1149
          </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
  1150
        </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
  1151
      </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
  1152
    </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
  1153
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1154
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="@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
  1155
    <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
  1156
    <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
  1157
      <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
  1158
      <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
  1159
      <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
  1160
    </xsl:attribute>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1161
    <xsl:attribute name="original">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1162
      <xsl:value-of select="."/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1163
    </xsl:attribute>
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
  1164
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1165
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="@*">
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
  1166
    <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
  1167
  </xsl:template>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1168
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="svg:use">
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1169
    <xsl:param name="seed"/>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1170
    <xsl:variable name="targetid" select="substring-after(@xlink:href,'#')"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1171
    <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1172
      <xsl:when test="func:is_unlinkable($targetid, @id)">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1173
        <xsl:call-template name="unlink_clone">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1174
          <xsl:with-param name="targetid" select="$targetid"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1175
          <xsl:with-param name="seed" select="$seed"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1176
        </xsl:call-template>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1177
      </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1178
      <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1179
        <xsl:copy>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1180
          <xsl:apply-templates mode="unlink_clone" select="@*">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1181
            <xsl:with-param name="seed" select="$seed"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1182
          </xsl:apply-templates>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1183
        </xsl:copy>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1184
      </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  1185
    </xsl:choose>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  1186
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1187
  <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="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
  1188
    <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
  1189
    <xsl:choose>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1190
      <xsl:when test="@id = $hmi_widgets/@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
  1191
        <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
  1192
          <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
  1193
            <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
  1194
          </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
  1195
        </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
  1196
      </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
  1197
      <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
  1198
        <xsl:copy>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1199
          <xsl:apply-templates mode="unlink_clone" select="@* | node()">
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
  1200
            <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
  1201
          </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
  1202
        </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
  1203
      </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
  1204
    </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
  1205
  </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
  1206
  <xsl:variable name="result_svg">
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1207
    <xsl:apply-templates mode="inline_svg" select="/"/>
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
  1208
  </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
  1209
  <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
  1210
  <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
  1211
  <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
  1212
    <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
  1213
</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
  1214
    <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
  1215
    <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
  1216
    <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
  1217
</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
  1218
    <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
  1219
</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
  1220
    <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
  1221
</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
  1222
    <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
  1223
    <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
  1224
    <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
  1225
</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
  1226
    <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
  1227
</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
  1228
  </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
  1229
  <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
  1230
  <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
  1231
    <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
  1232
</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
  1233
    <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
  1234
    <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
  1235
    <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
  1236
</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
  1237
    <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
  1238
</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
  1239
    <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
  1240
</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
  1241
    <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
  1242
</xsl:text>
2878
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1243
    <xsl:for-each select="$to_unlink">
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1244
      <xsl:value-of select="@id"/>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1245
      <xsl:text>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1246
</xsl:text>
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1247
    </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
  1248
    <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
  1249
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  1250
    <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
  1251
      <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
  1252
      <xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  1253
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  1254
    </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
  1255
    <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
  1256
</xsl:text>
2878
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
  1257
  </xsl:template>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1258
  <xsl:template mode="extract_i18n" match="svg:tspan">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1259
    <xsl:if test="string-length(.) &gt; 0">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1260
      <line>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1261
        <xsl:value-of select="."/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1262
      </line>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1263
    </xsl:if>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1264
  </xsl:template>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1265
  <xsl:template mode="extract_i18n" match="svg:text">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1266
    <msg>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1267
      <xsl:attribute name="id">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1268
        <xsl:value-of select="@id"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1269
      </xsl:attribute>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1270
      <xsl:attribute name="label">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1271
        <xsl:value-of select="substring(@inkscape:label,2)"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1272
      </xsl:attribute>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1273
      <xsl:if test="string-length(text()) &gt; 0">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1274
        <line>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1275
          <xsl:value-of select="text()"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1276
        </line>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1277
      </xsl:if>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1278
      <xsl:apply-templates mode="extract_i18n" select="svg:*"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1279
    </msg>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1280
  </xsl:template>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1281
  <xsl:variable name="translatable_texts" select="//svg:text[starts-with(@inkscape:label, '_')]"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1282
  <xsl:variable name="translatable_strings">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1283
    <xsl:apply-templates mode="extract_i18n" select="$translatable_texts"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1284
  </xsl:variable>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1285
  <preamble:i18n/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1286
  <xsl:template match="preamble:i18n">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1287
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1288
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1289
    <xsl:text>/* </xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1290
    <xsl:value-of select="local-name()"/>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1291
    <xsl:text> */
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1292
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1293
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1294
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1295
    <xsl:variable name="translations" select="ns:GetTranslations($translatable_strings)"/>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  1296
    <xsl:text>var langs = [ ["Default", "C"],</xsl:text>
3116
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1297
    <xsl:for-each select="$translations/langs/lang">
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  1298
      <xsl:text>["</xsl:text>
3116
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1299
      <xsl:value-of select="."/>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  1300
      <xsl:text>","</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  1301
      <xsl:value-of select="@code"/>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  1302
      <xsl:text>"]</xsl:text>
3116
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1303
      <xsl:if test="position()!=last()">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1304
        <xsl:text>,</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1305
      </xsl:if>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1306
    </xsl:for-each>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1307
    <xsl:text>];
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1308
</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1309
    <xsl:text>var translations = [
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1310
</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1311
    <xsl:for-each select="$translatable_texts">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1312
      <xsl:variable name="n" select="position()"/>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1313
      <xsl:variable name="current_id" select="@id"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1314
      <xsl:variable name="text_unlinked_uses" select="$result_svg_ns//svg:text[@original = $current_id]/@id"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1315
      <xsl:text>  [[</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1316
      <xsl:for-each select="@id | $text_unlinked_uses">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1317
        <xsl:text>id("</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1318
        <xsl:value-of select="."/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1319
        <xsl:text>")</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1320
        <xsl:if test="position()!=last()">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1321
          <xsl:text>,</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1322
        </xsl:if>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1323
      </xsl:for-each>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1324
      <xsl:text>],[</xsl:text>
3116
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1325
      <xsl:for-each select="$translations/messages/msgid[$n]/msg">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1326
        <xsl:text>"</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1327
        <xsl:for-each select="line">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1328
          <xsl:value-of select="."/>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1329
          <xsl:if test="position()!=last()">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1330
            <xsl:text>\n</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1331
          </xsl:if>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1332
        </xsl:for-each>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1333
        <xsl:text>"</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1334
        <xsl:if test="position()!=last()">
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1335
          <xsl:text>,</xsl:text>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1336
        </xsl:if>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1337
      </xsl:for-each>
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1338
      <xsl:text>]]</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1339
      <xsl:if test="position()!=last()">
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1340
        <xsl:text>,</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1341
      </xsl:if>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1342
      <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1343
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1344
    </xsl:for-each>
3116
6da94ec04325 SVGHMI: i18n: finished passing back translated messaged to xslt proc, finished template to generate corresponding javascript literals.
Edouard Tisserant
parents: 3112
diff changeset
  1345
    <xsl:text>]
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1346
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1347
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1348
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  1349
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1350
  <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
  1351
    <xsl:variable name="widget" select="func:widget(@id)"/>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1352
    <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
  1353
    <xsl:variable name="args">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1354
      <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
  1355
        <xsl:text>"</xsl:text>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1356
        <xsl:value-of select="func:escape_quotes(@value)"/>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1357
        <xsl:text>"</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1358
        <xsl:if test="position()!=last()">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1359
          <xsl:text>,</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1360
        </xsl:if>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1361
      </xsl:for-each>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1362
    </xsl:variable>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1363
    <xsl:variable name="indexes">
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1364
      <xsl:for-each select="$widget/path">
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1365
        <xsl:if test="position()!=last()">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1366
          <xsl:text>,</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1367
        </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1368
      </xsl:for-each>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1369
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1370
    <xsl:variable name="variables">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1371
      <xsl:for-each select="$widget/path">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1372
        <xsl:text>[</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1373
        <xsl:choose>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1374
          <xsl:when test="not(@index)">
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1375
            <xsl:choose>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1376
              <xsl:when test="not(@type)">
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  1377
                <xsl:message terminate="no">
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1378
                  <xsl:text>Widget </xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1379
                  <xsl:value-of select="$widget/@type"/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1380
                  <xsl:text> id="</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1381
                  <xsl:value-of select="$eltid"/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1382
                  <xsl:text>" : No match for path "</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1383
                  <xsl:value-of select="@value"/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1384
                  <xsl:text>" in HMI tree</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1385
                </xsl:message>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  1386
                <xsl:text>undefined</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1387
              </xsl:when>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1388
              <xsl:when test="@type = 'PAGE_LOCAL'">
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1389
                <xsl:text>"</xsl:text>
3025
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1390
                <xsl:value-of select="@value"/>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1391
                <xsl:text>"</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1392
              </xsl:when>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1393
              <xsl:when test="@type = 'HMI_LOCAL'">
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1394
                <xsl:text>hmi_local_index("</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1395
                <xsl:value-of select="@value"/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1396
                <xsl:text>")</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1397
              </xsl:when>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1398
              <xsl:otherwise>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1399
                <xsl:message terminate="yes">
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1400
                  <xsl:text>Internal error while processing widget's non indexed HMI tree path : unknown type</xsl:text>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1401
                </xsl:message>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1402
              </xsl:otherwise>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1403
            </xsl:choose>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1404
          </xsl:when>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1405
          <xsl:otherwise>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1406
            <xsl:value-of select="@index"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1407
          </xsl:otherwise>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1408
        </xsl:choose>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1409
        <xsl:text>, {</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1410
        <xsl:if test="@min and @max">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1411
          <xsl:text>minmax:[</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1412
          <xsl:value-of select="@min"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1413
          <xsl:text>, </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1414
          <xsl:value-of select="@max"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1415
          <xsl:text>]</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1416
          <xsl:if test="@assign">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1417
            <xsl:text>,</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1418
          </xsl:if>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1419
        </xsl:if>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1420
        <xsl:if test="@assign">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1421
          <xsl:text>assign:"</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1422
          <xsl:value-of select="@assign"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1423
          <xsl:text>"</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1424
        </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1425
        <xsl:text>}]</xsl:text>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1426
        <xsl:if test="position()!=last()">
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1427
          <xsl:text>,</xsl:text>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1428
        </xsl:if>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1429
      </xsl:for-each>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1430
    </xsl:variable>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1431
    <xsl:variable name="freq">
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1432
      <xsl:choose>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  1433
        <xsl:when test="$widget/@freq">
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1434
          <xsl:text>"</xsl:text>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  1435
          <xsl:value-of select="$widget/@freq"/>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1436
          <xsl:text>"</xsl:text>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1437
        </xsl:when>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1438
        <xsl:otherwise>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1439
          <xsl:text>undefined</xsl:text>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1440
        </xsl:otherwise>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1441
      </xsl:choose>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1442
    </xsl:variable>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1443
    <xsl:variable name="enable_expr">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1444
      <xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1445
        <xsl:when test="$widget/@enable_expr">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1446
          <xsl:text>true</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1447
        </xsl:when>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1448
        <xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1449
          <xsl:text>false</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1450
        </xsl:otherwise>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1451
      </xsl:choose>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1452
    </xsl:variable>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1453
    <xsl:text>  "</xsl:text>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1454
    <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
  1455
    <xsl:text>": new </xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1456
    <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
  1457
    <xsl:text>Widget ("</xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1458
    <xsl:value-of select="@id"/>
3410
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1459
    <xsl:text>",</xsl:text>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1460
    <xsl:value-of select="$freq"/>
eac5832a1489 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3387
diff changeset
  1461
    <xsl:text>,[</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1462
    <xsl:value-of select="$args"/>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1463
    <xsl:text>],[</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1464
    <xsl:value-of select="$variables"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1465
    <xsl:text>],</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1466
    <xsl:value-of select="$enable_expr"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1467
    <xsl:text>,{
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1468
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1469
    <xsl:if test="$widget/@enable_expr">
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  1470
      <xsl:text>      enable_assignments: [],
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1471
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1472
      <xsl:text>      compute_enable: function(value, oldval, varnum) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1473
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1474
      <xsl:text>        let result = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1475
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1476
      <xsl:text>        do {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1477
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1478
      <xsl:for-each select="$widget/path">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1479
        <xsl:variable name="varid" select="generate-id()"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1480
        <xsl:variable name="varnum" select="position()-1"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1481
        <xsl:if test="@assign">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1482
          <xsl:for-each select="$widget/path[@assign]">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1483
            <xsl:if test="$varid = generate-id()">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1484
              <xsl:text>          if(varnum == </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1485
              <xsl:value-of select="$varnum"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  1486
              <xsl:text>) this.enable_assignments[</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1487
              <xsl:value-of select="position()-1"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1488
              <xsl:text>] = value;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1489
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1490
              <xsl:text>          let </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1491
              <xsl:value-of select="@assign"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  1492
              <xsl:text> = this.enable_assignments[</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1493
              <xsl:value-of select="position()-1"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1494
              <xsl:text>];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1495
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1496
              <xsl:text>          if(</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1497
              <xsl:value-of select="@assign"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1498
              <xsl:text> == undefined) break;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1499
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1500
            </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1501
          </xsl:for-each>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1502
        </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1503
      </xsl:for-each>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1504
      <xsl:text>          result = </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1505
      <xsl:value-of select="$widget/@enable_expr"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1506
      <xsl:text>;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1507
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1508
      <xsl:text>        } while(0);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1509
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1510
      <xsl:text>        this.enable(result);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1511
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1512
      <xsl:text>      },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1513
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1514
    </xsl:if>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1515
    <xsl:apply-templates mode="widget_defs" select="$widget">
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1516
      <xsl:with-param name="hmi_element" select="."/>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1517
    </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
  1518
    <xsl:text>  })</xsl:text>
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1519
    <xsl:if test="position()!=last()">
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1520
      <xsl:text>,</xsl:text>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1521
    </xsl:if>
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2879
diff changeset
  1522
    <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
  1523
</xsl:text>
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
  1524
  </xsl:template>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1525
  <preamble:local-variable-indexes/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1526
  <xsl:template match="preamble:local-variable-indexes">
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
  1527
    <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
  1528
</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
  1529
    <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
  1530
    <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
  1531
    <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
  1532
</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
  1533
    <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
  1534
</xsl:text>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  1535
    <xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  1536
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1537
    <xsl:text>let hmi_locals = {};
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1538
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1539
    <xsl:text>var last_remote_index = hmitree_types.length - 1;
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1540
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1541
    <xsl:text>var next_available_index = hmitree_types.length;
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1542
</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1543
    <xsl:text>let cookies = new Map(document.cookie.split("; ").map(s=&gt;s.split("=")));
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1544
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1545
    <xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1546
</xsl:text>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1547
    <xsl:text>const local_defaults = {
Edouard Tisserant
parents: 3022 3021
diff changeset
  1548
</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1549
    <xsl:for-each select="$parsed_widgets/widget[starts-with(@type,'VarInit')]">
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1550
      <xsl:if test="count(path) != 1">
Edouard Tisserant
parents: 3022 3021
diff changeset
  1551
        <xsl:message terminate="yes">
Edouard Tisserant
parents: 3022 3021
diff changeset
  1552
          <xsl:text>VarInit </xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1553
          <xsl:value-of select="@id"/>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1554
          <xsl:text> must have only one variable given.</xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1555
        </xsl:message>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1556
      </xsl:if>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1557
      <xsl:if test="path/@type != 'PAGE_LOCAL' and path/@type != 'HMI_LOCAL'">
Edouard Tisserant
parents: 3022 3021
diff changeset
  1558
        <xsl:message terminate="yes">
Edouard Tisserant
parents: 3022 3021
diff changeset
  1559
          <xsl:text>VarInit </xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1560
          <xsl:value-of select="@id"/>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1561
          <xsl:text> only applies to HMI variable.</xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1562
        </xsl:message>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1563
      </xsl:if>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1564
      <xsl:text>    "</xsl:text>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1565
      <xsl:value-of select="path/@value"/>
3025
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1566
      <xsl:text>":</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1567
      <xsl:choose>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1568
        <xsl:when test="@type = 'VarInitPersistent'">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1569
          <xsl:text>cookies.has("</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1570
          <xsl:value-of select="path/@value"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1571
          <xsl:text>")?cookies.get("</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1572
          <xsl:value-of select="path/@value"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1573
          <xsl:text>"):</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1574
          <xsl:value-of select="arg[1]/@value"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1575
        </xsl:when>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1576
        <xsl:otherwise>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1577
          <xsl:value-of select="arg[1]/@value"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1578
        </xsl:otherwise>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1579
      </xsl:choose>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1580
      <xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1581
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1582
      <xsl:if test="position()!=last()">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1583
        <xsl:text>,</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1584
      </xsl:if>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1585
    </xsl:for-each>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1586
    <xsl:text>};
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1587
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1588
    <xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1589
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1590
    <xsl:text>const persistent_locals = new Set([
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1591
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1592
    <xsl:for-each select="$parsed_widgets/widget[@type='VarInitPersistent']">
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1593
      <xsl:text>   "</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1594
      <xsl:value-of select="path/@value"/>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1595
      <xsl:text>"</xsl:text>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1596
      <xsl:if test="position()!=last()">
Edouard Tisserant
parents: 3022 3021
diff changeset
  1597
        <xsl:text>,</xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1598
      </xsl:if>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1599
      <xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1600
</xsl:text>
Edouard Tisserant
parents: 3022 3021
diff changeset
  1601
    </xsl:for-each>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1602
    <xsl:text>]);
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1603
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1604
    <xsl:text>var persistent_indexes = new Map();
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  1605
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1606
    <xsl:text>var cache = hmitree_types.map(_ignored =&gt; undefined);
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1607
</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1608
    <xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1609
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1610
    <xsl:text>function page_local_index(varname, pagename){
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1611
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1612
    <xsl:text>    let pagevars = hmi_locals[pagename];
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1613
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1614
    <xsl:text>    let new_index;
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1615
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1616
    <xsl:text>    if(pagevars == undefined){
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1617
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1618
    <xsl:text>        new_index = next_available_index++;
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1619
</xsl:text>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  1620
    <xsl:text>        hmi_locals[pagename] = {[varname]:new_index};
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1621
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1622
    <xsl:text>    } else {
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1623
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1624
    <xsl:text>        let result = pagevars[varname];
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1625
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1626
    <xsl:text>        if(result != undefined) {
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1627
</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1628
    <xsl:text>            return result;
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1629
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1630
    <xsl:text>        }
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1631
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1632
    <xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1633
</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1634
    <xsl:text>        new_index = next_available_index++;
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1635
</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1636
    <xsl:text>        pagevars[varname] = new_index;
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1637
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1638
    <xsl:text>    }
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1639
</xsl:text>
3025
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1640
    <xsl:text>    let defaultval = local_defaults[varname];
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1641
</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1642
    <xsl:text>    if(defaultval != undefined) {
3025
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1643
</xsl:text>
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1644
    <xsl:text>        cache[new_index] = defaultval; 
48e7e336c052 SVGHMI: HMI:VarInit:"a string"@a_value : empty widget (i.e. empty svg:group) that initialize content of local variables to value given as first argument.
Edouard Tisserant
parents: 3024
diff changeset
  1645
</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1646
    <xsl:text>        if(persistent_locals.has(varname))
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1647
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1648
    <xsl:text>            persistent_indexes.set(new_index, varname);
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1649
</xsl:text>
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1650
    <xsl:text>    }
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  1651
</xsl:text>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1652
    <xsl:text>    return new_index;
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  1653
</xsl:text>
3017
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1654
    <xsl:text>}
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1655
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1656
    <xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1657
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1658
    <xsl:text>function hmi_local_index(varname){
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1659
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1660
    <xsl:text>    return page_local_index(varname, "HMI_LOCAL");
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1661
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1662
    <xsl:text>}
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1663
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1664
    <xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1665
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1666
  </xsl:template>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1667
  <preamble:widget-base-class/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1668
  <xsl:template match="preamble:widget-base-class">
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1669
    <xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1670
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1671
    <xsl:text>/* </xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1672
    <xsl:value-of select="local-name()"/>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1673
    <xsl:text> */
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1674
</xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1675
    <xsl:text>
15e2df3e5610 SVGHMI: Intermediate state while implementing local HMI variables. Now write to cache only (no send), still need to implement dispatch on change.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3008
diff changeset
  1676
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1677
    <xsl:text>var pending_widget_animates = [];
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1678
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1679
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1680
</xsl:text>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1681
    <xsl:text>function _hide(elt, placeholder){
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1682
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1683
    <xsl:text>    if(elt.parentNode != null)
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1684
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1685
    <xsl:text>        placeholder.parentNode.removeChild(elt);
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1686
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1687
    <xsl:text>}
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1688
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1689
    <xsl:text>function _show(elt, placeholder){
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1690
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1691
    <xsl:text>    placeholder.parentNode.insertBefore(elt, placeholder);
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1692
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1693
    <xsl:text>}
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1694
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1695
    <xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1696
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1697
    <xsl:text>function set_activity_state(eltsub, state){
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1698
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1699
    <xsl:text>    if(eltsub.active_elt != undefined){
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1700
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1701
    <xsl:text>        if(eltsub.active_elt_placeholder == undefined){
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1702
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1703
    <xsl:text>            eltsub.active_elt_placeholder = document.createComment("");
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1704
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1705
    <xsl:text>            eltsub.active_elt.parentNode.insertBefore(eltsub.active_elt_placeholder, eltsub.active_elt);
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1706
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1707
    <xsl:text>        }
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1708
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1709
    <xsl:text>        (state?_show:_hide)(eltsub.active_elt, eltsub.active_elt_placeholder);
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1710
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1711
    <xsl:text>    }
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1712
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1713
    <xsl:text>    if(eltsub.inactive_elt != undefined){
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1714
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1715
    <xsl:text>        if(eltsub.inactive_elt_placeholder == undefined){
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1716
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1717
    <xsl:text>            eltsub.inactive_elt_placeholder = document.createComment("");
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1718
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1719
    <xsl:text>            eltsub.inactive_elt.parentNode.insertBefore(eltsub.inactive_elt_placeholder, eltsub.inactive_elt);
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1720
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1721
    <xsl:text>        }
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1722
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1723
    <xsl:text>        ((state || state==undefined)?_hide:_show)(eltsub.inactive_elt, eltsub.inactive_elt_placeholder);
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1724
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  1725
    <xsl:text>    }
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1726
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1727
    <xsl:text>}
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1728
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1729
    <xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  1730
</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
  1731
    <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
  1732
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  1733
    <xsl:text>    offset = 0;
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  1734
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  1735
    <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
  1736
</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
  1737
    <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
  1738
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1739
    <xsl:text>    pending_animate = false;
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1740
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1741
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  1742
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1743
    <xsl:text>    constructor(elt_id, freq, args, variables, enable_expr, members){
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1744
</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
  1745
    <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
  1746
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1747
    <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
  1748
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1749
    <xsl:text>        this.args = args;
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1750
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1751
    <xsl:text>        
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1752
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1753
    <xsl:text>        [this.indexes, this.variables_options] = (variables.length&gt;0) ? zip(...variables) : [[],[]];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1754
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1755
    <xsl:text>        this.indexes_length = this.indexes.length;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1756
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1757
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1758
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1759
    <xsl:text>        this.enable_expr = enable_expr;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1760
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1761
    <xsl:text>        this.enable_state = true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1762
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1763
    <xsl:text>        this.enable_displayed_state = true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1764
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1765
    <xsl:text>        this.enabled_elts = [];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1766
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1767
    <xsl:text>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  1768
</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
  1769
    <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
  1770
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1771
    <xsl:text>        this.lastapply = this.indexes.map(() =&gt; undefined);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1772
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1773
    <xsl:text>        this.inhibit = this.indexes.map(() =&gt; undefined);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1774
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1775
    <xsl:text>        this.pending = this.indexes.map(() =&gt; undefined);
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  1776
</xsl:text>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1777
    <xsl:text>        this.bound_uninhibit = this.uninhibit.bind(this);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1778
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1779
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1780
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1781
    <xsl:text>        this.lastdispatch = this.indexes.map(() =&gt; undefined);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1782
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1783
    <xsl:text>        this.deafen = this.indexes.map(() =&gt; undefined);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1784
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1785
    <xsl:text>        this.incoming = this.indexes.map(() =&gt; undefined);
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1786
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1787
    <xsl:text>        this.bound_undeafen = this.undeafen.bind(this);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1788
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  1789
    <xsl:text>
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  1790
</xsl:text>
3418
a1d9a0353053 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3414
diff changeset
  1791
    <xsl:text>        this.forced_frequency = freq;
a1d9a0353053 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3414
diff changeset
  1792
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1793
    <xsl:text>        this.clip = true;
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1794
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1795
    <xsl:text>    }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1796
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1797
    <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1798
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1799
    <xsl:text>    do_init(){
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1800
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1801
    <xsl:text>        let forced = this.forced_frequency;
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1802
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1803
    <xsl:text>        if(forced !== undefined){
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1804
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1805
    <xsl:text>            /*
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1806
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1807
    <xsl:text>            once every 10 seconds : 10s
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1808
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1809
    <xsl:text>            once per minute : 1m
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1810
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1811
    <xsl:text>            once per hour : 1h
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1812
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1813
    <xsl:text>            once per day : 1d
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1814
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1815
    <xsl:text>            */
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1816
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1817
    <xsl:text>            let unit = forced.slice(-1);
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1818
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1819
    <xsl:text>            let factor = {
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1820
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1821
    <xsl:text>                "s":1,
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1822
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1823
    <xsl:text>                "m":60,
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1824
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1825
    <xsl:text>                "h":3600,
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1826
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1827
    <xsl:text>                "d":86400}[unit];
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1828
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1829
    <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1830
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1831
    <xsl:text>            this.frequency = factor ? 1/(factor * Number(forced.slice(0,-1)))
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1832
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1833
    <xsl:text>                                      : Number(forced);
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1834
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1835
    <xsl:text>        }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1836
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1837
    <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1838
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1839
    <xsl:text>        let init = this.init;
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1840
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1841
    <xsl:text>        if(typeof(init) == "function"){
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1842
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1843
    <xsl:text>            try {
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1844
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1845
    <xsl:text>                init.call(this);
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1846
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1847
    <xsl:text>            } catch(err) {
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1848
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1849
    <xsl:text>                console.log(err);
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1850
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1851
    <xsl:text>            }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1852
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1853
    <xsl:text>        }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  1854
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1855
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1856
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1857
    <xsl:text>        if(this.enable_expr){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1858
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1859
    <xsl:text>            this.enable_state = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1860
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1861
    <xsl:text>            this.enable_displayed_state = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1862
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1863
    <xsl:text>            for(let child of Array.from(this.element.children)){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1864
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1865
    <xsl:text>                let label = child.getAttribute("inkscape:label");
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1866
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1867
    <xsl:text>                if(label!="disabled"){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1868
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1869
    <xsl:text>                    this.enabled_elts.push(child);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1870
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1871
    <xsl:text>                    this.element.removeChild(child);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1872
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1873
    <xsl:text>                }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1874
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1875
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1876
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1877
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1878
</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
  1879
    <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
  1880
</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
  1881
    <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
  1882
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1883
    <xsl:text>    unsub(){
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1884
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1885
    <xsl:text>        /* remove subsribers */
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  1886
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1887
    <xsl:text>        for(let i = 0; i &lt; this.indexes_length; i++) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1888
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1889
    <xsl:text>            /* flush updates pending because of inhibition */
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1890
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1891
    <xsl:text>            let inhibition = this.inhibit[i];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1892
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1893
    <xsl:text>            if(inhibition != undefined){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1894
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1895
    <xsl:text>                clearTimeout(inhibition);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1896
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1897
    <xsl:text>                this.lastapply[i] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1898
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1899
    <xsl:text>                this.uninhibit(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1900
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1901
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1902
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1903
    <xsl:text>            let deafened = this.deafen[i];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1904
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1905
    <xsl:text>            if(deafened != undefined){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1906
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1907
    <xsl:text>                clearTimeout(deafened);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1908
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1909
    <xsl:text>                this.lastdispatch[i] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1910
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1911
    <xsl:text>                this.undeafen(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1912
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1913
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1914
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1915
    <xsl:text>            let index = this.get_variable_index(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1916
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1917
    <xsl:text>            subscribers(index).delete(this);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1918
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1919
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1920
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1921
    <xsl:text>        this.offset = 0;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1922
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1923
    <xsl:text>        this.relativeness = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1924
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1925
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1926
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1927
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1928
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1929
    <xsl:text>    sub(new_offset=0, relativeness, container_id){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1930
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1931
    <xsl:text>        this.offset = new_offset;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1932
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1933
    <xsl:text>        this.relativeness = relativeness;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1934
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1935
    <xsl:text>        this.container_id = container_id ;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1936
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1937
    <xsl:text>        /* add this's subsribers */
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1938
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1939
    <xsl:text>        for(let i = 0; i &lt; this.indexes_length; i++) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1940
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1941
    <xsl:text>            let index = this.get_variable_index(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1942
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1943
    <xsl:text>            if(index == undefined) continue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1944
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1945
    <xsl:text>            subscribers(index).add(this);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1946
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1947
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1948
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1949
    <xsl:text>        this.apply_cache(); 
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1950
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1951
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1952
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1953
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1954
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1955
    <xsl:text>    apply_cache() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1956
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1957
    <xsl:text>        for(let i = 0; i &lt; this.indexes_length; i++) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1958
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1959
    <xsl:text>            /* dispatch current cache in newly opened page widgets */
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1960
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1961
    <xsl:text>            let realindex = this.get_variable_index(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1962
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1963
    <xsl:text>            if(realindex == undefined) continue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1964
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1965
    <xsl:text>            let cached_val = cache[realindex];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1966
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1967
    <xsl:text>            if(cached_val != undefined)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1968
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1969
    <xsl:text>                this.feed_data_for_dispatch(cached_val, cached_val, i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1970
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1971
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1972
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1973
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1974
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1975
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1976
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1977
    <xsl:text>    get_variable_index(varnum) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1978
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1979
    <xsl:text>        let index = this.indexes[varnum];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1980
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1981
    <xsl:text>        if(typeof(index) == "string"){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1982
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1983
    <xsl:text>            index = page_local_index(index, this.container_id);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1984
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1985
    <xsl:text>        } else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1986
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1987
    <xsl:text>            if(this.relativeness[varnum]){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1988
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1989
    <xsl:text>                index += this.offset;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1990
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1991
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1992
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1993
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1994
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1995
    <xsl:text>        return index;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1996
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1997
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1998
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  1999
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2000
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2001
    <xsl:text>    overshot(new_val, max) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2002
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2003
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2004
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2005
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2006
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2007
    <xsl:text>    undershot(new_val, min) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2008
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2009
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2010
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2011
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2012
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2013
    <xsl:text>    clip_min_max(index, new_val) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2014
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2015
    <xsl:text>        let minmax = this.variables_options[index].minmax;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2016
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2017
    <xsl:text>        if(minmax !== undefined &amp;&amp; typeof new_val == "number") {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2018
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2019
    <xsl:text>            let [min,max] = minmax;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2020
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2021
    <xsl:text>            if(new_val &lt; min){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2022
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2023
    <xsl:text>                this.undershot(new_val, min);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2024
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2025
    <xsl:text>                return min;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2026
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2027
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2028
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2029
    <xsl:text>            if(new_val &gt; max){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2030
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2031
    <xsl:text>                this.overshot(new_val, max);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2032
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2033
    <xsl:text>                return max;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2034
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2035
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2036
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2037
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2038
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2039
    <xsl:text>        return new_val;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2040
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2041
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2042
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2043
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2044
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2045
    <xsl:text>    change_hmi_value(index, opstr) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2046
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2047
    <xsl:text>        let realindex = this.get_variable_index(index);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2048
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2049
    <xsl:text>        if(realindex == undefined) return undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2050
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2051
    <xsl:text>        let old_val = cache[realindex];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2052
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2053
    <xsl:text>        let new_val = eval_operation_string(old_val, opstr);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2054
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2055
    <xsl:text>        if(this.clip)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2056
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2057
    <xsl:text>            new_val = this.clip_min_max(index, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2058
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2059
    <xsl:text>        return apply_hmi_value(realindex, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2060
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2061
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2062
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2063
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2064
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2065
    <xsl:text>    _apply_hmi_value(index, new_val) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2066
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2067
    <xsl:text>        let realindex = this.get_variable_index(index);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2068
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2069
    <xsl:text>        if(realindex == undefined) return undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2070
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2071
    <xsl:text>        if(this.clip)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2072
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2073
    <xsl:text>            new_val = this.clip_min_max(index, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2074
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2075
    <xsl:text>        return apply_hmi_value(realindex, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2076
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2077
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2078
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2079
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2080
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2081
    <xsl:text>    uninhibit(index){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2082
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2083
    <xsl:text>        this.inhibit[index] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2084
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2085
    <xsl:text>        let new_val = this.pending[index];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2086
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2087
    <xsl:text>        this.pending[index] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2088
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2089
    <xsl:text>        return this.apply_hmi_value(index, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2090
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2091
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2092
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2093
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2094
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2095
    <xsl:text>    apply_hmi_value(index, new_val) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2096
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2097
    <xsl:text>        if(this.inhibit[index] == undefined){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2098
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2099
    <xsl:text>            let now = Date.now();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2100
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2101
    <xsl:text>            let min_interval = 1000/this.frequency;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2102
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2103
    <xsl:text>            let lastapply = this.lastapply[index];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2104
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2105
    <xsl:text>            if(lastapply == undefined || now &gt; lastapply + min_interval){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2106
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2107
    <xsl:text>                this.lastapply[index] = now;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2108
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2109
    <xsl:text>                return this._apply_hmi_value(index, new_val);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2110
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2111
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2112
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2113
    <xsl:text>            else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2114
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2115
    <xsl:text>                let elapsed = now - lastapply;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2116
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2117
    <xsl:text>                this.pending[index] = new_val;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2118
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2119
    <xsl:text>                this.inhibit[index] = setTimeout(this.bound_uninhibit, min_interval - elapsed, index);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2120
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2121
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2122
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2123
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2124
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2125
    <xsl:text>        else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2126
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2127
    <xsl:text>            this.pending[index] = new_val;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2128
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2129
    <xsl:text>            return new_val;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2130
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2131
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2132
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2133
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2134
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2135
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2136
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2137
    <xsl:text>    new_hmi_value(index, value, oldval) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2138
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2139
    <xsl:text>        // TODO avoid searching, store index at sub()
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2140
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2141
    <xsl:text>        for(let i = 0; i &lt; this.indexes_length; i++) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2142
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2143
    <xsl:text>            let refindex = this.get_variable_index(i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2144
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2145
    <xsl:text>            if(refindex == undefined) continue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2146
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2147
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2148
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2149
    <xsl:text>            if(index == refindex) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2150
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2151
    <xsl:text>                this.feed_data_for_dispatch(value, oldval, i);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2152
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2153
    <xsl:text>                break;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2154
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2155
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2156
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2157
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2158
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2159
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2160
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2161
    <xsl:text>    
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2162
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2163
    <xsl:text>    undeafen(index){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2164
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2165
    <xsl:text>        this.deafen[index] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2166
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2167
    <xsl:text>        let [new_val, old_val] = this.incoming[index];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2168
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2169
    <xsl:text>        this.incoming[index] = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2170
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2171
    <xsl:text>        this.do_dispatch(new_val, old_val, index);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2172
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2173
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2174
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2175
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2176
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2177
    <xsl:text>    enable(enabled){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2178
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2179
    <xsl:text>        if(this.enable_state != enabled){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2180
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2181
    <xsl:text>            this.enable_state = enabled;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2182
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2183
    <xsl:text>            this.request_animate();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2184
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2185
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2186
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2187
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2188
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2189
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2190
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2191
    <xsl:text>    animate_enable(){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2192
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2193
    <xsl:text>        if(this.enable_state &amp;&amp; !this.enable_displayed_state){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2194
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2195
    <xsl:text>            //show widget
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2196
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2197
    <xsl:text>            for(let child of this.enabled_elts){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2198
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2199
    <xsl:text>                this.element.appendChild(child);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2200
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2201
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2202
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2203
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2204
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2205
    <xsl:text>            //hide disabled content
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2206
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2207
    <xsl:text>            if(this.disabled_elt &amp;&amp; this.disabled_elt.parentNode != null)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2208
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2209
    <xsl:text>                this.element.removeChild(this.disabled_elt);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2210
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2211
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2212
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2213
    <xsl:text>            this.enable_displayed_state = true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2214
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2215
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2216
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2217
    <xsl:text>        }else if(!this.enable_state &amp;&amp; this.enable_displayed_state){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2218
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2219
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2220
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2221
    <xsl:text>            //hide widget
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2222
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2223
    <xsl:text>            for(let child of this.enabled_elts){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2224
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2225
    <xsl:text>                if(child.parentNode != null)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2226
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2227
    <xsl:text>                    this.element.removeChild(child);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2228
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2229
    <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2230
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2231
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2232
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2233
    <xsl:text>            //show disabled content
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2234
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2235
    <xsl:text>            if(this.disabled_elt)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2236
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2237
    <xsl:text>                this.element.appendChild(this.disabled_elt);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2238
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2239
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2240
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2241
    <xsl:text>            this.enable_displayed_state = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2242
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2243
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2244
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2245
    <xsl:text>            // once disabled activity display is lost
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2246
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2247
    <xsl:text>            this.activity_displayed_state = undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2248
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2249
    <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2250
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2251
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2252
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2253
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2254
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2255
    <xsl:text>    feed_data_for_dispatch(value, oldval, varnum) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2256
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2257
    <xsl:text>        if(this.dispatch || this.enable_expr){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2258
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2259
    <xsl:text>            if(this.deafen[varnum] == undefined){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2260
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2261
    <xsl:text>                let now = Date.now();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2262
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2263
    <xsl:text>                let min_interval = 1000/this.frequency;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2264
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2265
    <xsl:text>                let lastdispatch = this.lastdispatch[varnum];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2266
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2267
    <xsl:text>                if(lastdispatch == undefined || now &gt; lastdispatch + min_interval){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2268
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2269
    <xsl:text>                    this.lastdispatch[varnum] = now;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2270
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2271
    <xsl:text>                    this.do_dispatch(value, oldval, varnum)
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2272
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2273
    <xsl:text>                }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2274
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2275
    <xsl:text>                else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2276
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2277
    <xsl:text>                    let elapsed = now - lastdispatch;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2278
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2279
    <xsl:text>                    this.incoming[varnum] = [value, oldval];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2280
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2281
    <xsl:text>                    this.deafen[varnum] = setTimeout(this.bound_undeafen, min_interval - elapsed, varnum);
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  2282
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  2283
    <xsl:text>                }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  2284
</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
  2285
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2286
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2287
    <xsl:text>            else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2288
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2289
    <xsl:text>                this.incoming[varnum] = [value, oldval];
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
  2290
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2291
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  2292
</xsl:text>
3026
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2293
    <xsl:text>        }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2294
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2295
    <xsl:text>    }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2296
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2297
    <xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2298
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2299
    <xsl:text>    do_dispatch(value, oldval, varnum) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2300
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2301
    <xsl:text>        if(this.dispatch) try {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2302
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2303
    <xsl:text>            this.dispatch(value, oldval, varnum);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2304
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2305
    <xsl:text>        } catch(err) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2306
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2307
    <xsl:text>            console.log(err);
3026
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2308
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2309
    <xsl:text>        }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2310
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2311
    <xsl:text>        if(this.enable_expr) try {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2312
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2313
    <xsl:text>            this.compute_enable(value, oldval, varnum);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2314
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2315
    <xsl:text>        } catch(err) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2316
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2317
    <xsl:text>            console.log(err);
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  2318
</xsl:text>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  2319
    <xsl:text>        }
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  2320
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2321
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2322
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2323
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2324
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2325
    <xsl:text>    _animate(){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2326
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2327
    <xsl:text>        if(this.enable_expr)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2328
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2329
    <xsl:text>            this.animate_enable();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2330
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2331
    <xsl:text>        // inhibit widget animation when disabled
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2332
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2333
    <xsl:text>        if(!this.enable_expr || this.enable_state){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2334
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2335
    <xsl:text>            if(this.has_activity)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2336
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2337
    <xsl:text>                this.animate_activity();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2338
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2339
    <xsl:text>            if(this.animate != undefined)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2340
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2341
    <xsl:text>                this.animate();
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2342
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2343
    <xsl:text>        }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2344
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2345
    <xsl:text>        this.pending_animate = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2346
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2347
    <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2348
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2349
    <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2350
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2351
    <xsl:text>    request_animate(){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2352
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2353
    <xsl:text>        if(!this.pending_animate){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2354
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2355
    <xsl:text>            pending_widget_animates.push(this);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2356
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2357
    <xsl:text>            this.pending_animate = true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2358
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2359
    <xsl:text>            requestHMIAnimation();
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2360
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  2361
    <xsl:text>        }
3026
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2362
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2363
    <xsl:text>    }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2364
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2365
    <xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2366
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2367
    <xsl:text>    animate_activity(){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2368
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2369
    <xsl:text>        if(this.activity_displayed_state != this.activity_state){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2370
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2371
    <xsl:text>            set_activity_state(this.activable_sub, this.activity_state);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2372
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  2373
    <xsl:text>            this.activity_displayed_state = this.activity_state;
3026
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2374
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2375
    <xsl:text>        }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2376
</xsl:text>
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2377
    <xsl:text>    }
d454ed480c0f SVGHMI: factorize dispatch calling logic.
Edouard Tisserant
parents: 3025
diff changeset
  2378
</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
  2379
    <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
  2380
</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
  2381
    <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
  2382
</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
  2383
  </xsl:template>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  2384
  <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
3264
51645afeded9 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3242
diff changeset
  2385
  <xsl:key name="TypesKey" match="widget" use="@type"/>
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  2386
  <declarations:hmi-classes/>
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  2387
  <xsl:template match="declarations:hmi-classes">
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
  2388
    <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
  2389
</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
  2390
    <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
  2391
    <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
  2392
    <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
  2393
</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
  2394
    <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
  2395
</xsl:text>
3124
f263359d8108 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
  2396
    <xsl:variable name="used_widget_types" select="$parsed_widgets/widget[&#10;                                    generate-id() = generate-id(key('TypesKey', @type)) and &#10;                                    not(@type = $excluded_types)]"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  2397
    <xsl:apply-templates mode="widget_class" select="$used_widget_types"/>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  2398
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  2399
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  2400
  </xsl:template>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  2401
  <xsl:template mode="widget_class" match="widget">
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
  2402
    <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
  2403
    <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
  2404
    <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
  2405
</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
  2406
    <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
  2407
    <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
  2408
    <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
  2409
</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
  2410
    <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
  2411
</xsl:text>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2412
    <xsl:message terminate="no">
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2413
      <xsl:value-of select="@type"/>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2414
      <xsl:text> widget is used in SVG but widget type is not declared</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2415
    </xsl:message>
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
  2416
  </xsl:template>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
  2417
  <xsl:variable name="included_ids" select="$parsed_widgets/widget[not(@type = $excluded_types) and not(@id = $discardable_elements/@id)]/@id"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  2418
  <xsl:variable name="page_ids" select="$parsed_widgets/widget[@type = 'Page']/@id"/>
3124
f263359d8108 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3118
diff changeset
  2419
  <xsl:variable name="hmi_widgets" select="$hmi_elements[@id = $included_ids]"/>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  2420
  <xsl:variable name="page_widgets" select="$hmi_elements[@id = $page_ids]"/>
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
  2421
  <xsl:variable name="result_widgets" select="$result_svg_ns//*[@id = $hmi_widgets/@id]"/>
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  2422
  <declarations:hmi-elements/>
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  2423
  <xsl:template match="declarations: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
  2424
    <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
  2425
</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
  2426
    <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
  2427
    <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
  2428
    <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
  2429
</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
  2430
    <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
  2431
</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
  2432
    <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
  2433
</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  2434
    <xsl:apply-templates mode="hmi_widgets" select="$hmi_widgets | $page_widgets"/>
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
  2435
    <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
  2436
</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
  2437
    <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
  2438
</xsl:text>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2439
    <xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  2440
</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
  2441
  </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
  2442
  <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
  2443
    <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
  2444
    <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
  2445
    <xsl:param name="subelements" select="/.."/>
2800
68cee1366b9c SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents: 2799
diff changeset
  2446
    <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
  2447
    <xsl:variable name="widget_type" select="@type"/>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2448
    <xsl:variable name="widget_id" select="@id"/>
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
  2449
    <xsl:for-each select="str:split($labels)">
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  2450
      <xsl:variable name="absolute" select="starts-with(., '/')"/>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  2451
      <xsl:variable name="name" select="substring(.,number($absolute)+1)"/>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  2452
      <xsl:variable name="widget" select="$result_widgets[@id = $hmi_element/@id]"/>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  2453
      <xsl:variable name="elt" select="($widget//*[not($absolute) and @inkscape:label=$name] | $widget/*[$absolute and @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
  2454
      <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
  2455
        <xsl:when test="not($elt/@id)">
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2456
          <xsl:if test="$mandatory!='no'">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2457
            <xsl:variable name="errmsg">
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
  2458
              <xsl:value-of select="$widget_type"/>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2459
              <xsl:text> widget (id=</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2460
              <xsl:value-of select="$widget_id"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2461
              <xsl:text>) must have a </xsl:text>
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
  2462
              <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
  2463
              <xsl:text> element</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2464
            </xsl:variable>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2465
            <xsl:choose>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2466
              <xsl:when test="$mandatory='yes'">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2467
                <xsl:message terminate="yes">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2468
                  <xsl:value-of select="$errmsg"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2469
                </xsl:message>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2470
              </xsl:when>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2471
              <xsl:otherwise>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2472
                <xsl:message terminate="no">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2473
                  <xsl:value-of select="$errmsg"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2474
                </xsl:message>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2475
              </xsl:otherwise>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2476
            </xsl:choose>
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
  2477
          </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
  2478
        </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
  2479
        <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
  2480
          <xsl:text>    </xsl:text>
2807
7fa21b3b5f9f SVGHMI - added simple Meter widget.
Edouard Tisserant
parents: 2806
diff changeset
  2481
          <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
  2482
          <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
  2483
          <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
  2484
          <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
  2485
</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
  2486
          <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
  2487
            <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
  2488
            <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
  2489
            <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
  2490
</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
  2491
            <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
  2492
              <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
  2493
              <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
  2494
              <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
  2495
                <xsl:when test="not($subelt/@id)">
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2496
                  <xsl:if test="$mandatory!='no'">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2497
                    <xsl:variable name="errmsg">
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
  2498
                      <xsl:value-of select="$widget_type"/>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2499
                      <xsl:text> widget (id=</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2500
                      <xsl:value-of select="$widget_id"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2501
                      <xsl:text>) must have a </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
  2502
                      <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
  2503
                      <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
  2504
                      <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
  2505
                      <xsl:text> element</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2506
                    </xsl:variable>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2507
                    <xsl:choose>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2508
                      <xsl:when test="$mandatory='yes'">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2509
                        <xsl:message terminate="yes">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2510
                          <xsl:value-of select="$errmsg"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2511
                        </xsl:message>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2512
                      </xsl:when>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2513
                      <xsl:otherwise>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2514
                        <xsl:message terminate="no">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2515
                          <xsl:value-of select="$errmsg"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2516
                        </xsl:message>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2517
                      </xsl:otherwise>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  2518
                    </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
  2519
                  </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
  2520
                  <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
  2521
                  <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
  2522
                  <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
  2523
                  <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
  2524
                  <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
  2525
</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
  2526
                </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
  2527
                <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
  2528
                  <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
  2529
                  <xsl:value-of select="$subname"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  2530
                  <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
  2531
                  <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
  2532
                  <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
  2533
                  <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
  2534
                    <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
  2535
                  </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
  2536
                  <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
  2537
</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
  2538
                </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
  2539
              </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
  2540
            </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
  2541
            <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
  2542
</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
  2543
          </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
  2544
        </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
  2545
      </xsl:choose>
2807
7fa21b3b5f9f SVGHMI - added simple Meter widget.
Edouard Tisserant
parents: 2806
diff changeset
  2546
    </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
  2547
  </xsl:template>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2548
  <func:function name="func:escape_quotes">
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2549
    <xsl:param name="txt"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2550
    <xsl:choose>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  2551
      <xsl:when test="contains($txt,'&quot;')">
Edouard Tisserant
parents: 3022 3021
diff changeset
  2552
        <func:result select="concat(substring-before($txt,'&quot;'),'\&quot;',func:escape_quotes(substring-after($txt,'&quot;')))"/>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2553
      </xsl:when>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2554
      <xsl:otherwise>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2555
        <func:result select="$txt"/>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2556
      </xsl:otherwise>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2557
    </xsl:choose>
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  2558
  </func:function>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2559
  <xsl:template match="widget[@type='Animate']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2560
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2561
    <xsl:text>AnimateWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2562
    <xsl:text> extends Widget{
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2563
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2564
    <xsl:text>    frequency = 5;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2565
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2566
    <xsl:text>    speed = 0;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2567
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2568
    <xsl:text>    start = false;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2569
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2570
    <xsl:text>    widget_center = undefined;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2571
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2572
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2573
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2574
    <xsl:text>    dispatch(value) {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2575
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2576
    <xsl:text>        this.speed = value / 5;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2577
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2578
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2579
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2580
    <xsl:text>        //reconfigure animation
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2581
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2582
    <xsl:text>        this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2583
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2584
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2585
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2586
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2587
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2588
    <xsl:text>    animate(){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2589
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2590
    <xsl:text>       // change animation properties
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2591
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2592
    <xsl:text>       for(let child of this.element.children){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2593
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2594
    <xsl:text>            if(child.nodeName.startsWith("animate")){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2595
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2596
    <xsl:text>                if(this.speed != 0 &amp;&amp; !this.start){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2597
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2598
    <xsl:text>                    this.start = true;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2599
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2600
    <xsl:text>                    this.element.beginElement();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2601
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2602
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2603
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2604
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2605
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2606
    <xsl:text>                if(this.speed &gt; 0){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2607
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2608
    <xsl:text>                    child.setAttribute("dur", this.speed+"s");
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2609
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2610
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2611
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2612
    <xsl:text>                else if(this.speed &lt; 0){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2613
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2614
    <xsl:text>                    child.setAttribute("dur", (-1)*this.speed+"s");
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2615
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2616
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2617
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2618
    <xsl:text>                else{
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2619
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2620
    <xsl:text>                    this.start = false;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2621
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2622
    <xsl:text>                    this.element.endElement();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2623
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2624
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2625
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2626
    <xsl:text>            }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2627
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2628
    <xsl:text>       }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2629
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2630
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2631
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2632
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2633
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2634
    <xsl:text>    init() {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2635
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2636
    <xsl:text>        let widget_pos = this.element.getBBox();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2637
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2638
    <xsl:text>        this.widget_center = [(widget_pos.x+widget_pos.width/2), (widget_pos.y+widget_pos.height/2)];
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2639
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2640
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2641
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2642
    <xsl:text>}
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2643
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2644
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2645
  <xsl:template match="widget[@type='AnimateRotation']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2646
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2647
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2648
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2649
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2650
      <xsl:text>AnimateRotation - DEPRECATED, do not use.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2651
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2652
      <xsl:text>Doesn't follow WYSIWYG principle, and forces user to add animateTransform tag in SVG (using inkscape XML editor for exemple)
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2653
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2654
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2655
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2656
      <xsl:text>AnimateRotation - DEPRECATED</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2657
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2658
    <path name="speed" accepts="HMI_INT,HMI_REAL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2659
      <xsl:text>speed</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2660
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2661
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2662
  <xsl:template match="widget[@type='AnimateRotation']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2663
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2664
    <xsl:text>AnimateRotationWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2665
    <xsl:text> extends Widget{
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2666
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2667
    <xsl:text>    frequency = 5;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2668
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2669
    <xsl:text>    speed = 0;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2670
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2671
    <xsl:text>    widget_center = undefined;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2672
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2673
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2674
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2675
    <xsl:text>    dispatch(value) {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2676
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2677
    <xsl:text>        this.speed = value / 5;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2678
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2679
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2680
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2681
    <xsl:text>        //reconfigure animation
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2682
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2683
    <xsl:text>        this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2684
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2685
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2686
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2687
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2688
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2689
    <xsl:text>    animate(){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2690
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2691
    <xsl:text>       // change animation properties
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2692
</xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2693
    <xsl:text>       // TODO : rewrite with proper es6
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2694
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2695
    <xsl:text>       for(let child of this.element.children){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2696
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2697
    <xsl:text>            if(child.nodeName == "animateTransform"){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2698
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2699
    <xsl:text>                if(this.speed &gt; 0){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2700
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2701
    <xsl:text>                    child.setAttribute("dur", this.speed+"s");
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2702
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2703
    <xsl:text>                    child.setAttribute("from", "0 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2704
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2705
    <xsl:text>                    child.setAttribute("to", "360 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2706
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2707
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2708
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2709
    <xsl:text>                else if(this.speed &lt; 0){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2710
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2711
    <xsl:text>                    child.setAttribute("dur", (-1)*this.speed+"s");
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2712
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2713
    <xsl:text>                    child.setAttribute("from", "360 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2714
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2715
    <xsl:text>                    child.setAttribute("to", "0 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2716
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2717
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2718
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2719
    <xsl:text>                else{
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2720
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2721
    <xsl:text>                    child.setAttribute("from", "0 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2722
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2723
    <xsl:text>                    child.setAttribute("to", "0 "+this.widget_center[0]+" "+this.widget_center[1]);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2724
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2725
    <xsl:text>                }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2726
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2727
    <xsl:text>            }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2728
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2729
    <xsl:text>       }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2730
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2731
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2732
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2733
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2734
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2735
    <xsl:text>    init() {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2736
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2737
    <xsl:text>        let widget_pos = this.element.getBBox();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2738
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2739
    <xsl:text>        this.widget_center = [(widget_pos.x+widget_pos.width/2), (widget_pos.y+widget_pos.height/2)];
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2740
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2741
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2742
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2743
    <xsl:text>}
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2744
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2745
  </xsl:template>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2746
  <xsl:template match="widget[@type='Assign']" mode="widget_desc">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2747
    <type>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2748
      <xsl:value-of select="@type"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2749
    </type>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2750
    <longdesc>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2751
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2752
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2753
      <xsl:text>Arguments are either:
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2754
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2755
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2756
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2757
      <xsl:text>- name=value: setting variable with literal value.
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2758
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2759
      <xsl:text>- name=other_name: copy variable content into another
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2760
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2761
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2762
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2763
      <xsl:text>"active"+"inactive" labeled elements can be provided to show feedback when pressed
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2764
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2765
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2766
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2767
      <xsl:text>Exemples:
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2768
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2769
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2770
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2771
      <xsl:text>HMI:Assign:notify=1@notify=/PLCVAR
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2772
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2773
      <xsl:text>HMI:Assign:ack=2:notify=1@ack=.local_var@notify=/PLCVAR
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2774
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2775
      <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2776
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2777
    </longdesc>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2778
    <shortdesc>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2779
      <xsl:text>Assign variables on click</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2780
    </shortdesc>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2781
  </xsl:template>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2782
  <xsl:template match="widget[@type='Assign']" mode="widget_class">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2783
    <xsl:text>class </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2784
    <xsl:text>AssignWidget</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2785
    <xsl:text> extends Widget{
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2786
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2787
    <xsl:text>        frequency = 2;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2788
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2789
    <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2790
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2791
    <xsl:text>        onmouseup(evt) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2792
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2793
    <xsl:text>            svg_root.removeEventListener("pointerup", this.bound_onmouseup, true);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2794
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2795
    <xsl:text>            if(this.enable_state) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2796
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2797
    <xsl:text>                this.activity_state = false
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2798
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2799
    <xsl:text>                this.request_animate();
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2800
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2801
    <xsl:text>                this.assign();
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2802
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2803
    <xsl:text>            }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2804
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2805
    <xsl:text>        }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2806
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2807
    <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2808
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2809
    <xsl:text>        onmousedown(){
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2810
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2811
    <xsl:text>            if(this.enable_state) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2812
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2813
    <xsl:text>                svg_root.addEventListener("pointerup", this.bound_onmouseup, true);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2814
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2815
    <xsl:text>                this.activity_state = true;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2816
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2817
    <xsl:text>                this.request_animate();
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2818
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2819
    <xsl:text>            }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2820
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2821
    <xsl:text>        }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2822
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2823
    <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2824
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2825
    <xsl:text>}
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2826
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2827
  </xsl:template>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2828
  <xsl:template match="widget[@type='Assign']" mode="widget_defs">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2829
    <xsl:param name="hmi_element"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2830
    <xsl:variable name="disability">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2831
      <xsl:call-template name="defs_by_labels">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2832
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2833
        <xsl:with-param name="labels">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2834
          <xsl:text>/disabled</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2835
        </xsl:with-param>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2836
        <xsl:with-param name="mandatory" select="'no'"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2837
      </xsl:call-template>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2838
    </xsl:variable>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2839
    <xsl:value-of select="$disability"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2840
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2841
    <xsl:text>    activable_sub:{
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2842
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2843
    <xsl:variable name="activity">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2844
      <xsl:call-template name="defs_by_labels">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2845
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2846
        <xsl:with-param name="labels">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2847
          <xsl:text>/active /inactive</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2848
        </xsl:with-param>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2849
        <xsl:with-param name="mandatory">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2850
          <xsl:text>no</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2851
        </xsl:with-param>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2852
      </xsl:call-template>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2853
    </xsl:variable>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2854
    <xsl:value-of select="$activity"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2855
    <xsl:variable name="has_activity" select="string-length($activity)&gt;0"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2856
    <xsl:text>    },
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2857
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2858
    <xsl:text>    has_activity: </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2859
    <xsl:value-of select="$has_activity"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2860
    <xsl:text>,
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2861
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2862
    <xsl:text>    init: function() {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2863
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2864
    <xsl:text>        this.bound_onmouseup = this.onmouseup.bind(this);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2865
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2866
    <xsl:text>        this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2867
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2868
    <xsl:text>    },
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2869
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2870
    <xsl:text>    assignments: {},
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2871
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2872
    <xsl:text>    dispatch: function(value, oldval, varnum) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2873
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2874
    <xsl:variable name="widget" select="."/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2875
    <xsl:for-each select="path">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2876
      <xsl:variable name="varid" select="generate-id()"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2877
      <xsl:variable name="varnum" select="position()-1"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2878
      <xsl:if test="@assign">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2879
        <xsl:for-each select="$widget/path[@assign]">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2880
          <xsl:if test="$varid = generate-id()">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2881
            <xsl:text>        if(varnum == </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2882
            <xsl:value-of select="$varnum"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2883
            <xsl:text>) this.assignments["</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2884
            <xsl:value-of select="@assign"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2885
            <xsl:text>"] = value;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2886
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2887
          </xsl:if>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2888
        </xsl:for-each>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2889
      </xsl:if>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2890
    </xsl:for-each>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2891
    <xsl:text>    },
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2892
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2893
    <xsl:text>    assign: function() {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2894
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2895
    <xsl:variable name="paths" select="path"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2896
    <xsl:for-each select="arg[contains(@value,'=')]">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2897
      <xsl:variable name="name" select="substring-before(@value,'=')"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2898
      <xsl:variable name="value" select="substring-after(@value,'=')"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2899
      <xsl:variable name="index">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2900
        <xsl:for-each select="$paths">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2901
          <xsl:if test="@assign = $name">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2902
            <xsl:value-of select="position()-1"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2903
          </xsl:if>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2904
        </xsl:for-each>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2905
      </xsl:variable>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2906
      <xsl:variable name="isVarName" select="regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]+$')"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2907
      <xsl:choose>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2908
        <xsl:when test="$isVarName">
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2909
          <xsl:text>        const </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2910
          <xsl:value-of select="$value"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2911
          <xsl:text> = this.assignments["</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2912
          <xsl:value-of select="$value"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2913
          <xsl:text>"];
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2914
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2915
          <xsl:text>        if(</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2916
          <xsl:value-of select="$value"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2917
          <xsl:text> != undefined)
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2918
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2919
          <xsl:text>            this.apply_hmi_value(</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2920
          <xsl:value-of select="$index"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2921
          <xsl:text>, </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2922
          <xsl:value-of select="$value"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2923
          <xsl:text>);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2924
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2925
        </xsl:when>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2926
        <xsl:otherwise>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2927
          <xsl:text>        this.apply_hmi_value(</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2928
          <xsl:value-of select="$index"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2929
          <xsl:text>, </xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2930
          <xsl:value-of select="$value"/>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2931
          <xsl:text>);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2932
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2933
        </xsl:otherwise>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2934
      </xsl:choose>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2935
    </xsl:for-each>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2936
    <xsl:text>    },
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2937
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  2938
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2939
  <xsl:template match="widget[@type='Back']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2940
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2941
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2942
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2943
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2944
      <xsl:text>Back widget brings focus back to previous page in history when clicked.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2945
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2946
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2947
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2948
      <xsl:text>Jump to previous page</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2949
    </shortdesc>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  2950
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2951
  <xsl:template match="widget[@type='Back']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2952
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2953
    <xsl:text>BackWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  2954
    <xsl:text> extends Widget{
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
  2955
</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
  2956
    <xsl:text>    on_click(evt) {
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2957
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2958
    <xsl:text>        if(jump_history.length &gt; 1){
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2959
</xsl:text>
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2960
    <xsl:text>           let page_name, index;
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2961
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2962
    <xsl:text>           do {
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2963
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2964
    <xsl:text>               jump_history.pop(); // forget current page
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2965
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2966
    <xsl:text>               if(jump_history.length == 0) return;
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2967
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2968
    <xsl:text>               [page_name, index] = jump_history[jump_history.length-1];
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2969
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2970
    <xsl:text>           } while(page_name == "ScreenSaver") // never go back to ScreenSaver
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2971
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2972
    <xsl:text>           switch_page(page_name, index);
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2973
</xsl:text>
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2974
    <xsl:text>        }
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
  2975
</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
  2976
    <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
  2977
</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
  2978
    <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
  2979
</xsl:text>
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
  2980
    <xsl:text>        this.element.onclick = this.on_click.bind(this);
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
  2981
</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
  2982
    <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
  2983
</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
  2984
    <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
  2985
</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
  2986
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2987
  <xsl:template match="widget[@type='Button']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2988
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2989
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2990
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2991
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2992
      <xsl:text>Button widget takes one boolean variable path, and reflect current true
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2993
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2994
      <xsl:text>or false value by showing "active" or "inactive" labeled element
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2995
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2996
      <xsl:text>respectively. Pressing and releasing button changes variable to true and
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2997
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2998
      <xsl:text>false respectively. Potential inconsistency caused by quick consecutive
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  2999
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3000
      <xsl:text>presses on the button is mitigated by using a state machine that wait for
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3001
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3002
      <xsl:text>previous state change to be reflected on variable before applying next one.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3003
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3004
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3005
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3006
      <xsl:text>Push button reflecting consistently given boolean variable</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3007
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3008
    <path name="value" accepts="HMI_BOOL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3009
      <xsl:text>Boolean variable</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3010
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3011
  </xsl:template>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3012
  <xsl:variable name="_push_button_fsm">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3013
    <fsm>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3014
      <state name="init">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3015
        <on-dispatch value="false">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3016
          <jump state="reflect_off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3017
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3018
        <on-dispatch value="true">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3019
          <jump state="reflect_on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3020
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3021
      </state>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3022
      <state name="reflect_on">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3023
        <show eltname="active"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3024
        <on-mouse position="down">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3025
          <jump state="on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3026
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3027
        <on-mouse position="up">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3028
          <jump state="off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3029
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3030
        <on-dispatch value="false">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3031
          <jump state="reflect_off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3032
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3033
      </state>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3034
      <state name="on">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3035
        <hmi-value value="true"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3036
        <show eltname="active"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3037
        <on-mouse position="up">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3038
          <jump state="off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3039
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3040
        <on-dispatch value="false">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3041
          <jump state="reflect_off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3042
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3043
      </state>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3044
      <state name="reflect_off">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3045
        <show eltname="inactive"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3046
        <on-mouse position="down">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3047
          <jump state="on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3048
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3049
        <on-mouse position="up">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3050
          <jump state="off"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3051
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3052
        <on-dispatch value="true">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3053
          <jump state="reflect_on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3054
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3055
      </state>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3056
      <state name="off">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3057
        <hmi-value value="false"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3058
        <show eltname="inactive"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3059
        <on-mouse position="down">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3060
          <jump state="on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3061
        </on-mouse>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3062
        <on-dispatch value="true">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3063
          <jump state="reflect_on"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3064
        </on-dispatch>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3065
      </state>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3066
    </fsm>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3067
  </xsl:variable>
3085
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3068
  <xsl:variable name="_button_fsm">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3069
    <fsm>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3070
      <state name="init">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3071
        <on-dispatch value="false">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3072
          <jump state="released"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3073
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3074
        <on-dispatch value="true">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3075
          <jump state="pressed"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3076
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3077
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3078
      <state name="pressing">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3079
        <hmi-value value="true"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3080
        <on-dispatch value="true">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3081
          <jump state="pressed"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3082
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3083
        <on-mouse position="up">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3084
          <jump state="shortpress"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3085
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3086
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3087
      <state name="pressed">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3088
        <show eltname="active"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3089
        <on-mouse position="up">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3090
          <jump state="releasing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3091
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3092
        <on-dispatch value="false">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3093
          <jump state="released"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3094
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3095
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3096
      <state name="shortpress">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3097
        <on-dispatch value="true">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3098
          <jump state="releasing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3099
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3100
        <on-mouse position="down">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3101
          <jump state="pressing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3102
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3103
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3104
      <state name="releasing">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3105
        <hmi-value value="false"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3106
        <on-dispatch value="false">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3107
          <jump state="released"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3108
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3109
        <on-mouse position="down">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3110
          <jump state="shortrelease"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3111
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3112
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3113
      <state name="released">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3114
        <show eltname="inactive"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3115
        <on-mouse position="down">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3116
          <jump state="pressing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3117
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3118
        <on-dispatch value="true">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3119
          <jump state="pressed"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3120
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3121
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3122
      <state name="shortrelease">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3123
        <on-dispatch value="false">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3124
          <jump state="pressing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3125
        </on-dispatch>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3126
        <on-mouse position="up">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3127
          <jump state="releasing"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3128
        </on-mouse>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3129
      </state>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3130
    </fsm>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3131
  </xsl:variable>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3132
  <xsl:template mode="dispatch_transition" match="fsm">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3133
    <xsl:text>        switch (this.state) {
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3134
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3135
    <xsl:apply-templates mode="dispatch_transition" select="state"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3136
    <xsl:text>        }
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3137
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3138
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3139
  <xsl:template mode="dispatch_transition" match="state">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3140
    <xsl:text>          case "</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3141
    <xsl:value-of select="@name"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3142
    <xsl:text>":
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3143
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3144
    <xsl:apply-templates select="on-dispatch"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3145
    <xsl:text>            break;
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3146
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3147
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3148
  <xsl:template match="on-dispatch">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3149
    <xsl:text>            if(value ==  </xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3150
    <xsl:value-of select="@value"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3151
    <xsl:text>) {
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3152
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3153
    <xsl:apply-templates mode="transition" select="jump"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3154
    <xsl:text>            }
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3155
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3156
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3157
  <xsl:template mode="mouse_transition" match="fsm">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3158
    <xsl:param name="position"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3159
    <xsl:text>        switch (this.state) {
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3160
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3161
    <xsl:apply-templates mode="mouse_transition" select="state">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3162
      <xsl:with-param name="position" select="$position"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3163
    </xsl:apply-templates>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3164
    <xsl:text>        }
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3165
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3166
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3167
  <xsl:template mode="mouse_transition" match="state">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3168
    <xsl:param name="position"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3169
    <xsl:text>          case "</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3170
    <xsl:value-of select="@name"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3171
    <xsl:text>":
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3172
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3173
    <xsl:apply-templates select="on-mouse[@position = $position]"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3174
    <xsl:text>            break;
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3175
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3176
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3177
  <xsl:template match="on-mouse">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3178
    <xsl:apply-templates mode="transition" select="jump"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3179
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3180
  <xsl:template mode="transition" match="jump">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3181
    <xsl:text>            this.state = "</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3182
    <xsl:value-of select="@state"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3183
    <xsl:text>";
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3184
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3185
    <xsl:text>            this.</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3186
    <xsl:value-of select="@state"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3187
    <xsl:text>_action();
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3188
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3189
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3190
  <xsl:template mode="actions" match="fsm">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3191
    <xsl:apply-templates mode="actions" select="state"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3192
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3193
  <xsl:template mode="actions" match="state">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3194
    <xsl:text>    </xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3195
    <xsl:value-of select="@name"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3196
    <xsl:text>_action(){
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3197
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3198
    <xsl:apply-templates mode="actions" select="*"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3199
    <xsl:text>    }
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3200
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3201
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3202
  <xsl:template mode="actions" match="show">
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3203
    <xsl:text>        this.activity_state = </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3204
    <xsl:value-of select="@eltname = 'active'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3205
    <xsl:text>;
3085
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3206
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3207
    <xsl:text>        this.request_animate();
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3208
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3209
  </xsl:template>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3210
  <xsl:template mode="actions" match="hmi-value">
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3211
    <xsl:text>        this.apply_hmi_value(0, </xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3212
    <xsl:value-of select="@value"/>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3213
    <xsl:text>);
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3214
</xsl:text>
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3215
  </xsl:template>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3216
  <xsl:template name="generated_button_class">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3217
    <xsl:param name="fsm"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3218
    <xsl:text>    state = "init";
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3219
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3220
    <xsl:text>    dispatch(value) {
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3221
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3222
    <xsl:apply-templates mode="dispatch_transition" select="$fsm"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3223
    <xsl:text>    }
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3224
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3225
    <xsl:text>    onmouseup(evt) {
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3226
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3227
    <xsl:text>        svg_root.removeEventListener("pointerup", this.bound_onmouseup, true);
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3228
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3229
    <xsl:apply-templates mode="mouse_transition" select="$fsm">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3230
      <xsl:with-param name="position" select="'up'"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3231
    </xsl:apply-templates>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3232
    <xsl:text>    }
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3233
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3234
    <xsl:text>    onmousedown(evt) {
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3235
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3236
    <xsl:text>        svg_root.addEventListener("pointerup", this.bound_onmouseup, true);
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3237
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3238
    <xsl:apply-templates mode="mouse_transition" select="$fsm">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3239
      <xsl:with-param name="position" select="'down'"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3240
    </xsl:apply-templates>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3241
    <xsl:text>    }
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3242
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3243
    <xsl:apply-templates mode="actions" select="$fsm"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3244
    <xsl:text>    init() {
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3245
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3246
    <xsl:text>        this.bound_onmouseup = this.onmouseup.bind(this);
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3247
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3248
    <xsl:text>        this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3249
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3250
    <xsl:text>        this.activity_state = undefined;
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3251
</xsl:text>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3252
    <xsl:text>    }
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3253
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3254
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3255
  <xsl:template match="widget[@type='Button']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3256
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3257
    <xsl:text>ButtonWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3258
    <xsl:text> extends Widget{
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3259
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  3260
    <xsl:text>    frequency = 5;
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  3261
</xsl:text>
3085
6b1b23971960 SVGHMI: Rewrote button widget.
Edouard Tisserant
parents: 3084
diff changeset
  3262
    <xsl:variable name="fsm" select="exsl:node-set($_button_fsm)"/>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3263
    <xsl:call-template name="generated_button_class">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3264
      <xsl:with-param name="fsm" select="$fsm"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3265
    </xsl:call-template>
3024
Edouard Tisserant
parents: 3022 3021
diff changeset
  3266
    <xsl:text>}
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3267
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3268
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3269
  <xsl:template match="widget[@type='Button']" mode="widget_defs">
2976
99c4521bb844 SVGHMI: Changed widget button handler to element attribute.
dgaberscek
parents: 2970
diff changeset
  3270
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3271
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3272
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3273
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3274
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3275
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3276
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3277
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3278
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3279
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3280
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3281
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3282
    <xsl:text>    activable_sub:{
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3283
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3284
    <xsl:variable name="activity">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3285
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3286
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3287
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3288
          <xsl:text>/active /inactive</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3289
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3290
        <xsl:with-param name="mandatory">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3291
          <xsl:text>warn</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3292
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3293
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3294
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3295
    <xsl:value-of select="$activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3296
    <xsl:variable name="has_activity" select="string-length($activity)&gt;0"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3297
    <xsl:text>    },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3298
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3299
    <xsl:text>    has_activity: </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3300
    <xsl:value-of select="$has_activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3301
    <xsl:text>,
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3302
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3303
  </xsl:template>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3304
  <xsl:template match="widget[@type='PushButton']" mode="widget_class">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3305
    <xsl:text>class </xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3306
    <xsl:text>PushButtonWidget</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3307
    <xsl:text> extends Widget{
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3308
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  3309
    <xsl:text>    frequency = 20;
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  3310
</xsl:text>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3311
    <xsl:variable name="fsm" select="exsl:node-set($_push_button_fsm)"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3312
    <xsl:call-template name="generated_button_class">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3313
      <xsl:with-param name="fsm" select="$fsm"/>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3314
    </xsl:call-template>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3315
    <xsl:text>}
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3316
</xsl:text>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3317
  </xsl:template>
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3318
  <xsl:template match="widget[@type='PushButton']" mode="widget_defs">
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3319
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3320
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3321
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3322
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3323
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3324
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3325
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3326
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3327
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3328
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3329
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3330
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3331
    <xsl:text>    activable_sub:{
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3332
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3333
    <xsl:variable name="activity">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3334
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3335
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3336
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3337
          <xsl:text>/active /inactive</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3338
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3339
        <xsl:with-param name="mandatory">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3340
          <xsl:text>warn</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3341
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3342
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3343
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3344
    <xsl:value-of select="$activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3345
    <xsl:variable name="has_activity" select="string-length($activity)&gt;0"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3346
    <xsl:text>    },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3347
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3348
    <xsl:text>    has_activity: </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3349
    <xsl:value-of select="$has_activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3350
    <xsl:text>,
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  3351
</xsl:text>
3414
0ff608310312 SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3410
diff changeset
  3352
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3353
  <xsl:template match="widget[@type='CircularBar']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3354
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3355
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3356
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3357
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3358
      <xsl:text>CircularBar widget changes the end angle of a "path" labeled arc according
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3359
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3360
      <xsl:text>to value of the single accepted variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3361
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3362
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3363
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3364
      <xsl:text>If "min" a "max" labeled texts are provided, then they are used as
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3365
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3366
      <xsl:text>respective minimum and maximum value. Otherwise, value is expected to be
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3367
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3368
      <xsl:text>in between 0 and 100.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3369
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3370
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3371
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3372
      <xsl:text>Change end angle of Inkscape's arc</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3373
    </shortdesc>
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3374
    <arg name="min" count="optional" accepts="int,real">
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3375
      <xsl:text>minimum value</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3376
    </arg>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3377
    <arg name="max" count="optional" accepts="int,real">
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3378
      <xsl:text>maximum value</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3379
    </arg>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3380
    <path name="value" accepts="HMI_INT,HMI_REAL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3381
      <xsl:text>Value to display</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3382
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3383
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3384
  <xsl:template match="widget[@type='CircularBar']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3385
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3386
    <xsl:text>CircularBarWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3387
    <xsl:text> extends Widget{
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3388
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3389
    <xsl:text>    frequency = 10;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3390
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3391
    <xsl:text>    range = undefined;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3392
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3393
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3394
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3395
    <xsl:text>    dispatch(value) {
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3396
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3397
    <xsl:text>        this.display_val = value;
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3398
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3399
    <xsl:text>        this.request_animate();
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3400
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3401
    <xsl:text>    }
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3402
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3403
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3404
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3405
    <xsl:text>    animate(){
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3406
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3407
    <xsl:text>        if(this.value_elt)
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3408
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3409
    <xsl:text>            this.value_elt.textContent = String(this.display_val);
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3410
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3411
    <xsl:text>        let [min,max,start,end] = this.range;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3412
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3413
    <xsl:text>        let [cx,cy] = this.center;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3414
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3415
    <xsl:text>        let [rx,ry] = this.proportions;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3416
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3417
    <xsl:text>        let tip = start + (end-start)*Number(this.display_val)/(max-min);
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3418
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3419
    <xsl:text>        let size = 0;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3420
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3421
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3422
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3423
    <xsl:text>        if (tip-start &gt; Math.PI)
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3424
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3425
    <xsl:text>            size = 1;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3426
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3427
    <xsl:text>        else
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3428
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3429
    <xsl:text>            size = 0;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3430
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3431
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3432
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3433
    <xsl:text>        this.path_elt.setAttribute('d', "M "+(cx+rx*Math.cos(start))+","+(cy+ry*Math.sin(start))+
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3434
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3435
    <xsl:text>                                        " A "+rx+","+ry+
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3436
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3437
    <xsl:text>                                        " 0 "+size+
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3438
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3439
    <xsl:text>                                        " 1 "+(cx+rx*Math.cos(tip))+","+(cy+ry*Math.sin(tip)));
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3440
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3441
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3442
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3443
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3444
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3445
    <xsl:text>    init() {
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3446
</xsl:text>
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3447
    <xsl:text>        if(this.args.length &gt;= 2)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3448
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3449
    <xsl:text>            [this.min, this.max]=this.args;
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3450
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3451
    <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3452
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3453
    <xsl:text>        let [start, end, cx, cy, rx, ry] = ["start", "end", "cx", "cy", "rx", "ry"].
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3454
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3455
    <xsl:text>            map(tag=&gt;Number(this.path_elt.getAttribute('sodipodi:'+tag)))
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3456
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3457
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3458
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3459
    <xsl:text>        if (ry == 0) 
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3460
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3461
    <xsl:text>            ry = rx;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3462
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3463
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3464
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3465
    <xsl:text>        if (start &gt; end)
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3466
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3467
    <xsl:text>            end = end + 2*Math.PI;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3468
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3469
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3470
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3471
    <xsl:text>        let [min,max] = [[this.min_elt,0],[this.max_elt,100]].map(([elt,def],i)=&gt;elt?
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3472
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3473
    <xsl:text>            Number(elt.textContent) :
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3474
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3475
    <xsl:text>            this.args.length &gt;= i+1 ? this.args[i] : def);
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3476
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  3477
    <xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3478
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3479
    <xsl:text>        this.range = [min, max, start, end];
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3480
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3481
    <xsl:text>        this.center = [cx, cy];
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3482
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3483
    <xsl:text>        this.proportions = [rx, ry];
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3484
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3485
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3486
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3487
    <xsl:text>}
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3488
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3489
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3490
  <xsl:template match="widget[@type='CircularBar']" mode="widget_defs">
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3491
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3492
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3493
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3494
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3495
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3496
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3497
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3498
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3499
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3500
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3501
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  3502
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3503
    <xsl:call-template name="defs_by_labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3504
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3505
      <xsl:with-param name="labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3506
        <xsl:text>path</xsl:text>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3507
      </xsl:with-param>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3508
    </xsl:call-template>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3509
    <xsl:call-template name="defs_by_labels">
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3510
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3511
      <xsl:with-param name="labels">
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  3512
        <xsl:text>min max</xsl:text>
2944
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3513
      </xsl:with-param>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3514
      <xsl:with-param name="mandatory" select="'no'"/>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3515
    </xsl:call-template>
2a20038fbea9 Added button and circular bar widgets.
dgaberscek
parents: 2943
diff changeset
  3516
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3517
  <xsl:template match="widget[@type='CircularSlider']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3518
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3519
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3520
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3521
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3522
      <xsl:text>CircularSlider - DEPRECATED, to be replaced by PathSlider
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3523
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3524
      <xsl:text>This widget moves "handle" labeled group along "range" labeled
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3525
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3526
      <xsl:text>arc, according to value of the single accepted variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3527
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3528
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3529
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3530
      <xsl:text>If "min" a "max" labeled texts are provided, or if first and second
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3531
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3532
      <xsl:text>argument are given, then they are used as respective minimum and maximum
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3533
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3534
      <xsl:text>value. Otherwise, value is expected to be in between 0 and 100.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3535
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3536
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3537
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3538
      <xsl:text>If "value" labeled text is found, then its content is replaced by value.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3539
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3540
      <xsl:text>During drag, "setpoint" labeled group is moved to position defined by user
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3541
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3542
      <xsl:text>while "handle" reflects current value from variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3543
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3544
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3545
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3546
      <xsl:text>CircularSlider - DEPRECATED</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3547
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3548
    <arg name="min" count="optional" accepts="int,real">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3549
      <xsl:text>minimum value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3550
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3551
    <arg name="min" count="optional" accepts="int,real">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3552
      <xsl:text>maximum value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3553
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3554
    <path name="value" accepts="HMI_INT,HMI_REAL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3555
      <xsl:text>Value to display</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3556
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  3557
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3558
  <xsl:template match="widget[@type='CircularSlider']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3559
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3560
    <xsl:text>CircularSliderWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  3561
    <xsl:text> extends Widget{
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3562
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3563
    <xsl:text>    frequency = 5;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3564
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3565
    <xsl:text>    range = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3566
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3567
    <xsl:text>    circle = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3568
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3569
    <xsl:text>    handle_pos = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3570
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3571
    <xsl:text>    curr_value = 0;
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3572
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3573
    <xsl:text>    drag = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3574
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3575
    <xsl:text>    enTimer = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3576
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3577
    <xsl:text>    last_drag = false;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3578
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3579
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3580
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3581
    <xsl:text>    dispatch(value) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3582
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3583
    <xsl:text>        let [min,max,start,totallength] = this.range;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3584
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3585
    <xsl:text>        //save current value inside widget
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3586
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3587
    <xsl:text>        this.curr_value = value;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3588
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3589
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3590
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3591
    <xsl:text>        //check if in range
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3592
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3593
    <xsl:text>        if (this.curr_value &gt; max){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3594
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3595
    <xsl:text>            this.curr_value = max;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3596
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3597
    <xsl:text>            this.apply_hmi_value(0, this.curr_value);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3598
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3599
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3600
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3601
    <xsl:text>        else if (this.curr_value &lt; min){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3602
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3603
    <xsl:text>            this.curr_value = min;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3604
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3605
    <xsl:text>            this.apply_hmi_value(0, this.curr_value);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3606
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3607
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3608
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3609
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3610
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3611
    <xsl:text>        if(this.value_elt)
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3612
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3613
    <xsl:text>            this.value_elt.textContent = String(value);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3614
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3615
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3616
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3617
    <xsl:text>        //don't update if draging and setpoint ghost doesn't exist
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3618
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3619
    <xsl:text>        if(!this.drag || (this.setpoint_elt != undefined)){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3620
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3621
    <xsl:text>            this.update_DOM(value, this.handle_elt);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3622
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3623
    <xsl:text>        }
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3624
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3625
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3626
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3627
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3628
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3629
    <xsl:text>    update_DOM(value, elt){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3630
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3631
    <xsl:text>        let [min,max,totalDistance] = this.range;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3632
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3633
    <xsl:text>        let length = Math.max(0,Math.min((totalDistance),(Number(value)-min)/(max-min)*(totalDistance)));
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3634
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3635
    <xsl:text>        let tip = this.range_elt.getPointAtLength(length);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3636
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3637
    <xsl:text>        elt.setAttribute('transform',"translate("+(tip.x-this.handle_pos.x)+","+(tip.y-this.handle_pos.y)+")");
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3638
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3639
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3640
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3641
    <xsl:text>        // show or hide ghost if exists
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3642
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3643
    <xsl:text>        if(this.setpoint_elt != undefined){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3644
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3645
    <xsl:text>            if(this.last_drag!= this.drag){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3646
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3647
    <xsl:text>                if(this.drag){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3648
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3649
    <xsl:text>                    this.setpoint_elt.setAttribute("style", this.setpoint_style);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3650
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3651
    <xsl:text>                }else{
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3652
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3653
    <xsl:text>                    this.setpoint_elt.setAttribute("style", "display:none");
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3654
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3655
    <xsl:text>                }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3656
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3657
    <xsl:text>                this.last_drag = this.drag;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3658
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3659
    <xsl:text>            }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3660
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3661
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3662
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3663
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3664
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3665
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3666
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3667
    <xsl:text>    on_release(evt) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3668
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3669
    <xsl:text>        //unbind events
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3670
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3671
    <xsl:text>        window.removeEventListener("touchmove", this.on_bound_drag, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3672
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3673
    <xsl:text>        window.removeEventListener("mousemove", this.on_bound_drag, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3674
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3675
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3676
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3677
    <xsl:text>        window.removeEventListener("mouseup", this.bound_on_release, true)
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3678
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3679
    <xsl:text>        window.removeEventListener("touchend", this.bound_on_release, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3680
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3681
    <xsl:text>        window.removeEventListener("touchcancel", this.bound_on_release, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3682
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3683
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3684
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3685
    <xsl:text>        //reset drag flag
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3686
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3687
    <xsl:text>        if(this.drag){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3688
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3689
    <xsl:text>            this.drag = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3690
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3691
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3692
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3693
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3694
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3695
    <xsl:text>        // get final position
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3696
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3697
    <xsl:text>        this.update_position(evt);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3698
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3699
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3700
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3701
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3702
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3703
    <xsl:text>    on_drag(evt){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3704
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3705
    <xsl:text>        //ignore drag event for X amount of time and if not selected
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3706
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3707
    <xsl:text>        if(this.enTimer &amp;&amp; this.drag){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3708
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3709
    <xsl:text>            this.update_position(evt);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3710
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3711
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3712
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3713
    <xsl:text>            //reset timer
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3714
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3715
    <xsl:text>            this.enTimer = false;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3716
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3717
    <xsl:text>            setTimeout("{hmi_widgets['"+this.element_id+"'].enTimer = true;}", 100);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3718
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3719
    <xsl:text>        }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3720
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3721
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3722
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3723
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3724
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3725
    <xsl:text>    update_position(evt){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3726
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3727
    <xsl:text>        if(this.drag &amp;&amp; this.enTimer){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3728
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3729
    <xsl:text>            var svg_dist = 0;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3730
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3731
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3732
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3733
    <xsl:text>            //calculate center of widget in html
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3734
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3735
    <xsl:text>            // --TODO maybe it would be better to bind this part to window change size event ???
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3736
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3737
    <xsl:text>            let [xdest,ydest,svgWidth,svgHeight] = page_desc[current_visible_page].bbox;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3738
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3739
    <xsl:text>            let [cX, cY,fiStart,fiEnd,minMax,x1,y1,width,height] = this.circle;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3740
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3741
    <xsl:text>            let htmlCirc = this.range_elt.getBoundingClientRect();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3742
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3743
    <xsl:text>            let cxHtml = ((htmlCirc.right-htmlCirc.left)/(width)*(cX-x1))+htmlCirc.left;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3744
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3745
    <xsl:text>            let cyHtml = ((htmlCirc.bottom-htmlCirc.top)/(height)*(cY-y1))+htmlCirc.top;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3746
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3747
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3748
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3749
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3750
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3751
    <xsl:text>            //get mouse coordinates
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3752
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3753
    <xsl:text>            let mouseX = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3754
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3755
    <xsl:text>            let mouseY = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3756
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3757
    <xsl:text>            if (evt.type.startsWith("touch")){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3758
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3759
    <xsl:text>                mouseX = Math.ceil(evt.touches[0].clientX);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3760
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3761
    <xsl:text>                mouseY = Math.ceil(evt.touches[0].clientY);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3762
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3763
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3764
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3765
    <xsl:text>            else{
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3766
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3767
    <xsl:text>                mouseX = evt.pageX;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3768
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3769
    <xsl:text>                mouseY = evt.pageY;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3770
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3771
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3772
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3773
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3774
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3775
    <xsl:text>            //calculate angle
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3776
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3777
    <xsl:text>            let fi = Math.atan2(cyHtml-mouseY, mouseX-cxHtml);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3778
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3779
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3780
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3781
    <xsl:text>            // transform from 0 to 2PI
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3782
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3783
    <xsl:text>            if (fi &gt; 0){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3784
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3785
    <xsl:text>                fi = 2*Math.PI-fi;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3786
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3787
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3788
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3789
    <xsl:text>            else{
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3790
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3791
    <xsl:text>                fi = -fi;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3792
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3793
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3794
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3795
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3796
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3797
    <xsl:text>            //offset it to 0
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3798
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3799
    <xsl:text>            fi = fi - fiStart;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3800
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3801
    <xsl:text>            if (fi &lt; 0){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3802
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3803
    <xsl:text>                fi = fi + 2*Math.PI;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3804
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3805
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3806
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3807
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3808
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3809
    <xsl:text>            //get handle distance from mouse position
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3810
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3811
    <xsl:text>            if(fi&lt;fiEnd){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3812
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3813
    <xsl:text>               this.curr_value=(fi)/(fiEnd)*(this.range[1]-this.range[0]);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3814
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3815
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3816
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3817
    <xsl:text>            else if(fiEnd&lt;fi &amp;&amp; fi&lt;fiEnd+minMax){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3818
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3819
    <xsl:text>                this.curr_value = this.range[1];
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3820
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3821
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3822
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3823
    <xsl:text>            else{
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3824
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3825
    <xsl:text>                this.curr_value = this.range[0];
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3826
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3827
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3828
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3829
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3830
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3831
    <xsl:text>            //apply value to hmi
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3832
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3833
    <xsl:text>            this.apply_hmi_value(0, Math.ceil(this.curr_value));
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3834
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3835
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3836
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3837
    <xsl:text>            //redraw handle
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3838
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3839
    <xsl:text>            this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3840
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3841
    <xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3842
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3843
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3844
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3845
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3846
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3847
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3848
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3849
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3850
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3851
    <xsl:text>    animate(){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3852
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3853
    <xsl:text>        // redraw handle on screen refresh
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3854
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3855
    <xsl:text>        // check if setpoint(ghost) handle exsist otherwise update main handle
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3856
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3857
    <xsl:text>        if(this.setpoint_elt != undefined){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3858
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3859
    <xsl:text>            this.update_DOM(this.curr_value, this.setpoint_elt);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3860
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3861
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3862
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3863
    <xsl:text>        else{
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3864
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3865
    <xsl:text>            this.update_DOM(this.curr_value, this.handle_elt);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3866
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3867
    <xsl:text>        }
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3868
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3869
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3870
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3871
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3872
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3873
    <xsl:text>    on_select(evt){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3874
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3875
    <xsl:text>        //enable drag flag and timer
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3876
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3877
    <xsl:text>        this.drag = true;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3878
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3879
    <xsl:text>        this.enTimer = true;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3880
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3881
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3882
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3883
    <xsl:text>        //bind events
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3884
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3885
    <xsl:text>        window.addEventListener("touchmove", this.on_bound_drag, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3886
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3887
    <xsl:text>        window.addEventListener("mousemove", this.on_bound_drag, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3888
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3889
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3890
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3891
    <xsl:text>        window.addEventListener("mouseup", this.bound_on_release, true);
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3892
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3893
    <xsl:text>        window.addEventListener("touchend", this.bound_on_release, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3894
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3895
    <xsl:text>        window.addEventListener("touchcancel", this.bound_on_release, true);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3896
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3897
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3898
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3899
    <xsl:text>        //update postion on mouse press
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3900
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3901
    <xsl:text>        this.update_position(evt);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3902
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3903
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3904
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3905
    <xsl:text>        //prevent next events
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3906
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3907
    <xsl:text>        evt.stopPropagation();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3908
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3909
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3910
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3911
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3912
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3913
    <xsl:text>    init() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3914
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3915
    <xsl:text>        //get min max
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3916
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3917
    <xsl:text>        let min = this.min_elt ?
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3918
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3919
    <xsl:text>                    Number(this.min_elt.textContent) :
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3920
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3921
    <xsl:text>                    this.args.length &gt;= 1 ? this.args[0] : 0;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3922
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3923
    <xsl:text>        let max = this.max_elt ?
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3924
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3925
    <xsl:text>                    Number(this.max_elt.textContent) :
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3926
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3927
    <xsl:text>                    this.args.length &gt;= 2 ? this.args[1] : 100;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3928
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3929
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3930
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3931
    <xsl:text>        //fiStart ==&gt; offset
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3932
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3933
    <xsl:text>        let fiStart = Number(this.range_elt.getAttribute('sodipodi:start'));
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3934
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3935
    <xsl:text>        let fiEnd = Number(this.range_elt.getAttribute('sodipodi:end'));
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3936
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3937
    <xsl:text>        fiEnd = fiEnd - fiStart;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3938
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3939
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3940
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3941
    <xsl:text>        //fiEnd ==&gt; size of angle
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3942
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3943
    <xsl:text>        if (fiEnd &lt; 0){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3944
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3945
    <xsl:text>            fiEnd = 2*Math.PI + fiEnd;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3946
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3947
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3948
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3949
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3950
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3951
    <xsl:text>        //min max barrier angle
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3952
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3953
    <xsl:text>        let minMax = (2*Math.PI - fiEnd)/2;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3954
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3955
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3956
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3957
    <xsl:text>        //get parameters from svg
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3958
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3959
    <xsl:text>        let cX = Number(this.range_elt.getAttribute('sodipodi:cx'));
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3960
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3961
    <xsl:text>        let cY = Number(this.range_elt.getAttribute('sodipodi:cy'));
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3962
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3963
    <xsl:text>        this.range_elt.style.strokeMiterlimit="0"; //eliminates some weird border around html object
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3964
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3965
    <xsl:text>        this.range = [min, max,this.range_elt.getTotalLength()];
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3966
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3967
    <xsl:text>        let cPos = this.range_elt.getBBox();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3968
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3969
    <xsl:text>        this.handle_pos = this.range_elt.getPointAtLength(0);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3970
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3971
    <xsl:text>        this.circle = [cX, cY,fiStart,fiEnd,minMax,cPos.x,cPos.y,cPos.width,cPos.height];
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3972
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3973
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3974
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3975
    <xsl:text>        //bind functions
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3976
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3977
    <xsl:text>        this.bound_on_select = this.on_select.bind(this);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3978
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3979
    <xsl:text>        this.bound_on_release = this.on_release.bind(this);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3980
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3981
    <xsl:text>        this.on_bound_drag = this.on_drag.bind(this);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3982
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3983
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3984
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3985
    <xsl:text>        this.handle_elt.addEventListener("mousedown", this.bound_on_select);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  3986
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3987
    <xsl:text>        this.element.addEventListener("mousedown", this.bound_on_select);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3988
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3989
    <xsl:text>        this.element.addEventListener("touchstart", this.bound_on_select);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  3990
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3991
    <xsl:text>        //touch recognised as page drag without next command
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3992
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3993
    <xsl:text>        document.body.addEventListener("touchstart", function(e){}, false);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3994
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3995
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3996
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3997
    <xsl:text>        //save ghost style
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3998
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  3999
    <xsl:text>        //save ghost style
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4000
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4001
    <xsl:text>        if(this.setpoint_elt != undefined){
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4002
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4003
    <xsl:text>            this.setpoint_style = this.setpoint_elt.getAttribute("style");
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4004
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4005
    <xsl:text>            this.setpoint_elt.setAttribute("style", "display:none");
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4006
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4007
    <xsl:text>        }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4008
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  4009
    <xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4010
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4011
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4012
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4013
    <xsl:text>}
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4014
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4015
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4016
  <xsl:template match="widget[@type='CircularSlider']" mode="widget_defs">
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4017
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4018
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4019
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4020
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4021
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4022
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4023
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4024
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4025
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4026
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4027
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4028
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4029
    <xsl:call-template name="defs_by_labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4030
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4031
      <xsl:with-param name="labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4032
        <xsl:text>handle range</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4033
      </xsl:with-param>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4034
    </xsl:call-template>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4035
    <xsl:call-template name="defs_by_labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4036
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4037
      <xsl:with-param name="labels">
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4038
        <xsl:text>value min max setpoint</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4039
      </xsl:with-param>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4040
      <xsl:with-param name="mandatory" select="'no'"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4041
    </xsl:call-template>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4042
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4043
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  4044
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4045
  <xsl:template match="widget[@type='CustomHtml']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4046
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4047
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4048
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4049
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4050
      <xsl:text>CustomHtml widget allows insertion of HTML code in a svg:foreignObject.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4051
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4052
      <xsl:text>Widget content is replaced by foreignObject. HTML code is obtained from
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4053
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4054
      <xsl:text>"code" labeled text content. HTML insert position and size is given with
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4055
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4056
      <xsl:text>"container" labeled element.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4057
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4058
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4059
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4060
      <xsl:text>Custom HTML insert</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4061
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4062
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4063
  <xsl:template match="widget[@type='CustomHtml']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4064
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4065
    <xsl:text>CustomHtmlWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4066
    <xsl:text> extends Widget{
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4067
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4068
    <xsl:text>    frequency = 5;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4069
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4070
    <xsl:text>    widget_size = undefined;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4071
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4072
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4073
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4074
    <xsl:text>    dispatch(value) {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4075
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4076
    <xsl:text>        this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4077
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4078
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4079
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4080
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4081
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4082
    <xsl:text>    animate(){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4083
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4084
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4085
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4086
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4087
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4088
    <xsl:text>    init() {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4089
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4090
    <xsl:text>        this.widget_size = this.container_elt.getBBox();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4091
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4092
    <xsl:text>        this.element.innerHTML ='&lt;foreignObject x="'+
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4093
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4094
    <xsl:text>            this.widget_size.x+'" y="'+this.widget_size.y+
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4095
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4096
    <xsl:text>            '" width="'+this.widget_size.width+'" height="'+this.widget_size.height+'"&gt; '+
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4097
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4098
    <xsl:text>            this.code_elt.textContent+
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4099
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4100
    <xsl:text>            ' &lt;/foreignObject&gt;';
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4101
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4102
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4103
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4104
    <xsl:text>}
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4105
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4106
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4107
  <xsl:template match="widget[@type='CustomHtml']" mode="widget_defs">
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4108
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4109
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4110
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4111
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4112
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4113
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4114
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4115
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4116
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4117
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4118
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4119
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4120
    <xsl:call-template name="defs_by_labels">
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4121
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4122
      <xsl:with-param name="labels">
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4123
        <xsl:text>container code</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4124
      </xsl:with-param>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4125
    </xsl:call-template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4126
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4127
  <xsl:template match="widget[@type='Display']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4128
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4129
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4130
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4131
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4132
      <xsl:text>If Display widget is a svg:text element, then text content is replaced by
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4133
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4134
      <xsl:text>value of given variables, space separated.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4135
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4136
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4137
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4138
      <xsl:text>Otherwise, if Display widget is a group containing a svg:text element
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4139
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4140
      <xsl:text>labelled "format", then text content is replaced by printf-like formated
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4141
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4142
      <xsl:text>string. In other words, if "format" labeled text is "%d %s %f", then 3
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4143
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4144
      <xsl:text>variables paths are expected : HMI_IN, HMI_STRING and HMI_REAL.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4145
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4146
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4147
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4148
      <xsl:text>In case Display widget is a svg::text element, it is also possible to give
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4149
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4150
      <xsl:text>format string as first argument.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4151
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4152
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4153
    <shortdesc>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4154
      <xsl:text>Printf-like formated text display</xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4155
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4156
    <arg name="format" count="optional" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4157
      <xsl:text>printf-like format string when not given as svg:text</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4158
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4159
    <path name="fields" count="many" accepts="HMI_INT,HMI_REAL,HMI_STRING,HMI_BOOL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4160
      <xsl:text>variables to be displayed</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4161
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4162
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4163
  <xsl:template match="widget[@type='Display']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4164
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4165
    <xsl:text>DisplayWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4166
    <xsl:text> extends Widget{
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4167
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4168
    <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
  4169
</xsl:text>
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  4170
    <xsl:text>    dispatch(value, oldval, index) {
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  4171
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4172
    <xsl:text>        this.fields[index] = value;
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4173
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4174
    <xsl:text>        if(!this.ready){
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4175
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4176
    <xsl:text>            this.readyfields[index] = true;
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4177
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4178
    <xsl:text>            this.ready = this.readyfields.every(x=&gt;x);
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4179
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4180
    <xsl:text>        }
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  4181
</xsl:text>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4182
    <xsl:text>        this.request_animate();
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4183
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4184
    <xsl:text>    }
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4185
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4186
    <xsl:text>}
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4187
</xsl:text>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4188
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4189
  <xsl:template match="widget[@type='Display']" mode="widget_defs">
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
  4190
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4191
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4192
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4193
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4194
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4195
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4196
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4197
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4198
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4199
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4200
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  4201
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4202
    <xsl:variable name="format">
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4203
      <xsl:call-template name="defs_by_labels">
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4204
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4205
        <xsl:with-param name="labels">
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4206
          <xsl:text>format</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4207
        </xsl:with-param>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4208
        <xsl:with-param name="mandatory" select="'no'"/>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4209
      </xsl:call-template>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4210
    </xsl:variable>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4211
    <xsl:variable name="has_format" select="string-length($format)&gt;0"/>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4212
    <xsl:value-of select="$format"/>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4213
    <xsl:if test="$hmi_element[not(self::svg:text)] and not($has_format)">
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4214
      <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
  4215
        <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
  4216
        <xsl:value-of select="$hmi_element/@id"/>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4217
        <xsl:text>" must be a svg::text element itself or a group containing a svg:text element labelled "format"</xsl:text>
2998
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4218
      </xsl:message>
e8f707d99dc3 SVGHMI: Update Widget Display templates to generate Class based declaration.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2997
diff changeset
  4219
    </xsl:if>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4220
    <xsl:variable name="field_initializer">
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4221
      <xsl:for-each select="path">
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4222
        <xsl:choose>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4223
          <xsl:when test="@type='HMI_STRING'">
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4224
            <xsl:text>""</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4225
          </xsl:when>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4226
          <xsl:otherwise>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4227
            <xsl:text>0</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  4228
          </xsl:otherwise>
3022
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4229
        </xsl:choose>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4230
        <xsl:if test="position()!=last()">
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4231
          <xsl:text>,</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4232
        </xsl:if>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4233
      </xsl:for-each>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4234
    </xsl:variable>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4235
    <xsl:text>    fields: [</xsl:text>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4236
    <xsl:value-of select="$field_initializer"/>
f6fe42b7ce60 SVGHMI: finished initial implementation of PAGE_LOCAL and HMI_LOCAL variables.
Edouard Tisserant
parents: 3017
diff changeset
  4237
    <xsl:text>],
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  4238
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4239
    <xsl:variable name="readyfield_initializer">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4240
      <xsl:for-each select="path">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4241
        <xsl:text>false</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4242
        <xsl:if test="position()!=last()">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4243
          <xsl:text>,</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4244
        </xsl:if>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4245
      </xsl:for-each>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4246
    </xsl:variable>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4247
    <xsl:text>    readyfields: [</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4248
    <xsl:value-of select="$readyfield_initializer"/>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4249
    <xsl:text>],
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4250
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4251
    <xsl:text>    ready: false,
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4252
</xsl:text>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4253
    <xsl:text>    animate: function(){
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4254
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4255
    <xsl:choose>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4256
      <xsl:when test="$has_format">
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4257
        <xsl:text>      if(this.format_elt.getAttribute("lang")) {
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4258
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4259
        <xsl:text>          this.format = svg_text_to_multiline(this.format_elt);
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4260
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4261
        <xsl:text>          this.format_elt.removeAttribute("lang");
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4262
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4263
        <xsl:text>      }
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4264
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4265
        <xsl:text>      let str = vsprintf(this.format,this.fields);
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4266
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4267
        <xsl:text>      multiline_to_svg_text(this.format_elt, str, !this.ready);
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4268
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4269
      </xsl:when>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4270
      <xsl:otherwise>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4271
        <xsl:text>      let str = this.args.length == 1 ? vsprintf(this.args[0],this.fields) : this.fields.join(' ');
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4272
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4273
        <xsl:text>      multiline_to_svg_text(this.element, str, !this.ready);
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4274
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4275
      </xsl:otherwise>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4276
    </xsl:choose>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4277
    <xsl:text>    },
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4278
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4279
    <xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4280
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4281
    <xsl:text>    init: function() {
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4282
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4283
    <xsl:if test="$has_format">
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4284
      <xsl:text>      this.format = svg_text_to_multiline(this.format_elt);
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4285
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  4286
    </xsl:if>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4287
    <xsl:text>      this.animate();
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4288
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4289
    <xsl:text>    },
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  4290
</xsl:text>
3008
dabad70db1bf SVGHMI: allow multiple variables and formatting in Display widget. Formatting is printf style and given as first argument. If no formating is given as widget argument, space separated.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
  4291
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4292
  <xsl:template match="widget[@type='DropDown']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4293
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4294
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4295
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4296
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4297
      <xsl:text>DropDown widget let user select an entry in a list of texts, given as
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4298
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4299
      <xsl:text>arguments. Single variable path is index of selection.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4300
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4301
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4302
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4303
      <xsl:text>It needs "text" (svg:text or svg:use referring to svg:text),
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4304
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4305
      <xsl:text>"box" (svg:rect), "button" (svg:*), and "highlight" (svg:rect)
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4306
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4307
      <xsl:text>labeled elements.
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4308
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4309
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4310
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4311
      <xsl:text>When user clicks on "button", "text" is duplicated to display enties in the
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4312
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4313
      <xsl:text>limit of available space in page, and "box" is extended to contain all
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4314
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4315
      <xsl:text>texts. "highlight" is moved over pre-selected entry.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4316
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4317
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4318
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4319
      <xsl:text>When only one argument is given and argment contains "#langs" then list of
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4320
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4321
      <xsl:text>texts is automatically set to the human-readable list of supported
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4322
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4323
      <xsl:text>languages by this HMI. 
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4324
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4325
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4326
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4327
      <xsl:text>If "text" labeled element is of type svg:use and refers to a svg:text 
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4328
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4329
      <xsl:text>element part of a TextList widget, no argument is expected. In that case
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4330
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4331
      <xsl:text>list of texts is set to TextList content.
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4332
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4333
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4334
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4335
      <xsl:text>Let user select text entry in a drop-down menu</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4336
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4337
    <arg name="entries" count="many" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4338
      <xsl:text>drop-down menu entries</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4339
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4340
    <path name="selection" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4341
      <xsl:text>selection index</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4342
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  4343
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4344
  <xsl:template match="widget[@type='DropDown']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4345
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4346
    <xsl:text>DropDownWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4347
    <xsl:text> extends Widget{
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4348
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4349
    <xsl:text>        dispatch(value) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4350
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4351
    <xsl:text>            if(!this.opened) this.set_selection(value);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4352
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4353
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4354
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4355
    <xsl:text>        init() {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4356
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4357
    <xsl:text>            this.init_specific();
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4358
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4359
    <xsl:text>            this.button_elt.onclick = this.on_button_click.bind(this);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4360
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4361
    <xsl:text>            // Save original size of rectangle
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4362
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4363
    <xsl:text>            this.box_bbox = this.box_elt.getBBox()
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4364
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4365
    <xsl:text>            this.highlight_bbox = this.highlight_elt.getBBox()
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4366
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4367
    <xsl:text>            this.highlight_elt.style.visibility = "hidden";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4368
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4369
    <xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4370
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4371
    <xsl:text>            // Compute margins
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4372
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4373
    <xsl:text>            this.text_bbox = this.text_elt.getBBox();
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4374
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4375
    <xsl:text>            let lmargin = this.text_bbox.x - this.box_bbox.x;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4376
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4377
    <xsl:text>            let tmargin = this.text_bbox.y - this.box_bbox.y;
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4378
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4379
    <xsl:text>            this.margins = [lmargin, tmargin].map(x =&gt; Math.max(x,0));
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4380
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4381
    <xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4382
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4383
    <xsl:text>            // Index of first visible element in the menu, when opened
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4384
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4385
    <xsl:text>            this.menu_offset = 0;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4386
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4387
    <xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4388
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4389
    <xsl:text>            // How mutch to lift the menu vertically so that it does not cross bottom border
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4390
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4391
    <xsl:text>            this.lift = 0;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4392
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4393
    <xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4394
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4395
    <xsl:text>            // Event handlers cannot be object method ('this' is unknown)
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4396
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4397
    <xsl:text>            // as a workaround, handler given to addEventListener is bound in advance.
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4398
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4399
    <xsl:text>            this.bound_close_on_click_elsewhere = this.close_on_click_elsewhere.bind(this);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4400
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4401
    <xsl:text>            this.bound_on_selection_click = this.on_selection_click.bind(this);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4402
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4403
    <xsl:text>            this.bound_on_backward_click = this.on_backward_click.bind(this);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4404
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4405
    <xsl:text>            this.bound_on_forward_click = this.on_forward_click.bind(this);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4406
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4407
    <xsl:text>            this.opened = false;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4408
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4409
    <xsl:text>            this.clickables = [];
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4410
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4411
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4412
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4413
    <xsl:text>        on_button_click() {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4414
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4415
    <xsl:text>            this.open();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4416
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4417
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4418
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4419
    <xsl:text>        // Called when a menu entry is clicked
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4420
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4421
    <xsl:text>        on_selection_click(selection) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4422
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4423
    <xsl:text>            this.close();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4424
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4425
    <xsl:text>            this.apply_hmi_value(0, selection);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4426
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4427
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4428
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4429
    <xsl:text>        on_backward_click(){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4430
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4431
    <xsl:text>            this.scroll(false);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4432
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4433
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4434
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4435
    <xsl:text>        on_forward_click(){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4436
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4437
    <xsl:text>            this.scroll(true);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4438
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4439
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4440
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4441
    <xsl:text>        set_selection(value) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4442
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4443
    <xsl:text>            let display_str;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4444
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4445
    <xsl:text>            if(value &gt;= 0 &amp;&amp; value &lt; this.content.length){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4446
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4447
    <xsl:text>                // if valid selection resolve content
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4448
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4449
    <xsl:text>                display_str = gettext(this.content[value]);
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4450
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4451
    <xsl:text>                this.last_selection = value;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4452
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4453
    <xsl:text>            } else {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4454
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4455
    <xsl:text>                // otherwise show problem
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4456
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4457
    <xsl:text>                display_str = "?"+String(value)+"?";
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4458
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4459
    <xsl:text>            }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4460
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4461
    <xsl:text>            // It is assumed that first span always stays,
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4462
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4463
    <xsl:text>            // and contains selection when menu is closed
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4464
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4465
    <xsl:text>            this.text_elt.firstElementChild.textContent = display_str;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4466
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4467
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4468
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4469
    <xsl:text>        grow_text(up_to) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4470
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4471
    <xsl:text>            let count = 1;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4472
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4473
    <xsl:text>            let txt = this.text_elt;
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4474
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4475
    <xsl:text>            let first = txt.firstElementChild;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4476
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4477
    <xsl:text>            // Real world (pixels) boundaries of current page
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4478
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4479
    <xsl:text>            let bounds = svg_root.getBoundingClientRect();
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4480
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4481
    <xsl:text>            this.lift = 0;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4482
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4483
    <xsl:text>            while(count &lt; up_to) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4484
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4485
    <xsl:text>                let next = first.cloneNode();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4486
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4487
    <xsl:text>                // relative line by line text flow instead of absolute y coordinate
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4488
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4489
    <xsl:text>                next.removeAttribute("y");
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4490
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4491
    <xsl:text>                next.setAttribute("dy", "1.1em");
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4492
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4493
    <xsl:text>                // default content to allow computing text element bbox
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4494
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4495
    <xsl:text>                next.textContent = "...";
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4496
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4497
    <xsl:text>                // append new span to text element
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4498
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4499
    <xsl:text>                txt.appendChild(next);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4500
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4501
    <xsl:text>                // now check if text extended by one row fits to page
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4502
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4503
    <xsl:text>                // FIXME : exclude margins to be more accurate on box size
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4504
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4505
    <xsl:text>                let rect = txt.getBoundingClientRect();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4506
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4507
    <xsl:text>                if(rect.bottom &gt; bounds.bottom){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4508
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4509
    <xsl:text>                    // in case of overflow at the bottom, lift up one row
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4510
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4511
    <xsl:text>                    let backup = first.getAttribute("dy");
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4512
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4513
    <xsl:text>                    // apply lift as a dy added too first span (y attrib stays)
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4514
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4515
    <xsl:text>                    first.setAttribute("dy", "-"+String((this.lift+1)*1.1)+"em");
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4516
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4517
    <xsl:text>                    rect = txt.getBoundingClientRect();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4518
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4519
    <xsl:text>                    if(rect.top &gt; bounds.top){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4520
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4521
    <xsl:text>                        this.lift += 1;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4522
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4523
    <xsl:text>                    } else {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4524
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4525
    <xsl:text>                        // if it goes over the top, then backtrack
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4526
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4527
    <xsl:text>                        // restore dy attribute on first span
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4528
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4529
    <xsl:text>                        if(backup)
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4530
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4531
    <xsl:text>                            first.setAttribute("dy", backup);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4532
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4533
    <xsl:text>                        else
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4534
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4535
    <xsl:text>                            first.removeAttribute("dy");
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4536
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4537
    <xsl:text>                        // remove unwanted child
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4538
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4539
    <xsl:text>                        txt.removeChild(next);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4540
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4541
    <xsl:text>                        return count;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4542
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4543
    <xsl:text>                    }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4544
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4545
    <xsl:text>                }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4546
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4547
    <xsl:text>                count++;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4548
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4549
    <xsl:text>            }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4550
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4551
    <xsl:text>            return count;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4552
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4553
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4554
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4555
    <xsl:text>        close_on_click_elsewhere(e) {
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4556
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4557
    <xsl:text>            // inhibit events not targetting spans (menu items)
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4558
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4559
    <xsl:text>            if([this.text_elt, this.element].indexOf(e.target.parentNode) == -1){
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4560
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4561
    <xsl:text>                e.stopPropagation();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4562
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4563
    <xsl:text>                // close menu in case click is outside box
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4564
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4565
    <xsl:text>                if(e.target !== this.box_elt)
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4566
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4567
    <xsl:text>                    this.close();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4568
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4569
    <xsl:text>            }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4570
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4571
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4572
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4573
    <xsl:text>        close(){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4574
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4575
    <xsl:text>            // Stop hogging all click events
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4576
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4577
    <xsl:text>            svg_root.removeEventListener("pointerdown", this.numb_event, true);
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4578
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4579
    <xsl:text>            svg_root.removeEventListener("pointerup", this.numb_event, true);
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4580
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4581
    <xsl:text>            svg_root.removeEventListener("click", this.bound_close_on_click_elsewhere, true);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4582
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4583
    <xsl:text>            // Restore position and sixe of widget elements
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4584
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4585
    <xsl:text>            this.reset_text();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4586
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4587
    <xsl:text>            this.reset_clickables();
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4588
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4589
    <xsl:text>            this.reset_box();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4590
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4591
    <xsl:text>            this.reset_highlight();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4592
</xsl:text>
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4593
    <xsl:text>            // Put the button back in place
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4594
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4595
    <xsl:text>            this.element.appendChild(this.button_elt);
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4596
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4597
    <xsl:text>            // Mark as closed (to allow dispatch)
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4598
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4599
    <xsl:text>            this.opened = false;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4600
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4601
    <xsl:text>            // Dispatch last cached value
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4602
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4603
    <xsl:text>            this.apply_cache();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4604
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4605
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4606
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4607
    <xsl:text>        // Make item (text span) clickable by overlaying a rectangle on top of it
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4608
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4609
    <xsl:text>        make_clickable(span, func) {
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4610
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4611
    <xsl:text>            let txt = this.text_elt;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4612
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4613
    <xsl:text>            let original_text_y = this.text_bbox.y;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4614
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4615
    <xsl:text>            let highlight = this.highlight_elt;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4616
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4617
    <xsl:text>            let original_h_y = this.highlight_bbox.y;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4618
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4619
    <xsl:text>            let clickable = highlight.cloneNode();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4620
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4621
    <xsl:text>            let yoffset = span.getBBox().y - original_text_y;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4622
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4623
    <xsl:text>            clickable.y.baseVal.value = original_h_y + yoffset;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4624
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4625
    <xsl:text>            clickable.style.pointerEvents = "bounding-box";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4626
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4627
    <xsl:text>            //clickable.style.visibility = "hidden";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4628
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4629
    <xsl:text>            //clickable.onclick = () =&gt; alert("love JS");
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4630
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4631
    <xsl:text>            clickable.onclick = func;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4632
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4633
    <xsl:text>            this.element.appendChild(clickable);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4634
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4635
    <xsl:text>            this.clickables.push(clickable)
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4636
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4637
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4638
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4639
    <xsl:text>        reset_clickables() {
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4640
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4641
    <xsl:text>            while(this.clickables.length){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4642
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4643
    <xsl:text>                this.element.removeChild(this.clickables.pop());
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4644
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4645
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4646
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4647
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4648
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4649
    <xsl:text>        // Set text content when content is smaller than menu (no scrolling)
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4650
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4651
    <xsl:text>        set_complete_text(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4652
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4653
    <xsl:text>            let spans = this.text_elt.children;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4654
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4655
    <xsl:text>            let c = 0;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4656
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4657
    <xsl:text>            for(let item of this.content){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4658
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4659
    <xsl:text>                let span=spans[c];
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4660
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4661
    <xsl:text>                span.textContent = gettext(item);
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4662
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4663
    <xsl:text>                let sel = c;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4664
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4665
    <xsl:text>                this.make_clickable(span, (evt) =&gt; this.bound_on_selection_click(sel));
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4666
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4667
    <xsl:text>                c++;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4668
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4669
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4670
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4671
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4672
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4673
    <xsl:text>        // Move partial view :
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4674
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4675
    <xsl:text>        // false : upward, lower value
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4676
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4677
    <xsl:text>        // true  : downward, higher value
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4678
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4679
    <xsl:text>        scroll(forward){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4680
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4681
    <xsl:text>            let contentlength = this.content.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4682
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4683
    <xsl:text>            let spans = this.text_elt.children;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4684
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4685
    <xsl:text>            let spanslength = spans.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4686
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4687
    <xsl:text>            // reduce accounted menu size according to prsence of scroll buttons
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4688
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4689
    <xsl:text>            // since we scroll there is necessarly one button
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4690
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4691
    <xsl:text>            spanslength--;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4692
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4693
    <xsl:text>            if(forward){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4694
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4695
    <xsl:text>                // reduce accounted menu size because of back button
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4696
</xsl:text>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4697
    <xsl:text>                // in current view
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4698
</xsl:text>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4699
    <xsl:text>                if(this.menu_offset &gt; 0) spanslength--;
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4700
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4701
    <xsl:text>                this.menu_offset = Math.min(
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4702
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4703
    <xsl:text>                    contentlength - spans.length + 1,
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4704
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4705
    <xsl:text>                    this.menu_offset + spanslength);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4706
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4707
    <xsl:text>            }else{
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4708
</xsl:text>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4709
    <xsl:text>                // reduce accounted menu size because of back button
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4710
</xsl:text>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4711
    <xsl:text>                // in view once scrolled
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  4712
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4713
    <xsl:text>                if(this.menu_offset - spanslength &gt; 0) spanslength--;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4714
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4715
    <xsl:text>                this.menu_offset = Math.max(
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4716
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4717
    <xsl:text>                    0,
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4718
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4719
    <xsl:text>                    this.menu_offset - spanslength);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4720
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4721
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4722
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4723
    <xsl:text>            if(this.menu_offset == 1)
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4724
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4725
    <xsl:text>                this.menu_offset = 0;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4726
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4727
    <xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4728
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4729
    <xsl:text>            this.reset_highlight();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4730
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4731
    <xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4732
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4733
    <xsl:text>            this.reset_clickables();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4734
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4735
    <xsl:text>            this.set_partial_text();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4736
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4737
    <xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4738
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4739
    <xsl:text>            this.highlight_selection();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4740
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4741
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4742
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4743
    <xsl:text>        // Setup partial view text content
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4744
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4745
    <xsl:text>        // with jumps at first and last entry when appropriate
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4746
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4747
    <xsl:text>        set_partial_text(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4748
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4749
    <xsl:text>            let spans = this.text_elt.children;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4750
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4751
    <xsl:text>            let contentlength = this.content.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4752
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4753
    <xsl:text>            let spanslength = spans.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4754
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4755
    <xsl:text>            let i = this.menu_offset, c = 0;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4756
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4757
    <xsl:text>            let m = this.box_bbox;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4758
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4759
    <xsl:text>            while(c &lt; spanslength){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4760
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4761
    <xsl:text>                let span=spans[c];
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4762
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4763
    <xsl:text>                let onclickfunc;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4764
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4765
    <xsl:text>                // backward jump only present if not exactly at start
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4766
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4767
    <xsl:text>                if(c == 0 &amp;&amp; i != 0){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4768
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4769
    <xsl:text>                    span.textContent = "&#x25B2;";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4770
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4771
    <xsl:text>                    onclickfunc = this.bound_on_backward_click;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4772
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4773
    <xsl:text>                    let o = span.getBBox();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4774
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4775
    <xsl:text>                    span.setAttribute("dx", (m.width - o.width)/2);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4776
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4777
    <xsl:text>                // presence of forward jump when not right at the end
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4778
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4779
    <xsl:text>                }else if(c == spanslength-1 &amp;&amp; i &lt; contentlength - 1){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4780
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4781
    <xsl:text>                    span.textContent = "&#x25BC;";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4782
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4783
    <xsl:text>                    onclickfunc = this.bound_on_forward_click;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4784
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4785
    <xsl:text>                    let o = span.getBBox();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4786
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4787
    <xsl:text>                    span.setAttribute("dx", (m.width - o.width)/2);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4788
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4789
    <xsl:text>                // otherwise normal content
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4790
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4791
    <xsl:text>                }else{
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4792
</xsl:text>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  4793
    <xsl:text>                    span.textContent = gettext(this.content[i]);
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4794
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4795
    <xsl:text>                    let sel = i;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4796
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4797
    <xsl:text>                    onclickfunc = (evt) =&gt; this.bound_on_selection_click(sel);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4798
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4799
    <xsl:text>                    span.removeAttribute("dx");
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4800
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4801
    <xsl:text>                    i++;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4802
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4803
    <xsl:text>                }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4804
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4805
    <xsl:text>                this.make_clickable(span, onclickfunc);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4806
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4807
    <xsl:text>                c++;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4808
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4809
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4810
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4811
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4812
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4813
    <xsl:text>        numb_event(e) {
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4814
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4815
    <xsl:text>             e.stopPropagation();
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4816
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4817
    <xsl:text>        }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4818
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4819
    <xsl:text>        open(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4820
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4821
    <xsl:text>            let length = this.content.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4822
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4823
    <xsl:text>            // systematically reset text, to strip eventual whitespace spans
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4824
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4825
    <xsl:text>            this.reset_text();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4826
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4827
    <xsl:text>            // grow as much as needed or possible
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4828
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4829
    <xsl:text>            let slots = this.grow_text(length);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4830
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4831
    <xsl:text>            // Depending on final size
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4832
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4833
    <xsl:text>            if(slots == length) {
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4834
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4835
    <xsl:text>                // show all at once
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4836
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4837
    <xsl:text>                this.set_complete_text();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4838
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4839
    <xsl:text>            } else {
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4840
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4841
    <xsl:text>                // eventualy align menu to current selection, compensating for lift
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4842
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4843
    <xsl:text>                let offset = this.last_selection - this.lift;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4844
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4845
    <xsl:text>                if(offset &gt; 0)
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4846
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4847
    <xsl:text>                    this.menu_offset = Math.min(offset + 1, length - slots + 1);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4848
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4849
    <xsl:text>                else
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4850
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4851
    <xsl:text>                    this.menu_offset = 0;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4852
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4853
    <xsl:text>                // show surrounding values
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4854
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4855
    <xsl:text>                this.set_partial_text();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4856
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4857
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4858
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4859
    <xsl:text>            // Now that text size is known, we can set the box around it
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4860
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4861
    <xsl:text>            this.adjust_box_to_text();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4862
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4863
    <xsl:text>            // Take button out until menu closed
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4864
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4865
    <xsl:text>            this.element.removeChild(this.button_elt);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4866
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4867
    <xsl:text>            // Rise widget to top by moving it to last position among siblings
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4868
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4869
    <xsl:text>            this.element.parentNode.appendChild(this.element.parentNode.removeChild(this.element));
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4870
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4871
    <xsl:text>            // disable interaction with background
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4872
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4873
    <xsl:text>            svg_root.addEventListener("pointerdown", this.numb_event, true);
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4874
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  4875
    <xsl:text>            svg_root.addEventListener("pointerup", this.numb_event, true);
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4876
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4877
    <xsl:text>            svg_root.addEventListener("click", this.bound_close_on_click_elsewhere, true);
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4878
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4879
    <xsl:text>            this.highlight_selection();
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4880
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4881
    <xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4882
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4883
    <xsl:text>            // mark as open
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4884
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4885
    <xsl:text>            this.opened = true;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4886
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4887
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4888
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4889
    <xsl:text>        // Put text element in normalized state
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4890
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4891
    <xsl:text>        reset_text(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4892
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4893
    <xsl:text>            let txt = this.text_elt;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4894
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4895
    <xsl:text>            let first = txt.firstElementChild;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4896
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4897
    <xsl:text>            // remove attribute eventually added to first text line while opening
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4898
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4899
    <xsl:text>            first.onclick = null;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4900
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4901
    <xsl:text>            first.removeAttribute("dy");
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4902
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4903
    <xsl:text>            first.removeAttribute("dx");
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4904
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4905
    <xsl:text>            // keep only the first line of text
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4906
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4907
    <xsl:text>            for(let span of Array.from(txt.children).slice(1)){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4908
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4909
    <xsl:text>                txt.removeChild(span)
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4910
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4911
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4912
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4913
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4914
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4915
    <xsl:text>        // Put rectangle element in saved original state
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4916
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4917
    <xsl:text>        reset_box(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4918
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4919
    <xsl:text>            let m = this.box_bbox;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4920
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4921
    <xsl:text>            let b = this.box_elt;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4922
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4923
    <xsl:text>            b.x.baseVal.value = m.x;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4924
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4925
    <xsl:text>            b.y.baseVal.value = m.y;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4926
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4927
    <xsl:text>            b.width.baseVal.value = m.width;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4928
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4929
    <xsl:text>            b.height.baseVal.value = m.height;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4930
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4931
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4932
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4933
    <xsl:text>        highlight_selection(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4934
</xsl:text>
3128
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  4935
    <xsl:text>            if(this.last_selection == undefined) return;
32a4675af377 SVGHMI: Added HMI:VarInitPersistent to initialize persistent HMI_LOCAL and PAGE_LOCAL variables, stored as cookies in browser.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3124
diff changeset
  4936
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4937
    <xsl:text>            let highlighted_row = this.last_selection - this.menu_offset;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4938
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4939
    <xsl:text>            if(highlighted_row &lt; 0) return;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4940
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4941
    <xsl:text>            let spans = this.text_elt.children;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4942
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4943
    <xsl:text>            let spanslength = spans.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4944
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4945
    <xsl:text>            let contentlength = this.content.length;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4946
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4947
    <xsl:text>            if(this.menu_offset != 0) {
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4948
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4949
    <xsl:text>                spanslength--;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4950
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4951
    <xsl:text>                highlighted_row++;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4952
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4953
    <xsl:text>            }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4954
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4955
    <xsl:text>            if(this.menu_offset + spanslength &lt; contentlength - 1) spanslength--;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4956
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4957
    <xsl:text>            if(highlighted_row &gt; spanslength) return;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4958
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4959
    <xsl:text>            let original_text_y = this.text_bbox.y;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4960
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4961
    <xsl:text>            let highlight = this.highlight_elt;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4962
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4963
    <xsl:text>            let span = spans[highlighted_row];
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4964
</xsl:text>
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4965
    <xsl:text>            let yoffset = span.getBBox().y - original_text_y;
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4966
</xsl:text>
3092
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4967
    <xsl:text>            highlight.y.baseVal.value = this.highlight_bbox.y + yoffset;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4968
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4969
    <xsl:text>            highlight.style.visibility = "visible";
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4970
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4971
    <xsl:text>        }
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4972
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4973
    <xsl:text>        reset_highlight(){
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4974
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4975
    <xsl:text>            let highlight = this.highlight_elt;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4976
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4977
    <xsl:text>            highlight.y.baseVal.value = this.highlight_bbox.y;
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4978
</xsl:text>
96ffd8b1b016 SVGHMI: added dropdown selection highlighting and fixed scrolling so that it doesn't miss any entry while jumping from one page to the other.
Edouard Tisserant
parents: 3091
diff changeset
  4979
    <xsl:text>            highlight.style.visibility = "hidden";
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4980
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4981
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4982
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4983
    <xsl:text>        // Use margin and text size to compute box size
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4984
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4985
    <xsl:text>        adjust_box_to_text(){
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4986
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4987
    <xsl:text>            let [lmargin, tmargin] = this.margins;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4988
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4989
    <xsl:text>            let m = this.text_elt.getBBox();
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4990
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4991
    <xsl:text>            let b = this.box_elt;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4992
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4993
    <xsl:text>            // b.x.baseVal.value = m.x - lmargin;
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4994
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4995
    <xsl:text>            b.y.baseVal.value = m.y - tmargin;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4996
</xsl:text>
3091
f475f39713aa SVGHMI: change scroll buttons into single unicode triangle and center them. Use highlight rectangle duplicated and hidden to catch selection clicks so that the whole row is clickable.
Edouard Tisserant
parents: 3090
diff changeset
  4997
    <xsl:text>            // b.width.baseVal.value = 2 * lmargin + m.width;
3090
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4998
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  4999
    <xsl:text>            b.height.baseVal.value = 2 * tmargin + m.height;
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  5000
</xsl:text>
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  5001
    <xsl:text>        }
9e172e4e50c7 SVGHMI: DropDown widget now using new class based style
Edouard Tisserant
parents: 3085
diff changeset
  5002
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5003
    <xsl:text>}
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5004
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5005
  </xsl:template>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5006
  <xsl:template match="widget[@type='DropDown']" mode="widget_defs">
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5007
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5008
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5009
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5010
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5011
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5012
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5013
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5014
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5015
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5016
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5017
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5018
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5019
    <xsl:call-template name="defs_by_labels">
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5020
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5021
      <xsl:with-param name="labels">
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5022
        <xsl:text>box button highlight</xsl:text>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5023
      </xsl:with-param>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5024
    </xsl:call-template>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5025
    <xsl:variable name="text_elt" select="$hmi_element//*[@inkscape:label='text'][1]"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5026
    <xsl:text>init_specific: function() {
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5027
</xsl:text>
3134
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5028
    <xsl:choose>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5029
      <xsl:when test="count(arg) = 1 and arg[1]/@value = '#langs'">
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5030
        <xsl:text>  this.text_elt = id("</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5031
        <xsl:value-of select="$text_elt/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5032
        <xsl:text>");
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5033
</xsl:text>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  5034
        <xsl:text>  this.content = langs.map(([lname,lcode]) =&gt; lname);
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5035
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5036
      </xsl:when>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5037
      <xsl:when test="count(arg) = 0">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5038
        <xsl:if test="not($text_elt[self::svg:use])">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5039
          <xsl:message terminate="yes">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5040
            <xsl:text>No argrument for HMI:DropDown widget id="</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5041
            <xsl:value-of select="$hmi_element/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5042
            <xsl:text>" and "text" labeled element is not a svg:use element</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5043
          </xsl:message>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5044
        </xsl:if>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5045
        <xsl:variable name="real_text_elt" select="$result_widgets[@id = $hmi_element/@id]//*[@original=$text_elt/@id]/svg:text"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5046
        <xsl:text>  this.text_elt = id("</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5047
        <xsl:value-of select="$real_text_elt/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5048
        <xsl:text>");
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5049
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5050
        <xsl:variable name="from_list_id" select="substring-after($text_elt/@xlink:href,'#')"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5051
        <xsl:variable name="from_list" select="$hmi_textlists[(@id | */@id) = $from_list_id]"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5052
        <xsl:if test="count($from_list) = 0">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5053
          <xsl:message terminate="yes">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5054
            <xsl:text>HMI:DropDown widget id="</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5055
            <xsl:value-of select="$hmi_element/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5056
            <xsl:text>" "text" labeled element does not point to a svg:text owned by a HMI:List widget</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5057
          </xsl:message>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5058
        </xsl:if>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5059
        <xsl:text>  this.content = hmi_widgets["</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5060
        <xsl:value-of select="$from_list/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5061
        <xsl:text>"].texts;
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5062
</xsl:text>
3134
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5063
      </xsl:when>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5064
      <xsl:otherwise>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5065
        <xsl:text>  this.text_elt = id("</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5066
        <xsl:value-of select="$text_elt/@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5067
        <xsl:text>");
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5068
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5069
        <xsl:text>  this.content = [
3134
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5070
</xsl:text>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5071
        <xsl:for-each select="arg">
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5072
          <xsl:text>"</xsl:text>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5073
          <xsl:value-of select="@value"/>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5074
          <xsl:text>",
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5075
</xsl:text>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5076
        </xsl:for-each>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5077
        <xsl:text>  ];
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5078
</xsl:text>
3134
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5079
      </xsl:otherwise>
af558c9a5141 SVGHMI: Update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3128
diff changeset
  5080
    </xsl:choose>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5081
    <xsl:text>}
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5082
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5083
  </xsl:template>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5084
  <declarations:DropDown/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5085
  <xsl:template match="declarations:DropDown">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5086
    <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5087
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5088
    <xsl:text>/* </xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5089
    <xsl:value-of select="local-name()"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5090
    <xsl:text> */
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5091
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5092
    <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5093
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5094
    <xsl:text>function gettext(o) {
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5095
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5096
    <xsl:text>    if(typeof(o) == "string"){
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5097
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5098
    <xsl:text>        return o;
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5099
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5100
    <xsl:text>    }
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5101
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5102
    <xsl:text>    return svg_text_to_multiline(o);
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5103
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5104
    <xsl:text>};
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5105
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  5106
    <xsl:text>
2922
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5107
</xsl:text>
ddce4ebdf010 SVGHMI: intermediate commit while working on dropdown widget.
Edouard Tisserant
parents: 2921
diff changeset
  5108
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5109
  <xsl:template match="widget[@type='ForEach']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5110
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5111
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5112
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5113
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5114
      <xsl:text>ForEach widget is used to span a small set of widget over a larger set of
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5115
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5116
      <xsl:text>repeated HMI_NODEs. 
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5117
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5118
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5119
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5120
      <xsl:text>Idea is somewhat similar to relative page, but it all happens inside the
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5121
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5122
      <xsl:text>ForEach widget, no page involved.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5123
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5124
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5125
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5126
      <xsl:text>Together with relative Jump widgets it can be used to build a menu to reach
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5127
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5128
      <xsl:text>relative pages covering many identical HMI_NODES siblings.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5129
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5130
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5131
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5132
      <xsl:text>ForEach widget takes a HMI_CLASS name as argument and a HMI_NODE path as
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5133
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5134
      <xsl:text>variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5135
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5136
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5137
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5138
      <xsl:text>Direct sub-elements can be either groups of widget to be spanned, labeled
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5139
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5140
      <xsl:text>"ClassName:offset", or buttons to control the spanning, labeled
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5141
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5142
      <xsl:text>"ClassName:+/-number".
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5143
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5144
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5145
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5146
      <xsl:text>span widgets over a set of repeated HMI_NODEs</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5147
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5148
    <arg name="class_name" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5149
      <xsl:text>HMI_CLASS name</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5150
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5151
    <path name="root" accepts="HMI_NODE">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5152
      <xsl:text> where to find HMI_NODEs whose HMI_CLASS is class_name</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5153
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5154
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5155
  <xsl:template match="widget[@type='ForEach']" mode="widget_defs">
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5156
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5157
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5158
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5159
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5160
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5161
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5162
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5163
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5164
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5165
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5166
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5167
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
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
  5168
    <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
  5169
      <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
  5170
        <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
  5171
        <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
  5172
        <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
  5173
      </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
  5174
    </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
  5175
    <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
  5176
      <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
  5177
        <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
  5178
        <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
  5179
        <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
  5180
      </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
  5181
    </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
  5182
    <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
  5183
    <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
  5184
    <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
  5185
    <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
  5186
    <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
  5187
    <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
  5188
    <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
  5189
    <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
  5190
</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
  5191
    <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
  5192
      <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
  5193
      <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
  5194
      <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
  5195
        <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
  5196
      </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
  5197
      <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
  5198
</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
  5199
    </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
  5200
    <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
  5201
</xsl:text>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  5202
    <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
  5203
</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
  5204
    <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
  5205
    <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
  5206
    <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
  5207
    <xsl:for-each select="$buttons">
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  5208
      <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
  5209
      <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
  5210
      <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
  5211
      <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
  5212
      <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
  5213
      <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
  5214
      <xsl:value-of select="$op"/>
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  5215
      <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
  5216
</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
  5217
    </xsl:for-each>
2896
99c5335ed59f SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2895
diff changeset
  5218
    <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
  5219
</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
  5220
    <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
  5221
</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
  5222
    <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
  5223
    <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
  5224
    <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
  5225
      <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
  5226
      <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
  5227
      <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
  5228
      <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
  5229
      <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
  5230
      <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
  5231
      <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
  5232
      <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
  5233
      <xsl:text>" */
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5234
</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
  5235
      <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
  5236
        <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
  5237
          <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
  5238
          <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
  5239
          <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
  5240
          <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
  5241
        </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
  5242
      </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
  5243
      <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
  5244
        <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
  5245
          <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
  5246
            <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
  5247
            <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
  5248
            <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
  5249
            <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
  5250
            <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
  5251
            <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
  5252
            <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
  5253
            <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
  5254
            <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
  5255
          </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
  5256
        </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
  5257
        <xsl:text>            hmi_widgets["</xsl:text>
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5258
        <xsl:value-of select="@id"/>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5259
        <xsl:text>"]</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5260
        <xsl:if test="position()!=last()">
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5261
          <xsl:text>,</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5262
        </xsl:if>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5263
        <xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5264
</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5265
      </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
  5266
      <xsl:text>          ]</xsl:text>
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5267
      <xsl:if test="position()!=last()">
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5268
        <xsl:text>,</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5269
      </xsl:if>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5270
      <xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5271
</xsl:text>
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5272
    </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
  5273
    <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
  5274
</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
  5275
    <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
  5276
</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
  5277
    <xsl:text>    item_offset: 0,
2892
27dd409fba1d SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2890
diff changeset
  5278
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5279
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5280
  <xsl:template match="widget[@type='ForEach']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5281
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5282
    <xsl:text>ForEachWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5283
    <xsl:text> extends Widget{
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5284
</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
  5285
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5286
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5287
    <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
  5288
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5289
    <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
  5290
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5291
    <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
  5292
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5293
    <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
  5294
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5295
    <xsl:text>            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5296
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5297
    <xsl:text>        }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5298
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5299
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5300
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5301
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5302
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5303
    <xsl:text>    unsub(){
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5304
</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
  5305
    <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
  5306
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5307
    <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
  5308
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5309
    <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
  5310
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5311
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5312
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5313
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5314
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5315
    <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
  5316
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5317
    <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
  5318
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5319
    <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
  5320
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5321
    <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
  5322
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5323
    <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
  5324
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5325
    <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
  5326
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5327
    <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
  5328
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5329
    <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
  5330
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5331
    <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
  5332
</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
  5333
    <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
  5334
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5335
    <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
  5336
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5337
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5338
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5339
    <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
  5340
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5341
    <xsl:text>                */
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5342
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5343
    <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
  5344
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5345
    <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
  5346
</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
  5347
    <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
  5348
</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
  5349
    <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
  5350
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5351
    <xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5352
</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
  5353
    <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
  5354
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5355
    <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
  5356
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5357
    <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
  5358
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5359
    <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
  5360
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5361
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5362
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5363
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5364
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5365
    <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
  5366
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5367
    <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
  5368
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5369
    <xsl:text>    }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5370
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5371
    <xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5372
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5373
    <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
  5374
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5375
    <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
  5376
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5377
    <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
  5378
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5379
    <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
  5380
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5381
    <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
  5382
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5383
    <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
  5384
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5385
    <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
  5386
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5387
    <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
  5388
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5389
    <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
  5390
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5391
    <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
  5392
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5393
    <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
  5394
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5395
    <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
  5396
</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
  5397
    <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
  5398
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5399
    <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
  5400
</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
  5401
    <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
  5402
</xsl:text>
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3004
diff changeset
  5403
    <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
  5404
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5405
    <xsl:text>        update_subscriptions();
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5406
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5407
    <xsl:text>        this.apply_cache(); 
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5408
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5409
    <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
  5410
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5411
    <xsl:text>        requestHMIAnimation();
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5412
</xsl:text>
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  5413
    <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
  5414
</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
  5415
    <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
  5416
</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
  5417
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5418
  <xsl:template match="widget[@type='Input']" mode="widget_desc">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5419
    <type>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5420
      <xsl:value-of select="@type"/>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5421
    </type>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5422
    <longdesc>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5423
      <xsl:text>Input widget takes one variable path, and displays current value in
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5424
</xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5425
      <xsl:text>optional "value" labeled sub-element. 
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5426
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5427
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5428
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5429
      <xsl:text>Click on optional "edit" labeled element opens keypad to edit value.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5430
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5431
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5432
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5433
      <xsl:text>Operation on current value is performed when click on sub-elements with
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5434
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5435
      <xsl:text>label starting with '=', '+' or '-' sign. Value after sign is used as
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5436
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5437
      <xsl:text>operand.
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5438
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5439
    </longdesc>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5440
    <shortdesc>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5441
      <xsl:text>Input field with predefined operation buttons</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5442
    </shortdesc>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5443
    <arg name="format" accepts="string">
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5444
      <xsl:text>optional printf-like format </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5445
    </arg>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5446
    <path name="edit" accepts="HMI_INT, HMI_REAL, HMI_STRING">
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5447
      <xsl:text>single variable to edit</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5448
    </path>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5449
  </xsl:template>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5450
  <xsl:template match="widget[@type='Input']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5451
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5452
    <xsl:text>InputWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5453
    <xsl:text> extends Widget{
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5454
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5455
    <xsl:text>     on_op_click(opstr) {
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5456
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5457
    <xsl:text>         this.change_hmi_value(0, opstr);
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5458
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5459
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5460
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5461
    <xsl:text>     edit_callback(new_val) {
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5462
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5463
    <xsl:text>         this.apply_hmi_value(0, new_val);
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5464
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5465
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5466
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5467
    <xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5468
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5469
    <xsl:text>     is_inhibited = false;
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5470
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5471
    <xsl:text>     alert(msg){
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5472
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5473
    <xsl:text>         this.is_inhibited = true;
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5474
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5475
    <xsl:text>         this.display = msg;
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5476
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5477
    <xsl:text>         setTimeout(() =&gt; this.stopalert(), 1000);
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5478
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5479
    <xsl:text>         this.request_animate();
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5480
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5481
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5482
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5483
    <xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5484
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5485
    <xsl:text>     stopalert(){
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5486
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5487
    <xsl:text>         this.is_inhibited = false;
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5488
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5489
    <xsl:text>         this.display = this.last_value;
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5490
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5491
    <xsl:text>         this.request_animate();
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5492
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5493
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5494
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5495
    <xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5496
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5497
    <xsl:text>     overshot(new_val, max) {
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5498
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5499
    <xsl:text>         this.alert("max");
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5500
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5501
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5502
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5503
    <xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5504
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5505
    <xsl:text>     undershot(new_val, min) {
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5506
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5507
    <xsl:text>         this.alert("min");
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5508
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5509
    <xsl:text>     }
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5510
</xsl:text>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5511
    <xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5512
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5513
    <xsl:text>     display = "";
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5514
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5515
    <xsl:text>}
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5516
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5517
  </xsl:template>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5518
  <xsl:template match="widget[@type='Input']" mode="widget_defs">
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
  5519
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5520
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5521
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5522
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5523
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5524
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5525
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5526
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5527
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5528
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5529
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  5530
    <xsl:variable name="has_disability" select="string-length($disability)&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
  5531
    <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
  5532
      <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
  5533
        <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
  5534
        <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
  5535
          <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
  5536
        </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
  5537
        <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
  5538
      </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
  5539
    </xsl:variable>
2861
84c16ece8e10 SVGHMI: fixed repeated error when Input widget is missing 'value' element
Edouard Tisserant
parents: 2859
diff changeset
  5540
    <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
  5541
    <xsl:value-of select="$value_elt"/>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5542
    <xsl:variable name="edit_elt">
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5543
      <xsl:call-template name="defs_by_labels">
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5544
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5545
        <xsl:with-param name="labels">
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5546
          <xsl:text>edit</xsl:text>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5547
        </xsl:with-param>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5548
        <xsl:with-param name="mandatory" select="'no'"/>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5549
      </xsl:call-template>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5550
    </xsl:variable>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5551
    <xsl:variable name="have_edit" select="string-length($edit_elt)&gt;0"/>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5552
    <xsl:value-of select="$edit_elt"/>
3554
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5553
    <xsl:variable name="action_elements" select="$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]"/>
2861
84c16ece8e10 SVGHMI: fixed repeated error when Input widget is missing 'value' element
Edouard Tisserant
parents: 2859
diff changeset
  5554
    <xsl:if test="$have_value">
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  5555
      <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
  5556
</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
  5557
    </xsl:if>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  5558
    <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
  5559
</xsl:text>
3155
99ce78ddd353 SVGHMI: finally found why HMI:Input wasnt't initializing properly: vsprintf takes a list. Also, removed intermediate variable last_val, since edit_value() works on strings anyhow, and in case of formated floats, it is better to workl on already formated value.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3154
diff changeset
  5560
    <xsl:if test="$have_value or $have_edit">
3154
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5561
      <xsl:choose>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5562
        <xsl:when test="count(arg) = 1">
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5563
          <xsl:text>        this.last_value = vsprintf("</xsl:text>
3154
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5564
          <xsl:value-of select="arg[1]/@value"/>
3155
99ce78ddd353 SVGHMI: finally found why HMI:Input wasnt't initializing properly: vsprintf takes a list. Also, removed intermediate variable last_val, since edit_value() works on strings anyhow, and in case of formated floats, it is better to workl on already formated value.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3154
diff changeset
  5565
          <xsl:text>", [value]);
3154
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5566
</xsl:text>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5567
        </xsl:when>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5568
        <xsl:otherwise>
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5569
          <xsl:text>        this.last_value = value;
3154
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5570
</xsl:text>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5571
        </xsl:otherwise>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5572
      </xsl:choose>
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5573
      <xsl:text>        if(!this.is_inhibited){
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5574
</xsl:text>
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5575
      <xsl:text>            this.display = this.last_value;
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5576
</xsl:text>
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5577
      <xsl:if test="$have_value">
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5578
        <xsl:text>            this.request_animate();
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5579
</xsl:text>
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5580
      </xsl:if>
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5581
      <xsl:text>        }
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
  5582
</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
  5583
    </xsl:if>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  5584
    <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
  5585
</xsl:text>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5586
    <xsl:if test="$have_value">
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5587
      <xsl:text>    animate: function(){
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5588
</xsl:text>
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5589
      <xsl:text>        this.value_elt.textContent = String(this.display);
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5590
</xsl:text>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5591
      <xsl:text>    },
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5592
</xsl:text>
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  5593
    </xsl:if>
3554
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5594
    <xsl:for-each select="$action_elements">
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5595
      <xsl:text>    action_elt_</xsl:text>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5596
      <xsl:value-of select="position()"/>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5597
      <xsl:text>: id("</xsl:text>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5598
      <xsl:value-of select="@id"/>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5599
      <xsl:text>"),
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5600
</xsl:text>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5601
    </xsl:for-each>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  5602
    <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
  5603
</xsl:text>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5604
    <xsl:if test="$have_edit">
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
  5605
      <xsl:text>        this.edit_elt.onclick = () =&gt; edit_value("</xsl:text>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5606
      <xsl:value-of select="path/@value"/>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5607
      <xsl:text>", "</xsl:text>
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5608
      <xsl:value-of select="path/@type"/>
3188
c173452bf894 SVGHMI: Fixed problems happening when value is higher than maximum or lower than minimum in Input widget. "max" and "min" string was getting into keypad text field, was not diplayed systematically, and was staying forever sometime.
Edouard Tisserant
parents: 3187
diff changeset
  5609
      <xsl:text>", this, this.last_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
  5610
</xsl:text>
3154
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5611
      <xsl:if test="$have_value">
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5612
        <xsl:text>        this.value_elt.style.pointerEvents = "none";
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5613
</xsl:text>
a8c81a080588 SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3151
diff changeset
  5614
      </xsl:if>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5615
      <xsl:text>        this.animate();
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5616
</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
  5617
    </xsl:if>
3554
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5618
    <xsl:for-each select="$action_elements">
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5619
      <xsl:text>        this.action_elt_</xsl:text>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5620
      <xsl:value-of select="position()"/>
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  5621
      <xsl:text>.onclick = () =&gt; this.on_op_click("</xsl:text>
2829
4c2c50f60730 SVGHMI : HMI_STRING now also supported from HMI to PLC
Edouard Tisserant
parents: 2828
diff changeset
  5622
      <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
3094
3e184f1e1012 SVGHMI: almost rewrote Input widget to make it new class based style.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3092
diff changeset
  5623
      <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
  5624
</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
  5625
    </xsl:for-each>
3525
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5626
    <xsl:if test="$have_value">
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5627
      <xsl:text>        this.value_elt.textContent = "";
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5628
</xsl:text>
c2f7e9bda366 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3521
diff changeset
  5629
    </xsl:if>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  5630
    <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
  5631
</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
  5632
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5633
  <xsl:template match="widget[@type='JsonTable']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5634
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5635
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5636
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5637
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5638
      <xsl:text>Send given variables as POST to http URL argument, spread returned JSON in
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5639
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5640
      <xsl:text>SVG sub-elements of "data" labeled element.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5641
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5642
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5643
</xsl:text>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  5644
      <xsl:text>Documentation to be written. see svghmi exemple.
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5645
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5646
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5647
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5648
      <xsl:text>Http POST variables, spread JSON back</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5649
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5650
    <arg name="url" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5651
      <xsl:text> </xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5652
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5653
    <path name="edit" accepts="HMI_INT, HMI_REAL, HMI_STRING">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5654
      <xsl:text>single variable to edit</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5655
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  5656
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5657
  <xsl:template match="widget[@type='JsonTable']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5658
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5659
    <xsl:text>JsonTableWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  5660
    <xsl:text> extends Widget{
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
  5661
</xsl:text>
3069
a9b03c2634c5 Arbitrary variables added to JsonTable subscription are now passed as 'extra' field in json query. As an example added JsonTable filtering in tests/svghmi
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3068
diff changeset
  5662
    <xsl:text>    // arbitrary defaults to avoid missing entries in query
a9b03c2634c5 Arbitrary variables added to JsonTable subscription are now passed as 'extra' field in json query. As an example added JsonTable filtering in tests/svghmi
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3068
diff changeset
  5663
</xsl:text>
3187
ba8ff21fd82b SVGHMI: change default values for JsonTable, leading to scrollbar initialized at annoying non-zero position
Edouard Tisserant
parents: 3186
diff changeset
  5664
    <xsl:text>    cache = [0,0,0];
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  5665
</xsl:text>
3181
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  5666
    <xsl:text>    init_common() {
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5667
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5668
    <xsl:text>        this.spread_json_data_bound = this.spread_json_data.bind(this);
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5669
</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5670
    <xsl:text>        this.handle_http_response_bound = this.handle_http_response.bind(this);
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5671
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5672
    <xsl:text>        this.fetch_error_bound = this.fetch_error.bind(this);
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5673
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5674
    <xsl:text>        this.promised = false;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5675
</xsl:text>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5676
    <xsl:text>    }
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5677
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5678
    <xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5679
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5680
    <xsl:text>    handle_http_response(response) {
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5681
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5682
    <xsl:text>        if (!response.ok) {
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5683
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5684
    <xsl:text>          console.log("HTTP error, status = " + response.status);
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5685
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5686
    <xsl:text>        }
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5687
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5688
    <xsl:text>        return response.json();
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5689
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5690
    <xsl:text>    }
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5691
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5692
    <xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5693
</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5694
    <xsl:text>    fetch_error(e){
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5695
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5696
    <xsl:text>        console.log("HTTP fetch error, message = " + e.message + "Widget:" + this.element_id);
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5697
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5698
    <xsl:text>    }
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5699
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5700
    <xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5701
</xsl:text>
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5702
    <xsl:text>    do_http_request(...opt) {
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  5703
</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5704
    <xsl:text>        this.abort_controller = new AbortController();
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5705
</xsl:text>
3195
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5706
    <xsl:text>        return Promise.resolve().then(() =&gt; {
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5707
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5708
    <xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5709
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5710
    <xsl:text>            const query = {
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5711
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5712
    <xsl:text>                args: this.args,
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5713
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5714
    <xsl:text>                range: this.cache[1],
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5715
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5716
    <xsl:text>                position: this.cache[2],
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5717
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5718
    <xsl:text>                visible: this.visible,
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5719
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5720
    <xsl:text>                extra: this.cache.slice(4),
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5721
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5722
    <xsl:text>                options: opt
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5723
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5724
    <xsl:text>            };
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5725
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5726
    <xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5727
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5728
    <xsl:text>            const options = {
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5729
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5730
    <xsl:text>                 method: 'POST',
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5731
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5732
    <xsl:text>                 body: JSON.stringify(query),
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5733
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5734
    <xsl:text>                 headers: {'Content-Type': 'application/json'},
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5735
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5736
    <xsl:text>                 signal: this.abort_controller.signal
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5737
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5738
    <xsl:text>            };
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5739
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5740
    <xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5741
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5742
    <xsl:text>            return fetch(this.args[0], options)
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5743
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5744
    <xsl:text>                    .then(this.handle_http_response_bound)
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5745
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5746
    <xsl:text>                    .then(this.spread_json_data_bound)
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5747
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5748
    <xsl:text>                    .catch(this.fetch_error_bound);
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5749
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5750
    <xsl:text>        });
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5751
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5752
    <xsl:text>    }
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5753
</xsl:text>
cdd2a032b424 SVGHMI: JsonTable: Fixed options not being passed in JSON post when jumping to a page where additional variables are pre-defined by a HMI:VarInit.
Edouard Tisserant
parents: 3191
diff changeset
  5754
    <xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5755
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5756
    <xsl:text>    unsub(){
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5757
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5758
    <xsl:text>        this.abort_controller.abort();
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5759
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5760
    <xsl:text>        super.unsub();
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5761
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5762
    <xsl:text>    }
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5763
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5764
    <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
  5765
</xsl:text>
3189
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5766
    <xsl:text>    sub(...args){
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5767
</xsl:text>
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5768
    <xsl:text>        this.cache[0] = undefined;
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5769
</xsl:text>
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5770
    <xsl:text>        super.sub(...args);
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5771
</xsl:text>
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5772
    <xsl:text>    }
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5773
</xsl:text>
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5774
    <xsl:text>
0733114a2090 SVGHMI: JsonTable should refresh when re-subscibing, because data might have changed while not on the page we are switching to.
Edouard Tisserant
parents: 3188
diff changeset
  5775
</xsl:text>
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  5776
    <xsl:text>    dispatch(value, oldval, index) {
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  5777
</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5778
    <xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5779
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5780
    <xsl:text>        if(this.cache[index] != value)
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5781
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5782
    <xsl:text>            this.cache[index] = value;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5783
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5784
    <xsl:text>        else
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5785
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5786
    <xsl:text>            return;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5787
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5788
    <xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5789
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5790
    <xsl:text>        if(!this.promised){
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5791
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5792
    <xsl:text>            this.promised = true;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5793
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5794
    <xsl:text>            this.do_http_request().finally(() =&gt; {
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5795
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5796
    <xsl:text>                this.promised = false;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5797
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5798
    <xsl:text>            });
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5799
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  5800
    <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
  5801
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  5802
    <xsl:text>    }
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  5803
</xsl:text>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5804
    <xsl:text>    make_on_click(...options){
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5805
</xsl:text>
3084
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
  5806
    <xsl:text>        let that = this;
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
  5807
</xsl:text>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5808
    <xsl:text>        return function(evt){
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5809
</xsl:text>
3084
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
  5810
    <xsl:text>            that.do_http_request(...options);
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5811
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5812
    <xsl:text>        }
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5813
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5814
    <xsl:text>    }
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5815
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5816
    <xsl:text>    // on_click(evt, ...options) {
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5817
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5818
    <xsl:text>    //     this.do_http_request(...options);
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5819
</xsl:text>
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5820
    <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
  5821
</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
  5822
    <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
  5823
</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
  5824
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  5825
  <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
  5826
    <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
  5827
      <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
  5828
      <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
  5829
      <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
  5830
    </xsl:message>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  5831
  </xsl:template>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5832
  <func:function name="func:json_expressions">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5833
    <xsl:param name="expressions"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5834
    <xsl:param name="label"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5835
    <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5836
      <xsl:when test="$label">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5837
        <xsl:variable name="suffixes" select="str:split($label)"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5838
        <xsl:variable name="res">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5839
          <xsl:for-each select="$suffixes">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5840
            <expression>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5841
              <xsl:variable name="suffix" select="."/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5842
              <xsl:variable name="pos" select="position()"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5843
              <xsl:variable name="expr" select="$expressions[position() &lt;= $pos][last()]/expression"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5844
              <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5845
                <xsl:when test="contains($suffix,'=')">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5846
                  <xsl:variable name="name" select="substring-before($suffix,'=')"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5847
                  <xsl:if test="$expr/@name[. != $name]">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5848
                    <xsl:message terminate="yes">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5849
                      <xsl:text>JsonTable : missplaced '=' or inconsistent names in Json data expressions.</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5850
                    </xsl:message>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5851
                  </xsl:if>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5852
                  <xsl:attribute name="name">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5853
                    <xsl:value-of select="$name"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5854
                  </xsl:attribute>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5855
                  <xsl:attribute name="content">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5856
                    <xsl:value-of select="$expr/@content"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5857
                    <xsl:value-of select="substring-after($suffix,'=')"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5858
                  </xsl:attribute>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5859
                </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5860
                <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5861
                  <xsl:copy-of select="$expr/@name"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5862
                  <xsl:attribute name="content">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5863
                    <xsl:value-of select="$expr/@content"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5864
                    <xsl:value-of select="$suffix"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5865
                  </xsl:attribute>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5866
                </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5867
              </xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5868
            </expression>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5869
          </xsl:for-each>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5870
        </xsl:variable>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5871
        <func:result select="exsl:node-set($res)"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5872
      </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5873
      <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5874
        <func:result select="$expressions"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5875
      </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5876
    </xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5877
  </func:function>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5878
  <xsl:variable name="initexpr">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5879
    <expression>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5880
      <xsl:attribute name="content">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5881
        <xsl:text>jdata</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5882
      </xsl:attribute>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5883
    </expression>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5884
  </xsl:variable>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5885
  <xsl:variable name="initexpr_ns" select="exsl:node-set($initexpr)"/>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  5886
  <xsl:template mode="json_table_elt_render" match="svg:use">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5887
    <xsl:param name="expressions"/>
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
  5888
    <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
  5889
    <xsl:variable name="from_list" select="$hmi_lists[(@id | */@id) = $targetid]"/>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5890
    <xsl:choose>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5891
      <xsl:when test="count($from_list) &gt; 0">
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5892
        <xsl:text>        id("</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5893
        <xsl:value-of select="@id"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  5894
        <xsl:text>").href.baseVal =
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5895
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5896
        <xsl:text>            "#"+hmi_widgets["</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5897
        <xsl:value-of select="$from_list/@id"/>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5898
        <xsl:text>"].items[</xsl:text>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5899
        <xsl:value-of select="$expressions/expression[1]/@content"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  5900
        <xsl:text>];
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5901
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5902
      </xsl:when>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5903
      <xsl:otherwise>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5904
        <xsl:message terminate="no">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5905
          <xsl:text>Clones (svg:use) in JsonTable Widget must point to a valid HMI:List widget or item. Reference "</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5906
          <xsl:value-of select="@xlink:href"/>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5907
          <xsl:text>" is not valid and will not be updated.</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5908
        </xsl:message>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5909
      </xsl:otherwise>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  5910
    </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
  5911
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  5912
  <xsl:template mode="json_table_elt_render" match="svg:text">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5913
    <xsl:param name="expressions"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5914
    <xsl:variable name="value_expr" select="$expressions/expression[1]/@content"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5915
    <xsl:variable name="original" select="@original"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5916
    <xsl:variable name="from_textstylelist" select="$textstylelist_related_ns/list[elt/@eltid = $original]"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5917
    <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5918
      <xsl:when test="count($from_textstylelist) &gt; 0">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5919
        <xsl:variable name="content_expr" select="$expressions/expression[2]/@content"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5920
        <xsl:if test="string-length($content_expr) = 0 or $expressions/expression[2]/@name != 'textContent'">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5921
          <xsl:message terminate="yes">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5922
            <xsl:text>Clones (svg:use) in JsonTable Widget pointing to a HMI:TextStyleList widget or item must have a "textContent=.someVal" assignement following value expression in label.</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5923
          </xsl:message>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5924
        </xsl:if>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5925
        <xsl:text>        {
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5926
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5927
        <xsl:text>          let elt = id("</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5928
        <xsl:value-of select="@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5929
        <xsl:text>");
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5930
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5931
        <xsl:text>          elt.textContent = String(</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5932
        <xsl:value-of select="$content_expr"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5933
        <xsl:text>);
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5934
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5935
        <xsl:text>          elt.style = hmi_widgets["</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5936
        <xsl:value-of select="$from_textstylelist/@listid"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5937
        <xsl:text>"].styles[</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5938
        <xsl:value-of select="$value_expr"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5939
        <xsl:text>];
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5940
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5941
        <xsl:text>        }
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5942
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5943
      </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5944
      <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5945
        <xsl:text>        id("</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5946
        <xsl:value-of select="@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5947
        <xsl:text>").textContent = String(</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5948
        <xsl:value-of select="$value_expr"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5949
        <xsl:text>);
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5950
</xsl:text>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5951
      </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5952
    </xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5953
  </xsl:template>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5954
  <func:function name="func:filter_non_widget_label">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5955
    <xsl:param name="elt"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5956
    <xsl:param name="widget_elts"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5957
    <xsl:variable name="eltid">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5958
      <xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5959
        <xsl:when test="$elt/@original">
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5960
          <xsl:value-of select="$elt/@original"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5961
        </xsl:when>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5962
        <xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5963
          <xsl:value-of select="$elt/@id"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5964
        </xsl:otherwise>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5965
      </xsl:choose>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5966
    </xsl:variable>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5967
    <func:result select="$widget_elts[@id=$eltid]/@inkscape:label"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5968
  </func:function>
3043
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5969
  <xsl:template mode="json_table_render_except_comments" match="svg:*">
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5970
    <xsl:param name="expressions"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5971
    <xsl:param name="widget_elts"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5972
    <xsl:variable name="label" select="func:filter_non_widget_label(., $widget_elts)"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5973
    <xsl:if test="not(starts-with($label,'#'))">
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5974
      <xsl:apply-templates mode="json_table_render" select=".">
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5975
        <xsl:with-param name="expressions" select="$expressions"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5976
        <xsl:with-param name="widget_elts" select="$widget_elts"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5977
        <xsl:with-param name="label" select="$label"/>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5978
      </xsl:apply-templates>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5979
    </xsl:if>
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5980
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  5981
  <xsl:template mode="json_table_render" match="svg:*">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5982
    <xsl:param name="expressions"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  5983
    <xsl:param name="widget_elts"/>
3043
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  5984
    <xsl:param name="label"/>
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5985
    <xsl:variable name="new_expressions" select="func:json_expressions($expressions, $label)"/>
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5986
    <xsl:variable name="elt" select="."/>
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5987
    <xsl:for-each select="$new_expressions/expression[position() &gt; 1][starts-with(@name,'onClick')]">
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5988
      <xsl:text>        id("</xsl:text>
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5989
      <xsl:value-of select="$elt/@id"/>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  5990
      <xsl:text>").onclick = this.make_on_click('</xsl:text>
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5991
      <xsl:value-of select="@name"/>
3084
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
  5992
      <xsl:text>', </xsl:text>
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5993
      <xsl:value-of select="@content"/>
3084
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
  5994
      <xsl:text>);
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5995
</xsl:text>
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5996
    </xsl:for-each>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  5997
    <xsl:apply-templates mode="json_table_elt_render" select=".">
3048
d46d545ff7b7 SVGHMI: JsonTable can now have clickable elements, that trigger a request with extra argument whose content is taken from Json data.
Edouard Tisserant
parents: 3047
diff changeset
  5998
      <xsl:with-param name="expressions" select="$new_expressions"/>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  5999
    </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
  6000
  </xsl:template>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  6001
  <xsl:template mode="json_table_render" match="svg:g">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6002
    <xsl:param name="expressions"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6003
    <xsl:param name="widget_elts"/>
3043
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  6004
    <xsl:param name="label"/>
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6005
    <xsl:variable name="varprefix">
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6006
      <xsl:text>obj_</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6007
      <xsl:value-of select="@id"/>
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6008
      <xsl:text>_</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6009
    </xsl:variable>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6010
    <xsl:text>        try {
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6011
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6012
    <xsl:for-each select="$expressions/expression">
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6013
      <xsl:text>         let </xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6014
      <xsl:value-of select="$varprefix"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6015
      <xsl:value-of select="position()"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6016
      <xsl:text> = </xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6017
      <xsl:value-of select="@content"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6018
      <xsl:text>;
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6019
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6020
      <xsl:text>         if(</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6021
      <xsl:value-of select="$varprefix"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6022
      <xsl:value-of select="position()"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6023
      <xsl:text> == undefined) {
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6024
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6025
      <xsl:text>              throw null;
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6026
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6027
      <xsl:text>         }
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6028
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6029
    </xsl:for-each>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6030
    <xsl:variable name="new_expressions">
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6031
      <xsl:for-each select="$expressions/expression">
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6032
        <xsl:copy>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6033
          <xsl:copy-of select="@name"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6034
          <xsl:attribute name="content">
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6035
            <xsl:value-of select="$varprefix"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6036
            <xsl:value-of select="position()"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6037
          </xsl:attribute>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6038
        </xsl:copy>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6039
      </xsl:for-each>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6040
    </xsl:variable>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6041
    <xsl:text>          id("</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
  6042
    <xsl:value-of select="@id"/>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  6043
    <xsl:text>").style = "</xsl:text>
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6044
    <xsl:value-of select="@style"/>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  6045
    <xsl:text>";
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6046
</xsl:text>
3043
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  6047
    <xsl:apply-templates mode="json_table_render_except_comments" select="*">
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6048
      <xsl:with-param name="expressions" select="func:json_expressions(exsl:node-set($new_expressions), $label)"/>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6049
      <xsl:with-param name="widget_elts" select="$widget_elts"/>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  6050
    </xsl:apply-templates>
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6051
    <xsl:text>        } catch(err) {
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6052
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6053
    <xsl:text>          id("</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6054
    <xsl:value-of select="@id"/>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
  6055
    <xsl:text>").style = "display:none";
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6056
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6057
    <xsl:text>        }
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6058
</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
  6059
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6060
  <xsl:template match="widget[@type='JsonTable']" mode="widget_defs">
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  6061
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6062
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6063
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6064
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6065
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6066
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6067
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6068
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6069
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6070
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6071
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6072
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  6073
    <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
  6074
      <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
  6075
      <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
  6076
        <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
  6077
      </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
  6078
    </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
  6079
    <xsl:variable name="data_elt" select="$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"/>
3038
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6080
    <xsl:text>    visible: </xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6081
    <xsl:value-of select="count($data_elt/*[@inkscape:label])"/>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6082
    <xsl:text>,
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6083
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6084
    <xsl:text>    spread_json_data: function(janswer) {
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6085
</xsl:text>
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6086
    <xsl:text>        let [range,position,jdata] = janswer;
92101729f7b7 SVGHMI: Alarm test not using Button widget anymore, too many problems. Use Input widget instead to increment value on each click and execute python code on change.
Edouard Tisserant
parents: 3034
diff changeset
  6087
</xsl:text>
3150
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6088
    <xsl:text>        [[1, range], [2, position], [3, this.visible]].map(([i,v]) =&gt; {
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6089
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6090
    <xsl:text>             this.apply_hmi_value(i,v);
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6091
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6092
    <xsl:text>             this.cache[i] = v;
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6093
</xsl:text>
5a1bb6ec48a0 SVGHMI: JsonTable removed useless promise since fetch() already does one. Updated generated XSLT.
Edouard Tisserant
parents: 3147
diff changeset
  6094
    <xsl:text>        });
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  6095
</xsl:text>
3043
d7b009e49e87 SVGHMI: JsonTable now ignores elements and groups starting with #
Edouard Tisserant
parents: 3042
diff changeset
  6096
    <xsl:apply-templates mode="json_table_render_except_comments" select="$data_elt">
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6097
      <xsl:with-param name="expressions" select="$initexpr_ns"/>
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6098
      <xsl:with-param name="widget_elts" select="$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"/>
2996
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  6099
    </xsl:apply-templates>
3181
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6100
    <xsl:text>    },
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6101
</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6102
    <xsl:text>    init() {
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6103
</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6104
    <xsl:text>       this.init_common();
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6105
</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6106
    <xsl:for-each select="$hmi_element/*[starts-with(@inkscape:label,'action_')]">
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6107
      <xsl:text>        id("</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6108
      <xsl:value-of select="@id"/>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6109
      <xsl:text>").onclick = this.make_on_click("</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6110
      <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6111
      <xsl:text>");
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6112
</xsl:text>
50d0fef791d5 SVGHMI: Add generic action buttons to JSON table, with an example in tests/svghmi: wipe alar list.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3178
diff changeset
  6113
    </xsl:for-each>
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
  6114
    <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
  6115
</xsl:text>
14635b09d329 SVGHMI: JsonTable now generate working data access code for data/* elements.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2994
diff changeset
  6116
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6117
  <xsl:template match="widget[@type='Jump']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6118
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6119
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6120
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6121
    <longdesc>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6122
      <xsl:text>Jump widget brings focus to a different page. Mandatory first argument
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6123
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6124
      <xsl:text>gives name of the page.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6125
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6126
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6127
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6128
      <xsl:text>If first path is pointint to HMI_NODE variable is used as new reference
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6129
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6130
      <xsl:text>when jumping to a relative page.
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6131
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6132
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6133
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6134
      <xsl:text>Additional arguments are unordered options:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6135
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6136
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6137
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6138
      <xsl:text>- Absolute: force page jump to be not relative even if first path is of type HMI_NODE
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6139
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6140
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6141
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6142
      <xsl:text>- name=value: Notify PLC about jump by setting variable with path having same name assigned
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6143
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6144
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6145
</xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6146
      <xsl:text>"active"+"inactive" labeled elements can be provided and reflect current
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6147
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6148
      <xsl:text>page being shown.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6149
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6150
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6151
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6152
      <xsl:text>Exemples:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6153
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6154
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6155
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6156
      <xsl:text>Relative jump:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6157
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6158
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6159
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6160
      <xsl:text>HMI:Jump:RelativePage@/PUMP9
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6161
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6162
      <xsl:text>HMI:Jump:RelativePage@/PUMP9@role=.userrole#role=="admin"
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6163
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6164
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6165
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6166
      <xsl:text>Absolute jump:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6167
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6168
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6169
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6170
      <xsl:text>HMI:Jump:AbsolutePage
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6171
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6172
      <xsl:text>HMI:Jump:AbsolutePage@role=.userrole#role=="admin"
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6173
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6174
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6175
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6176
      <xsl:text>Forced absolute jump:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6177
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6178
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6179
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6180
      <xsl:text>HMI:Jump:AbsolutePage:Absolute@/PUMP9
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6181
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6182
      <xsl:text>HMI:Jump:AbsolutePage:Absolute:notify=1@notify=/PUMP9
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6183
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6184
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6185
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6186
      <xsl:text>Jump with feedback
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6187
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6188
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6189
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6190
      <xsl:text>HMI:Jump:AbsolutePage:notify=1@notify=.did_jump
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6191
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6192
      <xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6193
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6194
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6195
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6196
      <xsl:text>Jump to given page</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6197
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6198
    <arg name="page" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6199
      <xsl:text>name of page to jump to</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6200
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6201
    <path name="reference" count="optional" accepts="HMI_NODE">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6202
      <xsl:text>reference for relative jump</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6203
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6204
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6205
  <xsl:template match="widget[@type='Jump']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6206
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6207
    <xsl:text>JumpWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6208
    <xsl:text> extends Widget{
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6209
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6210
    <xsl:text>        activable = false;
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6211
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6212
    <xsl:text>        frequency = 2;
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6213
</xsl:text>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6214
    <xsl:text>        target_page_is_current_page = false;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6215
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6216
    <xsl:text>        button_beeing_pressed = false;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6217
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6218
    <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6219
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6220
    <xsl:text>        onmouseup(evt) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6221
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6222
    <xsl:text>            svg_root.removeEventListener("pointerup", this.bound_onmouseup, true);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6223
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6224
    <xsl:text>            if(this.enable_state) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6225
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6226
    <xsl:text>                const index =
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6227
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6228
    <xsl:text>                    (this.is_relative &amp;&amp; this.indexes.length &gt; 0) ?
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6229
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6230
    <xsl:text>                    this.indexes[0] + this.offset : undefined;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6231
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6232
    <xsl:text>                this.button_beeing_pressed = false;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6233
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6234
    <xsl:text>                this.activity_state = this.target_page_is_current_page || this.button_beeing_pressed;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6235
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6236
    <xsl:text>                fading_page_switch(this.args[0], index);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6237
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6238
    <xsl:text>                this.notify();
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6239
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6240
    <xsl:text>            }
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6241
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6242
    <xsl:text>        }
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6243
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6244
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6245
</xsl:text>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6246
    <xsl:text>        onmousedown(){
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6247
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6248
    <xsl:text>            if(this.enable_state) {
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6249
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6250
    <xsl:text>                svg_root.addEventListener("pointerup", this.bound_onmouseup, true);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6251
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6252
    <xsl:text>                this.button_beeing_pressed = true;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6253
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6254
    <xsl:text>                this.activity_state = true;
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6255
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6256
    <xsl:text>                this.request_animate();
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6257
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6258
    <xsl:text>            }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6259
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6260
    <xsl:text>        }
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6261
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6262
    <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6263
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6264
    <xsl:text>        notify_page_change(page_name, index) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6265
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6266
    <xsl:text>            // called from animate()
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6267
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6268
    <xsl:text>            if(this.activable) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6269
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6270
    <xsl:text>                const ref_index = this.indexes.length &gt; 0 ? this.indexes[0] + this.offset : undefined;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6271
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6272
    <xsl:text>                const ref_name = this.args[0];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6273
</xsl:text>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6274
    <xsl:text>                this.target_page_is_current_page = ((ref_name == undefined || ref_name == page_name) &amp;&amp; index == ref_index);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6275
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6276
    <xsl:text>                this.activity_state = this.target_page_is_current_page || this.button_beeing_pressed;
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6277
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6278
    <xsl:text>                // Since called from animate, update activity directly
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6279
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6280
    <xsl:text>                if(this.enable_displayed_state &amp;&amp; this.has_activity) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6281
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6282
    <xsl:text>                    this.animate_activity();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6283
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6284
    <xsl:text>                }
3240
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6285
</xsl:text>
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6286
    <xsl:text>            }
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6287
</xsl:text>
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6288
    <xsl:text>        }
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6289
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6290
    <xsl:text>}
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6291
</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6292
  </xsl:template>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6293
  <func:function name="func:is_relative_jump">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6294
    <xsl:param name="widget"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6295
    <func:result select="$widget/path and $widget/path[1]/@type='HMI_NODE' and not($widget/arg[position()&gt;1 and @value = 'Absolute'])"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6296
  </func:function>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6297
  <xsl:template match="widget[@type='Jump']" mode="widget_defs">
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
  6298
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6299
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6300
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6301
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6302
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6303
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6304
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6305
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6306
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6307
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6308
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6309
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6310
    <xsl:text>    activable_sub:{
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6311
</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
  6312
    <xsl:variable name="activity">
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6313
      <xsl:call-template name="defs_by_labels">
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
  6314
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6315
        <xsl:with-param name="labels">
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6316
          <xsl:text>/active /inactive</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6317
        </xsl:with-param>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6318
        <xsl:with-param name="mandatory">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6319
          <xsl:text>no</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6320
        </xsl:with-param>
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
  6321
      </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
  6322
    </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
  6323
    <xsl:value-of select="$activity"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6324
    <xsl:variable name="has_activity" select="string-length($activity)&gt;0"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6325
    <xsl:text>    },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6326
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6327
    <xsl:text>    has_activity: </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6328
    <xsl:value-of select="$has_activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6329
    <xsl:text>,
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6330
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6331
    <xsl:variable name="jump_disability" select="$has_activity and $has_disability"/>
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
  6332
    <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
  6333
</xsl:text>
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6334
    <xsl:text>        this.bound_onmouseup = this.onmouseup.bind(this);
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6335
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
  6336
    <xsl:text>        this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
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
  6337
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6338
    <xsl:if test="$has_activity">
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6339
      <xsl:text>        this.activable = true;
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6340
</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
  6341
    </xsl:if>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6342
    <xsl:text>        this.is_relative = </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
  6343
    <xsl:choose>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6344
      <xsl:when test="func:is_relative_jump(.)">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6345
        <xsl:text>true</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
  6346
      </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
  6347
      <xsl:otherwise>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6348
        <xsl:text>false</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
  6349
      </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
  6350
    </xsl:choose>
3240
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6351
    <xsl:text>;
5f756332ada1 SVGHMI: Fix behaviour of Jump widget, that wasn't displaying "disabled" state in some cases.
Edouard Tisserant
parents: 3229
diff changeset
  6352
</xsl:text>
2954
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  6353
    <xsl:text>    },
b5dccd0d99ac SVGHMI: clean up dead code, update generated xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2949
diff changeset
  6354
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6355
    <xsl:text>    notify: function() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6356
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6357
    <xsl:variable name="paths" select="path"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6358
    <xsl:for-each select="arg[position()&gt;1 and contains(@value,'=')]">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6359
      <xsl:variable name="name" select="substring-before(@value,'=')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6360
      <xsl:variable name="value" select="substring-after(@value,'=')"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6361
      <xsl:variable name="index">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6362
        <xsl:for-each select="$paths">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6363
          <xsl:if test="@assign = $name">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6364
            <xsl:value-of select="position()-1"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6365
          </xsl:if>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6366
        </xsl:for-each>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6367
      </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6368
      <xsl:text>        // </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6369
      <xsl:value-of select="@value"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6370
      <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6371
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6372
      <xsl:text>        this.apply_hmi_value(</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6373
      <xsl:value-of select="$index"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6374
      <xsl:text>, </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6375
      <xsl:value-of select="$value"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6376
      <xsl:text>);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6377
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6378
    </xsl:for-each>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6379
    <xsl:text>    },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6380
</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
  6381
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6382
  <xsl:template match="widget[@type='Jump']" mode="widget_page">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6383
    <xsl:param name="page_desc"/>
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
  6384
    <xsl:param name="page_desc"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6385
    <xsl:if test="func:is_relative_jump(.)">
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
  6386
      <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
  6387
        <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
  6388
          <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
  6389
            <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
  6390
          </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
  6391
          <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
  6392
            <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
  6393
          </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
  6394
        </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
  6395
      </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
  6396
      <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
  6397
        <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
  6398
          <xsl:when test="arg">
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  6399
            <xsl:value-of select="$hmi_pages_descs[arg[1]/@value = $target_page_name]/path[not(@assign)]/@value"/>
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
  6400
          </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
  6401
          <xsl:otherwise>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  6402
            <xsl:value-of select="$page_desc/path[not(@assign)]/@value"/>
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
  6403
          </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
  6404
        </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
  6405
      </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
  6406
      <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
  6407
        <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
  6408
          <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
  6409
          <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
  6410
          <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
  6411
          <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
  6412
          <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
  6413
          <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
  6414
          <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
  6415
          <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
  6416
          <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
  6417
        </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
  6418
      </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
  6419
    </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
  6420
  </xsl:template>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6421
  <cssdefs:jump/>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6422
  <xsl:template match="cssdefs:jump">
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6423
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6424
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6425
    <xsl:text>/* </xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6426
    <xsl:value-of select="local-name()"/>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6427
    <xsl:text> */
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6428
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6429
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6430
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6431
    <xsl:text>.fade-out-page {
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6432
</xsl:text>
3554
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  6433
    <xsl:text>    animation: cubic-bezier(0, 0.8, 0.6, 1) fadeOut 0.6s both;
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6434
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6435
    <xsl:text>}
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6436
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6437
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6438
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6439
    <xsl:text>@keyframes fadeOut {
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6440
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6441
    <xsl:text>    0% { opacity: 1; }
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6442
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6443
    <xsl:text>    100% { opacity: 0; }
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6444
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6445
    <xsl:text>}
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6446
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6447
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6448
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6449
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6450
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  6451
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  6452
  <declarations:jump/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  6453
  <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
  6454
    <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
  6455
</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
  6456
    <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
  6457
    <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
  6458
    <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
  6459
</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
  6460
    <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
  6461
</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
  6462
    <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
  6463
</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
  6464
    <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
  6465
</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
  6466
    <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
  6467
</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
  6468
    <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
  6469
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6470
    <xsl:text>    // called from animate()
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6471
</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
  6472
    <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
  6473
</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
  6474
    <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
  6475
</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
  6476
    <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
  6477
</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
  6478
    <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
  6479
</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
  6480
    <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
  6481
</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
  6482
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6483
  <xsl:template match="widget[@type='Keypad']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6484
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6485
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6486
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6487
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6488
      <xsl:text>Keypad - to be written
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6489
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6490
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6491
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6492
      <xsl:text>Keypad </xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6493
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6494
    <arg name="supported_types" accepts="string">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6495
      <xsl:text>keypad can input those types </xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6496
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6497
  </xsl:template>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  6498
  <declarations:keypad/>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
  6499
  <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
  6500
    <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
  6501
</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
  6502
    <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
  6503
    <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
  6504
    <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
  6505
</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
  6506
    <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
  6507
</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
  6508
    <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
  6509
</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
  6510
    <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
  6511
</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
  6512
    <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
  6513
      <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
  6514
      <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
  6515
        <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
  6516
        <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
  6517
        <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
  6518
        <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
  6519
        <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
  6520
        <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
  6521
        <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
  6522
        <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
  6523
        <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
  6524
        <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
  6525
</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
  6526
      </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
  6527
    </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
  6528
    <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
  6529
</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
  6530
    <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
  6531
</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
  6532
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6533
  <xsl:template match="widget[@type='Keypad']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6534
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6535
    <xsl:text>KeypadWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6536
    <xsl:text> extends Widget{
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6537
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6538
    <xsl:text>     on_key_click(symbols) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6539
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6540
    <xsl:text>         var syms = symbols.split(" ");
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6541
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6542
    <xsl:text>         this.shift |= this.caps;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6543
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6544
    <xsl:text>         if(this.virgin)
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6545
</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6546
    <xsl:text>             this.editstr = ""; 
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6547
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6548
    <xsl:text>         this.editstr += syms[this.shift?syms.length-1:0];
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6549
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6550
    <xsl:text>         this.shift = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6551
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6552
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6553
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6554
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6555
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6556
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6557
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6558
    <xsl:text>     on_Esc_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6559
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6560
    <xsl:text>         end_modal.call(this);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6561
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6562
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6563
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6564
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6565
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6566
    <xsl:text>     on_Enter_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6567
</xsl:text>
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6568
    <xsl:text>         let coercedval = (typeof this.initial) == "number" ? Number(this.editstr) : this.editstr;
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6569
</xsl:text>
3042
ed43facc7137 SVGHMI: Fix keypad : non-number input was always considered invalid because of missing type checking.
Edouard Tisserant
parents: 3041
diff changeset
  6570
    <xsl:text>         if(typeof coercedval == 'number' &amp;&amp; isNaN(coercedval)){
ed43facc7137 SVGHMI: Fix keypad : non-number input was always considered invalid because of missing type checking.
Edouard Tisserant
parents: 3041
diff changeset
  6571
</xsl:text>
ed43facc7137 SVGHMI: Fix keypad : non-number input was always considered invalid because of missing type checking.
Edouard Tisserant
parents: 3041
diff changeset
  6572
    <xsl:text>             // revert to initial so it explicitely shows input was ignored
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6573
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6574
    <xsl:text>             this.editstr = String(this.initial);
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6575
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6576
    <xsl:text>             this.update();
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6577
</xsl:text>
3042
ed43facc7137 SVGHMI: Fix keypad : non-number input was always considered invalid because of missing type checking.
Edouard Tisserant
parents: 3041
diff changeset
  6578
    <xsl:text>         } else { 
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6579
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6580
    <xsl:text>             let callback_obj = this.result_callback_obj;
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6581
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6582
    <xsl:text>             end_modal.call(this);
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6583
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6584
    <xsl:text>             callback_obj.edit_callback(coercedval);
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6585
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6586
    <xsl:text>         }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6587
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6588
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6589
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6590
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6591
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6592
    <xsl:text>     on_BackSpace_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6593
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6594
    <xsl:text>         this.editstr = this.editstr.slice(0,this.editstr.length-1);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6595
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6596
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6597
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6598
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6599
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6600
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6601
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6602
    <xsl:text>     on_Sign_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6603
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6604
    <xsl:text>         if(this.editstr[0] == "-")
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6605
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6606
    <xsl:text>             this.editstr = this.editstr.slice(1,this.editstr.length);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6607
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6608
    <xsl:text>         else
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6609
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6610
    <xsl:text>             this.editstr = "-" + this.editstr;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6611
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6612
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6613
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6614
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6615
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6616
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6617
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6618
    <xsl:text>     on_NumDot_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6619
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6620
    <xsl:text>         if(this.editstr.indexOf(".") == "-1"){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6621
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6622
    <xsl:text>             this.editstr += ".";
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6623
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6624
    <xsl:text>             this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6625
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6626
    <xsl:text>         }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6627
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6628
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6629
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6630
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6631
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6632
    <xsl:text>     on_Space_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6633
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6634
    <xsl:text>         this.editstr += " ";
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6635
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6636
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6637
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6638
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6639
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6640
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6641
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6642
    <xsl:text>     caps = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6643
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6644
    <xsl:text>     _caps = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6645
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6646
    <xsl:text>     on_CapsLock_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6647
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6648
    <xsl:text>         this.caps = !this.caps;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6649
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6650
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6651
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6652
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6653
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6654
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6655
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6656
    <xsl:text>     shift = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6657
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6658
    <xsl:text>     _shift = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6659
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6660
    <xsl:text>     on_Shift_click() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6661
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6662
    <xsl:text>         this.shift = !this.shift;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6663
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6664
    <xsl:text>         this.caps = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6665
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6666
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6667
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6668
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6669
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6670
    <xsl:text>     editstr = "";
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6671
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6672
    <xsl:text>     _editstr = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6673
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6674
    <xsl:text>     result_callback_obj = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6675
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6676
    <xsl:text>     start_edit(info, valuetype, callback_obj, initial,size) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6677
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6678
    <xsl:text>         show_modal.call(this,size);
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6679
</xsl:text>
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6680
    <xsl:text>         this.editstr = String(initial);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6681
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6682
    <xsl:text>         this.result_callback_obj = callback_obj;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6683
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6684
    <xsl:text>         if(this.Info_elt)
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6685
</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6686
    <xsl:text>             this.Info_elt.textContent = info;
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6687
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6688
    <xsl:text>         this.shift = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6689
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6690
    <xsl:text>         this.caps = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6691
</xsl:text>
3034
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6692
    <xsl:text>         this.initial = initial;
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6693
</xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6694
    <xsl:text>
793ce2117258 SVGHMI: JsonTable now makes meaningfull JSON request : all arguments and variables are passed in.
Edouard Tisserant
parents: 3031
diff changeset
  6695
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6696
    <xsl:text>         this.update();
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6697
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6698
    <xsl:text>         this.virgin = true;
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6699
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6700
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6701
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6702
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6703
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6704
    <xsl:text>     update() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6705
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6706
    <xsl:text>         if(this.editstr != this._editstr){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6707
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6708
    <xsl:text>             this.virgin = false;
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6709
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6710
    <xsl:text>             this._editstr = this.editstr;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6711
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6712
    <xsl:text>             this.Value_elt.textContent = this.editstr;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6713
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6714
    <xsl:text>         }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6715
</xsl:text>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  6716
    <xsl:text>         if(this.Shift_sub &amp;&amp; this.shift != this._shift){
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6717
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6718
    <xsl:text>             this._shift = this.shift;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6719
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6720
    <xsl:text>             set_activity_state(this.Shift_sub, this.shift);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6721
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6722
    <xsl:text>         }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6723
</xsl:text>
3103
677764fba71d SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3097
diff changeset
  6724
    <xsl:text>         if(this.CapsLock_sub &amp;&amp; this.caps != this._caps){
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6725
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6726
    <xsl:text>             this._caps = this.caps;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6727
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6728
    <xsl:text>             set_activity_state(this.CapsLock_sub, this.caps);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6729
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6730
    <xsl:text>         }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6731
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6732
    <xsl:text>     }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6733
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6734
    <xsl:text>}
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6735
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6736
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6737
  <xsl:template match="widget[@type='Keypad']" mode="widget_defs">
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6738
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6739
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6740
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6741
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6742
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6743
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6744
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6745
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6746
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6747
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6748
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6749
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6750
    <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
  6751
      <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
  6752
      <xsl:with-param name="labels">
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6753
        <xsl:text>Esc Enter BackSpace Keys Value</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6754
      </xsl:with-param>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6755
    </xsl:call-template>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6756
    <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
  6757
      <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
  6758
      <xsl:with-param name="labels">
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6759
        <xsl:text>Sign Space NumDot Info</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6760
      </xsl:with-param>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6761
      <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
  6762
    </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
  6763
    <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
  6764
      <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
  6765
      <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
  6766
        <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
  6767
      </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
  6768
      <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
  6769
      <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
  6770
    </xsl:call-template>
2913
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  6771
    <xsl:text>    init: function() {
ac4328e69079 SVGHMI: Keypad: added code to re-attach keypad when starting edit.
Edouard Tisserant
parents: 2907
diff changeset
  6772
</xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6773
    <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
  6774
      <xsl:text>        id("</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6775
      <xsl:value-of select="@id"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6776
      <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
  6777
      <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
  6778
      <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
  6779
      <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
  6780
      <xsl:text>')");
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6781
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6782
    </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
  6783
    <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
  6784
      <xsl:text>        if(this.</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6785
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6786
      <xsl:text>_elt)
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6787
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6788
      <xsl:text>            this.</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6789
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6790
      <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
  6791
      <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
  6792
      <xsl:text>'].on_</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6793
      <xsl:value-of select="."/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6794
      <xsl:text>_click()");
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6795
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6796
    </xsl:for-each>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6797
    <xsl:text>    },
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6798
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6799
    <xsl:text>
2917
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6800
</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6801
    <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
  6802
    <xsl:text>    coordinates: [</xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6803
    <xsl:value-of select="$g/@x"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6804
    <xsl:text>, </xsl:text>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6805
    <xsl:value-of select="$g/@y"/>
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6806
    <xsl:text>],
c8d923dd707f SVGHMI: Keypad working for HMI_STRING, still Shift/CapsLock not finished.
Edouard Tisserant
parents: 2913
diff changeset
  6807
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6808
    <xsl:text>    virgin: false,
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  6809
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  6810
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6811
  <xsl:template match="widget[@type='List']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6812
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6813
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6814
    </type>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6815
    <longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6816
      <xsl:text>List widget is a svg:group, list items are labeled elements
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6817
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6818
      <xsl:text>in that group.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6819
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6820
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6821
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6822
      <xsl:text>To use a List, clone (svg:use) one of the items inside the widget that
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6823
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6824
      <xsl:text>expects a List.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6825
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6826
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6827
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6828
      <xsl:text>Positions of items are relative to each other, and they must all be in the
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6829
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6830
      <xsl:text>same place. In order to make editing easier it is therefore recommanded to
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6831
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6832
      <xsl:text>make stacked clones of svg elements spread nearby the list.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6833
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6834
    </longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6835
    <shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6836
      <xsl:text>A named list of named graphical elements</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6837
    </shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  6838
    <arg name="listname"/>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6839
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6840
  <xsl:template match="widget[@type='List']" mode="widget_defs">
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
  6841
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6842
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6843
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6844
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6845
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6846
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6847
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6848
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6849
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6850
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6851
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6852
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
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
  6853
    <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
  6854
</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
  6855
    <xsl:for-each select="$hmi_element/*[@inkscape:label]">
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6856
      <xsl:text>        "</xsl:text>
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3026
diff changeset
  6857
      <xsl:value-of select="@inkscape:label"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6858
      <xsl:text>": "</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
  6859
      <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
  6860
      <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
  6861
</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
  6862
    </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
  6863
    <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
  6864
</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
  6865
  </xsl:template>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6866
  <xsl:template match="widget[@type='List']" mode="widget_class">
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6867
    <xsl:text>class </xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6868
    <xsl:text>ListWidget</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6869
    <xsl:text> extends Widget{
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6870
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6871
    <xsl:text>}
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6872
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  6873
  </xsl:template>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6874
  <xsl:template match="widget[@type='ListSwitch']" mode="widget_desc">
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6875
    <type>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6876
      <xsl:value-of select="@type"/>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6877
    </type>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6878
    <longdesc>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6879
      <xsl:text>ListSwitch widget displays one item of an HMI:List depending on value of
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6880
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6881
      <xsl:text>given variable. Main element of the widget must be a clone of the list or
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6882
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6883
      <xsl:text>of an item of that list.  
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6884
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6885
      <xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6886
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6887
      <xsl:text>Given variable's current value is compared to list items
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6888
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6889
      <xsl:text>label. For exemple if given variable type
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6890
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6891
      <xsl:text>is HMI_INT and value is 1, then item with label '1' will be displayed.
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6892
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6893
      <xsl:text>If matching variable of type HMI_STRING, then no quotes are needed. 
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6894
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6895
      <xsl:text>For exemple, 'hello' match HMI_STRING 'hello'.
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6896
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6897
    </longdesc>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6898
    <shortdesc>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6899
      <xsl:text>Displays item of an HMI:List whose label matches value.</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6900
    </shortdesc>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6901
    <path name="value" accepts="HMI_INT,HMI_STRING">
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6902
      <xsl:text>value to compare to labels</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6903
    </path>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6904
  </xsl:template>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6905
  <xsl:template match="widget[@type='ListSwitch']" mode="widget_class">
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6906
    <xsl:text>class </xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6907
    <xsl:text>ListSwitchWidget</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6908
    <xsl:text> extends Widget{
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6909
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6910
    <xsl:text>    frequency = 5;
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6911
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6912
    <xsl:text>}
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6913
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6914
  </xsl:template>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6915
  <xsl:template match="widget[@type='ListSwitch']" mode="widget_defs">
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6916
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6917
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6918
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6919
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6920
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6921
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6922
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6923
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6924
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6925
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6926
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  6927
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6928
    <xsl:variable name="targetid" select="substring-after($hmi_element/@xlink:href,'#')"/>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6929
    <xsl:variable name="from_list" select="$hmi_lists[(@id | */@id) = $targetid]"/>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6930
    <xsl:text>    dispatch: function(value) {
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6931
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6932
    <xsl:text>        this.element.href.baseVal = "#"+hmi_widgets["</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6933
    <xsl:value-of select="$from_list/@id"/>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6934
    <xsl:text>"].items[value];
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6935
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6936
    <xsl:text>    },
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6937
</xsl:text>
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  6938
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6939
  <xsl:template match="widget[@type='Meter']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6940
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6941
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6942
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6943
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6944
      <xsl:text>Meter widget moves the end of "needle" labeled path along "range" labeled
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6945
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6946
      <xsl:text>path, according to value of the single accepted variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6947
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6948
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6949
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6950
      <xsl:text>Needle is reduced to a single segment. If "min" a "max" labeled texts
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6951
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6952
      <xsl:text>are provided, or if first and second argument are given, then they are used
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6953
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6954
      <xsl:text>as respective minimum and maximum value. Otherwise, value is expected to be
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6955
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6956
      <xsl:text>in between 0 and 100.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6957
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6958
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6959
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6960
      <xsl:text>Moves "needle" along "range"</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6961
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6962
    <arg name="min" count="optional" accepts="int,real">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6963
      <xsl:text>minimum value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6964
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6965
    <arg name="max" count="optional" accepts="int,real">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6966
      <xsl:text>maximum value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6967
    </arg>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6968
    <path name="value" accepts="HMI_INT,HMI_REAL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6969
      <xsl:text>Value to display</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6970
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  6971
  </xsl:template>
3276
c696ecf5173a SVGHMI: update generated xslt
Edouard Tisserant
parents: 3268
diff changeset
  6972
  <xsl:template match="widget[@type='Meter']" mode="widget_class">
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6973
    <xsl:text>class </xsl:text>
3276
c696ecf5173a SVGHMI: update generated xslt
Edouard Tisserant
parents: 3268
diff changeset
  6974
    <xsl:text>MeterWidget</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  6975
    <xsl:text> extends Widget{
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6976
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6977
    <xsl:text>    frequency = 10;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6978
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6979
    <xsl:text>    origin = undefined;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6980
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6981
    <xsl:text>    range = undefined;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6982
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6983
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6984
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6985
    <xsl:text>    dispatch(value) {
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6986
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6987
    <xsl:text>        this.display_val = value;
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6988
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6989
    <xsl:text>        this.request_animate();
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6990
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6991
    <xsl:text>    }
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6992
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6993
    <xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6994
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6995
    <xsl:text>    animate(){
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6996
</xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6997
    <xsl:text>        if(this.value_elt)
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  6998
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  6999
    <xsl:text>            this.value_elt.textContent = String(this.display_val);
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7000
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7001
    <xsl:text>        let [min,max,totallength] = this.range;
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7002
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7003
    <xsl:text>        let length = Math.max(0,Math.min(totallength,(Number(this.display_val)-min)*totallength/(max-min)));
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7004
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7005
    <xsl:text>        let tip = this.range_elt.getPointAtLength(length);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7006
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7007
    <xsl:text>        this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7008
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7009
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7010
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7011
    <xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7012
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7013
    <xsl:text>    init() {
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7014
</xsl:text>
3112
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7015
    <xsl:text>        let [min,max] = [[this.min_elt,0],[this.max_elt,100]].map(([elt,def],i)=&gt;elt?
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7016
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7017
    <xsl:text>            Number(elt.textContent) :
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7018
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7019
    <xsl:text>            this.args.length &gt;= i+1 ? this.args[i] : def);
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7020
</xsl:text>
bd20f9112014 SVGHMI: still WIP, now POT file is properly generated with utf-8 encoding and POEdit is launched when pressing button.
Edouard Tisserant
parents: 3103
diff changeset
  7021
    <xsl:text>
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7022
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7023
    <xsl:text>        this.range = [min, max, this.range_elt.getTotalLength()]
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7024
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7025
    <xsl:text>        this.origin = this.needle_elt.getPointAtLength(0);
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7026
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7027
    <xsl:text>    }
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7028
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7029
    <xsl:text>}
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7030
</xsl:text>
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7031
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7032
  <xsl:template match="widget[@type='Meter']" mode="widget_defs">
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
  7033
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7034
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7035
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7036
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7037
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7038
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7039
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7040
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7041
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7042
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7043
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7044
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
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
  7045
    <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
  7046
      <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
  7047
      <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
  7048
        <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
  7049
      </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
  7050
    </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
  7051
    <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
  7052
      <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
  7053
      <xsl:with-param name="labels">
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
  7054
        <xsl:text>min max</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
  7055
      </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
  7056
      <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
  7057
    </xsl:call-template>
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
  7058
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7059
  <xsl:template match="widget[@type='MultiState']" mode="widget_defs">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7060
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7061
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7062
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7063
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7064
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7065
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7066
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7067
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7068
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7069
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7070
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7071
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7072
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7073
      <xsl:text>Mutlistateh widget hides all subelements whose label do not match given
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7074
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7075
      <xsl:text>variable value representation. For exemple if given variable type
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7076
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7077
      <xsl:text>is HMI_INT and value is 1, then elements with label '1' will be displayed.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7078
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7079
      <xsl:text>Label can have comments, so '1#some comment' would also match. If matching
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7080
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7081
      <xsl:text>variable of type HMI_STRING, then double quotes must be used. For exemple,
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7082
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7083
      <xsl:text>'"hello"' or '"hello"#another comment' match HMI_STRING 'hello'.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7084
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7085
      <xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7086
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7087
      <xsl:text>Click on widget changes variable value to next value in given list, or to
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7088
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7089
      <xsl:text>first one if not initialized to value already part of the list.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7090
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7091
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7092
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7093
      <xsl:text>Show elements whose label match value.</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7094
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7095
    <path name="value" accepts="HMI_INT,HMI_STRING">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7096
      <xsl:text>value to compare to labels</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7097
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7098
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7099
  <xsl:template match="widget[@type='MultiState']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7100
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7101
    <xsl:text>MultiStateWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7102
    <xsl:text> extends Widget{
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7103
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7104
    <xsl:text>    frequency = 5;
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7105
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7106
    <xsl:text>    state = 0;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7107
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7108
    <xsl:text>    dispatch(value) {
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7109
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7110
    <xsl:text>        this.state = value;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7111
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7112
    <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
  7113
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7114
    <xsl:text>            if(this.state != choice.value){
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7115
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7116
    <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
  7117
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7118
    <xsl:text>            } else {
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7119
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7120
    <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
  7121
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7122
    <xsl:text>            }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7123
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7124
    <xsl:text>        }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7125
</xsl:text>
3554
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  7126
    <xsl:text>        // TODO : use RequestAnimate and animate()
611fd1f44ce9 SVGHMI: update generated XSLT file
Edouard Tisserant
parents: 3525
diff changeset
  7127
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7128
    <xsl:text>    }
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7129
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7130
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7131
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7132
    <xsl:text>    on_click(evt) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7133
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7134
    <xsl:text>        //get current selected value
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7135
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7136
    <xsl:text>        let next_ind;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7137
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7138
    <xsl:text>        for(next_ind=0; next_ind&lt;this.choices.length; next_ind++){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7139
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7140
    <xsl:text>            if(this.state == this.choices[next_ind].value){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7141
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7142
    <xsl:text>               next_ind = next_ind + 1;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7143
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7144
    <xsl:text>               break;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7145
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7146
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7147
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7148
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7149
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7150
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7151
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7152
    <xsl:text>        //get next selected value
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7153
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7154
    <xsl:text>        if(this.choices.length &gt; next_ind){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7155
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7156
    <xsl:text>            this.state = this.choices[next_ind].value;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7157
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7158
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7159
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7160
    <xsl:text>        else{
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7161
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7162
    <xsl:text>            this.state = this.choices[0].value;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7163
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7164
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7165
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7166
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7167
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7168
    <xsl:text>        //post value to plc
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7169
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  7170
    <xsl:text>        this.apply_hmi_value(0, this.state);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7171
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7172
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7173
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7174
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7175
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7176
    <xsl:text>    init() {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7177
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7178
    <xsl:text>        this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7179
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7180
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7181
</xsl:text>
2962
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7182
    <xsl:text>}
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7183
</xsl:text>
02ea529fd08c SVGHMI: Switch widget now use class declaration
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2961
diff changeset
  7184
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7185
  <xsl:template match="widget[@type='MultiState']" mode="widget_defs">
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7186
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7187
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7188
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7189
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7190
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7191
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7192
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7193
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7194
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7195
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7196
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7197
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7198
    <xsl:text>    choices: [
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7199
</xsl:text>
2907
1695122a5e16 SVGHMI: HMI:Switch now accepts boolean values 'true' and 'false'
Edouard Tisserant
parents: 2906
diff changeset
  7200
    <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
  7201
    <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
  7202
      <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
  7203
      <xsl:text>        {
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7204
</xsl:text>
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7205
      <xsl:text>            elt:id("</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7206
      <xsl:value-of select="@id"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7207
      <xsl:text>"),
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7208
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7209
      <xsl:text>            style:"</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7210
      <xsl:value-of select="@style"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7211
      <xsl:text>",
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7212
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7213
      <xsl:text>            value:</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7214
      <xsl:value-of select="$literal"/>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7215
      <xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7216
</xsl:text>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7217
      <xsl:text>        }</xsl:text>
2839
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7218
      <xsl:if test="position()!=last()">
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7219
        <xsl:text>,</xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7220
      </xsl:if>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7221
      <xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7222
</xsl:text>
f4dd234faa11 SVGHMI: Added mostly untested switch widget
Edouard Tisserant
parents: 2838
diff changeset
  7223
    </xsl:for-each>
2851
8d15c6238e62 SVGHMI: re-indent generated JS
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2850
diff changeset
  7224
    <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
  7225
</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
  7226
  </xsl:template>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7227
  <xsl:template match="widget[@type='Page']" mode="widget_desc">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7228
    <type>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7229
      <xsl:value-of select="@type"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7230
    </type>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7231
    <longdesc>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7232
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7233
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7234
      <xsl:text>Arguments are either:
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7235
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7236
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7237
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7238
      <xsl:text>- XXX reference path TODO
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7239
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7240
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7241
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7242
      <xsl:text>- name=value: setting variable with literal value.
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7243
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7244
      <xsl:text>- name=other_name: copy variable content into another
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7245
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7246
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7247
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7248
      <xsl:text>"active"+"inactive" labeled elements can be provided to show feedback when pressed
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7249
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7250
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7251
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7252
      <xsl:text>Exemples:
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7253
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7254
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7255
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7256
      <xsl:text>HMI:Page:notify=1@notify=/PLCVAR
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7257
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7258
      <xsl:text>HMI:Page:ack=2:notify=1@ack=.local_var@notify=/PLCVAR
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7259
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7260
      <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7261
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7262
    </longdesc>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7263
    <shortdesc>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7264
      <xsl:text>Page </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7265
    </shortdesc>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7266
  </xsl:template>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7267
  <xsl:template match="widget[@type='Page']" mode="widget_defs">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7268
    <xsl:param name="hmi_element"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7269
    <xsl:variable name="disability">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7270
      <xsl:call-template name="defs_by_labels">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7271
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7272
        <xsl:with-param name="labels">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7273
          <xsl:text>/disabled</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7274
        </xsl:with-param>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7275
        <xsl:with-param name="mandatory" select="'no'"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7276
      </xsl:call-template>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7277
    </xsl:variable>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7278
    <xsl:value-of select="$disability"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7279
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7280
    <xsl:text>    assignments: {},
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7281
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7282
    <xsl:text>    dispatch: function(value, oldval, varnum) {
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7283
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7284
    <xsl:variable name="widget" select="."/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7285
    <xsl:for-each select="path">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7286
      <xsl:variable name="varid" select="generate-id()"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7287
      <xsl:variable name="varnum" select="position()-1"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7288
      <xsl:if test="@assign">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7289
        <xsl:for-each select="$widget/path[@assign]">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7290
          <xsl:if test="$varid = generate-id()">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7291
            <xsl:text>        if(varnum == </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7292
            <xsl:value-of select="$varnum"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7293
            <xsl:text>) this.assignments["</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7294
            <xsl:value-of select="@assign"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7295
            <xsl:text>"] = value;
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7296
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7297
          </xsl:if>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7298
        </xsl:for-each>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7299
      </xsl:if>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7300
    </xsl:for-each>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7301
    <xsl:text>    },
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7302
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7303
    <xsl:text>    assign: function() {
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7304
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7305
    <xsl:variable name="paths" select="path"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7306
    <xsl:for-each select="arg[contains(@value,'=')]">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7307
      <xsl:variable name="name" select="substring-before(@value,'=')"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7308
      <xsl:variable name="value" select="substring-after(@value,'=')"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7309
      <xsl:variable name="index">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7310
        <xsl:for-each select="$paths">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7311
          <xsl:if test="@assign = $name">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7312
            <xsl:value-of select="position()-1"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7313
          </xsl:if>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7314
        </xsl:for-each>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7315
      </xsl:variable>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7316
      <xsl:variable name="isVarName" select="regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]+$')"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7317
      <xsl:choose>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7318
        <xsl:when test="$isVarName">
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7319
          <xsl:text>        const </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7320
          <xsl:value-of select="$value"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7321
          <xsl:text> = this.assignments["</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7322
          <xsl:value-of select="$value"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7323
          <xsl:text>"];
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7324
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7325
          <xsl:text>        if(</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7326
          <xsl:value-of select="$value"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7327
          <xsl:text> != undefined)
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7328
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7329
          <xsl:text>            this.apply_hmi_value(</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7330
          <xsl:value-of select="$index"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7331
          <xsl:text>, </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7332
          <xsl:value-of select="$value"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7333
          <xsl:text>);
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7334
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7335
        </xsl:when>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7336
        <xsl:otherwise>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7337
          <xsl:text>        this.apply_hmi_value(</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7338
          <xsl:value-of select="$index"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7339
          <xsl:text>, </xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7340
          <xsl:value-of select="$value"/>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7341
          <xsl:text>);
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7342
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7343
        </xsl:otherwise>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7344
      </xsl:choose>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7345
    </xsl:for-each>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7346
    <xsl:text>    },
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7347
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
  7348
  </xsl:template>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7349
  <xsl:template match="widget[@type='PathSlider']" mode="widget_desc">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7350
    <type>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7351
      <xsl:value-of select="@type"/>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7352
    </type>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7353
    <longdesc>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  7354
      <xsl:text>PathSlider -
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7355
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7356
    </longdesc>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7357
    <shortdesc>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7358
      <xsl:text>Slide an SVG element along a path by dragging it</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7359
    </shortdesc>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7360
    <path name="value" accepts="HMI_INT,HMI_REAL">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7361
      <xsl:text>value</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7362
    </path>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7363
    <path name="min" count="optional" accepts="HMI_INT,HMI_REAL">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7364
      <xsl:text>min</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7365
    </path>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7366
    <path name="max" count="optional" accepts="HMI_INT,HMI_REAL">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7367
      <xsl:text>max</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7368
    </path>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7369
    <arg name="min" count="optional" accepts="int,real">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7370
      <xsl:text>minimum value</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7371
    </arg>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7372
    <arg name="max" count="optional" accepts="int,real">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7373
      <xsl:text>maximum value</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7374
    </arg>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7375
  </xsl:template>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7376
  <xsl:template match="widget[@type='PathSlider']" mode="widget_class">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7377
    <xsl:text>class </xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7378
    <xsl:text>PathSliderWidget</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7379
    <xsl:text> extends Widget{
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7380
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7381
    <xsl:text>    frequency = 10;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7382
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7383
    <xsl:text>    position = undefined;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7384
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7385
    <xsl:text>    min = 0;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7386
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7387
    <xsl:text>    max = 100;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7388
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7389
    <xsl:text>    scannedPoints = [];
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7390
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7391
    <xsl:text>    pathLength = undefined;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7392
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7393
    <xsl:text>    precision = undefined;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7394
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7395
    <xsl:text>    origPt = undefined;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7396
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  7397
    <xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7398
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7399
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7400
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7401
    <xsl:text>    scanPath() {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7402
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7403
    <xsl:text>      this.pathLength = this.path_elt.getTotalLength();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7404
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7405
    <xsl:text>      this.precision = Math.floor(this.pathLength / 10);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7406
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7407
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7408
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7409
    <xsl:text>      // save linear scan for coarse approximation
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7410
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7411
    <xsl:text>      for (var scanLength = 0; scanLength &lt;= this.pathLength; scanLength += this.precision) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7412
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7413
    <xsl:text>        this.scannedPoints.push([this.path_elt.getPointAtLength(scanLength), scanLength]);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7414
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7415
    <xsl:text>      }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7416
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7417
    <xsl:text>      [this.origPt,] = this.scannedPoints[0];
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7418
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7419
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7420
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7421
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7422
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7423
    <xsl:text>    closestPoint(point) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7424
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7425
    <xsl:text>      var bestPoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7426
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7427
    <xsl:text>          bestLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7428
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7429
    <xsl:text>          bestDistance = Infinity,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7430
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7431
    <xsl:text>          scanDistance;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7432
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7433
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7434
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7435
    <xsl:text>      // use linear scan for coarse approximation
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7436
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7437
    <xsl:text>      for (let [scanPoint, scanLength] of this.scannedPoints){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7438
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7439
    <xsl:text>        if ((scanDistance = distance2(scanPoint)) &lt; bestDistance) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7440
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7441
    <xsl:text>          bestPoint = scanPoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7442
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7443
    <xsl:text>          bestLength = scanLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7444
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7445
    <xsl:text>          bestDistance = scanDistance;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7446
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7447
    <xsl:text>        }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7448
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7449
    <xsl:text>      }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7450
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7451
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7452
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7453
    <xsl:text>      // binary search for more precise estimate
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7454
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7455
    <xsl:text>      let precision = this.precision / 2;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7456
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7457
    <xsl:text>      while (precision &gt; 0.5) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7458
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7459
    <xsl:text>        var beforePoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7460
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7461
    <xsl:text>            afterPoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7462
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7463
    <xsl:text>            beforeLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7464
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7465
    <xsl:text>            afterLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7466
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7467
    <xsl:text>            beforeDistance,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7468
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7469
    <xsl:text>            afterDistance;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7470
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7471
    <xsl:text>        if ((beforeLength = bestLength - precision) &gt;= 0 &amp;&amp;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7472
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7473
    <xsl:text>            (beforeDistance = distance2(beforePoint = this.path_elt.getPointAtLength(beforeLength))) &lt; bestDistance) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7474
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7475
    <xsl:text>          bestPoint = beforePoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7476
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7477
    <xsl:text>          bestLength = beforeLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7478
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7479
    <xsl:text>          bestDistance = beforeDistance;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7480
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
  7481
    <xsl:text>        } else if ((afterLength = bestLength + precision) &lt;= this.pathLength &amp;&amp;
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7482
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7483
    <xsl:text>                   (afterDistance = distance2(afterPoint = this.path_elt.getPointAtLength(afterLength))) &lt; bestDistance) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7484
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7485
    <xsl:text>          bestPoint = afterPoint,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7486
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7487
    <xsl:text>          bestLength = afterLength,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7488
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7489
    <xsl:text>          bestDistance = afterDistance;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7490
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7491
    <xsl:text>        }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7492
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7493
    <xsl:text>        precision /= 2;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7494
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7495
    <xsl:text>      }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7496
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7497
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7498
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7499
    <xsl:text>      return [bestPoint, bestLength];
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7500
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7501
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7502
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7503
    <xsl:text>      function distance2(p) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7504
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7505
    <xsl:text>        var dx = p.x - point.x,
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7506
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7507
    <xsl:text>            dy = p.y - point.y;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7508
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7509
    <xsl:text>        return dx * dx + dy * dy;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7510
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7511
    <xsl:text>      }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7512
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7513
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7514
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7515
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7516
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7517
    <xsl:text>    dispatch(value,oldval, index) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7518
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7519
    <xsl:text>        switch(index) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7520
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7521
    <xsl:text>            case 0:
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7522
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7523
    <xsl:text>                this.position = value;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7524
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7525
    <xsl:text>                break;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7526
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7527
    <xsl:text>            case 1:
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7528
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7529
    <xsl:text>                this.min = value;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7530
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7531
    <xsl:text>                break;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7532
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7533
    <xsl:text>            case 2:
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7534
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7535
    <xsl:text>                this.max = value;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7536
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7537
    <xsl:text>                break;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7538
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7539
    <xsl:text>        }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7540
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7541
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7542
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7543
    <xsl:text>        this.request_animate();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7544
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7545
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7546
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7547
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7548
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7549
    <xsl:text>    get_current_point(){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7550
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7551
    <xsl:text>        let currLength = this.pathLength * (this.position - this.min) / (this.max - this.min)
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7552
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7553
    <xsl:text>        return this.path_elt.getPointAtLength(currLength);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7554
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7555
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7556
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7557
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7558
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7559
    <xsl:text>    animate(){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7560
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7561
    <xsl:text>        if(this.position == undefined)
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7562
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7563
    <xsl:text>            return;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7564
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7565
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7566
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7567
    <xsl:text>        let currPt = this.get_current_point();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7568
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7569
    <xsl:text>        this.cursor_transform.setTranslate(currPt.x - this.origPt.x, currPt.y - this.origPt.y);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7570
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7571
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7572
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7573
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7574
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7575
    <xsl:text>    init() {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7576
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7577
    <xsl:text>        if(this.args.length == 2)
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7578
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7579
    <xsl:text>            [this.min, this.max]=this.args;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7580
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7581
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7582
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7583
    <xsl:text>        this.scanPath();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7584
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7585
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7586
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7587
    <xsl:text>        this.cursor_transform = svg_root.createSVGTransform();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7588
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7589
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7590
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7591
    <xsl:text>        this.cursor_elt.transform.baseVal.appendItem(this.cursor_transform);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7592
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7593
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7594
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7595
    <xsl:text>        this.cursor_elt.onpointerdown = (e) =&gt; this.on_cursor_down(e);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7596
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7597
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7598
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7599
    <xsl:text>        this.bound_drag = this.drag.bind(this);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7600
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7601
    <xsl:text>        this.bound_drop = this.drop.bind(this);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7602
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7603
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7604
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7605
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7606
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7607
    <xsl:text>    start_dragging_from_event(e){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7608
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7609
    <xsl:text>        let clientPoint = new DOMPoint(e.clientX, e.clientY);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7610
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7611
    <xsl:text>        let point = clientPoint.matrixTransform(this.invctm);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7612
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7613
    <xsl:text>        let currPt = this.get_current_point();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7614
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7615
    <xsl:text>        this.draggingOffset = new DOMPoint(point.x - currPt.x , point.y - currPt.y);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7616
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7617
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7618
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7619
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7620
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7621
    <xsl:text>    apply_position_from_event(e){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7622
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7623
    <xsl:text>        let clientPoint = new DOMPoint(e.clientX, e.clientY);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7624
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7625
    <xsl:text>        let rawPoint = clientPoint.matrixTransform(this.invctm);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7626
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7627
    <xsl:text>        let point = new DOMPoint(rawPoint.x - this.draggingOffset.x , rawPoint.y - this.draggingOffset.y);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7628
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7629
    <xsl:text>        let [closestPoint, closestLength] = this.closestPoint(point);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7630
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7631
    <xsl:text>        let new_position = this.min + (this.max - this.min) * closestLength / this.pathLength;
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7632
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7633
    <xsl:text>        this.position = Math.round(Math.max(Math.min(new_position, this.max), this.min));
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7634
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7635
    <xsl:text>        this.apply_hmi_value(0, this.position);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7636
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7637
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7638
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7639
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7640
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7641
    <xsl:text>    on_cursor_down(e){
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7642
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7643
    <xsl:text>        // get scrollbar -&gt; root transform
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7644
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7645
    <xsl:text>        let ctm = this.path_elt.getCTM();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7646
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7647
    <xsl:text>        // root -&gt; path transform
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7648
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7649
    <xsl:text>        this.invctm = ctm.inverse();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7650
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7651
    <xsl:text>        this.start_dragging_from_event(e);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7652
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7653
    <xsl:text>        svg_root.addEventListener("pointerup", this.bound_drop, true);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7654
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7655
    <xsl:text>        svg_root.addEventListener("pointermove", this.bound_drag, true);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7656
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7657
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7658
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7659
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7660
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7661
    <xsl:text>    drop(e) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7662
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7663
    <xsl:text>        svg_root.removeEventListener("pointerup", this.bound_drop, true);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7664
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7665
    <xsl:text>        svg_root.removeEventListener("pointermove", this.bound_drag, true);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7666
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7667
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7668
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7669
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7670
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7671
    <xsl:text>    drag(e) {
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7672
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7673
    <xsl:text>        this.apply_position_from_event(e);
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7674
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7675
    <xsl:text>    }
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7676
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7677
    <xsl:text>}
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7678
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7679
  </xsl:template>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7680
  <xsl:template match="widget[@type='PathSlider']" mode="widget_defs">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7681
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7682
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7683
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7684
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7685
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7686
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7687
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7688
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7689
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7690
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7691
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7692
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7693
    <xsl:call-template name="defs_by_labels">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7694
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7695
      <xsl:with-param name="labels">
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7696
        <xsl:text>cursor path</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7697
      </xsl:with-param>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7698
    </xsl:call-template>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7699
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7700
  <xsl:template match="widget[@type='ScrollBar']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7701
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7702
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7703
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7704
    <longdesc>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7705
      <xsl:text>ScrollBar - svg:rect based scrollbar
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7706
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7707
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7708
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7709
      <xsl:text>ScrollBar</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7710
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7711
    <path name="value" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7712
      <xsl:text>value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7713
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7714
    <path name="range" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7715
      <xsl:text>range</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7716
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7717
    <path name="visible" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7718
      <xsl:text>visible</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7719
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7720
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7721
  <xsl:template match="widget[@type='ScrollBar']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7722
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7723
    <xsl:text>ScrollBarWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7724
    <xsl:text> extends Widget{
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7725
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7726
    <xsl:text>    frequency = 10;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7727
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7728
    <xsl:text>    position = undefined;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7729
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7730
    <xsl:text>    range = undefined;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7731
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7732
    <xsl:text>    size = undefined;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7733
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7734
    <xsl:text>    mincursize = 0.1;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7735
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7736
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7737
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7738
    <xsl:text>    dispatch(value,oldval, index) {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7739
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7740
    <xsl:text>        switch(index) {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7741
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7742
    <xsl:text>            case 0:
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7743
</xsl:text>
3178
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7744
    <xsl:text>                this.range = Math.max(1,value);
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7745
</xsl:text>
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7746
    <xsl:text>                break;
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7747
</xsl:text>
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7748
    <xsl:text>            case 1:
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7749
</xsl:text>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7750
    <xsl:text>                this.position = value;
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7751
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7752
    <xsl:text>                break;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7753
</xsl:text>
3178
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7754
    <xsl:text>            case 2:
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7755
</xsl:text>
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7756
    <xsl:text>                this.size = value;
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7757
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7758
    <xsl:text>                break;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7759
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7760
    <xsl:text>        }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7761
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7762
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7763
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7764
    <xsl:text>        this.request_animate();
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7765
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7766
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7767
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7768
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7769
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7770
    <xsl:text>    get_ratios() {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7771
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7772
    <xsl:text>        let range = this.range;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7773
</xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7774
    <xsl:text>        let size = Math.max(range * this.mincursize, Math.min(this.size, range));
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7775
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7776
    <xsl:text>        let maxh = this.range_elt.height.baseVal.value;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7777
</xsl:text>
3151
8e5d383a58cb SVGHMI: Fixed HMI:ScrollBar to exclude cursor size from accessible range ( position is now 0->range-size instead of 0->range ). Fixed and extended tests/svghmi to have working ScrollBar on two alarm pages. Includes generated XSLT update.
Edouard Tisserant
parents: 3150
diff changeset
  7778
    <xsl:text>        let pixels = maxh;
8e5d383a58cb SVGHMI: Fixed HMI:ScrollBar to exclude cursor size from accessible range ( position is now 0->range-size instead of 0->range ). Fixed and extended tests/svghmi to have working ScrollBar on two alarm pages. Includes generated XSLT update.
Edouard Tisserant
parents: 3150
diff changeset
  7779
</xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7780
    <xsl:text>        return [size, maxh, range, pixels];
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7781
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7782
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7783
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7784
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7785
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7786
    <xsl:text>    animate(){
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7787
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7788
    <xsl:text>        if(this.position == undefined || this.range == undefined || this.size == undefined)
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7789
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7790
    <xsl:text>            return;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7791
</xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7792
    <xsl:text>        let [size, maxh, range, pixels] = this.get_ratios();
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7793
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7794
    <xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7795
</xsl:text>
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7796
    <xsl:text>        let new_y = this.range_elt.y.baseVal.value + Math.round(Math.min(this.position,range-size) * pixels / range);
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7797
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7798
    <xsl:text>        let new_height = Math.round(maxh * size/range);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7799
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7800
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7801
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7802
    <xsl:text>        this.cursor_elt.y.baseVal.value = new_y;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7803
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7804
    <xsl:text>        this.cursor_elt.height.baseVal.value = new_height;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7805
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7806
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7807
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7808
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7809
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7810
    <xsl:text>    init_mandatory() {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7811
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7812
    <xsl:text>        this.cursor_elt.onpointerdown = () =&gt; this.on_cursor_down();
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7813
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7814
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7815
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7816
    <xsl:text>        this.bound_drag = this.drag.bind(this);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7817
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7818
    <xsl:text>        this.bound_drop = this.drop.bind(this);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7819
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7820
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7821
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7822
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7823
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7824
    <xsl:text>    apply_position(position){
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7825
</xsl:text>
3151
8e5d383a58cb SVGHMI: Fixed HMI:ScrollBar to exclude cursor size from accessible range ( position is now 0->range-size instead of 0->range ). Fixed and extended tests/svghmi to have working ScrollBar on two alarm pages. Includes generated XSLT update.
Edouard Tisserant
parents: 3150
diff changeset
  7826
    <xsl:text>        this.position = Math.round(Math.max(Math.min(position, this.range - this.size), 0));
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7827
</xsl:text>
3178
21cb76012c78 SVGHMI: Make ScrollBar's variables order match JsonTable's variables order to avoid confusion
Edouard Tisserant
parents: 3175
diff changeset
  7828
    <xsl:text>        this.apply_hmi_value(1, this.position);
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7829
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7830
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7831
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7832
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7833
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7834
    <xsl:text>    on_page_click(is_up){
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7835
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7836
    <xsl:text>        this.apply_position(is_up ? this.position-this.size
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7837
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7838
    <xsl:text>                                  : this.position+this.size);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7839
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7840
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7841
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7842
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7843
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7844
    <xsl:text>    on_cursor_down(e){
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7845
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7846
    <xsl:text>        // get scrollbar -&gt; root transform
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7847
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7848
    <xsl:text>        let ctm = this.range_elt.getCTM();
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7849
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7850
    <xsl:text>        // relative motion -&gt; discard translation
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7851
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7852
    <xsl:text>        ctm.e = 0;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7853
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7854
    <xsl:text>        ctm.f = 0;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7855
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7856
    <xsl:text>        // root -&gt; scrollbar transform
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7857
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7858
    <xsl:text>        this.invctm = ctm.inverse();
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7859
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7860
    <xsl:text>        svg_root.addEventListener("pointerup", this.bound_drop, true);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7861
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7862
    <xsl:text>        svg_root.addEventListener("pointermove", this.bound_drag, true);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7863
</xsl:text>
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7864
    <xsl:text>        this.dragpos = this.position;
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7865
</xsl:text>
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7866
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7867
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7868
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7869
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7870
    <xsl:text>    drop(e) {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7871
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7872
    <xsl:text>        svg_root.removeEventListener("pointerup", this.bound_drop, true);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7873
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7874
    <xsl:text>        svg_root.removeEventListener("pointermove", this.bound_drag, true);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7875
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7876
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7877
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7878
    <xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7879
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7880
    <xsl:text>    drag(e) {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7881
</xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7882
    <xsl:text>        let [size, maxh, range, pixels] = this.get_ratios();
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7883
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7884
    <xsl:text>        if(pixels == 0) return;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7885
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7886
    <xsl:text>        let point = new DOMPoint(e.movementX, e.movementY);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7887
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7888
    <xsl:text>        let movement = point.matrixTransform(this.invctm).y;
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7889
</xsl:text>
3358
7478d0c0dc1c SVGHMI: Update generated XSLT (PathSlider widget)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3355
diff changeset
  7890
    <xsl:text>        this.dragpos += movement * range / pixels;
3147
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7891
</xsl:text>
910290aec533 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3141
diff changeset
  7892
    <xsl:text>        this.apply_position(this.dragpos);
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7893
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7894
    <xsl:text>    }
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7895
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7896
    <xsl:text>}
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7897
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7898
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7899
  <xsl:template match="widget[@type='ScrollBar']" mode="widget_defs">
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7900
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7901
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7902
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7903
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7904
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7905
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7906
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7907
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7908
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7909
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7910
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  7911
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3141
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7912
    <xsl:call-template name="defs_by_labels">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7913
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7914
      <xsl:with-param name="labels">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7915
        <xsl:text>cursor range</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7916
      </xsl:with-param>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7917
    </xsl:call-template>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7918
    <xsl:variable name="pagebuttons">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7919
      <xsl:call-template name="defs_by_labels">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7920
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7921
        <xsl:with-param name="labels">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7922
          <xsl:text>pageup pagedown</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7923
        </xsl:with-param>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7924
        <xsl:with-param name="mandatory" select="'no'"/>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7925
      </xsl:call-template>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7926
    </xsl:variable>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7927
    <xsl:variable name="have_pagebuttons" select="string-length($pagebuttons)&gt;0"/>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7928
    <xsl:value-of select="$pagebuttons"/>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7929
    <xsl:text>    init: function() {
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7930
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7931
    <xsl:text>        this.init_mandatory();
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7932
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7933
    <xsl:if test="$have_pagebuttons">
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7934
      <xsl:text>        this.pageup_elt.onclick = () =&gt; this.on_page_click(true);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7935
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7936
      <xsl:text>        this.pagedown_elt.onclick = () =&gt; this.on_page_click(false);
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7937
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7938
    </xsl:if>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7939
    <xsl:text>    },
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7940
</xsl:text>
6d4c1e6560ac SVGHMI: update generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3134
diff changeset
  7941
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7942
  <xsl:template match="widget[@type='Slider']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7943
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7944
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7945
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7946
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7947
      <xsl:text>Slider - DEPRECATED - use ScrollBar or PathSlider instead
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7948
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7949
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7950
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7951
      <xsl:text>Slider - DEPRECATED - use ScrollBar instead</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7952
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7953
    <path name="value" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7954
      <xsl:text>value</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7955
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7956
    <path name="range" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7957
      <xsl:text>range</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7958
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7959
    <path name="visible" accepts="HMI_INT">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7960
      <xsl:text>visible</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7961
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  7962
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7963
  <xsl:template match="widget[@type='Slider']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7964
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7965
    <xsl:text>SliderWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7966
    <xsl:text> extends Widget{
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  7967
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7968
    <xsl:text>    frequency = 5;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7969
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7970
    <xsl:text>    range = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7971
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7972
    <xsl:text>    handle_orig = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7973
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7974
    <xsl:text>    scroll_size = undefined;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7975
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7976
    <xsl:text>    scroll_range = 0;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7977
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7978
    <xsl:text>    scroll_visible = 7;
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7979
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7980
    <xsl:text>    min_size = 0.07;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7981
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7982
    <xsl:text>    fi = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7983
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7984
    <xsl:text>    curr_value = 0;
3045
f6d428330e04 All widgets reworked to use widget class and animate function if needed
usveticic
parents: 3026
diff changeset
  7985
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7986
    <xsl:text>    drag = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7987
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7988
    <xsl:text>    enTimer = false;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7989
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7990
    <xsl:text>    handle_click = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7991
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7992
    <xsl:text>    last_drag = false;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  7993
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7994
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  7995
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7996
    <xsl:text>    dispatch(value,oldval, index) {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7997
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7998
    <xsl:text>        if (index == 0){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  7999
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8000
    <xsl:text>            let [min,max,start,totallength] = this.range;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8001
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8002
    <xsl:text>            //save current value inside widget
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8003
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8004
    <xsl:text>            this.curr_value = value;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8005
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8006
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8007
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8008
    <xsl:text>            //check if in range
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8009
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8010
    <xsl:text>            if (this.curr_value &gt; max){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8011
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8012
    <xsl:text>                this.curr_value = max;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8013
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8014
    <xsl:text>                this.apply_hmi_value(0, this.curr_value);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8015
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8016
    <xsl:text>            }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8017
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8018
    <xsl:text>            else if (this.curr_value &lt; min){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8019
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8020
    <xsl:text>                this.curr_value = min;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8021
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8022
    <xsl:text>                this.apply_hmi_value(0, this.curr_value);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8023
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8024
    <xsl:text>            }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8025
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8026
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8027
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8028
    <xsl:text>            if(this.value_elt)
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8029
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8030
    <xsl:text>                this.value_elt.textContent = String(value);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8031
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8032
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8033
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8034
    <xsl:text>        else if(index == 1){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8035
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8036
    <xsl:text>            this.scroll_range = value;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8037
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8038
    <xsl:text>            this.set_scroll();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8039
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8040
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8041
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8042
    <xsl:text>        else if(index == 2){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8043
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8044
    <xsl:text>            this.scroll_visible = value;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8045
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8046
    <xsl:text>            this.set_scroll();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8047
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8048
    <xsl:text>        }
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8049
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8050
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8051
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8052
    <xsl:text>        //don't update if draging and setpoint ghost doesn't exist
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8053
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8054
    <xsl:text>        if(!this.drag || (this.setpoint_elt != undefined)){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8055
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8056
    <xsl:text>            this.update_DOM(this.curr_value, this.handle_elt);
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8057
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8058
    <xsl:text>        }
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8059
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8060
    <xsl:text>    }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8061
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8062
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8063
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8064
    <xsl:text>    set_scroll(){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8065
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8066
    <xsl:text>        //check if range is bigger than visible and set scroll size
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8067
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8068
    <xsl:text>        if(this.scroll_range &gt; this.scroll_visible){
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8069
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8070
    <xsl:text>            this.scroll_size = this.scroll_range - this.scroll_visible;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8071
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8072
    <xsl:text>            this.range[0] = 0;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8073
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8074
    <xsl:text>            this.range[1] = this.scroll_size;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8075
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8076
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8077
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8078
    <xsl:text>        else{
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8079
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8080
    <xsl:text>            this.scroll_size = 1;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8081
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8082
    <xsl:text>            this.range[0] = 0;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8083
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8084
    <xsl:text>            this.range[1] = 1;
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8085
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8086
    <xsl:text>        }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8087
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8088
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8089
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8090
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8091
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8092
    <xsl:text>    update_DOM(value, elt){
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8093
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8094
    <xsl:text>        let [min,max,start,totallength] = this.range;
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8095
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8096
    <xsl:text>        // check if handle is resizeable
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8097
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8098
    <xsl:text>        if (this.scroll_size != undefined){ //size changes
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8099
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8100
    <xsl:text>            //get parameters
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8101
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8102
    <xsl:text>            let length = Math.max(min,Math.min(max,(Number(value)-min)*max/(max-min)));
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8103
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8104
    <xsl:text>            let tip = this.range_elt.getPointAtLength(length);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8105
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8106
    <xsl:text>            let handle_min = totallength*this.min_size;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8107
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8108
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8109
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8110
    <xsl:text>            let step = 1;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8111
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8112
    <xsl:text>            //check if range is bigger than  max displayed and recalculate step
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8113
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8114
    <xsl:text>            if ((totallength/handle_min) &lt; (max-min+1)){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8115
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8116
    <xsl:text>                step = (max-min+1)/(totallength/handle_min-1);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8117
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8118
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8119
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8120
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8121
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8122
    <xsl:text>            let kx,ky,offseY,offseX = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8123
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8124
    <xsl:text>            //scale on x or y axes
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8125
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8126
    <xsl:text>            if (this.fi &gt; 0.75){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8127
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8128
    <xsl:text>                //get scale factor
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8129
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8130
    <xsl:text>                if(step &gt; 1){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8131
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8132
    <xsl:text>                    ky = handle_min/this.handle_orig.height;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8133
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8134
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8135
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8136
    <xsl:text>                else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8137
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8138
    <xsl:text>                    ky = (totallength-handle_min*(max-min))/this.handle_orig.height;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8139
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8140
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8141
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8142
    <xsl:text>                kx = 1;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8143
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8144
    <xsl:text>                //get 0 offset to stay inside range
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8145
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8146
    <xsl:text>                offseY = start.y - (this.handle_orig.height + this.handle_orig.y) * ky;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8147
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8148
    <xsl:text>                offseX = 0;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8149
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8150
    <xsl:text>                //get distance from value
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8151
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8152
    <xsl:text>                tip.y =this.range_elt.getPointAtLength(0).y - length/step *handle_min;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8153
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8154
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8155
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8156
    <xsl:text>            else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8157
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8158
    <xsl:text>                //get scale factor
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8159
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8160
    <xsl:text>                if(step &gt; 1){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8161
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8162
    <xsl:text>                    kx = handle_min/this.handle_orig.width;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8163
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8164
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8165
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8166
    <xsl:text>                else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8167
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8168
    <xsl:text>                    kx = (totallength-handle_min*(max-min))/this.handle_orig.width;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8169
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8170
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8171
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8172
    <xsl:text>                ky = 1;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8173
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8174
    <xsl:text>                //get 0 offset to stay inside range
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8175
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8176
    <xsl:text>                offseX = start.x - (this.handle_orig.x * kx);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8177
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8178
    <xsl:text>                offseY = 0;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8179
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8180
    <xsl:text>                //get distance from value
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8181
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8182
    <xsl:text>                tip.x =this.range_elt.getPointAtLength(0).x + length/step *handle_min;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8183
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8184
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8185
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8186
    <xsl:text>            elt.setAttribute('transform',"matrix("+(kx)+" 0 0 "+(ky)+" "+(tip.x-start.x+offseX)+" "+(tip.y-start.y+offseY)+")");
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8187
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8188
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8189
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8190
    <xsl:text>        else{ //size stays the same
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8191
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8192
    <xsl:text>            let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min)));
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8193
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8194
    <xsl:text>            let tip = this.range_elt.getPointAtLength(length);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8195
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8196
    <xsl:text>            elt.setAttribute('transform',"translate("+(tip.x-start.x)+","+(tip.y-start.y)+")");
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8197
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8198
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8199
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8200
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8201
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8202
    <xsl:text>        // show or hide ghost if exists
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8203
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8204
    <xsl:text>        if(this.setpoint_elt != undefined){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8205
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8206
    <xsl:text>            if(this.last_drag!= this.drag){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8207
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8208
    <xsl:text>                if(this.drag){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8209
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8210
    <xsl:text>                    this.setpoint_elt.setAttribute("style", this.setpoint_style);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8211
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8212
    <xsl:text>                }else{
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8213
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8214
    <xsl:text>                    this.setpoint_elt.setAttribute("style", "display:none");
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8215
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8216
    <xsl:text>                }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8217
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8218
    <xsl:text>                this.last_drag = this.drag;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8219
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8220
    <xsl:text>            }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8221
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8222
    <xsl:text>        }
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8223
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8224
    <xsl:text>    }
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8225
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8226
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8227
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8228
    <xsl:text>    on_release(evt) {
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8229
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8230
    <xsl:text>        //unbind events
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8231
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8232
    <xsl:text>        window.removeEventListener("touchmove", this.on_bound_drag, true);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8233
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8234
    <xsl:text>        window.removeEventListener("mousemove", this.on_bound_drag, true);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8235
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8236
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8237
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8238
    <xsl:text>        window.removeEventListener("mouseup", this.bound_on_release, true);
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8239
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8240
    <xsl:text>        window.removeEventListener("touchend", this.bound_on_release, true);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8241
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8242
    <xsl:text>        window.removeEventListener("touchcancel", this.bound_on_release, true);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8243
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8244
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8245
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8246
    <xsl:text>        //reset drag flag
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8247
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8248
    <xsl:text>        if(this.drag){
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8249
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8250
    <xsl:text>            this.drag = false;
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8251
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8252
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8253
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8254
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8255
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8256
    <xsl:text>        // get final position
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8257
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8258
    <xsl:text>        this.update_position(evt);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8259
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8260
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8261
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8262
    <xsl:text>    }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8263
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8264
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8265
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8266
    <xsl:text>    on_drag(evt){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8267
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8268
    <xsl:text>        //ignore drag event for X amount of time and if not selected
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8269
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8270
    <xsl:text>        if(this.enTimer &amp;&amp; this.drag){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8271
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8272
    <xsl:text>            this.update_position(evt);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8273
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8274
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8275
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8276
    <xsl:text>            //reset timer
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8277
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8278
    <xsl:text>            this.enTimer = false;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8279
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8280
    <xsl:text>            setTimeout("{hmi_widgets['"+this.element_id+"'].enTimer = true;}", 100);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8281
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8282
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8283
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8284
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8285
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8286
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8287
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8288
    <xsl:text>    update_position(evt){
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8289
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8290
    <xsl:text>        var html_dist = 0;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8291
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8292
    <xsl:text>        let [min,max,start,totallength] = this.range;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8293
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8294
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8295
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8296
    <xsl:text>        //calculate size of widget in html
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8297
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8298
    <xsl:text>        var range_borders = this.range_elt.getBoundingClientRect();
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8299
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8300
    <xsl:text>        var [minX,minY,maxX,maxY] = [range_borders.left,range_borders.bottom,range_borders.right,range_borders.top];
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8301
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8302
    <xsl:text>        var range_length = Math.sqrt( range_borders.height*range_borders.height + range_borders.width*range_borders.width );
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8303
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8304
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8305
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8306
    <xsl:text>        //get range and mouse coordinates
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8307
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8308
    <xsl:text>        var mouseX = undefined;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8309
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8310
    <xsl:text>        var mouseY = undefined;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8311
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8312
    <xsl:text>        if (evt.type.startsWith("touch")){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8313
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8314
    <xsl:text>            mouseX = Math.ceil(evt.touches[0].clientX);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8315
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8316
    <xsl:text>            mouseY = Math.ceil(evt.touches[0].clientY);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8317
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8318
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8319
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8320
    <xsl:text>        else{
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8321
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8322
    <xsl:text>            mouseX = evt.pageX;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8323
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8324
    <xsl:text>            mouseY = evt.pageY;
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8325
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8326
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8327
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8328
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8329
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8330
    <xsl:text>        // calculate position
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8331
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8332
    <xsl:text>        if (this.handle_click){ //if clicked on handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8333
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8334
    <xsl:text>            let moveDist = 0, resizeAdd = 0;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8335
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8336
    <xsl:text>            let range_percent = 1;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8337
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8338
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8339
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8340
    <xsl:text>            //set paramters for resizeable handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8341
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8342
    <xsl:text>            if (this.scroll_size != undefined){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8343
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8344
    <xsl:text>                // add one more object to stay inside range
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8345
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8346
    <xsl:text>                resizeAdd = 1;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8347
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8348
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8349
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8350
    <xsl:text>                //chack if range is bigger than display option and
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8351
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8352
    <xsl:text>                // calculate percent of range with out handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8353
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8354
    <xsl:text>                if(((max/(max*this.min_size)) &lt; (max-min+1))){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8355
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8356
    <xsl:text>                    range_percent = 1-this.min_size;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8357
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8358
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8359
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8360
    <xsl:text>                else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8361
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8362
    <xsl:text>                    range_percent = 1-(max-max*this.min_size*(max-min))/max;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8363
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8364
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8365
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8366
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8367
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8368
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8369
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8370
    <xsl:text>            //calculate value difference on x or y axis
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8371
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8372
    <xsl:text>            if(this.fi &gt; 0.7){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8373
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8374
    <xsl:text>                moveDist = ((max-min+resizeAdd)/(range_length*range_percent))*((this.handle_click[1]-mouseY)/Math.sin(this.fi));
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8375
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8376
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8377
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8378
    <xsl:text>            else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8379
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8380
    <xsl:text>                moveDist = ((max-min+resizeAdd)/(range_length*range_percent))*((mouseX-this.handle_click[0])/Math.cos(this.fi));
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8381
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8382
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8383
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8384
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8385
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8386
    <xsl:text>            this.curr_value = Math.ceil(this.handle_click[2] + moveDist);
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8387
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8388
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8389
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8390
    <xsl:text>        else{ //if clicked on widget
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8391
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8392
    <xsl:text>            //get handle distance from mouse position
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8393
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8394
    <xsl:text>            if (minX &gt; mouseX &amp;&amp; minY &lt; mouseY){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8395
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8396
    <xsl:text>                html_dist = 0;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8397
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8398
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8399
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8400
    <xsl:text>            else if (maxX &lt; mouseX &amp;&amp; maxY &gt; mouseY){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8401
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8402
    <xsl:text>                html_dist = range_length;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8403
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8404
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8405
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8406
    <xsl:text>            else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8407
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8408
    <xsl:text>                if(this.fi &gt; 0.7){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8409
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8410
    <xsl:text>                    html_dist = (minY - mouseY)/Math.sin(this.fi);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8411
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8412
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8413
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8414
    <xsl:text>                else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8415
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8416
    <xsl:text>                    html_dist = (mouseX - minX)/Math.cos(this.fi);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8417
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8418
    <xsl:text>                }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8419
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8420
    <xsl:text>            }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8421
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8422
    <xsl:text>            //calculate distance
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8423
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8424
    <xsl:text>            this.curr_value=Math.ceil((html_dist/range_length)*(this.range[1]-this.range[0])+this.range[0]);
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8425
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8426
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8427
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8428
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8429
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8430
    <xsl:text>        //check if in range and apply
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8431
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8432
    <xsl:text>        if (this.curr_value &gt; max){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8433
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8434
    <xsl:text>            this.curr_value = max;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8435
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8436
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8437
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8438
    <xsl:text>        else if (this.curr_value &lt; min){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8439
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8440
    <xsl:text>            this.curr_value = min;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8441
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8442
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8443
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8444
    <xsl:text>        this.apply_hmi_value(0, this.curr_value);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8445
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8446
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8447
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8448
    <xsl:text>        //redraw handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8449
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8450
    <xsl:text>        this.request_animate();
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8451
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8452
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8453
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8454
    <xsl:text>    }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8455
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8456
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8457
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8458
    <xsl:text>    animate(){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8459
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8460
    <xsl:text>        // redraw handle on screen refresh
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8461
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8462
    <xsl:text>        // check if setpoint(ghost) handle exsist otherwise update main handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8463
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8464
    <xsl:text>        if(this.setpoint_elt != undefined){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8465
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8466
    <xsl:text>            this.update_DOM(this.curr_value, this.setpoint_elt);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8467
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8468
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8469
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8470
    <xsl:text>        else{
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8471
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8472
    <xsl:text>            this.update_DOM(this.curr_value, this.handle_elt);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8473
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8474
    <xsl:text>        }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8475
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8476
    <xsl:text>    }
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8477
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8478
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8479
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8480
    <xsl:text>    on_select(evt){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8481
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8482
    <xsl:text>        //enable drag flag and timer
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8483
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8484
    <xsl:text>        this.drag = true;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8485
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8486
    <xsl:text>        this.enTimer = true;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8487
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8488
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8489
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8490
    <xsl:text>        //bind events
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8491
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8492
    <xsl:text>        window.addEventListener("touchmove", this.on_bound_drag, true);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8493
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8494
    <xsl:text>        window.addEventListener("mousemove", this.on_bound_drag, true);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8495
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8496
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8497
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8498
    <xsl:text>        window.addEventListener("mouseup", this.bound_on_release, true);
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8499
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8500
    <xsl:text>        window.addEventListener("touchend", this.bound_on_release, true);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8501
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8502
    <xsl:text>        window.addEventListener("touchcancel", this.bound_on_release, true);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8503
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8504
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8505
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8506
    <xsl:text>        // check if handle was pressed
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8507
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8508
    <xsl:text>        if (evt.currentTarget == this.handle_elt){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8509
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8510
    <xsl:text>            //get mouse position on the handle
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8511
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8512
    <xsl:text>            let mouseX = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8513
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8514
    <xsl:text>            let mouseY = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8515
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8516
    <xsl:text>            if (evt.type.startsWith("touch")){
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8517
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8518
    <xsl:text>                mouseX = Math.ceil(evt.touches[0].clientX);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8519
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8520
    <xsl:text>                mouseY = Math.ceil(evt.touches[0].clientY);
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8521
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8522
    <xsl:text>            }
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8523
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8524
    <xsl:text>            else{
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8525
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8526
    <xsl:text>                mouseX = evt.pageX;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8527
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8528
    <xsl:text>                mouseY = evt.pageY;
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8529
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8530
    <xsl:text>            }
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8531
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8532
    <xsl:text>            //save coordinates and orig value
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8533
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8534
    <xsl:text>            this.handle_click = [mouseX,mouseY,this.curr_value];
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8535
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8536
    <xsl:text>        }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8537
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8538
    <xsl:text>        else{
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8539
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8540
    <xsl:text>            // get new handle position and reset if handle was not pressed
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8541
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8542
    <xsl:text>            this.handle_click = undefined;
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8543
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8544
    <xsl:text>            this.update_position(evt);
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8545
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8546
    <xsl:text>        }
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8547
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8548
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8549
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8550
    <xsl:text>        //prevent next events
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8551
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8552
    <xsl:text>        evt.stopPropagation();
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8553
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8554
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8555
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8556
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8557
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8558
    <xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8559
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8560
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8561
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8562
    <xsl:text>    init() {
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8563
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8564
    <xsl:text>        //set min max value if not defined
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8565
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8566
    <xsl:text>        let min = this.min_elt ?
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8567
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8568
    <xsl:text>                    Number(this.min_elt.textContent) :
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8569
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8570
    <xsl:text>                    this.args.length &gt;= 1 ? this.args[0] : 0;
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8571
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8572
    <xsl:text>        let max = this.max_elt ?
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8573
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8574
    <xsl:text>                    Number(this.max_elt.textContent) :
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8575
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8576
    <xsl:text>                    this.args.length &gt;= 2 ? this.args[1] : 100;
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8577
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8578
    <xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8579
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8580
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8581
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8582
    <xsl:text>        // save initial parameters
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8583
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8584
    <xsl:text>        this.range_elt.style.strokeMiterlimit="0";
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8585
</xsl:text>
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8586
    <xsl:text>        this.range = [min, max, this.range_elt.getPointAtLength(0),this.range_elt.getTotalLength()];
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8587
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8588
    <xsl:text>        let start = this.range_elt.getPointAtLength(0);
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8589
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8590
    <xsl:text>        let end = this.range_elt.getPointAtLength(this.range_elt.getTotalLength());
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8591
</xsl:text>
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8592
    <xsl:text>        this.fi = Math.atan2(start.y-end.y, end.x-start.x);
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8593
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8594
    <xsl:text>        this.handle_orig = this.handle_elt.getBBox();
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8595
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8596
    <xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8597
</xsl:text>
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8598
    <xsl:text>        //bind functions
3019
497aac6522a3 SVGHMI: provide request_animate() to Widget authors so that they can register redraw code when events lead to redraw. Widget member animate() is called when it is time to update DOM.
Edouard Tisserant
parents: 3018
diff changeset
  8599
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8600
    <xsl:text>        this.bound_on_select = this.on_select.bind(this);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8601
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8602
    <xsl:text>        this.bound_on_release = this.on_release.bind(this);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8603
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8604
    <xsl:text>        this.on_bound_drag = this.on_drag.bind(this);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8605
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8606
    <xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8607
</xsl:text>
3058
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8608
    <xsl:text>        this.handle_elt.addEventListener("mousedown", this.bound_on_select);
6ea4b7e1a9ed Merge + fix side effects of making warning instead of errors in case of missing HMI variable
Edouard Tisserant
parents: 3048
diff changeset
  8609
</xsl:text>
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8610
    <xsl:text>        this.element.addEventListener("mousedown", this.bound_on_select);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8611
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8612
    <xsl:text>        this.element.addEventListener("touchstart", this.bound_on_select);
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8613
</xsl:text>
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8614
    <xsl:text>        //touch recognised as page drag without next command
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8615
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8616
    <xsl:text>        document.body.addEventListener("touchstart", function(e){}, false);
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8617
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8618
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8619
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8620
    <xsl:text>        //save ghost style
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8621
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8622
    <xsl:text>        if(this.setpoint_elt != undefined){
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8623
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8624
    <xsl:text>            this.setpoint_style = this.setpoint_elt.getAttribute("style");
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8625
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8626
    <xsl:text>            this.setpoint_elt.setAttribute("style", "display:none");
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8627
</xsl:text>
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8628
    <xsl:text>        }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8629
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8630
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8631
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8632
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8633
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8634
    <xsl:text>}
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8635
</xsl:text>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8636
  </xsl:template>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8637
  <xsl:template match="widget[@type='Slider']" mode="widget_defs">
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8638
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8639
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8640
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8641
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8642
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8643
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8644
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8645
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8646
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8647
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8648
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8649
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8650
    <xsl:call-template name="defs_by_labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8651
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8652
      <xsl:with-param name="labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8653
        <xsl:text>handle range</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8654
      </xsl:with-param>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8655
    </xsl:call-template>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8656
    <xsl:call-template name="defs_by_labels">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8657
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8658
      <xsl:with-param name="labels">
3021
49799de67540 SVGHMI: add a SetPoint to Slider Widget, visible only when operating the slider.
Edouard Tisserant
parents: 3019
diff changeset
  8659
        <xsl:text>value min max setpoint</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8660
      </xsl:with-param>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8661
      <xsl:with-param name="mandatory" select="'no'"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8662
    </xsl:call-template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8663
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8664
  <xsl:template match="widget[@type='Switch']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8665
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8666
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8667
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8668
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8669
      <xsl:text>Switch widget hides all subelements whose label do not match given
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8670
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8671
      <xsl:text>variable current value representation. For exemple if given variable type
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8672
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8673
      <xsl:text>is HMI_INT and value is 1, then elements with label '1' will be displayed.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8674
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8675
      <xsl:text>Label can have comments, so '1#some comment' would also match. If matching
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8676
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8677
      <xsl:text>variable of type HMI_STRING, then double quotes must be used. For exemple,
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8678
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8679
      <xsl:text>'"hello"' or '"hello"#another comment' match HMI_STRING 'hello'.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8680
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8681
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8682
    <shortdesc>
3387
ecefd38d5c7d SVGHMI: update tests/evghmi to reflect/test latest changes. update generated XSLT.
Edouard Tisserant
parents: 3383
diff changeset
  8683
      <xsl:text>Show elements whose label matches value.</xsl:text>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8684
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8685
    <path name="value" accepts="HMI_INT,HMI_STRING">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8686
      <xsl:text>value to compare to labels</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8687
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8688
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8689
  <xsl:template match="widget[@type='Switch']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8690
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8691
    <xsl:text>SwitchWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8692
    <xsl:text> extends Widget{
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8693
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8694
    <xsl:text>    frequency = 5;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8695
</xsl:text>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8696
    <xsl:text>    current_value = undefined;
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8697
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8698
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8699
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8700
    <xsl:text>    init(){
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8701
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8702
    <xsl:text>        this.animate();
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8703
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8704
    <xsl:text>    }
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8705
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8706
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8707
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8708
    <xsl:text>    dispatch(value) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8709
</xsl:text>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8710
    <xsl:text>        this.current_value = value;
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8711
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8712
    <xsl:text>        this.request_animate();
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8713
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8714
    <xsl:text>    }
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8715
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8716
    <xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8717
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8718
    <xsl:text>    animate(){
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8719
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8720
    <xsl:text>        for(let choice of this.choices){
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8721
</xsl:text>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8722
    <xsl:text>            if(this.current_value != choice.value){
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8723
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8724
    <xsl:text>                if(choice.parent == undefined){
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8725
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8726
    <xsl:text>                    choice.parent = choice.elt.parentElement;
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8727
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8728
    <xsl:text>                    choice.parent.removeChild(choice.elt);
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8729
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8730
    <xsl:text>                }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8731
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8732
    <xsl:text>            } else {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8733
</xsl:text>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8734
    <xsl:text>                if(choice.parent != undefined){
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8735
</xsl:text>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8736
    <xsl:text>                    choice.parent.insertBefore(choice.elt,choice.sibling);
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8737
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8738
    <xsl:text>                    choice.parent = undefined;
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8739
</xsl:text>
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8740
    <xsl:text>                }
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8741
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8742
    <xsl:text>            }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8743
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8744
    <xsl:text>        }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8745
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8746
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8747
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8748
    <xsl:text>}
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8749
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8750
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8751
  <xsl:template match="widget[@type='Switch']" mode="widget_defs">
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8752
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8753
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8754
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8755
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8756
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8757
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8758
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8759
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8760
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8761
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8762
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8763
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8764
    <xsl:text>    choices: [
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8765
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8766
    <xsl:variable name="regex" select="'^(&quot;[^&quot;].*&quot;|\-?[0-9]+|false|true)(#.*)?$'"/>
3220
ec365ef396b1 SVGHMI: Ensure that when widgets are nested in HMI:Switch widget, their sub-elements are taken as switch's choice in case their label match the syntax.
Edouard Tisserant
parents: 3212
diff changeset
  8767
    <xsl:variable name="subelts" select="$result_widgets[@id = $hmi_element/@id]//*"/>
ec365ef396b1 SVGHMI: Ensure that when widgets are nested in HMI:Switch widget, their sub-elements are taken as switch's choice in case their label match the syntax.
Edouard Tisserant
parents: 3212
diff changeset
  8768
    <xsl:variable name="subwidgets" select="$subelts//*[@id = $hmi_widgets/@id]"/>
ec365ef396b1 SVGHMI: Ensure that when widgets are nested in HMI:Switch widget, their sub-elements are taken as switch's choice in case their label match the syntax.
Edouard Tisserant
parents: 3212
diff changeset
  8769
    <xsl:variable name="accepted" select="$subelts[not(ancestor-or-self::*/@id = $subwidgets/@id)]"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8770
    <xsl:variable name="choices" select="$accepted[regexp:test(@inkscape:label,$regex)]"/>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8771
    <xsl:for-each select="$choices">
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8772
      <xsl:variable name="literal" select="regexp:match(@inkscape:label,$regex)[2]"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8773
      <xsl:variable name="sibling" select="following-sibling::*[not(@id = $choices/@id)][position()=1]"/>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8774
      <xsl:text>        {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8775
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8776
      <xsl:text>            elt:id("</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8777
      <xsl:value-of select="@id"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8778
      <xsl:text>"),
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8779
</xsl:text>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
  8780
      <xsl:text>            parent:undefined,
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8781
</xsl:text>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8782
      <xsl:choose>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8783
        <xsl:when test="count($sibling)=0">
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8784
          <xsl:text>            sibling:null,
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8785
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8786
        </xsl:when>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8787
        <xsl:otherwise>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8788
          <xsl:text>            sibling:id("</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8789
          <xsl:value-of select="$sibling/@id"/>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8790
          <xsl:text>"),
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8791
</xsl:text>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8792
        </xsl:otherwise>
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8793
      </xsl:choose>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8794
      <xsl:text>            value:</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8795
      <xsl:value-of select="$literal"/>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8796
      <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8797
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8798
      <xsl:text>        }</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8799
      <xsl:if test="position()!=last()">
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8800
        <xsl:text>,</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8801
      </xsl:if>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8802
      <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8803
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8804
    </xsl:for-each>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8805
    <xsl:text>    ],
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8806
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8807
  </xsl:template>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8808
  <xsl:template match="widget[@type='TextList']" mode="widget_desc">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8809
    <type>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8810
      <xsl:value-of select="@type"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8811
    </type>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8812
    <longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8813
      <xsl:text>TextList widget is a svg:group, list items are labeled elements
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8814
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8815
      <xsl:text>in that group.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8816
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8817
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8818
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8819
      <xsl:text>To use a TextList, clone (svg:use) one of the items inside the widget 
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8820
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8821
      <xsl:text>that expects a TextList.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8822
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8823
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8824
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8825
      <xsl:text>In this list, (translated) text content is what matters. Nevertheless
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8826
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8827
      <xsl:text>text style of the cloned item will be applied in client widget.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8828
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8829
    </longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8830
    <shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8831
      <xsl:text>A named list of ordered texts </xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8832
    </shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8833
    <arg name="listname"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8834
  </xsl:template>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8835
  <xsl:template match="widget[@type='TextList']" mode="widget_defs">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8836
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8837
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8838
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8839
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8840
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8841
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8842
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8843
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8844
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8845
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8846
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8847
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8848
    <xsl:text>    texts: [
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8849
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8850
    <xsl:for-each select="func:refered_elements($hmi_element/*[@inkscape:label])[self::svg:text]">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8851
      <xsl:text>        id("</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8852
      <xsl:value-of select="@id"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8853
      <xsl:text>"),
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8854
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8855
    </xsl:for-each>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8856
    <xsl:text>    ].reverse(),
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8857
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8858
  </xsl:template>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8859
  <xsl:template match="widget[@type='TextList']" mode="widget_class">
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8860
    <xsl:text>class </xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8861
    <xsl:text>TextListWidget</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8862
    <xsl:text> extends Widget{
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8863
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8864
    <xsl:text>}
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8865
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8866
  </xsl:template>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8867
  <xsl:template match="widget[@type='TextStyleList']" mode="widget_desc">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8868
    <type>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8869
      <xsl:value-of select="@type"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8870
    </type>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8871
    <longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8872
      <xsl:text>TextStyleList widget is a svg:group, list items are labeled elements
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8873
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8874
      <xsl:text>in that group.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8875
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8876
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8877
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8878
      <xsl:text>To use a TextStyleList, clone (svg:use) one of the items inside the widget 
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8879
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8880
      <xsl:text>that expects a TextStyleList.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8881
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8882
      <xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8883
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8884
      <xsl:text>In this list, only style matters. Text content is ignored.
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8885
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8886
    </longdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8887
    <shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8888
      <xsl:text>A named list of named texts</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8889
    </shortdesc>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8890
    <arg name="listname"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8891
  </xsl:template>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8892
  <xsl:template match="widget[@type='TextStyleList']" mode="widget_defs">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8893
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8894
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8895
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8896
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8897
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8898
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8899
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8900
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8901
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8902
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8903
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8904
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3355
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8905
    <xsl:text>    styles: {
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8906
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8907
    <xsl:for-each select="$hmi_element/*[@inkscape:label]">
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8908
      <xsl:variable name="style" select="func:refered_elements(.)[self::svg:text]/@style"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8909
      <xsl:text>        </xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8910
      <xsl:value-of select="@inkscape:label"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8911
      <xsl:text>: "</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8912
      <xsl:value-of select="$style"/>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8913
      <xsl:text>",
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8914
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8915
    </xsl:for-each>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8916
    <xsl:text>    },
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8917
</xsl:text>
b16e9561a3c1 SVGHMI: update generated xslt (List related changes)
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3299
diff changeset
  8918
  </xsl:template>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8919
  <xsl:template match="widget[@type='TextStyleList']" mode="widget_class">
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8920
    <xsl:text>class </xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8921
    <xsl:text>TextStyleListWidget</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8922
    <xsl:text> extends Widget{
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8923
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8924
    <xsl:text>}
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8925
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
  8926
  </xsl:template>
3241
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8927
  <xsl:template match="widget[@type='ToggleButton']" mode="widget_desc">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8928
    <type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8929
      <xsl:value-of select="@type"/>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8930
    </type>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8931
    <longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8932
      <xsl:text>Button widget takes one boolean variable path, and reflect current true
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8933
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8934
      <xsl:text>or false value by showing "active" or "inactive" labeled element
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8935
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8936
      <xsl:text>respectively. Clicking or touching button toggles variable.
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8937
</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8938
    </longdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8939
    <shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8940
      <xsl:text>Toggle button reflecting given boolean variable</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8941
    </shortdesc>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8942
    <path name="value" accepts="HMI_BOOL">
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8943
      <xsl:text>Boolean variable</xsl:text>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8944
    </path>
fe945f1f48b7 SVGHMI: WIP on Widget DnD UI : Added documentation to widgets, that is injected in widget parse tree during widget analysis
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3238
diff changeset
  8945
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8946
  <xsl:template match="widget[@type='ToggleButton']" mode="widget_class">
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8947
    <xsl:text>class </xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8948
    <xsl:text>ToggleButtonWidget</xsl:text>
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  8949
    <xsl:text> extends Widget{
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8950
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8951
    <xsl:text>    frequency = 5;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8952
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8953
    <xsl:text>    active_style = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8954
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8955
    <xsl:text>    inactive_style = undefined;
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8956
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8957
    <xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8958
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8959
    <xsl:text>    dispatch(value) {
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8960
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8961
    <xsl:text>        this.activity_state = Boolean(value);
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8962
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8963
    <xsl:text>        //redraw toggle button
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8964
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8965
    <xsl:text>        this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8966
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8967
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8968
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8969
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8970
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8971
    <xsl:text>    on_click(evt) {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8972
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8973
    <xsl:text>        //toggle state and apply
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8974
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8975
    <xsl:text>        this.activity_state = this.activity_state ? false : true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8976
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8977
    <xsl:text>        this.apply_hmi_value(0, this.activity_state);
3065
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8978
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8979
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8980
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8981
    <xsl:text>        //redraw toggle button
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8982
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8983
    <xsl:text>        this.request_animate();
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8984
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8985
    <xsl:text>    }
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8986
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8987
    <xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8988
</xsl:text>
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8989
    <xsl:text>    init() {
c369a742443d SVGHMI: non significant cosmetic changes
Edouard Tisserant
parents: 3058
diff changeset
  8990
</xsl:text>
3220
ec365ef396b1 SVGHMI: Ensure that when widgets are nested in HMI:Switch widget, their sub-elements are taken as switch's choice in case their label match the syntax.
Edouard Tisserant
parents: 3212
diff changeset
  8991
    <xsl:text>        this.element.onclick = (evt) =&gt; this.on_click(evt);
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8992
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  8993
    <xsl:text>        this.activity_state = undefined;
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  8994
</xsl:text>
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8995
    <xsl:text>    }
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8996
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8997
    <xsl:text>}
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8998
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
  8999
  </xsl:template>
3238
8a9d4c794cba SVGHMI: updating generated XSLT
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3229
diff changeset
  9000
  <xsl:template match="widget[@type='ToggleButton']" mode="widget_defs">
2977
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  9001
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9002
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9003
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9004
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9005
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9006
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9007
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9008
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9009
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9010
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9011
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9012
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  9013
    <xsl:text>    activable_sub:{
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  9014
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9015
    <xsl:variable name="activity">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9016
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9017
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9018
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9019
          <xsl:text>/active /inactive</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9020
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9021
        <xsl:with-param name="mandatory">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9022
          <xsl:text>warn</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9023
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9024
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9025
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9026
    <xsl:value-of select="$activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9027
    <xsl:variable name="has_activity" select="string-length($activity)&gt;0"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9028
    <xsl:text>    },
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9029
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9030
    <xsl:text>    has_activity: </xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9031
    <xsl:value-of select="$has_activity"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9032
    <xsl:text>,
3521
4345b3c9b9de SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3517
diff changeset
  9033
</xsl:text>
2977
82f062408e70 SVGHMI: Added widget toggleButton.
dgaberscek
parents: 2976
diff changeset
  9034
  </xsl:template>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9035
  <xsl:template match="widget[@type='XYGraph']" mode="widget_desc">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9036
    <type>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9037
      <xsl:value-of select="@type"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9038
    </type>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9039
    <longdesc>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9040
      <xsl:text>XYGraph draws a cartesian trend graph re-using styles given for axis,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9041
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9042
      <xsl:text>grid/marks, legends and curves.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9043
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9044
      <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9045
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9046
      <xsl:text>Elements labeled "x_axis" and "y_axis" are svg:groups containg:
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9047
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9048
      <xsl:text> - "axis_label" svg:text gives style an alignment for axis labels.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9049
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9050
      <xsl:text> - "interval_major_mark" and "interval_minor_mark" are svg elements to be
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9051
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9052
      <xsl:text>   duplicated along axis line to form intervals marks.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9053
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9054
      <xsl:text> - "axis_line"  svg:path is the axis line. Paths must be intersect and their
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9055
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9056
      <xsl:text>   bounding box is the chart wall.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9057
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9058
      <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9059
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9060
      <xsl:text>Elements labeled "curve_0", "curve_1", ... are paths whose styles are used
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9061
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9062
      <xsl:text>to draw curves corresponding to data from variables passed as HMI tree paths.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9063
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9064
      <xsl:text>"curve_0" is mandatory. HMI variables outnumbering given curves are ignored.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9065
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9066
      <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9067
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9068
    </longdesc>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9069
    <shortdesc>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9070
      <xsl:text>Cartesian trend graph showing values of given variables over time</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9071
    </shortdesc>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9072
    <path name="value" count="1+" accepts="HMI_INT,HMI_REAL">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9073
      <xsl:text>value</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9074
    </path>
3507
Edouard Tisserant
parents: 3506 3495
diff changeset
  9075
    <arg name="xrange" accepts="int,time">
Edouard Tisserant
parents: 3506 3495
diff changeset
  9076
      <xsl:text>X axis range expressed either in samples or duration.</xsl:text>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9077
    </arg>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9078
    <arg name="xformat" count="optional" accepts="string">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9079
      <xsl:text>format string for X label</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9080
    </arg>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9081
    <arg name="yformat" count="optional" accepts="string">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9082
      <xsl:text>format string for Y label</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9083
    </arg>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9084
  </xsl:template>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9085
  <xsl:template match="widget[@type='XYGraph']" mode="widget_class">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9086
    <xsl:text>class </xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9087
    <xsl:text>XYGraphWidget</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9088
    <xsl:text> extends Widget{
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9089
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9090
    <xsl:text>    frequency = 1;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9091
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9092
    <xsl:text>    init() {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9093
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9094
    <xsl:text>        let x_duration_s;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9095
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9096
    <xsl:text>        [x_duration_s,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9097
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9098
    <xsl:text>         this.x_format, this.y_format] = this.args;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9099
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9100
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9101
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9102
    <xsl:text>        let timeunit = x_duration_s.slice(-1);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9103
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9104
    <xsl:text>        let factor = {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9105
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9106
    <xsl:text>            "s":1,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9107
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9108
    <xsl:text>            "m":60,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9109
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9110
    <xsl:text>            "h":3600,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9111
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9112
    <xsl:text>            "d":86400}[timeunit];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9113
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9114
    <xsl:text>        if(factor == undefined){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9115
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9116
    <xsl:text>            this.max_data_length = Number(x_duration_s);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9117
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9118
    <xsl:text>            this.x_duration = undefined;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9119
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9120
    <xsl:text>        }else{
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9121
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9122
    <xsl:text>            let duration = factor*Number(x_duration_s.slice(0,-1));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9123
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9124
    <xsl:text>            this.max_data_length = undefined;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9125
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9126
    <xsl:text>            this.x_duration = duration*1000;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9127
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9128
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9129
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9130
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9131
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9132
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9133
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9134
    <xsl:text>        // Min and Max given with paths are meant to describe visible range,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9135
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9136
    <xsl:text>        // not to clip data.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9137
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9138
    <xsl:text>        this.clip = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9139
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9140
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9141
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9142
    <xsl:text>        let y_min = Infinity, y_max = -Infinity;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9143
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9144
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9145
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9146
    <xsl:text>        // Compute visible Y range by merging fixed curves Y ranges
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9147
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9148
    <xsl:text>        for(let minmax of this.minmaxes){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9149
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9150
    <xsl:text>           if(minmax){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9151
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9152
    <xsl:text>               let [min,max] = minmax;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9153
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9154
    <xsl:text>               if(min &lt; y_min)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9155
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9156
    <xsl:text>                   y_min = min;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9157
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9158
    <xsl:text>               if(max &gt; y_max)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9159
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9160
    <xsl:text>                   y_max = max;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9161
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9162
    <xsl:text>           }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9163
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9164
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9165
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9166
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9167
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9168
    <xsl:text>        if(y_min !== Infinity &amp;&amp; y_max !== -Infinity){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9169
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9170
    <xsl:text>           this.fixed_y_range = true;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9171
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9172
    <xsl:text>        } else {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9173
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9174
    <xsl:text>           this.fixed_y_range = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9175
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9176
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9177
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9178
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9179
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9180
    <xsl:text>        this.ymin = y_min;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9181
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9182
    <xsl:text>        this.ymax = y_max;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9183
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9184
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9185
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9186
    <xsl:text>        this.curves = [];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9187
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9188
    <xsl:text>        this.init_specific();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9189
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9190
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9191
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9192
    <xsl:text>        this.reference = new ReferenceFrame(
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9193
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9194
    <xsl:text>            [[this.x_interval_minor_mark_elt, this.x_interval_major_mark_elt],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9195
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9196
    <xsl:text>             [this.y_interval_minor_mark_elt, this.y_interval_major_mark_elt]],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9197
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9198
    <xsl:text>            [this.x_axis_label_elt, this.y_axis_label_elt],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9199
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9200
    <xsl:text>            [this.x_axis_line_elt, this.y_axis_line_elt],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9201
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9202
    <xsl:text>            [this.x_format, this.y_format]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9203
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9204
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9205
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9206
    <xsl:text>        let max_stroke_width = 0;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9207
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9208
    <xsl:text>        for(let curve of this.curves){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9209
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9210
    <xsl:text>            if(curve.style.strokeWidth &gt; max_stroke_width){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9211
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9212
    <xsl:text>                max_stroke_width = curve.style.strokeWidth;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9213
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9214
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9215
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9216
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9217
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9218
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9219
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9220
    <xsl:text>        this.Margins=this.reference.getLengths().map(length =&gt; max_stroke_width/length);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9221
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9222
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9223
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9224
    <xsl:text>        // create &lt;clipPath&gt; path and attach it to widget
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9225
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9226
    <xsl:text>        let clipPath = document.createElementNS(xmlns,"clipPath");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9227
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9228
    <xsl:text>        let clipPathPath = document.createElementNS(xmlns,"path");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9229
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9230
    <xsl:text>        let clipPathPathDattr = document.createAttribute("d");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9231
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9232
    <xsl:text>        clipPathPathDattr.value = this.reference.getClipPathPathDattr();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9233
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9234
    <xsl:text>        clipPathPath.setAttributeNode(clipPathPathDattr);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9235
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9236
    <xsl:text>        clipPath.appendChild(clipPathPath);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9237
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9238
    <xsl:text>        clipPath.id = randomId();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9239
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9240
    <xsl:text>        this.element.appendChild(clipPath);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9241
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9242
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9243
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9244
    <xsl:text>        // assign created clipPath to clip-path property of curves
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9245
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9246
    <xsl:text>        for(let curve of this.curves){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9247
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9248
    <xsl:text>            curve.setAttribute("clip-path", "url(#" + clipPath.id + ")");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9249
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9250
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9251
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9252
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9253
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9254
    <xsl:text>        this.curves_data = [];
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9255
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9256
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9257
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9258
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9259
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9260
    <xsl:text>    dispatch(value,oldval, index) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9261
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9262
    <xsl:text>        // TODO: get PLC time instead of browser time
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9263
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9264
    <xsl:text>        let time = Date.now();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9265
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9266
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9267
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9268
    <xsl:text>        // naive local buffer impl. 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9269
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9270
    <xsl:text>        // data is updated only when graph is visible
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9271
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9272
    <xsl:text>        // TODO: replace with separate recording
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9273
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9274
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9275
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9276
    <xsl:text>        if(this.curves_data[index] === undefined){
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9277
</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9278
    <xsl:text>            this.curves_data[index] = [];
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9279
</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9280
    <xsl:text>        }
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9281
</xsl:text>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9282
    <xsl:text>        this.curves_data[index].push([time, value]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9283
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9284
    <xsl:text>        let data_length = this.curves_data[index].length;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9285
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9286
    <xsl:text>        let ymin_damaged = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9287
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9288
    <xsl:text>        let ymax_damaged = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9289
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9290
    <xsl:text>        let overflow;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9291
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9292
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9293
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9294
    <xsl:text>        if(this.max_data_length == undefined){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9295
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9296
    <xsl:text>            let peremption = time - this.x_duration;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9297
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9298
    <xsl:text>            let oldest = this.curves_data[index][0][0]
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9299
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9300
    <xsl:text>            this.xmin = peremption;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9301
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9302
    <xsl:text>            if(oldest &lt; peremption){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9303
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9304
    <xsl:text>                // remove first item
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9305
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9306
    <xsl:text>                overflow = this.curves_data[index].shift()[1];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9307
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9308
    <xsl:text>                data_length = data_length - 1;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9309
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9310
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9311
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9312
    <xsl:text>        } else {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9313
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9314
    <xsl:text>            if(data_length &gt; this.max_data_length){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9315
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9316
    <xsl:text>                // remove first item
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9317
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9318
    <xsl:text>                [this.xmin, overflow] = this.curves_data[index].shift();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9319
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9320
    <xsl:text>                data_length = data_length - 1;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9321
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9322
    <xsl:text>            } else {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9323
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9324
    <xsl:text>                if(this.xmin == undefined){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9325
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9326
    <xsl:text>                    this.xmin = time;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9327
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9328
    <xsl:text>                }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9329
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9330
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9331
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9332
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9333
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9334
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9335
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9336
    <xsl:text>        this.xmax = time;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9337
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9338
    <xsl:text>        let Xrange = this.xmax - this.xmin;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9339
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9340
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9341
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9342
    <xsl:text>        if(!this.fixed_y_range){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9343
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9344
    <xsl:text>            ymin_damaged = overflow &lt;= this.ymin;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9345
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9346
    <xsl:text>            ymax_damaged = overflow &gt;= this.ymax;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9347
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9348
    <xsl:text>            if(value &gt; this.ymax){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9349
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9350
    <xsl:text>                ymax_damaged = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9351
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9352
    <xsl:text>                this.ymax = value;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9353
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9354
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9355
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9356
    <xsl:text>            if(value &lt; this.ymin){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9357
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9358
    <xsl:text>                ymin_damaged = false;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9359
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9360
    <xsl:text>                this.ymin = value;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9361
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9362
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9363
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9364
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9365
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9366
    <xsl:text>        let Yrange = this.ymax - this.ymin;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9367
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9368
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9369
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9370
    <xsl:text>        // apply margin by moving min and max to enlarge range
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9371
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9372
    <xsl:text>        let [xMargin,yMargin] = zip(this.Margins, [Xrange, Yrange]).map(([m,l]) =&gt; m*l);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9373
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9374
    <xsl:text>        [[this.dxmin, this.dxmax],[this.dymin,this.dymax]] =
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9375
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9376
    <xsl:text>            [[this.xmin-xMargin, this.xmax+xMargin],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9377
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9378
    <xsl:text>             [this.ymin-yMargin, this.ymax+yMargin]];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9379
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9380
    <xsl:text>        Xrange += 2*xMargin;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9381
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9382
    <xsl:text>        Yrange += 2*yMargin;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9383
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9384
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9385
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9386
    <xsl:text>        // recompute curves "d" attribute
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9387
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9388
    <xsl:text>        // FIXME: use SVG getPathData and setPathData when available.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9389
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9390
    <xsl:text>        //        https://svgwg.org/specs/paths/#InterfaceSVGPathData
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9391
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9392
    <xsl:text>        //        https://github.com/jarek-foksa/path-data-polyfill
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9393
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9394
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9395
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9396
    <xsl:text>        let [base_point, xvect, yvect] = this.reference.getBaseRef();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9397
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9398
    <xsl:text>        this.curves_d_attr =
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9399
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9400
    <xsl:text>            zip(this.curves_data, this.curves).map(([data,curve]) =&gt; {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9401
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9402
    <xsl:text>                let new_d = data.map(([x,y], i) =&gt; {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9403
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9404
    <xsl:text>                    // compute curve point from data, ranges, and base_ref
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9405
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9406
    <xsl:text>                    let xv = vectorscale(xvect, (x - this.dxmin) / Xrange);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9407
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9408
    <xsl:text>                    let yv = vectorscale(yvect, (y - this.dymin) / Yrange);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9409
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9410
    <xsl:text>                    let px = base_point.x + xv.x + yv.x;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9411
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9412
    <xsl:text>                    let py = base_point.y + xv.y + yv.y;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9413
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9414
    <xsl:text>                    if(!this.fixed_y_range){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9415
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9416
    <xsl:text>                        // update min and max from curve data if needed
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9417
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9418
    <xsl:text>                        if(ymin_damaged &amp;&amp; y &lt; this.ymin) this.ymin = y;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9419
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9420
    <xsl:text>                        if(ymax_damaged &amp;&amp; y &gt; this.ymax) this.ymax = y;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9421
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9422
    <xsl:text>                    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9423
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9424
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9425
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9426
    <xsl:text>                    return " " + px + "," + py;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9427
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9428
    <xsl:text>                });
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9429
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9430
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9431
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9432
    <xsl:text>                new_d.unshift("M ");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9433
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9434
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9435
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9436
    <xsl:text>                return new_d.join('');
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9437
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9438
    <xsl:text>            });
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9439
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9440
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9441
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9442
    <xsl:text>        // computed curves "d" attr is applied to svg curve during animate();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9443
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9444
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9445
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9446
    <xsl:text>        this.request_animate();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9447
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9448
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9449
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9450
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9451
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9452
    <xsl:text>    animate(){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9453
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9454
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9455
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9456
    <xsl:text>        // move elements only if enough data
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9457
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9458
    <xsl:text>        if(this.curves_data.some(data =&gt; data.length &gt; 1)){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9459
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9460
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9461
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9462
    <xsl:text>            // move marks and update labels
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9463
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9464
    <xsl:text>            this.reference.applyRanges([[this.dxmin, this.dxmax],
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9465
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9466
    <xsl:text>                                        [this.dymin, this.dymax]]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9467
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9468
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9469
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9470
    <xsl:text>            // apply computed curves "d" attributes
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9471
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9472
    <xsl:text>            for(let [curve, d_attr] of zip(this.curves, this.curves_d_attr)){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9473
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9474
    <xsl:text>                curve.setAttribute("d", d_attr);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9475
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9476
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9477
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9478
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9479
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9480
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9481
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9482
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9483
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9484
    <xsl:text>}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9485
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9486
  </xsl:template>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9487
  <func:function name="func:check_curves_label_consistency">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9488
    <xsl:param name="curve_elts"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9489
    <xsl:param name="number_to_check"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9490
    <xsl:variable name="res">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9491
      <xsl:choose>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9492
        <xsl:when test="$curve_elts[@inkscape:label = concat('curve_', string($number_to_check))]">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9493
          <xsl:if test="$number_to_check &gt; 0">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9494
            <xsl:value-of select="func:check_curves_label_consistency($curve_elts, $number_to_check - 1)"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9495
          </xsl:if>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9496
        </xsl:when>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9497
        <xsl:otherwise>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9498
          <xsl:value-of select="concat('missing curve_', string($number_to_check))"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9499
        </xsl:otherwise>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9500
      </xsl:choose>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9501
    </xsl:variable>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9502
    <func:result select="$res"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9503
  </func:function>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9504
  <xsl:template match="widget[@type='XYGraph']" mode="widget_defs">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9505
    <xsl:param name="hmi_element"/>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9506
    <xsl:variable name="disability">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9507
      <xsl:call-template name="defs_by_labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9508
        <xsl:with-param name="hmi_element" select="$hmi_element"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9509
        <xsl:with-param name="labels">
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9510
          <xsl:text>/disabled</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9511
        </xsl:with-param>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9512
        <xsl:with-param name="mandatory" select="'no'"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9513
      </xsl:call-template>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9514
    </xsl:variable>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9515
    <xsl:value-of select="$disability"/>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
  9516
    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9517
    <xsl:call-template name="defs_by_labels">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9518
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9519
      <xsl:with-param name="labels">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9520
        <xsl:text>/x_interval_minor_mark /x_axis_line /x_interval_major_mark /x_axis_label</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9521
      </xsl:with-param>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9522
    </xsl:call-template>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9523
    <xsl:call-template name="defs_by_labels">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9524
      <xsl:with-param name="hmi_element" select="$hmi_element"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9525
      <xsl:with-param name="labels">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9526
        <xsl:text>/y_interval_minor_mark /y_axis_line /y_interval_major_mark /y_axis_label</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9527
      </xsl:with-param>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9528
    </xsl:call-template>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9529
    <xsl:text>    init_specific() {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9530
</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9531
    <xsl:variable name="curves" select="$hmi_element/*[regexp:test(@inkscape:label,'^curve_[0-9]+$')]"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9532
    <xsl:variable name="curves_error" select="func:check_curves_label_consistency($curves,count($curves)-1)"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9533
    <xsl:if test="string-length($curves_error)">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9534
      <xsl:message terminate="yes">
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9535
        <xsl:text>XYGraph id="</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9536
        <xsl:value-of select="@id"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9537
        <xsl:text>", label="</xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9538
        <xsl:value-of select="@inkscape:label"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9539
        <xsl:text>" : </xsl:text>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9540
        <xsl:value-of select="$curves_error"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9541
      </xsl:message>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9542
    </xsl:if>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9543
    <xsl:for-each select="$curves">
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9544
      <xsl:variable name="label" select="@inkscape:label"/>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9545
      <xsl:variable name="_id" select="@id"/>
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9546
      <xsl:variable name="curve_num" select="substring(@inkscape:label, 7)"/>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9547
      <xsl:text>        this.curves[</xsl:text>
3510
0d7f9c555ae2 SVGHMI: update generated XSLT filesw
Edouard Tisserant
parents: 3507
diff changeset
  9548
      <xsl:value-of select="$curve_num"/>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9549
      <xsl:text>] = id("</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9550
      <xsl:value-of select="@id"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9551
      <xsl:text>"); /* </xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9552
      <xsl:value-of select="@inkscape:label"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9553
      <xsl:text> */
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9554
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9555
    </xsl:for-each>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9556
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9557
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9558
  </xsl:template>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9559
  <declarations:XYGraph/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9560
  <xsl:template match="declarations:XYGraph">
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9561
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9562
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9563
    <xsl:text>/* </xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9564
    <xsl:value-of select="local-name()"/>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9565
    <xsl:text> */
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9566
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9567
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9568
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9569
    <xsl:text>function lineFromPath(path_elt) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9570
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9571
    <xsl:text>    let start = path_elt.getPointAtLength(0);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9572
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9573
    <xsl:text>    let end = path_elt.getPointAtLength(path_elt.getTotalLength());
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9574
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9575
    <xsl:text>    return [start, new DOMPoint(end.x - start.x , end.y - start.y)];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9576
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9577
    <xsl:text>};
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9578
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9579
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9580
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9581
    <xsl:text>function vector(p1, p2) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9582
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9583
    <xsl:text>    return new DOMPoint(p2.x - p1.x , p2.y - p1.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9584
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9585
    <xsl:text>};
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9586
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9587
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9588
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9589
    <xsl:text>function vectorscale(p1, p2) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9590
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9591
    <xsl:text>    return new DOMPoint(p2 * p1.x , p2 * p1.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9592
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9593
    <xsl:text>};
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9594
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9595
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9596
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9597
    <xsl:text>function vectorLength(p1) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9598
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9599
    <xsl:text>    return Math.sqrt(p1.x*p1.x + p1.y*p1.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9600
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9601
    <xsl:text>};
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9602
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9603
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9604
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9605
    <xsl:text>function randomId(){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9606
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9607
    <xsl:text>    return Date.now().toString(36) + Math.random().toString(36).substr(2);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9608
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9609
    <xsl:text>}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9610
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9611
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9612
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9613
    <xsl:text>function move_elements_to_group(elements) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9614
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9615
    <xsl:text>    let newgroup = document.createElementNS(xmlns,"g");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9616
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9617
    <xsl:text>    newgroup.id = randomId();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9618
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9619
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9620
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9621
    <xsl:text>    for(let element of elements){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9622
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9623
    <xsl:text>        let parent = element.parentElement;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9624
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9625
    <xsl:text>        if(parent !== null)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9626
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9627
    <xsl:text>            parent.removeChild(element);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9628
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9629
    <xsl:text>        newgroup.appendChild(element);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9630
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9631
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9632
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9633
    <xsl:text>    return newgroup;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9634
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9635
    <xsl:text>}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9636
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9637
    <xsl:text>function getLinesIntesection(l1, l2) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9638
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9639
    <xsl:text>    let [l1start, l1vect] = l1;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9640
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9641
    <xsl:text>    let [l2start, l2vect] = l2;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9642
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9643
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9644
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9645
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9646
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9647
    <xsl:text>    /*
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9648
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9649
    <xsl:text>    Compute intersection of two lines
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9650
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9651
    <xsl:text>    =================================
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9652
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9653
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9654
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9655
    <xsl:text>                          ^ l2vect
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9656
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9657
    <xsl:text>                         /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9658
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9659
    <xsl:text>                        /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9660
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9661
    <xsl:text>                       /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9662
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9663
    <xsl:text>    l1start ----------X--------------&gt; l1vect
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9664
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9665
    <xsl:text>                     / intersection
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9666
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9667
    <xsl:text>                    /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9668
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9669
    <xsl:text>                   /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9670
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9671
    <xsl:text>                   l2start
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9672
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9673
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9674
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9675
    <xsl:text>	*/
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9676
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9677
    <xsl:text>    let [x1, y1, x3, y3] = [l1start.x, l1start.y, l2start.x, l2start.y];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9678
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9679
    <xsl:text>	let [x2, y2, x4, y4] = [x1+l1vect.x, y1+l1vect.y, x3+l2vect.x, y3+l2vect.y];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9680
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9681
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9682
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9683
    <xsl:text>	// line intercept math by Paul Bourke http://paulbourke.net/geometry/pointlineplane/
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9684
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9685
    <xsl:text>	// Determine the intersection point of two line segments
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9686
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9687
    <xsl:text>	// Return FALSE if the lines don't intersect
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9688
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9689
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9690
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9691
    <xsl:text>    // Check if none of the lines are of length 0
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9692
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9693
    <xsl:text>    if ((x1 === x2 &amp;&amp; y1 === y2) || (x3 === x4 &amp;&amp; y3 === y4)) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9694
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9695
    <xsl:text>        return false
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9696
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9697
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9698
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9699
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9700
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9701
    <xsl:text>    denominator = ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1))
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9702
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9703
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9704
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9705
    <xsl:text>    // Lines are parallel
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9706
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9707
    <xsl:text>    if (denominator === 0) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9708
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9709
    <xsl:text>        return false
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9710
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9711
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9712
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9713
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9714
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9715
    <xsl:text>    let ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9716
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9717
    <xsl:text>    let ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9718
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9719
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9720
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9721
    <xsl:text>    // Return a object with the x and y coordinates of the intersection
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9722
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9723
    <xsl:text>    let x = x1 + ua * (x2 - x1)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9724
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9725
    <xsl:text>    let y = y1 + ua * (y2 - y1)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9726
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9727
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9728
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9729
    <xsl:text>    return new DOMPoint(x,y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9730
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9731
    <xsl:text>};
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9732
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9733
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9734
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9735
    <xsl:text>class ReferenceFrame {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9736
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9737
    <xsl:text>    constructor(
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9738
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9739
    <xsl:text>        // [[Xminor,Xmajor], [Yminor,Ymajor]]
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9740
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9741
    <xsl:text>        marks,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9742
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9743
    <xsl:text>        // [Xlabel, Ylabel]
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9744
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9745
    <xsl:text>        labels,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9746
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9747
    <xsl:text>        // [Xline, Yline]
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9748
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9749
    <xsl:text>        lines,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9750
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9751
    <xsl:text>        // [Xformat, Yformat] printf-like formating strings
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9752
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9753
    <xsl:text>        formats
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9754
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9755
    <xsl:text>    ){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9756
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9757
    <xsl:text>        this.axes = zip(labels,marks,lines,formats).map(args =&gt; new Axis(...args));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9758
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9759
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9760
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9761
    <xsl:text>        let [lx,ly] = this.axes.map(axis =&gt; axis.line);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9762
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9763
    <xsl:text>        let [[xstart, xvect], [ystart, yvect]] = [lx,ly];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9764
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9765
    <xsl:text>        let base_point = this.getBasePoint();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9766
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9767
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9768
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9769
    <xsl:text>        // setup clipping for curves
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9770
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9771
    <xsl:text>        this.clipPathPathDattr =
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9772
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9773
    <xsl:text>            "m " + base_point.x + "," + base_point.y + " "
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9774
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9775
    <xsl:text>                 + xvect.x + "," + xvect.y + " "
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9776
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9777
    <xsl:text>                 + yvect.x + "," + yvect.y + " "
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9778
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9779
    <xsl:text>                 + -xvect.x + "," + -xvect.y + " "
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9780
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9781
    <xsl:text>                 + -yvect.x + "," + -yvect.y + " z";
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9782
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9783
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9784
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9785
    <xsl:text>        this.base_ref = [base_point, xvect, yvect];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9786
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9787
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9788
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9789
    <xsl:text>        this.lengths = [xvect,yvect].map(v =&gt; vectorLength(v));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9790
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9791
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9792
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9793
    <xsl:text>        for(let axis of this.axes){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9794
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9795
    <xsl:text>            axis.setBasePoint(base_point);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9796
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9797
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9798
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9799
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9800
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9801
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9802
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9803
    <xsl:text>    getLengths(){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9804
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9805
    <xsl:text>        return this.lengths;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9806
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9807
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9808
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9809
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9810
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9811
    <xsl:text>	getBaseRef(){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9812
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9813
    <xsl:text>        return this.base_ref;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9814
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9815
    <xsl:text>	}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9816
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9817
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9818
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9819
    <xsl:text>    getClipPathPathDattr(){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9820
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9821
    <xsl:text>        return this.clipPathPathDattr;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9822
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9823
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9824
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9825
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9826
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9827
    <xsl:text>    applyRanges(ranges){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9828
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9829
    <xsl:text>        let origin_moves = zip(ranges,this.axes).map(([range,axis]) =&gt; axis.applyRange(...range));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9830
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9831
    <xsl:text>		zip(origin_moves.reverse(),this.axes).forEach(([vect,axis]) =&gt; axis.moveOrigin(vect));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9832
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9833
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9834
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9835
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9836
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9837
    <xsl:text>    getBasePoint() {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9838
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9839
    <xsl:text>        let [[xstart, xvect], [ystart, yvect]] = this.axes.map(axis =&gt; axis.line);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9840
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9841
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9842
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9843
    <xsl:text>        /*
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9844
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9845
    <xsl:text>        Compute graph clipping region base point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9846
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9847
    <xsl:text>        ========================================
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9848
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9849
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9850
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9851
    <xsl:text>        Clipping region is a parallelogram containing axes lines,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9852
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9853
    <xsl:text>        and whose sides are parallel to axes line respectively.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9854
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9855
    <xsl:text>        Given axes lines are not starting at the same point, hereafter is
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9856
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9857
    <xsl:text>        calculus of parallelogram base point.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9858
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9859
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9860
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9861
    <xsl:text>                              ^ given Y axis (yvect)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9862
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9863
    <xsl:text>                   /         /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9864
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9865
    <xsl:text>                  /         /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9866
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9867
    <xsl:text>                 /         /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9868
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9869
    <xsl:text>         xstart *---------*--------------&gt; given X axis (xvect)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9870
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9871
    <xsl:text>               /         /origin
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9872
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9873
    <xsl:text>              /         /
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9874
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9875
    <xsl:text>             *---------*--------------
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9876
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9877
    <xsl:text>        base_point   ystart
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9878
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9879
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9880
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9881
    <xsl:text>        */
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9882
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9883
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9884
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9885
    <xsl:text>        let base_point = getLinesIntesection([xstart,yvect],[ystart,xvect]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9886
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9887
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9888
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9889
    <xsl:text>        return base_point;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9890
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9891
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9892
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9893
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9894
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9895
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9896
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9897
    <xsl:text>}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9898
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9899
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9900
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9901
    <xsl:text>class Axis {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9902
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9903
    <xsl:text>    constructor(label, marks, line, format){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9904
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9905
    <xsl:text>        this.lineElement = line;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9906
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9907
    <xsl:text>        this.line = lineFromPath(line);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9908
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9909
    <xsl:text>        this.format = format;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9910
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9911
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9912
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9913
    <xsl:text>        this.label = label;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9914
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9915
    <xsl:text>        this.marks = marks;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9916
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9917
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9918
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9919
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9920
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9921
    <xsl:text>        // add transforms for elements sliding along the axis line
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9922
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9923
    <xsl:text>        for(let [elementname,element] of zip(["minor", "major", "label"],[...marks,label])){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9924
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9925
    <xsl:text>            for(let name of ["base","slide"]){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9926
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9927
    <xsl:text>                let transform = svg_root.createSVGTransform();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9928
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9929
    <xsl:text>                element.transform.baseVal.insertItemBefore(transform,0);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9930
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9931
    <xsl:text>                this[elementname+"_"+name+"_transform"]=transform;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9932
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9933
    <xsl:text>            };
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9934
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9935
    <xsl:text>        };
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9936
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9937
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9938
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9939
    <xsl:text>        // group marks an labels together
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9940
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9941
    <xsl:text>        let parent = line.parentElement;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9942
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9943
    <xsl:text>        this.marks_group = move_elements_to_group(marks);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9944
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9945
    <xsl:text>        this.marks_and_label_group = move_elements_to_group([this.marks_group, label]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9946
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9947
    <xsl:text>        this.group = move_elements_to_group([this.marks_and_label_group,line]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9948
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9949
    <xsl:text>        parent.appendChild(this.group);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9950
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9951
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9952
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9953
    <xsl:text>        // Add transforms to group
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9954
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9955
    <xsl:text>        for(let name of ["base","origin"]){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9956
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9957
    <xsl:text>            let transform = svg_root.createSVGTransform();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9958
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9959
    <xsl:text>            this.group.transform.baseVal.appendItem(transform);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9960
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9961
    <xsl:text>            this[name+"_transform"]=transform;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9962
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9963
    <xsl:text>        };
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9964
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9965
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9966
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9967
    <xsl:text>        this.marks_and_label_group_transform = svg_root.createSVGTransform();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9968
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9969
    <xsl:text>        this.marks_and_label_group.transform.baseVal.appendItem(this.marks_and_label_group_transform);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9970
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9971
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9972
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9973
    <xsl:text>        this.duplicates = [];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9974
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9975
    <xsl:text>        this.last_duplicate_index = 0;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9976
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9977
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9978
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9979
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9980
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9981
    <xsl:text>    setBasePoint(base_point){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9982
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9983
    <xsl:text>        // move Axis to base point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9984
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9985
    <xsl:text>        let [start, _vect] = this.line;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9986
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9987
    <xsl:text>        let v = vector(start, base_point);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9988
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9989
    <xsl:text>        this.base_transform.setTranslate(v.x, v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9990
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9991
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9992
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9993
    <xsl:text>        // Move marks and label to base point.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9994
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9995
    <xsl:text>        // _|_______          _|________
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9996
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9997
    <xsl:text>        //  |  '  |     ==&gt;    '
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9998
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
  9999
    <xsl:text>        //  |     0            0
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10000
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10001
    <xsl:text>        //  |                  |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10002
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10003
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10004
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10005
    <xsl:text>        for(let [markname,mark] of zip(["minor", "major"],this.marks)){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10006
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10007
    <xsl:text>            let pos = vector(
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10008
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10009
    <xsl:text>                // Marks are expected to be paths
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10010
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10011
    <xsl:text>                // paths are expected to be lines
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10012
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10013
    <xsl:text>                // intersection with axis line is taken 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10014
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10015
    <xsl:text>                // as reference for mark position
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10016
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10017
    <xsl:text>                getLinesIntesection(
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10018
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10019
    <xsl:text>                    this.line, lineFromPath(mark)),base_point);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10020
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10021
    <xsl:text>            this[markname+"_base_transform"].setTranslate(pos.x - v.x, pos.y - v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10022
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10023
    <xsl:text>            if(markname == "major"){ // label follow major mark
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10024
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10025
    <xsl:text>                this.label_base_transform.setTranslate(pos.x - v.x, pos.y - v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10026
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10027
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10028
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10029
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10030
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10031
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10032
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10033
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10034
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10035
    <xsl:text>	moveOrigin(vect){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10036
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10037
    <xsl:text>		this.origin_transform.setTranslate(vect.x, vect.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10038
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10039
    <xsl:text>	}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10040
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10041
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10042
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10043
    <xsl:text>    applyRange(min, max){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10044
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10045
    <xsl:text>        let range = max - min;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10046
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10047
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10048
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10049
    <xsl:text>        // compute how many units for a mark
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10050
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10051
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10052
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10053
    <xsl:text>        // - Units are expected to be an order of magnitude smaller than range,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10054
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10055
    <xsl:text>        //   so that marks are not too dense and also not too sparse.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10056
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10057
    <xsl:text>        //   Order of magnitude of range is log10(range)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10058
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10059
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10060
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10061
    <xsl:text>        // - Units are necessarily power of ten, otherwise it is complicated to
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10062
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10063
    <xsl:text>        //   fill the text in labels...
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10064
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10065
    <xsl:text>        //   Unit is pow(10, integer_number )
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10066
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10067
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10068
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10069
    <xsl:text>        // - To transform order of magnitude to an integer, floor() is used.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10070
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10071
    <xsl:text>        //   This results in a count of mark fluctuating in between 10 and 100.
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10072
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10073
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10074
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10075
    <xsl:text>        // - To spare resources result is better in between 3 and 30,
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10076
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10077
    <xsl:text>        //   and log10(3) is substracted to order of magnitude to obtain this
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10078
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10079
    <xsl:text>        let unit = Math.pow(10, Math.floor(Math.log10(range)-Math.log10(3)));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10080
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10081
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10082
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10083
    <xsl:text>        // TODO: for time values (ms), units may be :
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10084
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10085
    <xsl:text>        //       1       -&gt; ms
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10086
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10087
    <xsl:text>        //       10      -&gt; s/100
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10088
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10089
    <xsl:text>        //       100     -&gt; s/10
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10090
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10091
    <xsl:text>        //       1000    -&gt; s
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10092
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10093
    <xsl:text>        //       60000   -&gt; min
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10094
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10095
    <xsl:text>        //       3600000 -&gt; hour
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10096
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10097
    <xsl:text>        //       ...
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10098
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10099
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10100
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10101
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10102
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10103
    <xsl:text>        // Compute position of origin along axis [0...range]
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10104
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10105
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10106
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10107
    <xsl:text>        // min &lt; 0, max &gt; 0, offset = -min
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10108
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10109
    <xsl:text>        // _____________|________________
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10110
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10111
    <xsl:text>        // ... -3 -2 -1 |0  1  2  3  4 ...
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10112
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10113
    <xsl:text>        // &lt;--offset---&gt; ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10114
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10115
    <xsl:text>        //               |_original
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10116
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10117
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10118
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10119
    <xsl:text>        // min &gt; 0, max &gt; 0, offset = 0
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10120
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10121
    <xsl:text>        // |________________
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10122
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10123
    <xsl:text>        // |6  7  8  9  10...
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10124
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10125
    <xsl:text>        //  ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10126
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10127
    <xsl:text>        //  |_original
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10128
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10129
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10130
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10131
    <xsl:text>        // min &lt; 0, max &lt; 0, offset = max-min (range)
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10132
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10133
    <xsl:text>        // _____________|_
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10134
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10135
    <xsl:text>        // ... -5 -4 -3 |-2
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10136
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10137
    <xsl:text>        // &lt;--offset---&gt; ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10138
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10139
    <xsl:text>        //               |_original
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10140
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10141
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10142
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10143
    <xsl:text>        let offset = (max&gt;=0 &amp;&amp; min&gt;=0) ? 0 : (
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10144
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10145
    <xsl:text>                     (max&lt;0 &amp;&amp; min&lt;0)   ? range : -min);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10146
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10147
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10148
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10149
    <xsl:text>        // compute unit vector
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10150
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10151
    <xsl:text>        let [_start, vect] = this.line;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10152
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10153
    <xsl:text>        let unit_vect = vectorscale(vect, 1/range);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10154
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10155
    <xsl:text>        let [mark_min, mark_max, mark_offset] = [min,max,offset].map(val =&gt; Math.round(val/unit));
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10156
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10157
    <xsl:text>        let mark_count = mark_max-mark_min;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10158
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10159
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10160
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10161
    <xsl:text>        // apply unit vector to marks and label
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10162
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10163
    <xsl:text>        // offset is a representing position of an 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10164
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10165
    <xsl:text>        // axis along the opposit axis line, expressed in major marks units
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10166
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10167
    <xsl:text>        // unit_vect is unit vector
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10168
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10169
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10170
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10171
    <xsl:text>        //              ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10172
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10173
    <xsl:text>        //              | unit_vect
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10174
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10175
    <xsl:text>        //              |&lt;---&gt;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10176
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10177
    <xsl:text>        //     _________|__________&gt;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10178
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10179
    <xsl:text>        //     ^  |  '  |  '  |  '
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10180
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10181
    <xsl:text>        //     |yoffset |     1 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10182
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10183
    <xsl:text>        //     |        |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10184
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10185
    <xsl:text>        //     v xoffset|
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10186
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10187
    <xsl:text>        //     X&lt;------&gt;|
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10188
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10189
    <xsl:text>        // base_point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10190
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10191
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10192
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10193
    <xsl:text>        // move major marks and label to first positive mark position
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10194
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10195
    <xsl:text>        // let v = vectorscale(unit_vect, unit);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10196
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10197
    <xsl:text>        // this.label_slide_transform.setTranslate(v.x, v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10198
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10199
    <xsl:text>        // this.major_slide_transform.setTranslate(v.x, v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10200
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10201
    <xsl:text>        // move minor mark to first half positive mark position
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10202
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10203
    <xsl:text>        let v = vectorscale(unit_vect, unit/2);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10204
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10205
    <xsl:text>        this.minor_slide_transform.setTranslate(v.x, v.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10206
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10207
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10208
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10209
    <xsl:text>        // duplicate marks and labels as needed
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10210
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10211
    <xsl:text>        let current_mark_count = this.duplicates.length;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10212
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10213
    <xsl:text>        for(let i = current_mark_count; i &lt;= mark_count; i++){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10214
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10215
    <xsl:text>            // cloneNode() label and add a svg:use of marks in a new group
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10216
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10217
    <xsl:text>            let newgroup = document.createElementNS(xmlns,"g");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10218
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10219
    <xsl:text>            let transform = svg_root.createSVGTransform();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10220
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10221
    <xsl:text>            let newlabel = this.label.cloneNode(true);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10222
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10223
    <xsl:text>            let newuse = document.createElementNS(xmlns,"use");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10224
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10225
    <xsl:text>            let newuseAttr = document.createAttribute("href");
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10226
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10227
    <xsl:text>            newuseAttr.value = "#"+this.marks_group.id;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10228
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10229
    <xsl:text>            newuse.setAttributeNode(newuseAttr);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10230
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10231
    <xsl:text>            newgroup.transform.baseVal.appendItem(transform);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10232
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10233
    <xsl:text>            newgroup.appendChild(newlabel);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10234
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10235
    <xsl:text>            newgroup.appendChild(newuse);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10236
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10237
    <xsl:text>            this.duplicates.push([transform,newgroup]);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10238
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10239
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10240
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10241
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10242
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10243
    <xsl:text>        // move marks and labels, set labels
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10244
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10245
    <xsl:text>        // 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10246
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10247
    <xsl:text>        // min &gt; 0, max &gt; 0, offset = 0
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10248
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10249
    <xsl:text>        //         ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10250
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10251
    <xsl:text>        //         |________&gt;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10252
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10253
    <xsl:text>        //        '| |  '  |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10254
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10255
    <xsl:text>        //         | 6     7
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10256
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10257
    <xsl:text>        //         X
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10258
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10259
    <xsl:text>        //     base_point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10260
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10261
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10262
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10263
    <xsl:text>        // min &lt; 0, max &gt; 0, offset = -min
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10264
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10265
    <xsl:text>        //              ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10266
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10267
    <xsl:text>        //     _________|__________&gt;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10268
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10269
    <xsl:text>        //     '  |  '  |  '  |  '
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10270
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10271
    <xsl:text>        //       -1     |     1 
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10272
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10273
    <xsl:text>        //       offset |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10274
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10275
    <xsl:text>        //     X&lt;------&gt;|
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10276
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10277
    <xsl:text>        // base_point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10278
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10279
    <xsl:text>        //
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10280
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10281
    <xsl:text>        // min &lt; 0, max &lt; 0, offset = range
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10282
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10283
    <xsl:text>        //                 ^
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10284
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10285
    <xsl:text>        //     ____________|    
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10286
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10287
    <xsl:text>        //      '  |  '  | |'
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10288
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10289
    <xsl:text>        //        -5    -4 |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10290
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10291
    <xsl:text>        //         offset  |
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10292
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10293
    <xsl:text>        //     X&lt;---------&gt;|
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10294
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10295
    <xsl:text>        // base_point
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10296
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10297
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10298
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10299
    <xsl:text>        let duplicate_index = 0;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10300
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10301
    <xsl:text>        for(let mark_index = 0; mark_index &lt;= mark_count; mark_index++){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10302
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10303
    <xsl:text>            let val = (mark_min + mark_index) * unit;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10304
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10305
    <xsl:text>            let vec = vectorscale(unit_vect, val - min);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10306
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10307
    <xsl:text>            let text = this.format ? sprintf(this.format, val) : val.toString();
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10308
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10309
    <xsl:text>            if(mark_index == mark_offset){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10310
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10311
    <xsl:text>                // apply offset to original marks and label groups
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10312
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10313
    <xsl:text>                this.marks_and_label_group_transform.setTranslate(vec.x, vec.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10314
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10315
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10316
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10317
    <xsl:text>                // update original label text
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10318
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10319
    <xsl:text>                this.label.getElementsByTagName("tspan")[0].textContent = text;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10320
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10321
    <xsl:text>            } else {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10322
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10323
    <xsl:text>                let [transform,element] = this.duplicates[duplicate_index++];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10324
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10325
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10326
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10327
    <xsl:text>                // apply unit vector*N to marks and label groups
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10328
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10329
    <xsl:text>                transform.setTranslate(vec.x, vec.y);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10330
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10331
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10332
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10333
    <xsl:text>                // update label text
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10334
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10335
    <xsl:text>                element.getElementsByTagName("tspan")[0].textContent = text;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10336
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10337
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10338
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10339
    <xsl:text>                // Attach to group if not already
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10340
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10341
    <xsl:text>                if(element.parentElement == null){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10342
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10343
    <xsl:text>                    this.group.appendChild(element);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10344
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10345
    <xsl:text>                }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10346
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10347
    <xsl:text>            }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10348
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10349
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10350
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10351
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10352
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10353
    <xsl:text>        let save_duplicate_index = duplicate_index;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10354
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10355
    <xsl:text>        // dettach marks and label from group if not anymore visible
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10356
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10357
    <xsl:text>        for(;duplicate_index &lt; this.last_duplicate_index; duplicate_index++){
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10358
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10359
    <xsl:text>            let [transform,element] = this.duplicates[duplicate_index];
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10360
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10361
    <xsl:text>            this.group.removeChild(element);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10362
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10363
    <xsl:text>        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10364
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10365
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10366
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10367
    <xsl:text>        this.last_duplicate_index = save_duplicate_index;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10368
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10369
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10370
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10371
    <xsl:text>		return vectorscale(unit_vect, offset);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10372
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10373
    <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10374
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10375
    <xsl:text>}
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10376
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10377
    <xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10378
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 10379
  </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
 10380
  <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
 10381
    <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
 10382
      <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
 10383
    </xsl:comment>
3264
51645afeded9 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3242
diff changeset
 10384
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3212
2b5b3f4f26f0 SVGHMI: silence debug output in generated xhtml.
Edouard Tisserant
parents: 3211
diff changeset
 10385
      <head>
3264
51645afeded9 SVGHMI: update generated XSLT files
Edouard Tisserant
parents: 3242
diff changeset
 10386
        <style type="text/css" media="screen">
3212
2b5b3f4f26f0 SVGHMI: silence debug output in generated xhtml.
Edouard Tisserant
parents: 3211
diff changeset
 10387
          <xsl:value-of select="ns:GetFonts()"/>
3517
dacf329abdd9 SVGHMI: update generated xslt files
Edouard Tisserant
parents: 3510
diff changeset
 10388
          <xsl:apply-templates select="document('')/*/cssdefs:*"/>
3212
2b5b3f4f26f0 SVGHMI: silence debug output in generated xhtml.
Edouard Tisserant
parents: 3211
diff changeset
 10389
        </style>
2b5b3f4f26f0 SVGHMI: silence debug output in generated xhtml.
Edouard Tisserant
parents: 3211
diff changeset
 10390
      </head>
3084
1ae4a871b6f9 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3080
diff changeset
 10391
      <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
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
 10392
        <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
 10393
        <script>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10394
          <xsl:text>/*
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10395
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10396
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10397
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10398
          <xsl:text>From https://github.com/keyvan-m-sadeghi/pythonic
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10399
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10400
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10401
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10402
          <xsl:text>Slightly modified in order to be usable in browser (i.e. not as a node.js module)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10403
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10404
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10405
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10406
          <xsl:text>The MIT License (MIT)
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10407
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10408
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10409
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10410
          <xsl:text>Copyright (c) 2016 Assister.Ai
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10411
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10412
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10413
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10414
          <xsl:text>Permission is hereby granted, free of charge, to any person obtaining a copy of
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10415
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10416
          <xsl:text>this software and associated documentation files (the "Software"), to deal in
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10417
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10418
          <xsl:text>the Software without restriction, including without limitation the rights to
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10419
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10420
          <xsl:text>use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10421
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10422
          <xsl:text>the Software, and to permit persons to whom the Software is furnished to do so,
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10423
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10424
          <xsl:text>subject to the following conditions:
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10425
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10426
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10427
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10428
          <xsl:text>The above copyright notice and this permission notice shall be included in all
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10429
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10430
          <xsl:text>copies or substantial portions of the Software.
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10431
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10432
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10433
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10434
          <xsl:text>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10435
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10436
          <xsl:text>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10437
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10438
          <xsl:text>FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10439
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10440
          <xsl:text>COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10441
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10442
          <xsl:text>IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10443
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10444
          <xsl:text>CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10445
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10446
          <xsl:text>*/
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10447
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10448
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10449
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10450
          <xsl:text>class Iterator {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10451
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10452
          <xsl:text>    constructor(generator) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10453
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10454
          <xsl:text>        this[Symbol.iterator] = generator;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10455
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10456
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10457
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10458
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10459
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10460
          <xsl:text>    async * [Symbol.asyncIterator]() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10461
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10462
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10463
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10464
          <xsl:text>            yield await element;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10465
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10466
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10467
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10468
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10469
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10470
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10471
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10472
          <xsl:text>    forEach(callback) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10473
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10474
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10475
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10476
          <xsl:text>            callback(element);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10477
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10478
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10479
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10480
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10481
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10482
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10483
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10484
          <xsl:text>    map(callback) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10485
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10486
          <xsl:text>        const result = [];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10487
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10488
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10489
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10490
          <xsl:text>            result.push(callback(element));
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10491
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10492
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10493
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10494
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10495
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10496
          <xsl:text>        return result;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10497
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10498
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10499
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10500
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10501
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10502
          <xsl:text>    filter(callback) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10503
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10504
          <xsl:text>        const result = [];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10505
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10506
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10507
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10508
          <xsl:text>            if (callback(element)) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10509
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10510
          <xsl:text>                result.push(element);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10511
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10512
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10513
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10514
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10515
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10516
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10517
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10518
          <xsl:text>        return result;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10519
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10520
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10521
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10522
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10523
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10524
          <xsl:text>    reduce(callback, initialValue) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10525
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10526
          <xsl:text>        let empty = typeof initialValue === 'undefined';
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10527
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10528
          <xsl:text>        let accumulator = initialValue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10529
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10530
          <xsl:text>        let index = 0;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10531
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10532
          <xsl:text>        for (const currentValue of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10533
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10534
          <xsl:text>            if (empty) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10535
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10536
          <xsl:text>                accumulator = currentValue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10537
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10538
          <xsl:text>                empty = false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10539
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10540
          <xsl:text>                continue;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10541
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10542
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10543
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10544
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10545
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10546
          <xsl:text>            accumulator = callback(accumulator, currentValue, index, this);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10547
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10548
          <xsl:text>            index++;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10549
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10550
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10551
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10552
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10553
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10554
          <xsl:text>        if (empty) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10555
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10556
          <xsl:text>            throw new TypeError('Reduce of empty Iterator with no initial value');
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10557
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10558
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10559
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10560
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10561
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10562
          <xsl:text>        return accumulator;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10563
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10564
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10565
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10566
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10567
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10568
          <xsl:text>    some(callback) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10569
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10570
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10571
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10572
          <xsl:text>            if (callback(element)) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10573
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10574
          <xsl:text>                return true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10575
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10576
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10577
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10578
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10579
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10580
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10581
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10582
          <xsl:text>        return false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10583
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10584
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10585
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10586
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10587
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10588
          <xsl:text>    every(callback) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10589
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10590
          <xsl:text>        for (const element of this) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10591
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10592
          <xsl:text>            if (!callback(element)) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10593
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10594
          <xsl:text>                return false;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10595
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10596
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10597
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10598
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10599
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10600
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10601
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10602
          <xsl:text>        return true;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10603
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10604
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10605
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10606
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10607
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10608
          <xsl:text>    static fromIterable(iterable) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10609
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10610
          <xsl:text>        return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10611
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10612
          <xsl:text>            for (const element of iterable) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10613
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10614
          <xsl:text>                yield element;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10615
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10616
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10617
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10618
          <xsl:text>        });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10619
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10620
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10621
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10622
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10623
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10624
          <xsl:text>    toArray() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10625
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10626
          <xsl:text>        return Array.from(this);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10627
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10628
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10629
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10630
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10631
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10632
          <xsl:text>    next() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10633
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10634
          <xsl:text>        if (!this.currentInvokedGenerator) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10635
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10636
          <xsl:text>            this.currentInvokedGenerator = this[Symbol.iterator]();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10637
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10638
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10639
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10640
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10641
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10642
          <xsl:text>        return this.currentInvokedGenerator.next();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10643
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10644
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10645
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10646
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10647
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10648
          <xsl:text>    reset() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10649
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10650
          <xsl:text>        delete this.currentInvokedGenerator;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10651
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10652
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10653
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10654
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10655
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10656
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10657
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10658
          <xsl:text>function rangeSimple(stop) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10659
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10660
          <xsl:text>    return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10661
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10662
          <xsl:text>        for (let i = 0; i &lt; stop; i++) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10663
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10664
          <xsl:text>            yield i;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10665
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10666
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10667
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10668
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10669
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10670
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10671
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10672
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10673
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10674
          <xsl:text>function rangeOverload(start, stop, step = 1) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10675
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10676
          <xsl:text>    return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10677
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10678
          <xsl:text>        for (let i = start; i &lt; stop; i += step) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10679
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10680
          <xsl:text>            yield i;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10681
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10682
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10683
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10684
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10685
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10686
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10687
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10688
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10689
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10690
          <xsl:text>function range(...args) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10691
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10692
          <xsl:text>    if (args.length &lt; 2) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10693
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10694
          <xsl:text>        return rangeSimple(...args);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10695
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10696
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10697
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10698
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10699
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10700
          <xsl:text>    return rangeOverload(...args);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10701
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10702
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10703
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10704
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10705
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10706
          <xsl:text>function enumerate(iterable) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10707
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10708
          <xsl:text>    return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10709
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10710
          <xsl:text>        let index = 0;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10711
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10712
          <xsl:text>        for (const element of iterable) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10713
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10714
          <xsl:text>            yield [index, element];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10715
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10716
          <xsl:text>            index++;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10717
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10718
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10719
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10720
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10721
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10722
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10723
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10724
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10725
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10726
          <xsl:text>const _zip = longest =&gt; (...iterables) =&gt; {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10727
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10728
          <xsl:text>    if (iterables.length == 0) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10729
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10730
          <xsl:text>        // works starting with 1 iterable
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10731
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10732
          <xsl:text>        // [a,b,c] -&gt; [[a],[b],[c]]
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10733
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10734
          <xsl:text>        // [a,b,c],[d,e,f] -&gt; [[a,d],[b,e],[c,f]]
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10735
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10736
          <xsl:text>        throw new TypeError("zip takes 1 iterables at least, "+iterables.length+" given");
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10737
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10738
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10739
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10740
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10741
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10742
          <xsl:text>    return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10743
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10744
          <xsl:text>        const iterators = iterables.map(iterable =&gt; Iterator.fromIterable(iterable));
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10745
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10746
          <xsl:text>        while (true) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10747
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10748
          <xsl:text>            const row = iterators.map(iterator =&gt; iterator.next());
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10749
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10750
          <xsl:text>            const check = longest ? row.every.bind(row) : row.some.bind(row);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10751
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10752
          <xsl:text>            if (check(next =&gt; next.done)) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10753
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10754
          <xsl:text>                return;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10755
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10756
          <xsl:text>            }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10757
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10758
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10759
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10760
          <xsl:text>            yield row.map(next =&gt; next.value);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10761
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10762
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10763
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10764
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10765
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10766
          <xsl:text>};
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10767
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10768
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10769
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10770
          <xsl:text>const zip = _zip(false), zipLongest= _zip(true);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10771
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10772
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10773
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10774
          <xsl:text>function items(obj) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10775
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10776
          <xsl:text>    let {keys, get} = obj;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10777
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10778
          <xsl:text>    if (obj instanceof Map) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10779
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10780
          <xsl:text>        keys = keys.bind(obj);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10781
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10782
          <xsl:text>        get = get.bind(obj);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10783
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10784
          <xsl:text>    } else {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10785
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10786
          <xsl:text>        keys = function () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10787
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10788
          <xsl:text>            return Object.keys(obj);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10789
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10790
          <xsl:text>        };
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10791
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10792
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10793
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10794
          <xsl:text>        get = function (key) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10795
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10796
          <xsl:text>            return obj[key];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10797
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10798
          <xsl:text>        };
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10799
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10800
          <xsl:text>    }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10801
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10802
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10803
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10804
          <xsl:text>    return new Iterator(function * () {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10805
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10806
          <xsl:text>        for (const key of keys()) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10807
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10808
          <xsl:text>            yield [key, get(key)];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10809
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10810
          <xsl:text>        }
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10811
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10812
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10813
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10814
          <xsl:text>}
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10815
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10816
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10817
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10818
          <xsl:text>/*
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10819
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10820
          <xsl:text>module.exports = {Iterator, range, enumerate, zip: _zip(false), zipLongest: _zip(true), items};
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10821
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10822
          <xsl:text>*/
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 10823
</xsl:text>
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10824
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10825
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10826
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10827
// Early independent declarations 
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10828
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10829
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10830
</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
 10831
          <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
 10832
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10833
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10834
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10835
// 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
 10836
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10837
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10838
</xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10839
          <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
 10840
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10841
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10842
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10843
// 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
 10844
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10845
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10846
</xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10847
          <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
 10848
          <xsl:text>
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10849
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10850
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10851
// 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
 10852
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10853
//
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2942
diff changeset
 10854
</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
 10855
          <xsl:apply-templates select="document('')/*/epilogue:*"/>
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10856
          <xsl:text>/* https://github.com/alexei/sprintf.js/blob/master/src/sprintf.js */
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10857
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10858
          <xsl:text>/* global window, exports, define */
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10859
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10860
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10861
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10862
          <xsl:text>!function() {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10863
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10864
          <xsl:text>    'use strict'
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10865
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10866
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10867
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10868
          <xsl:text>    var re = {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10869
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10870
          <xsl:text>        not_string: /[^s]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10871
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10872
          <xsl:text>        not_bool: /[^t]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10873
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10874
          <xsl:text>        not_type: /[^T]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10875
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10876
          <xsl:text>        not_primitive: /[^v]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10877
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10878
          <xsl:text>        number: /[diefg]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10879
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10880
          <xsl:text>        numeric_arg: /[bcdiefguxX]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10881
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10882
          <xsl:text>        json: /[j]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10883
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10884
          <xsl:text>        not_json: /[^j]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10885
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10886
          <xsl:text>        text: /^[^%]+/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10887
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10888
          <xsl:text>        modulo: /^%{2}/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10889
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 10890
          <xsl:text>        placeholder: /^%(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxXD])/,
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10891
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10892
          <xsl:text>        key: /^([a-z_][a-z_\d]*)/i,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10893
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10894
          <xsl:text>        key_access: /^\.([a-z_][a-z_\d]*)/i,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10895
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10896
          <xsl:text>        index_access: /^\[(\d+)\]/,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10897
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10898
          <xsl:text>        sign: /^[+-]/
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10899
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10900
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10901
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10902
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10903
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10904
          <xsl:text>    function sprintf(key) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10905
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10906
          <xsl:text>        // arguments is not an array, but should be fine for this call
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10907
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10908
          <xsl:text>        return sprintf_format(sprintf_parse(key), arguments)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10909
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10910
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10911
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10912
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10913
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10914
          <xsl:text>    function vsprintf(fmt, argv) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10915
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10916
          <xsl:text>        return sprintf.apply(null, [fmt].concat(argv || []))
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10917
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10918
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10919
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10920
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10921
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10922
          <xsl:text>    function sprintf_format(parse_tree, argv) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10923
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10924
          <xsl:text>        var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10925
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10926
          <xsl:text>        for (i = 0; i &lt; tree_length; i++) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10927
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10928
          <xsl:text>            if (typeof parse_tree[i] === 'string') {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10929
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10930
          <xsl:text>                output += parse_tree[i]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10931
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10932
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10933
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10934
          <xsl:text>            else if (typeof parse_tree[i] === 'object') {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10935
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10936
          <xsl:text>                ph = parse_tree[i] // convenience purposes only
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10937
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10938
          <xsl:text>                if (ph.keys) { // keyword argument
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10939
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10940
          <xsl:text>                    arg = argv[cursor]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10941
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10942
          <xsl:text>                    for (k = 0; k &lt; ph.keys.length; k++) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10943
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10944
          <xsl:text>                        if (arg == undefined) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10945
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10946
          <xsl:text>                            throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10947
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10948
          <xsl:text>                        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10949
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10950
          <xsl:text>                        arg = arg[ph.keys[k]]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10951
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10952
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10953
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10954
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10955
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10956
          <xsl:text>                else if (ph.param_no) { // positional argument (explicit)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10957
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10958
          <xsl:text>                    arg = argv[ph.param_no]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10959
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10960
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10961
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10962
          <xsl:text>                else { // positional argument (implicit)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10963
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10964
          <xsl:text>                    arg = argv[cursor++]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10965
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10966
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10967
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10968
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10969
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10970
          <xsl:text>                if (re.not_type.test(ph.type) &amp;&amp; re.not_primitive.test(ph.type) &amp;&amp; arg instanceof Function) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10971
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10972
          <xsl:text>                    arg = arg()
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10973
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10974
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10975
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10976
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10977
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10978
          <xsl:text>                if (re.numeric_arg.test(ph.type) &amp;&amp; (typeof arg !== 'number' &amp;&amp; isNaN(arg))) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10979
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10980
          <xsl:text>                    throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10981
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10982
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10983
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10984
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10985
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10986
          <xsl:text>                if (re.number.test(ph.type)) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10987
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10988
          <xsl:text>                    is_positive = arg &gt;= 0
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10989
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10990
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10991
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10992
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10993
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10994
          <xsl:text>                switch (ph.type) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10995
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10996
          <xsl:text>                    case 'b':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10997
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10998
          <xsl:text>                        arg = parseInt(arg, 10).toString(2)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 10999
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11000
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11001
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11002
          <xsl:text>                    case 'c':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11003
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11004
          <xsl:text>                        arg = String.fromCharCode(parseInt(arg, 10))
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11005
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11006
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11007
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11008
          <xsl:text>                    case 'd':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11009
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11010
          <xsl:text>                    case 'i':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11011
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11012
          <xsl:text>                        arg = parseInt(arg, 10)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11013
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11014
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11015
</xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11016
          <xsl:text>                    case 'D':
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11017
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11018
          <xsl:text>                        /*  
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11019
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11020
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11021
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11022
          <xsl:text>                            select date format with width
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11023
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11024
          <xsl:text>                            select time format with precision
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11025
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11026
          <xsl:text>                            %D  =&gt; 13:31 AM (default)
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11027
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11028
          <xsl:text>                            %1D  =&gt; 13:31 AM
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11029
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11030
          <xsl:text>                            %.1D  =&gt; 07/07/20
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11031
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11032
          <xsl:text>                            %1.1D  =&gt; 07/07/20, 13:31 AM
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11033
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11034
          <xsl:text>                            %1.2D  =&gt; 07/07/20, 13:31:55 AM
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11035
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11036
          <xsl:text>                            %2.2D  =&gt; May 5, 2022, 9:29:16 AM
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11037
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11038
          <xsl:text>                            %3.3D  =&gt; May 5, 2022 at 9:28:16 AM GMT+2
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11039
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11040
          <xsl:text>                            %4.4D  =&gt; Thursday, May 5, 2022 at 9:26:59 AM Central European Summer Time
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11041
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11042
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11043
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11044
          <xsl:text>                            see meaning of DateTimeFormat's options "datestyle" and "timestyle" in MDN 
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11045
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11046
          <xsl:text>                        */
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11047
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11048
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11049
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11050
          <xsl:text>                        let [datestyle, timestyle] = [ph.width, ph.precision].map(val =&gt; ({
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11051
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11052
          <xsl:text>                            1: "short",
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11053
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11054
          <xsl:text>                            2: "medium",
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11055
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11056
          <xsl:text>                            3: "long",
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11057
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11058
          <xsl:text>                            4: "full"
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11059
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11060
          <xsl:text>                        }[val]));
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11061
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11062
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11063
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11064
          <xsl:text>                        if(timestyle === undefined &amp;&amp; datestyle === undefined){
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11065
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11066
          <xsl:text>                            timestyle = "short";
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11067
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11068
          <xsl:text>                        }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11069
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11070
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11071
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11072
          <xsl:text>                        let options = {
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11073
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11074
          <xsl:text>                            dateStyle: datestyle,
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11075
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11076
          <xsl:text>                            timeStyle: timestyle,
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11077
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11078
          <xsl:text>                            hour12: false
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11079
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11080
          <xsl:text>                        }
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11081
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11082
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11083
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11084
          <xsl:text>                        /* get lang from globals */
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11085
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11086
          <xsl:text>                        let lang = get_current_lang_code();
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11087
</xsl:text>
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11088
          <xsl:text>                        let f;
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11089
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11090
          <xsl:text>                        try{
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11091
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11092
          <xsl:text>                            f = new Intl.DateTimeFormat(lang, options);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11093
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11094
          <xsl:text>                        } catch(e) {
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11095
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11096
          <xsl:text>                            f = new Intl.DateTimeFormat('en-US', options);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11097
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11098
          <xsl:text>                        }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11099
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11100
          <xsl:text>                        arg = f.format(arg);
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11101
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11102
          <xsl:text>
3495
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11103
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11104
          <xsl:text>                        /*    
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11105
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11106
          <xsl:text>                            TODO: select with padding char
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11107
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11108
          <xsl:text>                                  a: absolute time and date (default)
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11109
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11110
          <xsl:text>                                  r: relative time
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11111
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11112
          <xsl:text>                        */
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11113
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11114
          <xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11115
</xsl:text>
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11116
          <xsl:text>                        break
f422d3d71f89 SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3418
diff changeset
 11117
</xsl:text>
3362
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11118
          <xsl:text>                    case 'j':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11119
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11120
          <xsl:text>                        arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11121
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11122
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11123
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11124
          <xsl:text>                    case 'e':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11125
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11126
          <xsl:text>                        arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential()
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11127
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11128
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11129
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11130
          <xsl:text>                    case 'f':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11131
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11132
          <xsl:text>                        arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11133
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11134
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11135
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11136
          <xsl:text>                    case 'g':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11137
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11138
          <xsl:text>                        arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11139
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11140
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11141
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11142
          <xsl:text>                    case 'o':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11143
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11144
          <xsl:text>                        arg = (parseInt(arg, 10) &gt;&gt;&gt; 0).toString(8)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11145
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11146
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11147
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11148
          <xsl:text>                    case 's':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11149
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11150
          <xsl:text>                        arg = String(arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11151
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11152
          <xsl:text>                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11153
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11154
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11155
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11156
          <xsl:text>                    case 't':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11157
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11158
          <xsl:text>                        arg = String(!!arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11159
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11160
          <xsl:text>                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11161
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11162
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11163
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11164
          <xsl:text>                    case 'T':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11165
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11166
          <xsl:text>                        arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11167
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11168
          <xsl:text>                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11169
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11170
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11171
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11172
          <xsl:text>                    case 'u':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11173
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11174
          <xsl:text>                        arg = parseInt(arg, 10) &gt;&gt;&gt; 0
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11175
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11176
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11177
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11178
          <xsl:text>                    case 'v':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11179
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11180
          <xsl:text>                        arg = arg.valueOf()
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11181
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11182
          <xsl:text>                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11183
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11184
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11185
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11186
          <xsl:text>                    case 'x':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11187
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11188
          <xsl:text>                        arg = (parseInt(arg, 10) &gt;&gt;&gt; 0).toString(16)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11189
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11190
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11191
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11192
          <xsl:text>                    case 'X':
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11193
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11194
          <xsl:text>                        arg = (parseInt(arg, 10) &gt;&gt;&gt; 0).toString(16).toUpperCase()
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11195
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11196
          <xsl:text>                        break
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11197
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11198
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11199
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11200
          <xsl:text>                if (re.json.test(ph.type)) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11201
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11202
          <xsl:text>                    output += arg
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11203
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11204
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11205
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11206
          <xsl:text>                else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11207
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11208
          <xsl:text>                    if (re.number.test(ph.type) &amp;&amp; (!is_positive || ph.sign)) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11209
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11210
          <xsl:text>                        sign = is_positive ? '+' : '-'
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11211
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11212
          <xsl:text>                        arg = arg.toString().replace(re.sign, '')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11213
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11214
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11215
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11216
          <xsl:text>                    else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11217
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11218
          <xsl:text>                        sign = ''
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11219
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11220
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11221
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11222
          <xsl:text>                    pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11223
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11224
          <xsl:text>                    pad_length = ph.width - (sign + arg).length
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11225
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11226
          <xsl:text>                    pad = ph.width ? (pad_length &gt; 0 ? pad_character.repeat(pad_length) : '') : ''
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11227
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11228
          <xsl:text>                    output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11229
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11230
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11231
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11232
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11233
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11234
          <xsl:text>        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11235
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11236
          <xsl:text>        return output
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11237
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11238
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11239
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11240
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11241
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11242
          <xsl:text>    var sprintf_cache = Object.create(null)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11243
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11244
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11245
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11246
          <xsl:text>    function sprintf_parse(fmt) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11247
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11248
          <xsl:text>        if (sprintf_cache[fmt]) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11249
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11250
          <xsl:text>            return sprintf_cache[fmt]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11251
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11252
          <xsl:text>        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11253
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11254
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11255
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11256
          <xsl:text>        var _fmt = fmt, match, parse_tree = [], arg_names = 0
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11257
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11258
          <xsl:text>        while (_fmt) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11259
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11260
          <xsl:text>            if ((match = re.text.exec(_fmt)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11261
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11262
          <xsl:text>                parse_tree.push(match[0])
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11263
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11264
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11265
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11266
          <xsl:text>            else if ((match = re.modulo.exec(_fmt)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11267
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11268
          <xsl:text>                parse_tree.push('%')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11269
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11270
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11271
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11272
          <xsl:text>            else if ((match = re.placeholder.exec(_fmt)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11273
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11274
          <xsl:text>                if (match[2]) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11275
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11276
          <xsl:text>                    arg_names |= 1
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11277
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11278
          <xsl:text>                    var field_list = [], replacement_field = match[2], field_match = []
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11279
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11280
          <xsl:text>                    if ((field_match = re.key.exec(replacement_field)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11281
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11282
          <xsl:text>                        field_list.push(field_match[1])
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11283
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11284
          <xsl:text>                        while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11285
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11286
          <xsl:text>                            if ((field_match = re.key_access.exec(replacement_field)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11287
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11288
          <xsl:text>                                field_list.push(field_match[1])
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11289
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11290
          <xsl:text>                            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11291
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11292
          <xsl:text>                            else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11293
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11294
          <xsl:text>                                field_list.push(field_match[1])
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11295
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11296
          <xsl:text>                            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11297
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11298
          <xsl:text>                            else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11299
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11300
          <xsl:text>                                throw new SyntaxError('[sprintf] failed to parse named argument key')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11301
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11302
          <xsl:text>                            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11303
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11304
          <xsl:text>                        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11305
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11306
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11307
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11308
          <xsl:text>                    else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11309
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11310
          <xsl:text>                        throw new SyntaxError('[sprintf] failed to parse named argument key')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11311
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11312
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11313
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11314
          <xsl:text>                    match[2] = field_list
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11315
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11316
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11317
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11318
          <xsl:text>                else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11319
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11320
          <xsl:text>                    arg_names |= 2
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11321
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11322
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11323
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11324
          <xsl:text>                if (arg_names === 3) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11325
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11326
          <xsl:text>                    throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11327
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11328
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11329
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11330
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11331
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11332
          <xsl:text>                parse_tree.push(
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11333
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11334
          <xsl:text>                    {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11335
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11336
          <xsl:text>                        placeholder: match[0],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11337
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11338
          <xsl:text>                        param_no:    match[1],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11339
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11340
          <xsl:text>                        keys:        match[2],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11341
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11342
          <xsl:text>                        sign:        match[3],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11343
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11344
          <xsl:text>                        pad_char:    match[4],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11345
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11346
          <xsl:text>                        align:       match[5],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11347
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11348
          <xsl:text>                        width:       match[6],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11349
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11350
          <xsl:text>                        precision:   match[7],
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11351
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11352
          <xsl:text>                        type:        match[8]
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11353
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11354
          <xsl:text>                    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11355
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11356
          <xsl:text>                )
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11357
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11358
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11359
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11360
          <xsl:text>            else {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11361
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11362
          <xsl:text>                throw new SyntaxError('[sprintf] unexpected placeholder')
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11363
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11364
          <xsl:text>            }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11365
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11366
          <xsl:text>            _fmt = _fmt.substring(match[0].length)
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11367
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11368
          <xsl:text>        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11369
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11370
          <xsl:text>        return sprintf_cache[fmt] = parse_tree
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11371
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11372
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11373
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11374
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11375
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11376
          <xsl:text>    /**
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11377
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11378
          <xsl:text>     * export to either browser or node.js
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11379
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11380
          <xsl:text>     */
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11381
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11382
          <xsl:text>    /* eslint-disable quote-props */
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11383
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11384
          <xsl:text>    if (typeof exports !== 'undefined') {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11385
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11386
          <xsl:text>        exports['sprintf'] = sprintf
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11387
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11388
          <xsl:text>        exports['vsprintf'] = vsprintf
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11389
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11390
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11391
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11392
          <xsl:text>    if (typeof window !== 'undefined') {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11393
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11394
          <xsl:text>        window['sprintf'] = sprintf
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11395
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11396
          <xsl:text>        window['vsprintf'] = vsprintf
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11397
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11398
          <xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11399
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11400
          <xsl:text>        if (typeof define === 'function' &amp;&amp; define['amd']) {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11401
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11402
          <xsl:text>            define(function() {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11403
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11404
          <xsl:text>                return {
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11405
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11406
          <xsl:text>                    'sprintf': sprintf,
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11407
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11408
          <xsl:text>                    'vsprintf': vsprintf
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11409
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11410
          <xsl:text>                }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11411
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11412
          <xsl:text>            })
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11413
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11414
          <xsl:text>        }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11415
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11416
          <xsl:text>    }
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11417
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11418
          <xsl:text>    /* eslint-enable quote-props */
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11419
</xsl:text>
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11420
          <xsl:text>}(); // eslint-disable-line    
abcdbef160e9 SVGHMI: Update generated xslt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3358
diff changeset
 11421
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11422
          <xsl:text>// svghmi.js
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11423
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11424
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11425
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11426
          <xsl:text>function dispatch_value(index, value) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11427
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11428
          <xsl:text>    let widgets = subscribers(index);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11429
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11430
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11431
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11432
          <xsl:text>    let oldval = cache[index];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11433
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11434
          <xsl:text>    cache[index] = value;
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11435
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11436
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11437
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11438
          <xsl:text>    if(widgets.size &gt; 0) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11439
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11440
          <xsl:text>        for(let widget of widgets){
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11441
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11442
          <xsl:text>            widget.new_hmi_value(index, value, oldval);
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11443
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11444
          <xsl:text>        }
3506
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11445
</xsl:text>
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11446
          <xsl:text>    }
ca312be56929 SVGHMI: update generated xslt.
Edouard Tisserant
parents: 3418
diff changeset
 11447
</xsl:text>
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11448
          <xsl:text>};
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11449
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11450
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11451
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11452
          <xsl:text>function init_widgets() {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11453
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11454
          <xsl:text>    Object.keys(hmi_widgets).forEach(function(id) {
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11455
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11456
          <xsl:text>        let widget = hmi_widgets[id];
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11457
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11458
          <xsl:text>        widget.do_init();
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11459
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11460
          <xsl:text>    });
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11461
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11462
          <xsl:text>};
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11463
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11464
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11465
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11466
          <xsl:text>// Open WebSocket to relative "/ws" address
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11467
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11468
          <xsl:text>var has_watchdog = window.location.hash == "#watchdog";
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11469
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11470
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 11471
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11472
          <xsl:text>const dvgetters = {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11473
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11474
          <xsl:text>    INT: (dv,offset) =&gt; [dv.getInt16(offset, true), 2],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11475
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11476
          <xsl:text>    BOOL: (dv,offset) =&gt; [dv.getInt8(offset, true), 1],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11477
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11478
          <xsl:text>    NODE: (dv,offset) =&gt; [dv.getInt8(offset, true), 1],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11479
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11480
          <xsl:text>    REAL: (dv,offset) =&gt; [dv.getFloat32(offset, true), 4],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11481
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11482
          <xsl:text>    STRING: (dv, offset) =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11483
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11484
          <xsl:text>        const size = dv.getInt8(offset);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11485
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11486
          <xsl:text>        return [
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11487
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11488
          <xsl:text>            String.fromCharCode.apply(null, new Uint8Array(
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11489
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11490
          <xsl:text>                dv.buffer, /* original buffer */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11491
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11492
          <xsl:text>                offset + 1, /* string starts after size*/
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11493
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11494
          <xsl:text>                size /* size of string */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11495
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11496
          <xsl:text>            )), size + 1]; /* total increment */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11497
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11498
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11499
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11500
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11501
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11502
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11503
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11504
          <xsl:text>// Called on requestAnimationFrame, modifies DOM
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11505
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11506
          <xsl:text>var requestAnimationFrameID = null;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11507
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11508
          <xsl:text>function animate() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11509
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11510
          <xsl:text>    let rearm = true;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11511
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11512
          <xsl:text>    do{
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11513
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11514
          <xsl:text>        if(page_fading == "pending" || page_fading == "forced"){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11515
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11516
          <xsl:text>            if(page_fading == "pending")
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11517
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11518
          <xsl:text>                svg_root.classList.add("fade-out-page");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11519
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11520
          <xsl:text>            page_fading = "in_progress";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11521
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11522
          <xsl:text>            if(page_fading_args.length)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11523
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11524
          <xsl:text>                setTimeout(function(){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11525
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11526
          <xsl:text>                    switch_page(...page_fading_args);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11527
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11528
          <xsl:text>                },1);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11529
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11530
          <xsl:text>            break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11531
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11532
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11533
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11534
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11535
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11536
          <xsl:text>        // Do the page swith if pending
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11537
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11538
          <xsl:text>        if(page_switch_in_progress){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11539
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11540
          <xsl:text>            if(current_subscribed_page != current_visible_page){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11541
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11542
          <xsl:text>                switch_visible_page(current_subscribed_page);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11543
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11544
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11545
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11546
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11547
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11548
          <xsl:text>            page_switch_in_progress = false;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11549
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11550
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11551
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11552
          <xsl:text>            if(page_fading == "in_progress"){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11553
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11554
          <xsl:text>                svg_root.classList.remove("fade-out-page");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11555
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11556
          <xsl:text>                page_fading = "off";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11557
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11558
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11559
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11560
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11561
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11562
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11563
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11564
          <xsl:text>        if(jumps_need_update) update_jumps();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11565
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11566
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11567
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11568
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11569
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11570
          <xsl:text>        pending_widget_animates.forEach(widget =&gt; widget._animate());
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11571
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11572
          <xsl:text>        pending_widget_animates = [];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11573
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11574
          <xsl:text>        rearm = false;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11575
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11576
          <xsl:text>    } while(0);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11577
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11578
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11579
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11580
          <xsl:text>    requestAnimationFrameID = null;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11581
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11582
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11583
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11584
          <xsl:text>    if(rearm) requestHMIAnimation();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11585
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11586
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11587
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11588
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11589
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11590
          <xsl:text>function requestHMIAnimation() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11591
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11592
          <xsl:text>    if(requestAnimationFrameID == null){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11593
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11594
          <xsl:text>        requestAnimationFrameID = window.requestAnimationFrame(animate);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11595
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11596
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11597
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11598
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11599
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11600
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11601
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11602
          <xsl:text>// Message reception handler
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11603
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11604
          <xsl:text>// Hash is verified and HMI values updates resulting from binary parsing
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11605
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11606
          <xsl:text>// are stored until browser can compute next frame, DOM is left untouched
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11607
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11608
          <xsl:text>function ws_onmessage(evt) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11609
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11610
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11611
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11612
          <xsl:text>    let data = evt.data;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11613
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11614
          <xsl:text>    let dv = new DataView(data);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11615
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11616
          <xsl:text>    let i = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11617
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11618
          <xsl:text>    try {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11619
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11620
          <xsl:text>        for(let hash_int of hmi_hash) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11621
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11622
          <xsl:text>            if(hash_int != dv.getUint8(i)){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11623
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11624
          <xsl:text>                throw new Error("Hash doesn't match");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11625
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11626
          <xsl:text>            };
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11627
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11628
          <xsl:text>            i++;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11629
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11630
          <xsl:text>        };
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11631
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11632
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11633
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11634
          <xsl:text>        while(i &lt; data.byteLength){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11635
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11636
          <xsl:text>            let index = dv.getUint32(i, true);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11637
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11638
          <xsl:text>            i += 4;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11639
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11640
          <xsl:text>            let iectype = hmitree_types[index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11641
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11642
          <xsl:text>            if(iectype != undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11643
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11644
          <xsl:text>                let dvgetter = dvgetters[iectype];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11645
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11646
          <xsl:text>                let [value, bytesize] = dvgetter(dv,i);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11647
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11648
          <xsl:text>                dispatch_value(index, value);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11649
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11650
          <xsl:text>                i += bytesize;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11651
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11652
          <xsl:text>            } else {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11653
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11654
          <xsl:text>                throw new Error("Unknown index "+index);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11655
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11656
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11657
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11658
          <xsl:text>        };
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11659
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11660
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11661
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11662
          <xsl:text>        // register for rendering on next frame, since there are updates
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11663
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11664
          <xsl:text>    } catch(err) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11665
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11666
          <xsl:text>        // 1003 is for "Unsupported Data"
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11667
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11668
          <xsl:text>        // ws.close(1003, err.message);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11669
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11670
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11671
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11672
          <xsl:text>        // TODO : remove debug alert ?
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11673
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11674
          <xsl:text>        alert("Error : "+err.message+"\nHMI will be reloaded.");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11675
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11676
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11677
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11678
          <xsl:text>        // force reload ignoring cache
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11679
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11680
          <xsl:text>        location.reload(true);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11681
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11682
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11683
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11684
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11685
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11686
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11687
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11688
          <xsl:text>hmi_hash_u8 = new Uint8Array(hmi_hash);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11689
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11690
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11691
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11692
          <xsl:text>var ws = null;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11693
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11694
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11695
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11696
          <xsl:text>function send_blob(data) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11697
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11698
          <xsl:text>    if(ws &amp;&amp; data.length &gt; 0) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11699
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11700
          <xsl:text>        ws.send(new Blob([hmi_hash_u8].concat(data)));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11701
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11702
          <xsl:text>    };
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11703
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11704
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11705
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11706
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11707
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11708
          <xsl:text>const typedarray_types = {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11709
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11710
          <xsl:text>    INT: (number) =&gt; new Int16Array([number]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11711
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11712
          <xsl:text>    BOOL: (truth) =&gt; new Int8Array([truth]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11713
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11714
          <xsl:text>    NODE: (truth) =&gt; new Int8Array([truth]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11715
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11716
          <xsl:text>    REAL: (number) =&gt; new Float32Array([number]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11717
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11718
          <xsl:text>    STRING: (str) =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11719
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11720
          <xsl:text>        // beremiz default string max size is 128
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11721
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11722
          <xsl:text>        str = str.slice(0,128);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11723
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11724
          <xsl:text>        binary = new Uint8Array(str.length + 1);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11725
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11726
          <xsl:text>        binary[0] = str.length;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11727
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11728
          <xsl:text>        for(let i = 0; i &lt; str.length; i++){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11729
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11730
          <xsl:text>            binary[i+1] = str.charCodeAt(i);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11731
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11732
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11733
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11734
          <xsl:text>        return binary;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11735
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11736
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11737
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11738
          <xsl:text>    /* TODO */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11739
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11740
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11741
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11742
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11743
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11744
          <xsl:text>function send_reset() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11745
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11746
          <xsl:text>    send_blob(new Uint8Array([1])); /* reset = 1 */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11747
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11748
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11749
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11750
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11751
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11752
          <xsl:text>var subscriptions = [];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11753
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11754
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11755
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11756
          <xsl:text>function subscribers(index) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11757
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11758
          <xsl:text>    let entry = subscriptions[index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11759
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11760
          <xsl:text>    let res;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11761
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11762
          <xsl:text>    if(entry == undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11763
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11764
          <xsl:text>        res = new Set();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11765
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11766
          <xsl:text>        subscriptions[index] = [res,0];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11767
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11768
          <xsl:text>    }else{
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11769
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11770
          <xsl:text>        [res, _ign] = entry;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11771
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11772
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11773
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11774
          <xsl:text>    return res
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11775
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11776
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11777
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11778
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11779
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11780
          <xsl:text>function get_subscription_period(index) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11781
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11782
          <xsl:text>    let entry = subscriptions[index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11783
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11784
          <xsl:text>    if(entry == undefined)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11785
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11786
          <xsl:text>        return 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11787
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11788
          <xsl:text>    let [_ign, period] = entry;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11789
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11790
          <xsl:text>    return period;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11791
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11792
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11793
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11794
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11795
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11796
          <xsl:text>function set_subscription_period(index, period) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11797
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11798
          <xsl:text>    let entry = subscriptions[index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11799
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11800
          <xsl:text>    if(entry == undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11801
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11802
          <xsl:text>        subscriptions[index] = [new Set(), period];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11803
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11804
          <xsl:text>    } else {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11805
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11806
          <xsl:text>        entry[1] = period;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11807
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11808
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11809
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11810
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11811
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11812
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11813
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11814
          <xsl:text>function reset_subscription_periods() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11815
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11816
          <xsl:text>    for(let index in subscriptions)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11817
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11818
          <xsl:text>        subscriptions[index][1] = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11819
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11820
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11821
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11822
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11823
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11824
          <xsl:text>if(has_watchdog){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11825
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11826
          <xsl:text>    // artificially subscribe the watchdog widget to "/heartbeat" hmi variable
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11827
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11828
          <xsl:text>    // Since dispatch directly calls change_hmi_value,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11829
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11830
          <xsl:text>    // PLC will periodically send variable at given frequency
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11831
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11832
          <xsl:text>    subscribers(heartbeat_index).add({
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11833
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11834
          <xsl:text>        /* type: "Watchdog", */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11835
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11836
          <xsl:text>        frequency: 1,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11837
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11838
          <xsl:text>        indexes: [heartbeat_index],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11839
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11840
          <xsl:text>        new_hmi_value: function(index, value, oldval) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11841
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11842
          <xsl:text>            apply_hmi_value(heartbeat_index, value+1);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11843
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11844
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11845
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11846
          <xsl:text>    });
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11847
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11848
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11849
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11850
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11851
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11852
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11853
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11854
          <xsl:text>var page_fading = "off";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11855
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11856
          <xsl:text>var page_fading_args = "off";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11857
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11858
          <xsl:text>function fading_page_switch(...args){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11859
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11860
          <xsl:text>    if(page_fading == "in_progress")
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11861
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11862
          <xsl:text>        page_fading = "forced";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11863
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11864
          <xsl:text>    else
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11865
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11866
          <xsl:text>        page_fading = "pending";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11867
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11868
          <xsl:text>    page_fading_args = args;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11869
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11870
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11871
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11872
          <xsl:text>    requestHMIAnimation();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11873
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11874
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11875
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11876
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11877
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11878
          <xsl:text>document.body.style.backgroundColor = "black";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11879
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11880
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11881
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11882
          <xsl:text>// subscribe to per instance current page hmi variable
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11883
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11884
          <xsl:text>// PLC must prefix page name with "!" for page switch to happen
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11885
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11886
          <xsl:text>subscribers(current_page_var_index).add({
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11887
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11888
          <xsl:text>    frequency: 1,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11889
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11890
          <xsl:text>    indexes: [current_page_var_index],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11891
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11892
          <xsl:text>    new_hmi_value: function(index, value, oldval) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11893
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11894
          <xsl:text>        if(value.startsWith("!"))
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11895
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11896
          <xsl:text>            fading_page_switch(value.slice(1));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11897
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11898
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11899
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11900
          <xsl:text>});
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11901
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11902
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11903
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11904
          <xsl:text>function svg_text_to_multiline(elt) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11905
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11906
          <xsl:text>    return(Array.prototype.map.call(elt.children, x=&gt;x.textContent).join("\n")); 
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11907
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11908
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11909
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11910
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11911
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11912
          <xsl:text>function multiline_to_svg_text(elt, str, blank) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11913
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11914
          <xsl:text>    str.split('\n').map((line,i) =&gt; {elt.children[i].textContent = blank?"":line;});
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11915
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11916
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11917
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11918
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11919
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11920
          <xsl:text>function switch_langnum(langnum) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11921
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11922
          <xsl:text>    langnum = Math.max(0, Math.min(langs.length - 1, langnum));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11923
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11924
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11925
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11926
          <xsl:text>    for (let translation of translations) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11927
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11928
          <xsl:text>        let [objs, msgs] = translation;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11929
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11930
          <xsl:text>        let msg = msgs[langnum];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11931
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11932
          <xsl:text>        for (let obj of objs) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11933
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11934
          <xsl:text>            multiline_to_svg_text(obj, msg);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11935
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11936
          <xsl:text>            obj.setAttribute("lang",langnum);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11937
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11938
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11939
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11940
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11941
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11942
          <xsl:text>    return langnum;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11943
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11944
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11945
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11946
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11947
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11948
          <xsl:text>// backup original texts
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11949
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11950
          <xsl:text>for (let translation of translations) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11951
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11952
          <xsl:text>    let [objs, msgs] = translation;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11953
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11954
          <xsl:text>    msgs.unshift(svg_text_to_multiline(objs[0])); 
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11955
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11956
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11957
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11958
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11959
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11960
          <xsl:text>var lang_local_index = hmi_local_index("lang");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11961
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11962
          <xsl:text>var langcode_local_index = hmi_local_index("lang_code");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11963
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11964
          <xsl:text>var langname_local_index = hmi_local_index("lang_name");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11965
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11966
          <xsl:text>subscribers(lang_local_index).add({
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11967
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11968
          <xsl:text>    indexes: [lang_local_index],
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11969
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11970
          <xsl:text>    new_hmi_value: function(index, value, oldval) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11971
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11972
          <xsl:text>        let current_lang =  switch_langnum(value);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11973
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11974
          <xsl:text>        let [langname,langcode] = langs[current_lang];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11975
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11976
          <xsl:text>        apply_hmi_value(langcode_local_index, langcode);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11977
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11978
          <xsl:text>        apply_hmi_value(langname_local_index, langname);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11979
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11980
          <xsl:text>        switch_page();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11981
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11982
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11983
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11984
          <xsl:text>});
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11985
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11986
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11987
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11988
          <xsl:text>// returns en_US, fr_FR or en_UK depending on selected language
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11989
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11990
          <xsl:text>function get_current_lang_code(){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11991
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11992
          <xsl:text>    return cache[langcode_local_index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11993
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11994
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11995
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11996
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11997
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11998
          <xsl:text>function setup_lang(){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 11999
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12000
          <xsl:text>    let current_lang = cache[lang_local_index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12001
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12002
          <xsl:text>    let new_lang = switch_langnum(current_lang);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12003
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12004
          <xsl:text>    if(current_lang != new_lang){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12005
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12006
          <xsl:text>        apply_hmi_value(lang_local_index, new_lang);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12007
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12008
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12009
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12010
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12011
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12012
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12013
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12014
          <xsl:text>setup_lang();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12015
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12016
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12017
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12018
          <xsl:text>function update_subscriptions() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12019
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12020
          <xsl:text>    let delta = [];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12021
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12022
          <xsl:text>    if(!ws)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12023
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12024
          <xsl:text>        // dont' change subscriptions if not connected
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12025
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12026
          <xsl:text>        return;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12027
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12028
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12029
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12030
          <xsl:text>    for(let index in subscriptions){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12031
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12032
          <xsl:text>        let widgets = subscribers(index);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12033
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12034
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12035
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12036
          <xsl:text>        // periods are in ms
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12037
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12038
          <xsl:text>        let previous_period = get_subscription_period(index);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12039
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12040
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12041
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12042
          <xsl:text>        // subscribing with a zero period is unsubscribing
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12043
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12044
          <xsl:text>        let new_period = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12045
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12046
          <xsl:text>        if(widgets.size &gt; 0) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12047
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12048
          <xsl:text>            let maxfreq = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12049
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12050
          <xsl:text>            for(let widget of widgets){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12051
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12052
          <xsl:text>                let wf = widget.frequency;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12053
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12054
          <xsl:text>                if(wf != undefined &amp;&amp; maxfreq &lt; wf)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12055
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12056
          <xsl:text>                    maxfreq = wf;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12057
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12058
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12059
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12060
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12061
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12062
          <xsl:text>            if(maxfreq != 0)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12063
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12064
          <xsl:text>                new_period = 1000/maxfreq;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12065
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12066
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12067
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12068
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12069
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12070
          <xsl:text>        if(previous_period != new_period) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12071
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12072
          <xsl:text>            set_subscription_period(index, new_period);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12073
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12074
          <xsl:text>            if(index &lt;= last_remote_index){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12075
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12076
          <xsl:text>                delta.push(
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12077
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12078
          <xsl:text>                    new Uint8Array([2]), /* subscribe = 2 */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12079
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12080
          <xsl:text>                    new Uint32Array([index]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12081
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12082
          <xsl:text>                    new Uint16Array([new_period]));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12083
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12084
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12085
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12086
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12087
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12088
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12089
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12090
          <xsl:text>    send_blob(delta);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12091
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12092
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12093
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12094
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12095
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12096
          <xsl:text>function send_hmi_value(index, value) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12097
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12098
          <xsl:text>    if(index &gt; last_remote_index){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12099
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12100
          <xsl:text>        dispatch_value(index, value);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12101
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12102
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12103
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12104
          <xsl:text>        if(persistent_indexes.has(index)){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12105
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12106
          <xsl:text>            let varname = persistent_indexes.get(index);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12107
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12108
          <xsl:text>            document.cookie = varname+"="+value+"; max-age=3153600000";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12109
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12110
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12111
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12112
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12113
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12114
          <xsl:text>        return;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12115
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12116
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12117
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12118
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12119
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12120
          <xsl:text>    let iectype = hmitree_types[index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12121
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12122
          <xsl:text>    let tobinary = typedarray_types[iectype];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12123
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12124
          <xsl:text>    send_blob([
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12125
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12126
          <xsl:text>        new Uint8Array([0]),  /* setval = 0 */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12127
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12128
          <xsl:text>        new Uint32Array([index]),
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12129
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12130
          <xsl:text>        tobinary(value)]);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12131
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12132
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12133
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12134
          <xsl:text>    // DON'T DO THAT unless read_iterator in svghmi.c modifies wbuf as well, not only rbuf
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12135
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12136
          <xsl:text>    // cache[index] = value;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12137
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12138
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12139
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12140
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12141
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12142
          <xsl:text>function apply_hmi_value(index, new_val) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12143
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12144
          <xsl:text>    // Similarly to previous comment, taking decision to update based 
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12145
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12146
          <xsl:text>    // on cache content is bad and can lead to inconsistency
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12147
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12148
          <xsl:text>    /*let old_val = cache[index];*/
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12149
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12150
          <xsl:text>    if(new_val != undefined /*&amp;&amp; old_val != new_val*/)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12151
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12152
          <xsl:text>        send_hmi_value(index, new_val);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12153
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12154
          <xsl:text>    return new_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12155
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12156
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12157
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12158
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12159
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12160
          <xsl:text>const quotes = {"'":null, '"':null};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12161
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12162
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12163
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12164
          <xsl:text>function eval_operation_string(old_val, opstr) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12165
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12166
          <xsl:text>    let op = opstr[0];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12167
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12168
          <xsl:text>    let given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12169
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12170
          <xsl:text>    if(opstr.length &lt; 2) 
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12171
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12172
          <xsl:text>        return undefined;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12173
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12174
          <xsl:text>    if(opstr[1] in quotes){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12175
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12176
          <xsl:text>        if(opstr.length &lt; 3) 
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12177
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12178
          <xsl:text>            return undefined;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12179
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12180
          <xsl:text>        if(opstr[opstr.length-1] == opstr[1]){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12181
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12182
          <xsl:text>            given_val = opstr.slice(2,opstr.length-1);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12183
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12184
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12185
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12186
          <xsl:text>    } else {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12187
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12188
          <xsl:text>        given_val = Number(opstr.slice(1));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12189
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12190
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12191
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12192
          <xsl:text>    let new_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12193
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12194
          <xsl:text>    switch(op){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12195
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12196
          <xsl:text>      case "=":
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12197
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12198
          <xsl:text>        new_val = given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12199
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12200
          <xsl:text>        break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12201
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12202
          <xsl:text>      case "+":
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12203
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12204
          <xsl:text>        new_val = old_val + given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12205
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12206
          <xsl:text>        break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12207
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12208
          <xsl:text>      case "-":
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12209
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12210
          <xsl:text>        new_val = old_val - given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12211
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12212
          <xsl:text>        break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12213
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12214
          <xsl:text>      case "*":
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12215
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12216
          <xsl:text>        new_val = old_val * given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12217
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12218
          <xsl:text>        break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12219
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12220
          <xsl:text>      case "/":
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12221
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12222
          <xsl:text>        new_val = old_val / given_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12223
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12224
          <xsl:text>        break;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12225
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12226
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12227
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12228
          <xsl:text>    return new_val;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12229
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12230
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12231
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12232
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12233
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12234
          <xsl:text>var current_visible_page;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12235
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12236
          <xsl:text>var current_subscribed_page;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12237
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12238
          <xsl:text>var current_page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12239
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12240
          <xsl:text>var page_node_local_index = hmi_local_index("page_node");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12241
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12242
          <xsl:text>var page_switch_in_progress = false;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12243
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12244
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12245
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12246
          <xsl:text>function toggleFullscreen() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12247
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12248
          <xsl:text>  let elem = document.documentElement;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12249
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12250
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12251
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12252
          <xsl:text>  if (!document.fullscreenElement) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12253
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12254
          <xsl:text>    elem.requestFullscreen().catch(err =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12255
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12256
          <xsl:text>      console.log("Error attempting to enable full-screen mode: "+err.message+" ("+err.name+")");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12257
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12258
          <xsl:text>    });
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12259
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12260
          <xsl:text>  } else {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12261
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12262
          <xsl:text>    document.exitFullscreen();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12263
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12264
          <xsl:text>  }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12265
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12266
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12267
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12268
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12269
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12270
          <xsl:text>// prevents context menu from appearing on right click and long touch
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12271
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12272
          <xsl:text>document.body.addEventListener('contextmenu', e =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12273
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12274
          <xsl:text>    toggleFullscreen();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12275
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12276
          <xsl:text>    e.preventDefault();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12277
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12278
          <xsl:text>});
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12279
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12280
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12281
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12282
          <xsl:text>if(screensaver_delay){
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12283
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12284
          <xsl:text>    var screensaver_timer = null;
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12285
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12286
          <xsl:text>    function reset_screensaver_timer() {
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12287
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12288
          <xsl:text>        if(screensaver_timer){
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12289
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12290
          <xsl:text>            window.clearTimeout(screensaver_timer);
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12291
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12292
          <xsl:text>        }
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12293
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12294
          <xsl:text>        screensaver_timer = window.setTimeout(() =&gt; {
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12295
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12296
          <xsl:text>            switch_page("ScreenSaver");
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12297
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12298
          <xsl:text>            screensaver_timer = null;
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12299
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12300
          <xsl:text>        }, screensaver_delay*1000);
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12301
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12302
          <xsl:text>    }
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12303
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12304
          <xsl:text>    document.body.addEventListener('pointerdown', reset_screensaver_timer);
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12305
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12306
          <xsl:text>    // initialize screensaver
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12307
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12308
          <xsl:text>    reset_screensaver_timer();
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12309
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12310
          <xsl:text>}
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12311
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12312
          <xsl:text>
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12313
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12314
          <xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12315
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12316
          <xsl:text>function detach_detachables() {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12317
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12318
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12319
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12320
          <xsl:text>    for(let eltid in detachable_elements){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12321
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12322
          <xsl:text>        let [element,parent] = detachable_elements[eltid];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12323
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12324
          <xsl:text>        parent.removeChild(element);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12325
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12326
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12327
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12328
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12329
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12330
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12331
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12332
          <xsl:text>function switch_page(page_name, page_index) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12333
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12334
          <xsl:text>    if(page_switch_in_progress){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12335
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12336
          <xsl:text>        /* page switch already going */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12337
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12338
          <xsl:text>        /* TODO LOG ERROR */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12339
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12340
          <xsl:text>        return false;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12341
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12342
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12343
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12344
          <xsl:text>    page_switch_in_progress = true;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12345
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12346
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12347
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12348
          <xsl:text>    if(page_name == undefined)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12349
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12350
          <xsl:text>        page_name = current_subscribed_page;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12351
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12352
          <xsl:text>    else if(page_index == undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12353
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12354
          <xsl:text>        [page_name, page_index] = page_name.split('@')
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12355
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12356
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12357
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12358
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12359
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12360
          <xsl:text>    let old_desc = page_desc[current_subscribed_page];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12361
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12362
          <xsl:text>    let new_desc = page_desc[page_name];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12363
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12364
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12365
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12366
          <xsl:text>    if(new_desc == undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12367
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12368
          <xsl:text>        /* TODO LOG ERROR */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12369
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12370
          <xsl:text>        return false;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12371
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12372
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12373
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12374
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12375
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12376
          <xsl:text>    if(page_index == undefined)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12377
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12378
          <xsl:text>        page_index = new_desc.page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12379
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12380
          <xsl:text>    else if(typeof(page_index) == "string") {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12381
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12382
          <xsl:text>        let hmitree_node = hmitree_nodes[page_index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12383
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12384
          <xsl:text>        if(hmitree_node !== undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12385
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12386
          <xsl:text>            let [int_index, hmiclass] = hmitree_node;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12387
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12388
          <xsl:text>            if(hmiclass == new_desc.page_class)
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12389
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12390
          <xsl:text>                page_index = int_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12391
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12392
          <xsl:text>            else
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12393
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12394
          <xsl:text>                page_index = new_desc.page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12395
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12396
          <xsl:text>        } else {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12397
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12398
          <xsl:text>            page_index = new_desc.page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12399
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12400
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12401
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12402
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12403
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12404
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12405
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12406
          <xsl:text>    if(old_desc){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12407
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12408
          <xsl:text>        old_desc.widgets.map(([widget,relativeness])=&gt;widget.unsub());
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12409
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12410
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12411
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12412
          <xsl:text>    const new_offset = page_index == undefined ? 0 : page_index - new_desc.page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12413
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12414
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12415
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12416
          <xsl:text>    const container_id = page_name + (page_index != undefined ? page_index : "");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12417
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12418
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12419
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12420
          <xsl:text>    new_desc.widgets.map(([widget,relativeness])=&gt;widget.sub(new_offset,relativeness,container_id));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12421
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12422
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12423
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12424
          <xsl:text>    update_subscriptions();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12425
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12426
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12427
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12428
          <xsl:text>    current_subscribed_page = page_name;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12429
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12430
          <xsl:text>    current_page_index = page_index;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12431
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12432
          <xsl:text>    let page_node;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12433
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12434
          <xsl:text>    if(page_index != undefined){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12435
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12436
          <xsl:text>        page_node = hmitree_paths[page_index];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12437
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12438
          <xsl:text>    }else{
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12439
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12440
          <xsl:text>        page_node = "";
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12441
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12442
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12443
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12444
          <xsl:text>    apply_hmi_value(page_node_local_index, page_node);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12445
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12446
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12447
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12448
          <xsl:text>    jumps_need_update = true;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12449
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12450
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12451
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12452
          <xsl:text>    requestHMIAnimation();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12453
</xsl:text>
3656
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12454
          <xsl:text>    let [last_page_name, last_page_index] = jump_history[jump_history.length-1];
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12455
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12456
          <xsl:text>    if(last_page_name != page_name || last_page_index != page_index){
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12457
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12458
          <xsl:text>        jump_history.push([page_name, page_index]);
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12459
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12460
          <xsl:text>        if(jump_history.length &gt; 42)
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12461
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12462
          <xsl:text>            jump_history.shift();
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12463
</xsl:text>
efbc86949467 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3651
diff changeset
 12464
          <xsl:text>    }
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12465
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12466
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12467
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12468
          <xsl:text>    apply_hmi_value(current_page_var_index, page_index == undefined
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12469
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12470
          <xsl:text>        ? page_name
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12471
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12472
          <xsl:text>        : page_name + "@" + hmitree_paths[page_index]);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12473
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12474
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12475
</xsl:text>
3687
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12476
          <xsl:text>    // when entering a page, assignments are evaluated
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12477
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12478
          <xsl:text>    new_desc.widgets[0][0].assign();
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12479
</xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12480
          <xsl:text>
747ffdafbe31 SVGHMI: update generated xslt
Edouard Tisserant
parents: 3684
diff changeset
 12481
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12482
          <xsl:text>    return true;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12483
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12484
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12485
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12486
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12487
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12488
          <xsl:text>function switch_visible_page(page_name) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12489
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12490
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12491
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12492
          <xsl:text>    let old_desc = page_desc[current_visible_page];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12493
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12494
          <xsl:text>    let new_desc = page_desc[page_name];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12495
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12496
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12497
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12498
          <xsl:text>    if(old_desc){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12499
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12500
          <xsl:text>        for(let eltid in old_desc.required_detachables){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12501
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12502
          <xsl:text>            if(!(eltid in new_desc.required_detachables)){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12503
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12504
          <xsl:text>                let [element, parent] = old_desc.required_detachables[eltid];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12505
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12506
          <xsl:text>                parent.removeChild(element);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12507
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12508
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12509
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12510
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12511
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12512
          <xsl:text>        for(let eltid in new_desc.required_detachables){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12513
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12514
          <xsl:text>            if(!(eltid in old_desc.required_detachables)){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12515
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12516
          <xsl:text>                let [element, parent] = new_desc.required_detachables[eltid];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12517
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12518
          <xsl:text>                parent.appendChild(element);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12519
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12520
          <xsl:text>            }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12521
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12522
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12523
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12524
          <xsl:text>    }else{
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12525
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12526
          <xsl:text>        for(let eltid in new_desc.required_detachables){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12527
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12528
          <xsl:text>            let [element, parent] = new_desc.required_detachables[eltid];
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12529
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12530
          <xsl:text>            parent.appendChild(element);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12531
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12532
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12533
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12534
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12535
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12536
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12537
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12538
          <xsl:text>    svg_root.setAttribute('viewBox',new_desc.bbox.join(" "));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12539
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12540
          <xsl:text>    current_visible_page = page_name;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12541
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12542
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12543
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12544
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12545
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12546
          <xsl:text>/* From https://jsfiddle.net/ibowankenobi/1mmh7rs6/6/ */
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12547
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12548
          <xsl:text>function getAbsoluteCTM(element){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12549
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12550
          <xsl:text>	var height = svg_root.height.baseVal.value,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12551
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12552
          <xsl:text>		width = svg_root.width.baseVal.value,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12553
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12554
          <xsl:text>		viewBoxRect = svg_root.viewBox.baseVal,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12555
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12556
          <xsl:text>		vHeight = viewBoxRect.height,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12557
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12558
          <xsl:text>		vWidth = viewBoxRect.width;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12559
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12560
          <xsl:text>	if(!vWidth || !vHeight){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12561
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12562
          <xsl:text>		return element.getCTM();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12563
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12564
          <xsl:text>	}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12565
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12566
          <xsl:text>	var sH = height/vHeight,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12567
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12568
          <xsl:text>		sW = width/vWidth,
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12569
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12570
          <xsl:text>		matrix = svg_root.createSVGMatrix();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12571
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12572
          <xsl:text>	matrix.a = sW;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12573
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12574
          <xsl:text>	matrix.d = sH
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12575
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12576
          <xsl:text>	var realCTM = element.getCTM().multiply(matrix.inverse());
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12577
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12578
          <xsl:text>	realCTM.e = realCTM.e/sW + viewBoxRect.x;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12579
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12580
          <xsl:text>	realCTM.f = realCTM.f/sH + viewBoxRect.y;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12581
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12582
          <xsl:text>	return realCTM;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12583
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12584
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12585
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12586
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12587
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12588
          <xsl:text>function apply_reference_frames(){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12589
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12590
          <xsl:text>    const matches = svg_root.querySelectorAll("g[svghmi_x_offset]");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12591
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12592
          <xsl:text>    matches.forEach((group) =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12593
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12594
          <xsl:text>        let [x,y] = ["x", "y"].map((axis) =&gt; Number(group.getAttribute("svghmi_"+axis+"_offset")));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12595
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12596
          <xsl:text>        let ctm = getAbsoluteCTM(group);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12597
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12598
          <xsl:text>        // zero translation part of CTM
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12599
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12600
          <xsl:text>        // to only apply rotation/skewing to offset vector
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12601
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12602
          <xsl:text>        ctm.e = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12603
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12604
          <xsl:text>        ctm.f = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12605
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12606
          <xsl:text>        let invctm = ctm.inverse();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12607
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12608
          <xsl:text>        let vect = new DOMPoint(x, y);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12609
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12610
          <xsl:text>        let newvect = vect.matrixTransform(invctm);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12611
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12612
          <xsl:text>        let transform = svg_root.createSVGTransform();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12613
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12614
          <xsl:text>        transform.setTranslate(newvect.x, newvect.y);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12615
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12616
          <xsl:text>        group.transform.baseVal.appendItem(transform);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12617
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12618
          <xsl:text>        ["x", "y"].forEach((axis) =&gt; group.removeAttribute("svghmi_"+axis+"_offset"));
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12619
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12620
          <xsl:text>    });
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12621
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12622
          <xsl:text>}
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12623
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12624
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12625
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12626
          <xsl:text>// prepare SVG
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12627
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12628
          <xsl:text>apply_reference_frames();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12629
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12630
          <xsl:text>init_widgets();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12631
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12632
          <xsl:text>detach_detachables();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12633
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12634
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12635
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12636
          <xsl:text>// show main page
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12637
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12638
          <xsl:text>switch_page(default_page);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12639
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12640
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12641
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12642
          <xsl:text>var reconnect_delay = 0;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12643
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12644
          <xsl:text>var periodic_reconnect_timer;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12645
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12646
          <xsl:text>var force_reconnect = false;
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12647
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12648
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12649
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12650
          <xsl:text>// Once connection established
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12651
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12652
          <xsl:text>function ws_onopen(evt) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12653
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12654
          <xsl:text>    // Work around memory leak with websocket on QtWebEngine
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12655
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12656
          <xsl:text>    // reconnect every hour to force deallocate websocket garbage
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12657
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12658
          <xsl:text>    if(window.navigator.userAgent.includes("QtWebEngine")){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12659
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12660
          <xsl:text>        if(periodic_reconnect_timer){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12661
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12662
          <xsl:text>            window.clearTimeout(periodic_reconnect_timer);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12663
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12664
          <xsl:text>        }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12665
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12666
          <xsl:text>        periodic_reconnect_timer = window.setTimeout(() =&gt; {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12667
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12668
          <xsl:text>            force_reconnect = true;
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12669
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12670
          <xsl:text>            ws.close();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12671
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12672
          <xsl:text>            periodic_reconnect_timer = null;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12673
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12674
          <xsl:text>        }, 3600000);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12675
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12676
          <xsl:text>    }
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12677
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12678
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12679
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12680
          <xsl:text>    // forget earlier subscriptions locally
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12681
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12682
          <xsl:text>    reset_subscription_periods();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12683
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12684
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12685
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12686
          <xsl:text>    // update PLC about subscriptions and current page
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12687
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12688
          <xsl:text>    switch_page();
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12689
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12690
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12691
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12692
          <xsl:text>    // at first try reconnect immediately
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12693
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12694
          <xsl:text>    reconnect_delay = 1;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12695
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12696
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12697
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12698
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12699
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12700
          <xsl:text>function ws_onclose(evt) {
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12701
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12702
          <xsl:text>    console.log("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+" Reload in "+reconnect_delay+"ms.");
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12703
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12704
          <xsl:text>    ws = null;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12705
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12706
          <xsl:text>    // Do not attempt to reconnect immediately in case:
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12707
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12708
          <xsl:text>    //    - connection was closed by server (PLC stop)
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12709
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12710
          <xsl:text>    //    - connection was closed locally with an intention to reconnect
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12711
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12712
          <xsl:text>    if(evt.code=1000 &amp;&amp; !force_reconnect){
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12713
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12714
          <xsl:text>        window.alert("Connection closed by server");
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12715
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12716
          <xsl:text>        location.reload();
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12717
</xsl:text>
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12718
          <xsl:text>    }
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12719
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12720
          <xsl:text>    window.setTimeout(create_ws, reconnect_delay);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12721
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12722
          <xsl:text>    reconnect_delay += 500;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12723
</xsl:text>
3684
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12724
          <xsl:text>    force_reconnect = false;
2239f8e3de48 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3663
diff changeset
 12725
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12726
          <xsl:text>};
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12727
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12728
          <xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12729
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12730
          <xsl:text>var ws_url =
3621
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12731
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12732
          <xsl:text>    window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws')
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12733
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12734
          <xsl:text>    + '?mode=' + (has_watchdog ? "watchdog" : "multiclient");
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12735
</xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12736
          <xsl:text>
da020d88db0c SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3557
diff changeset
 12737
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12738
          <xsl:text>function create_ws(){
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12739
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12740
          <xsl:text>    ws = new WebSocket(ws_url);
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12741
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12742
          <xsl:text>    ws.binaryType = 'arraybuffer';
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12743
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12744
          <xsl:text>    ws.onmessage = ws_onmessage;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12745
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12746
          <xsl:text>    ws.onclose = ws_onclose;
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12747
</xsl:text>
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12748
          <xsl:text>    ws.onopen = ws_onopen;
3629
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
 12749
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
 12750
          <xsl:text>}
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
 12751
</xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
 12752
          <xsl:text>
f117526d41ba SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3621
diff changeset
 12753
</xsl:text>
3651
e3a29c5b74c4 SVGHMI: update generated XSLT
Edouard Tisserant
parents: 3629
diff changeset
 12754
          <xsl:text>create_ws()
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
 12755
</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
 12756
          <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
 12757
</xsl:text>
3080
e5fa1f49f0b9 SVGHMI: WIP trying to reduce memory usage : use .onclick onstead of SetAttribute, avoid useless closure and object creation when possible, etc.
Edouard Tisserant
parents: 3079
diff changeset
 12758
          <xsl:text>const xmlns = "http://www.w3.org/2000/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
 12759
</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
 12760
          <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
 12761
</xsl:text>
3079
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12762
          <xsl:text>const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null}
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12763
</xsl:text>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
 12764
          <xsl:text>function edit_value(path, valuetype, callback, initial) {
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
 12765
</xsl:text>
3079
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12766
          <xsl:text>    if(valuetype in localtypes){
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12767
</xsl:text>
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12768
          <xsl:text>        valuetype = (typeof initial) == "number" ? "HMI_REAL" : "HMI_STRING";
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12769
</xsl:text>
1021c6c74dde SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3069
diff changeset
 12770
          <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
 12771
</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
 12772
          <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
 12773
</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
 12774
          <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
 12775
</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
 12776
          <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
 12777
</xsl:text>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
 12778
          <xsl:text>    widget.start_edit(path, valuetype, callback, initial);
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
 12779
</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
 12780
          <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
 12781
</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
 12782
          <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
 12783
</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
 12784
          <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
 12785
</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
 12786
          <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
 12787
</xsl:text>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
 12788
          <xsl:text>function show_modal() {
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
 12789
</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
 12790
          <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
 12791
</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
 12792
          <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
 12793
</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
 12794
          <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
 12795
</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
 12796
          <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
 12797
</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
 12798
          <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
 12799
</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
 12800
          <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
 12801
</xsl:text>
3118
e704b0487515 SVGHMI : removed support for changing keyboard position and showing at user defined location. Feature was problematic in many respect.
Edouard Tisserant
parents: 3116
diff changeset
 12802
          <xsl:text>    tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")";
3015
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
 12803
</xsl:text>
bd0b120cf277 Rebuilded gen_index_html.xslt after all new widgets were commited
usveticic
parents: 3004
diff changeset
 12804
          <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
 12805
</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
 12806
          <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
 12807
</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
 12808
          <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
 12809
</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
 12810
          <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
 12811
</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
 12812
          <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
 12813
</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
 12814
          <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
 12815
</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
 12816
          <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
 12817
</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
 12818
          <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
 12819
</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
 12820
          <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
 12821
</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
 12822
          <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
 12823
</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
 12824
          <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
 12825
</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
 12826
          <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
 12827
</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
 12828
          <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
 12829
</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
 12830
          <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
 12831
</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
 12832
          <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
 12833
</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
 12834
          <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
 12835
</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
 12836
          <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
 12837
</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
 12838
          <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
 12839
</xsl:text>
3557
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12840
          <xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12841
//
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12842
//
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12843
// Declarations from SVG scripts (inkscape document properties) 
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12844
//
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12845
//
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12846
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12847
          <xsl:for-each select="/svg:svg/svg:script">
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12848
            <xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12849
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12850
            <xsl:text>/* </xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12851
            <xsl:value-of select="@id"/>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12852
            <xsl:text> */
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12853
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12854
            <xsl:value-of select="text()"/>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12855
            <xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12856
</xsl:text>
59158e360b8c SVGHMI: update generated xslt file
Edouard Tisserant
parents: 3554
diff changeset
 12857
          </xsl:for-each>
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
 12858
        </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
 12859
      </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
 12860
    </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
 12861
  </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
 12862
</xsl:stylesheet>