author | Edouard Tisserant |
Tue, 29 Oct 2019 09:10:10 +0100 | |
branch | svghmi |
changeset 2809 | b9c540253263 |
parent 2808 | dc78ffa5253d |
child 2810 | 63b9a37b73c7 |
permissions | -rw-r--r-- |
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"?> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
2 |
<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func" version="1.0" exclude-result-prefixes="ns str regexp exsl func"> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
3 |
<xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
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
|
4 |
<xsl:variable name="geometry" select="ns:GetSVGGeometry()"/> |
2763
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
5 |
<xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
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
|
6 |
<xsl:variable name="svg_root_id" select="/svg:svg/@id"/> |
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
|
7 |
<xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
8 |
<xsl:variable name="hmi_geometry" select="$geometry[@Id = $hmi_elements/@id]"/> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
9 |
<xsl:variable name="hmi_pages" select="$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']"/> |
2795 | 10 |
<xsl:variable name="default_page"> |
11 |
<xsl:choose> |
|
12 |
<xsl:when test="count($hmi_pages) > 1"> |
|
13 |
<xsl:variable name="Home_page" select="$hmi_pages[func:parselabel(@inkscape:label)/widget/arg[1]/@value = 'Home']"/> |
|
14 |
<xsl:choose> |
|
15 |
<xsl:when test="$Home_page"> |
|
16 |
<xsl:text>Home</xsl:text> |
|
17 |
</xsl:when> |
|
18 |
<xsl:otherwise> |
|
19 |
<xsl:message terminate="yes">No Home page defined!</xsl:message> |
|
20 |
</xsl:otherwise> |
|
21 |
</xsl:choose> |
|
22 |
</xsl:when> |
|
23 |
<xsl:when test="count($hmi_pages) = 0"> |
|
24 |
<xsl:message terminate="yes">No page defined!</xsl:message> |
|
25 |
</xsl:when> |
|
26 |
<xsl:otherwise> |
|
27 |
<xsl:value-of select="func:parselabel($hmi_pages/@inkscape:label)/widget/arg[1]/@value"/> |
|
28 |
</xsl:otherwise> |
|
29 |
</xsl:choose> |
|
30 |
</xsl:variable> |
|
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
31 |
<xsl:variable name="_categories"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
32 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
33 |
<xsl:text>HMI_ROOT</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
34 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
35 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
36 |
<xsl:text>HMI_LABEL</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
37 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
38 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
39 |
<xsl:text>HMI_CLASS</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
40 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
41 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
42 |
<xsl:text>HMI_PLC_STATUS</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
43 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
44 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
45 |
<xsl:text>HMI_CURRENT_PAGE</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
46 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
47 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
48 |
<xsl:variable name="categories" select="exsl:node-set($_categories)"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
49 |
<xsl:variable name="_indexed_hmitree"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
50 |
<xsl:apply-templates mode="index" select="$hmitree"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
51 |
</xsl:variable> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
52 |
<xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
53 |
<xsl:template mode="index" match="*"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
54 |
<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
|
55 |
<xsl:param name="parentpath" select="''"/> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
56 |
<xsl:variable name="content"> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
57 |
<xsl:variable name="path"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
58 |
<xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
59 |
<xsl:when test="local-name() = 'HMI_ROOT'"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
60 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
61 |
</xsl:when> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
62 |
<xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
63 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
64 |
<xsl:text>/</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
65 |
<xsl:value-of select="@name"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
66 |
</xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
67 |
</xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
68 |
</xsl:variable> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
69 |
<xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
70 |
<xsl:when test="not(local-name() = $categories/noindex)"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
71 |
<xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
72 |
<xsl:attribute name="index"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
73 |
<xsl:value-of select="$index"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
74 |
</xsl:attribute> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
75 |
<xsl:attribute name="hmipath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
76 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
77 |
</xsl:attribute> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
78 |
<xsl:for-each select="@*"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
79 |
<xsl:copy/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
80 |
</xsl:for-each> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
81 |
</xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
82 |
</xsl:when> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
83 |
<xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
84 |
<xsl:apply-templates mode="index" select="*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
85 |
<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
|
86 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
87 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
88 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
89 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
90 |
</xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
91 |
</xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
92 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
93 |
<xsl:copy-of select="$content"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
94 |
<xsl:apply-templates mode="index" select="following-sibling::*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
95 |
<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
|
96 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
97 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
98 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
99 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
100 |
</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
|
101 |
<xsl:template mode="inline_svg" match="@* | node()"> |
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
|
102 |
<xsl:copy> |
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
|
103 |
<xsl:apply-templates mode="inline_svg" select="@* | node()"/> |
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
|
104 |
</xsl:copy> |
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
|
105 |
</xsl:template> |
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
|
106 |
<xsl:template mode="inline_svg" match="svg:svg/@width"/> |
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
|
107 |
<xsl:template mode="inline_svg" match="svg:svg/@height"/> |
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
|
108 |
<xsl:template mode="inline_svg" match="svg:svg"> |
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
|
109 |
<xsl:copy> |
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
|
110 |
<xsl:attribute name="preserveAspectRatio"> |
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
|
111 |
<xsl:text>none</xsl:text> |
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
|
112 |
</xsl:attribute> |
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
|
113 |
<xsl:attribute name="height"> |
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
|
114 |
<xsl:text>100vh</xsl:text> |
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
|
115 |
</xsl:attribute> |
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
|
116 |
<xsl:attribute name="width"> |
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
|
117 |
<xsl:text>100vw</xsl:text> |
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
|
118 |
</xsl:attribute> |
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
|
119 |
<xsl:apply-templates mode="inline_svg" select="@* | node()"/> |
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
|
120 |
</xsl:copy> |
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
|
121 |
</xsl:template> |
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
|
122 |
<xsl:template match="/"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
123 |
<xsl:comment> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
124 |
<xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
125 |
</xsl:comment> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
126 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
127 |
<head/> |
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
|
128 |
<body style="margin:0;overflow:hidden;"> |
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
|
129 |
<xsl:apply-templates mode="inline_svg" select="svg:svg"/> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
130 |
<script> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
131 |
<xsl:call-template name="scripts"/> |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
132 |
</script> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
133 |
</body> |
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
134 |
</html> |
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
|
135 |
</xsl:template> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
136 |
<func:function name="func:parselabel"> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
137 |
<xsl:param name="label"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
138 |
<xsl:variable name="description" select="substring-after($label,'HMI:')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
139 |
<xsl:variable name="_args" select="substring-before($description,'@')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
140 |
<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
|
141 |
<xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
142 |
<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
|
143 |
<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
|
144 |
</xsl:when> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
145 |
<xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
146 |
<xsl:value-of select="$description"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
147 |
</xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
148 |
</xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
149 |
</xsl:variable> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
150 |
<xsl:variable name="_type" select="substring-before($args,':')"/> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
151 |
<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
|
152 |
<xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
153 |
<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
|
154 |
<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
|
155 |
</xsl:when> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
156 |
<xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
157 |
<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
|
158 |
</xsl:otherwise> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
159 |
</xsl:choose> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
160 |
</xsl:variable> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
161 |
<xsl:variable name="ast"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
162 |
<xsl:if test="$type"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
163 |
<widget> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
164 |
<xsl:attribute name="type"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
165 |
<xsl:value-of select="$type"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
166 |
</xsl:attribute> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
167 |
<xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
168 |
<arg> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
169 |
<xsl:attribute name="value"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
170 |
<xsl:value-of select="."/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
171 |
</xsl:attribute> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
172 |
</arg> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
173 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
174 |
<xsl:variable name="paths" select="substring-after($description,'@')"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
175 |
<xsl:for-each select="str:split($paths, '@')"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
176 |
<path> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
177 |
<xsl:attribute name="value"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
178 |
<xsl:value-of select="."/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
179 |
</xsl:attribute> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
180 |
</path> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
181 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
182 |
</widget> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
183 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
184 |
</xsl:variable> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
185 |
<func:result select="exsl:node-set($ast)"/> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
186 |
</func:function> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
187 |
<xsl:template name="scripts"> |
2799
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
188 |
<xsl:text>//(function(){ |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
189 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
190 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
191 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
192 |
<xsl:text>var hmi_hash = [</xsl:text> |
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
|
193 |
<xsl:value-of select="$hmitree/@hash"/> |
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
|
194 |
<xsl:text>]; |
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
|
195 |
</xsl:text> |
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
|
196 |
<xsl:text>var hmi_widgets = { |
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
|
197 |
</xsl:text> |
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
|
198 |
<xsl:for-each select="$hmi_elements"> |
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
|
199 |
<xsl:variable name="widget" select="func:parselabel(@inkscape:label)/widget"/> |
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
|
200 |
<xsl:value-of select="@id"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
201 |
<xsl:text>: { |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
202 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
203 |
<xsl:text> type: "</xsl:text> |
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
|
204 |
<xsl:value-of select="$widget/@type"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
205 |
<xsl:text>", |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
206 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
207 |
<xsl:text> args: [ |
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
|
208 |
</xsl:text> |
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
|
209 |
<xsl:for-each select="$widget/arg"> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
210 |
<xsl:text> "</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
211 |
<xsl:value-of select="@value"/> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
212 |
<xsl:text>"</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
213 |
<xsl:if test="position()!=last()"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
214 |
<xsl:text>,</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
215 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
216 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
217 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
218 |
</xsl:for-each> |
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
|
219 |
<xsl:text> ], |
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
|
220 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
221 |
<xsl:text> indexes: [ |
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
|
222 |
</xsl:text> |
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
|
223 |
<xsl:for-each select="$widget/path"> |
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
|
224 |
<xsl:variable name="hmipath" select="@value"/> |
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
|
225 |
<xsl:variable name="hmitree_match" select="$indexed_hmitree/*[@hmipath = $hmipath]"/> |
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
|
226 |
<xsl:if test="count($hmitree_match) = 0"> |
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
|
227 |
<xsl:message terminate="yes"> |
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
|
228 |
<xsl:text>No match for HMI </xsl:text> |
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
|
229 |
<xsl:value-of select="$hmipath"/> |
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
|
230 |
<xsl:text>;</xsl:text> |
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
|
231 |
</xsl:message> |
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
|
232 |
</xsl:if> |
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
|
233 |
<xsl:text> </xsl:text> |
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
|
234 |
<xsl:value-of select="$hmitree_match/@index"/> |
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
|
235 |
<xsl:if test="position()!=last()"> |
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
|
236 |
<xsl:text>,</xsl:text> |
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
|
237 |
</xsl:if> |
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
|
238 |
<xsl:text> |
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
|
239 |
</xsl:text> |
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
|
240 |
</xsl:for-each> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
241 |
<xsl:text> ], |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
242 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
243 |
<xsl:text> element: document.getElementById("</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
244 |
<xsl:value-of select="@id"/> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
245 |
<xsl:text>"), |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
246 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
247 |
<xsl:apply-templates mode="widget_defs" select="$widget"> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
248 |
<xsl:with-param name="hmi_element" select="."/> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
249 |
</xsl:apply-templates> |
2793
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
250 |
<xsl:text>}</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
251 |
<xsl:if test="position()!=last()"> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
252 |
<xsl:text>,</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
253 |
</xsl:if> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
254 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
255 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
256 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
257 |
<xsl:text>} |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
258 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
259 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
260 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
261 |
<xsl:text>var hmitree_types = [ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
262 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
263 |
<xsl:for-each select="$indexed_hmitree/*"> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
264 |
<xsl:text>/* </xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
265 |
<xsl:value-of select="@index"/> |
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
|
266 |
<xsl:text> </xsl:text> |
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
|
267 |
<xsl:value-of select="@hmipath"/> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
268 |
<xsl:text> */ "</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
269 |
<xsl:value-of select="substring(local-name(), 5)"/> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
270 |
<xsl:text>"</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
271 |
<xsl:if test="position()!=last()"> |
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
|
272 |
<xsl:text>,</xsl:text> |
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
|
273 |
</xsl:if> |
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
|
274 |
<xsl:text> |
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
|
275 |
</xsl:text> |
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
|
276 |
</xsl:for-each> |
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
|
277 |
<xsl:text>] |
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
|
278 |
</xsl:text> |
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
|
279 |
<xsl:text> |
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
|
280 |
</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
|
281 |
<xsl:text>var page_desc = { |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
282 |
</xsl:text> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
283 |
<xsl:for-each select="$hmi_pages"> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
284 |
<xsl:variable name="desc" select="func:parselabel(@inkscape:label)/widget"/> |
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
|
285 |
<xsl:variable name="page" select="."/> |
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
|
286 |
<xsl:variable name="p" select="$hmi_geometry[@Id = $page/@id]"/> |
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
|
287 |
<xsl:variable name="page_ids" select="$hmi_geometry[@Id != $page/@id and @x >= $p/@x and @y >= $p/@y and @x+@w <= $p/@x+$p/@w and @y+@h <= $p/@y+$p/@h]/@Id"/> |
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
|
288 |
<xsl:variable name="page_elements" select="$hmi_elements[@id = $page_ids]"/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
289 |
<xsl:text> "</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
290 |
<xsl:value-of select="$desc/arg[1]/@value"/> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
291 |
<xsl:text>": { |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
292 |
</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
293 |
<xsl:text> id: "</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
294 |
<xsl:value-of select="@id"/> |
2795 | 295 |
<xsl:text>", |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
296 |
</xsl:text> |
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
|
297 |
<xsl:text> bbox: [</xsl:text> |
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
|
298 |
<xsl:value-of select="$p/@x"/> |
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
|
299 |
<xsl:text>, </xsl:text> |
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
|
300 |
<xsl:value-of select="$p/@y"/> |
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
|
301 |
<xsl:text>, </xsl:text> |
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
|
302 |
<xsl:value-of select="$p/@w"/> |
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
|
303 |
<xsl:text>, </xsl:text> |
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
|
304 |
<xsl:value-of select="$p/@h"/> |
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
|
305 |
<xsl:text>], |
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
|
306 |
</xsl:text> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
307 |
<xsl:text> widgets: [ |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
308 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
309 |
<xsl:for-each select="$page_ids"> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
310 |
<xsl:text> hmi_widgets.</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
311 |
<xsl:value-of select="."/> |
2794
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
312 |
<xsl:if test="position()!=last()"> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
313 |
<xsl:text>,</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
314 |
</xsl:if> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
315 |
<xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
316 |
</xsl:text> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
317 |
</xsl:for-each> |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
318 |
<xsl:text> ] |
c10069a02ed0
SVGHMI: deduce pages content out of geometry (elements contained in page bounding box are in)
Edouard Tisserant
parents:
2793
diff
changeset
|
319 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
320 |
<xsl:text> }</xsl:text> |
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
|
321 |
<xsl:if test="position()!=last()"> |
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
|
322 |
<xsl:text>,</xsl:text> |
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
|
323 |
</xsl:if> |
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
|
324 |
<xsl:text> |
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
|
325 |
</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
|
326 |
</xsl:for-each> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
327 |
<xsl:text>} |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
328 |
</xsl:text> |
2795 | 329 |
<xsl:text> |
330 |
</xsl:text> |
|
331 |
<xsl:text>var default_page = "</xsl:text> |
|
332 |
<xsl:value-of select="$default_page"/> |
|
333 |
<xsl:text>"; |
|
334 |
</xsl:text> |
|
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
|
335 |
<xsl:text>var svg_root = document.getElementById("</xsl:text> |
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
|
336 |
<xsl:value-of select="$svg_root_id"/> |
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
|
337 |
<xsl:text>"); |
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
|
338 |
</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
|
339 |
<xsl:text>// svghmi.js |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
340 |
</xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
341 |
<xsl:text> |
2a97688c94c5
SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents:
2792
diff
changeset
|
342 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
343 |
<xsl:text>var cache = hmitree_types.map(_ignored => undefined); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
344 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
345 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
346 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
347 |
<xsl:text>function dispatch_value(index, value) { |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
348 |
</xsl:text> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
349 |
<xsl:text> let widgets = subscribers[index]; |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
350 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
351 |
<xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
352 |
</xsl:text> |
2805
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
353 |
<xsl:text> let oldval = cache[index]; |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
354 |
</xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
355 |
<xsl:text> cache[index] = value; |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
356 |
</xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
357 |
<xsl:text> |
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
358 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
359 |
<xsl:text> if(widgets.size > 0) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
360 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
361 |
<xsl:text> for(let widget of widgets){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
362 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
363 |
<xsl:text> let idxidx = widget.indexes.indexOf(index); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
364 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
365 |
<xsl:text> if(idxidx == -1){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
366 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
367 |
<xsl:text> throw new Error("Dispatching to widget not interested, should not happen."); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
368 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
369 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
370 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
371 |
<xsl:text> let d = widget.dispatch; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
372 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
373 |
<xsl:text> if(typeof(d) == "function" && idxidx == 0){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
374 |
</xsl:text> |
2805
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
375 |
<xsl:text> return d.call(widget, value, oldval); |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
376 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
377 |
<xsl:text> }else if(typeof(d) == "object" && d.length >= idxidx){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
378 |
</xsl:text> |
2805
e521e0d133d5
SVGHMI: fixed HMI->PLC dataflow : not updates as expected, and not initialized properly after subscribe.
Edouard Tisserant
parents:
2803
diff
changeset
|
379 |
<xsl:text> return d[idxidx].call(widget, value, oldval); |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
380 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
381 |
<xsl:text> }/* else dispatch_0, ..., dispatch_n ? */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
382 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
383 |
<xsl:text> /*else { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
384 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
385 |
<xsl:text> throw new Error("Dunno how to dispatch to widget at index = " + index); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
386 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
387 |
<xsl:text> }*/ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
388 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
389 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
390 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
391 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
392 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
393 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
394 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
395 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
396 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
397 |
<xsl:text>function init_widgets() { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
398 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
399 |
<xsl:text> Object.keys(hmi_widgets).forEach(function(id) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
400 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
401 |
<xsl:text> let widget = hmi_widgets[id]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
402 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
403 |
<xsl:text> let init = widget.init; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
404 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
405 |
<xsl:text> if(typeof(init) == "function"){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
406 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
407 |
<xsl:text> return init.call(widget); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
408 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
409 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
410 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
411 |
<xsl:text> }); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
412 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
413 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
414 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
415 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
416 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
417 |
<xsl:text>// Open WebSocket to relative "/ws" address |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
418 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
419 |
<xsl:text>var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws')); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
420 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
421 |
<xsl:text>ws.binaryType = 'arraybuffer'; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
422 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
423 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
424 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
425 |
<xsl:text>const dvgetters = { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
426 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
427 |
<xsl:text> INT: [DataView.prototype.getInt16, 2], |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
428 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
429 |
<xsl:text> BOOL: [DataView.prototype.getInt8, 1] |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
430 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
431 |
<xsl:text> /* TODO */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
432 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
433 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
434 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
435 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
436 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
437 |
<xsl:text>// Register message reception handler |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
438 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
439 |
<xsl:text>ws.onmessage = function (evt) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
440 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
441 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
442 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
443 |
<xsl:text> let data = evt.data; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
444 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
445 |
<xsl:text> let dv = new DataView(data); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
446 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
447 |
<xsl:text> let i = 0; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
448 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
449 |
<xsl:text> try { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
450 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
451 |
<xsl:text> for(let hash_int of hmi_hash) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
452 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
453 |
<xsl:text> if(hash_int != dv.getUint8(i)){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
454 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
455 |
<xsl:text> throw new Error("Hash doesn't match"); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
456 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
457 |
<xsl:text> }; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
458 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
459 |
<xsl:text> i++; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
460 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
461 |
<xsl:text> }; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
462 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
463 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
464 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
465 |
<xsl:text> while(i < data.byteLength){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
466 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
467 |
<xsl:text> let index = dv.getUint32(i, true); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
468 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
469 |
<xsl:text> i += 4; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
470 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
471 |
<xsl:text> let iectype = hmitree_types[index]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
472 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
473 |
<xsl:text> if(iectype != undefined){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
474 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
475 |
<xsl:text> let [dvgetter, bytesize] = dvgetters[iectype]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
476 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
477 |
<xsl:text> let value = dvgetter.call(dv,i,true); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
478 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
479 |
<xsl:text> dispatch_value(index, value); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
480 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
481 |
<xsl:text> i += bytesize; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
482 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
483 |
<xsl:text> } else { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
484 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
485 |
<xsl:text> throw new Error("Unknown index "+index) |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
486 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
487 |
<xsl:text> } |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
488 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
489 |
<xsl:text> }; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
490 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
491 |
<xsl:text> } catch(err) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
492 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
493 |
<xsl:text> // 1003 is for "Unsupported Data" |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
494 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
495 |
<xsl:text> // ws.close(1003, err.message); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
496 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
497 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
498 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
499 |
<xsl:text> // TODO : remove debug alert ? |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
500 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
501 |
<xsl:text> alert("Error : "+err.message+"\nHMI will be reloaded."); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
502 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
503 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
504 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
505 |
<xsl:text> // force reload ignoring cache |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
506 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
507 |
<xsl:text> location.reload(true); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
508 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
509 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
510 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
511 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
512 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
513 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
514 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
515 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
516 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
517 |
<xsl:text>function send_blob(data) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
518 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
519 |
<xsl:text> if(data.length > 0) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
520 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
521 |
<xsl:text> ws.send(new Blob([new Uint8Array(hmi_hash)].concat(data))); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
522 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
523 |
<xsl:text> }; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
524 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
525 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
526 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
527 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
528 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
529 |
<xsl:text>const typedarray_types = { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
530 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
531 |
<xsl:text> INT: Int16Array, |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
532 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
533 |
<xsl:text> BOOL: Uint8Array |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
534 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
535 |
<xsl:text> /* TODO */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
536 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
537 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
538 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
539 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
540 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
541 |
<xsl:text>function send_reset() { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
542 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
543 |
<xsl:text> send_blob(new Uint8Array([1])); /* reset = 1 */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
544 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
545 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
546 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
547 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
548 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
549 |
<xsl:text>// subscription state, as it should be in hmi server |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
550 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
551 |
<xsl:text>// hmitree indexed array of integers |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
552 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
553 |
<xsl:text>var subscriptions = hmitree_types.map(_ignored => 0); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
554 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
555 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
556 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
557 |
<xsl:text>// subscription state as needed by widget now |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
558 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
559 |
<xsl:text>// hmitree indexed array of Sets of widgets objects |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
560 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
561 |
<xsl:text>var subscribers = hmitree_types.map(_ignored => new Set()); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
562 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
563 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
564 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
565 |
<xsl:text>function update_subscriptions() { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
566 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
567 |
<xsl:text> let delta = []; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
568 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
569 |
<xsl:text> for(let index = 0; index < subscribers.length; index++){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
570 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
571 |
<xsl:text> let widgets = subscribers[index]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
572 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
573 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
574 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
575 |
<xsl:text> // periods are in ms |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
576 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
577 |
<xsl:text> let previous_period = subscriptions[index]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
578 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
579 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
580 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
581 |
<xsl:text> let new_period = 0; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
582 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
583 |
<xsl:text> if(widgets.size > 0) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
584 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
585 |
<xsl:text> let maxfreq = 0; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
586 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
587 |
<xsl:text> for(let widget of widgets) |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
588 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
589 |
<xsl:text> if(maxfreq < widget.frequency) |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
590 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
591 |
<xsl:text> maxfreq = widget.frequency; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
592 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
593 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
594 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
595 |
<xsl:text> if(maxfreq != 0) |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
596 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
597 |
<xsl:text> new_period = 1000/maxfreq; |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
598 |
</xsl:text> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
599 |
<xsl:text> } |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
600 |
</xsl:text> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
601 |
<xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
602 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
603 |
<xsl:text> if(previous_period != new_period) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
604 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
605 |
<xsl:text> subscriptions[index] = new_period; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
606 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
607 |
<xsl:text> delta.push( |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
608 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
609 |
<xsl:text> new Uint8Array([2]), /* subscribe = 2 */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
610 |
</xsl:text> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
611 |
<xsl:text> new Uint32Array([index]), |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
612 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
613 |
<xsl:text> new Uint16Array([new_period])); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
614 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
615 |
<xsl:text> } |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
616 |
</xsl:text> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
617 |
<xsl:text> } |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
618 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
619 |
<xsl:text> send_blob(delta); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
620 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
621 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
622 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
623 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
624 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
625 |
<xsl:text>function send_hmi_value(index, value) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
626 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
627 |
<xsl:text> let iectype = hmitree_types[index]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
628 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
629 |
<xsl:text> let jstype = typedarray_types[iectype]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
630 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
631 |
<xsl:text> send_blob([ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
632 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
633 |
<xsl:text> new Uint8Array([0]), /* setval = 0 */ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
634 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
635 |
<xsl:text> new Uint32Array([index]), |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
636 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
637 |
<xsl:text> new jstype([value])]); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
638 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
639 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
640 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
641 |
<xsl:text> cache[index] = value; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
642 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
643 |
<xsl:text>}; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
644 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
645 |
<xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
646 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
647 |
<xsl:text>function change_hmi_value(index, opstr) { |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
648 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
649 |
<xsl:text> let op = opstr[0]; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
650 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
651 |
<xsl:text> let given_val = opstr.slice(1); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
652 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
653 |
<xsl:text> let old_val = cache[index] |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
654 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
655 |
<xsl:text> let new_val; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
656 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
657 |
<xsl:text> switch(op){ |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
658 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
659 |
<xsl:text> case "=": |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
660 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
661 |
<xsl:text> eval("new_val"+opstr); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
662 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
663 |
<xsl:text> break; |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
664 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
665 |
<xsl:text> case "+": |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
666 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
667 |
<xsl:text> case "-": |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
668 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
669 |
<xsl:text> case "*": |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
670 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
671 |
<xsl:text> case "/": |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
672 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
673 |
<xsl:text> if(old_val != undefined) |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
674 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
675 |
<xsl:text> new_val = eval("old_val"+opstr); |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
676 |
</xsl:text> |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
677 |
<xsl:text> break; |
2799
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
678 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
679 |
<xsl:text> } |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
680 |
</xsl:text> |
2803
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
681 |
<xsl:text> if(new_val != undefined && old_val != new_val) |
f48121cf31b6
SVGHMI: Added relative changes of HMI value from widgets.
Edouard Tisserant
parents:
2802
diff
changeset
|
682 |
</xsl:text> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
683 |
<xsl:text> send_hmi_value(index, new_val); |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
684 |
</xsl:text> |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
685 |
<xsl:text> return new_val; |
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
|
686 |
</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
|
687 |
<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
|
688 |
</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
|
689 |
<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
|
690 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
691 |
<xsl:text>var current_page; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
692 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
693 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
694 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
695 |
<xsl:text>function switch_page(page_name) { |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
696 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
697 |
<xsl:text> let old_desc = page_desc[current_page]; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
698 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
699 |
<xsl:text> let new_desc = page_desc[page_name]; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
700 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
701 |
<xsl:text> /* TODO hide / show widgets */ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
702 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
703 |
<xsl:text> /* TODO move viewport */ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
704 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
705 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
706 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
707 |
<xsl:text> /* remove subsribers of previous page if any */ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
708 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
709 |
<xsl:text> if(old_desc) for(let widget of old_desc.widgets){ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
710 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
711 |
<xsl:text> for(let index of widget.indexes){ |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
712 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
713 |
<xsl:text> subscribers[index].delete(widget); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
714 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
715 |
<xsl:text> } |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
716 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
717 |
<xsl:text> } |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
718 |
</xsl:text> |
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
|
719 |
<xsl:text> |
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
|
720 |
</xsl:text> |
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
|
721 |
<xsl:text> if(new_desc) { |
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
|
722 |
</xsl:text> |
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
|
723 |
<xsl:text> /* add new subsribers if any */ |
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
|
724 |
</xsl:text> |
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
|
725 |
<xsl:text> for(let widget of new_desc.widgets){ |
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
|
726 |
</xsl:text> |
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
|
727 |
<xsl:text> for(let index of widget.indexes){ |
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
|
728 |
</xsl:text> |
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
|
729 |
<xsl:text> subscribers[index].add(widget); |
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
|
730 |
</xsl:text> |
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
|
731 |
<xsl:text> } |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
732 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
733 |
<xsl:text> } |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
734 |
</xsl:text> |
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
|
735 |
<xsl:text> svg_root.setAttribute('viewBox',new_desc.bbox.join(" ")); |
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
|
736 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
737 |
<xsl:text> } |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
738 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
739 |
<xsl:text> current_page = page_name; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
740 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
741 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
742 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
743 |
<xsl:text> update_subscriptions(); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
744 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
745 |
<xsl:text>}; |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
746 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
747 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
748 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
749 |
<xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
750 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
751 |
<xsl:text>// Once connection established |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
752 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
753 |
<xsl:text>ws.onopen = function (evt) { |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
754 |
</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
|
755 |
<xsl:text> init_widgets(); |
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
|
756 |
</xsl:text> |
2798
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
757 |
<xsl:text> send_reset(); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
758 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
759 |
<xsl:text> // show main page |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
760 |
</xsl:text> |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
761 |
<xsl:text> switch_page(default_page); |
ddb2c4668a6b
SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents:
2797
diff
changeset
|
762 |
</xsl:text> |
2799
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
763 |
<xsl:text>}; |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
764 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
765 |
<xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
766 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
767 |
<xsl:text>ws.onclose = function (evt) { |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
768 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
769 |
<xsl:text> // TODO : add visible notification while waiting for reload |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
770 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
771 |
<xsl:text> console.log("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+" Reload in 10s."); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
772 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
773 |
<xsl:text> // TODO : re-enable auto reload when not in debug |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
774 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
775 |
<xsl:text> //window.setTimeout(() => location.reload(true), 10000); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
776 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
777 |
<xsl:text> alert("Connection closed. code:"+evt.code+" reason:"+evt.reason+" wasClean:"+evt.wasClean+"."); |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
778 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
779 |
<xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
780 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
781 |
<xsl:text>}; |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
782 |
</xsl:text> |
f5da343b9b63
SVGHMI: Many fixes. Subscriptions to HMItree seems to be working, and dispatch function is called in JS with good data. Bidirectional communication now really working.
Edouard Tisserant
parents:
2798
diff
changeset
|
783 |
<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
|
784 |
</xsl:text> |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
785 |
</xsl:template> |
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
786 |
<xsl:template mode="page_desc" match="*"/> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
787 |
<xsl:template mode="code_from_descs" match="*"> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
788 |
<xsl:text>{ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
789 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
790 |
<xsl:text> var path, role, name, priv; |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
791 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
792 |
<xsl:text> var id = "</xsl:text> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
793 |
<xsl:value-of select="@id"/> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
794 |
<xsl:text>"; |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
795 |
</xsl:text> |
2789 | 796 |
<xsl:if test="@inkscape:label"> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
797 |
<xsl:text>name = "</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
798 |
<xsl:value-of select="@inkscape:label"/> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
799 |
<xsl:text>"; |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
800 |
</xsl:text> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
801 |
</xsl:if> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
802 |
<xsl:text>/* -------------- */ |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
803 |
</xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
804 |
<xsl:value-of select="substring-after(svg:desc, $mark)"/> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
805 |
<xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
806 |
</xsl:text> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
807 |
<xsl:text> /* -------------- */ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
808 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
809 |
<xsl:text> res.push({ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
810 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
811 |
<xsl:text> path:path, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
812 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
813 |
<xsl:text> role:role, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
814 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
815 |
<xsl:text> name:name, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
816 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
817 |
<xsl:text> priv:priv |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
818 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
819 |
<xsl:text> }) |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
820 |
</xsl:text> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
821 |
<xsl:text>} |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
822 |
</xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
823 |
</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
|
824 |
<xsl:template mode="testgeo" match="bbox"> |
2763
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
825 |
<xsl:text>ID: </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
826 |
<xsl:value-of select="@Id"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
827 |
<xsl:text> x: </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
828 |
<xsl:value-of select="@x"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
829 |
<xsl:text> y: </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
830 |
<xsl:value-of select="@y"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
831 |
<xsl:text> w: </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
832 |
<xsl:value-of select="@w"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
833 |
<xsl:text> h: </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
834 |
<xsl:value-of select="@h"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
835 |
<xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
836 |
</xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
837 |
</xsl:template> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
838 |
<xsl:template mode="testtree" match="*"> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
839 |
<xsl:param name="indent" select="''"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
840 |
<xsl:value-of select="$indent"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
841 |
<xsl:text> </xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
842 |
<xsl:value-of select="local-name()"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
843 |
<xsl:text> </xsl:text> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
844 |
<xsl:for-each select="@*"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
845 |
<xsl:value-of select="local-name()"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
846 |
<xsl:text>=</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
847 |
<xsl:value-of select="."/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
848 |
<xsl:text> </xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
849 |
</xsl:for-each> |
2763
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
850 |
<xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
851 |
</xsl:text> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
852 |
<xsl:apply-templates mode="testtree" select="*"> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
853 |
<xsl:with-param name="indent"> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
854 |
<xsl:value-of select="concat($indent,'>')"/> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
855 |
</xsl:with-param> |
ce04d79b8e57
Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents:
2756
diff
changeset
|
856 |
</xsl:apply-templates> |
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
|
857 |
</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
|
858 |
<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
|
859 |
<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
|
860 |
<xsl:param name="mandatory" select="'yes'"/> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
861 |
<xsl:param name="hmi_element"/> |
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
|
862 |
<xsl:for-each select="str:split($labels)"> |
2807 | 863 |
<xsl:variable name="name" select="."/> |
864 |
<xsl:variable name="elt_id" select="$hmi_element//*[@inkscape:label=$name][1]/@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
|
865 |
<xsl:if test="$mandatory='yes' and not($elt_id)"> |
2807 | 866 |
<xsl:message terminate="yes"> |
867 |
<xsl:text>Meter widget must have a </xsl:text> |
|
868 |
<xsl:value-of select="$name"/> |
|
869 |
<xsl:text> element</xsl:text> |
|
870 |
</xsl:message> |
|
871 |
</xsl:if> |
|
872 |
<xsl:value-of select="$name"/> |
|
873 |
<xsl:text>_elt: document.getElementById("</xsl:text> |
|
874 |
<xsl:value-of select="$elt_id"/> |
|
875 |
<xsl:text>"), |
|
876 |
</xsl:text> |
|
877 |
</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
|
878 |
</xsl:template> |
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
|
879 |
<xsl:template mode="widget_defs" match="widget[@type='Display']"> |
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
|
880 |
<xsl:param name="hmi_element"/> |
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
|
881 |
<xsl:text>frequency: 5, |
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
|
882 |
</xsl:text> |
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
|
883 |
<xsl:text>dispatch: function(value) { |
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
|
884 |
</xsl:text> |
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
|
885 |
<xsl:choose> |
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
|
886 |
<xsl:when test="$hmi_element[self::svg:text]"> |
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
|
887 |
<xsl:text> this.element.textContent = String(value); |
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
|
888 |
</xsl:text> |
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
|
889 |
</xsl:when> |
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
|
890 |
<xsl:otherwise> |
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
|
891 |
<xsl:message terminate="yes"> |
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
|
892 |
<xsl:text>Display widget as a group not implemented</xsl:text> |
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
|
893 |
</xsl:message> |
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
|
894 |
</xsl:otherwise> |
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
|
895 |
</xsl:choose> |
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
|
896 |
<xsl:text>}, |
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
|
897 |
</xsl:text> |
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
|
898 |
</xsl:template> |
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
|
899 |
<xsl:template mode="widget_defs" match="widget[@type='Meter']"> |
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
|
900 |
<xsl:param name="hmi_element"/> |
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
|
901 |
<xsl:text>frequency: 10, |
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
|
902 |
</xsl:text> |
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
|
903 |
<xsl:call-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
|
904 |
<xsl:with-param name="hmi_element" select="$hmi_element"/> |
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
|
905 |
<xsl:with-param name="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
|
906 |
<test>value min max needle range</test> |
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
|
907 |
</xsl:with-param> |
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
|
908 |
</xsl:call-template> |
2807 | 909 |
<xsl:text>dispatch: function(value) { |
910 |
</xsl:text> |
|
911 |
<xsl:text> this.value_elt.textContent = String(value); |
|
912 |
</xsl:text> |
|
913 |
<xsl:text> let [min,max,totallength] = this.range; |
|
914 |
</xsl:text> |
|
915 |
<xsl:text> let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); |
|
916 |
</xsl:text> |
|
917 |
<xsl:text> let tip = this.range_elt.getPointAtLength(length); |
|
918 |
</xsl:text> |
|
919 |
<xsl:text> this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); |
|
920 |
</xsl:text> |
|
921 |
<xsl:text>}, |
|
922 |
</xsl:text> |
|
923 |
<xsl:text>origin: undefined, |
|
924 |
</xsl:text> |
|
925 |
<xsl:text>range: undefined, |
|
926 |
</xsl:text> |
|
927 |
<xsl:text>init: function() { |
|
928 |
</xsl:text> |
|
929 |
<xsl:text> this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] |
|
930 |
</xsl:text> |
|
931 |
<xsl:text> this.origin = this.needle_elt.getPointAtLength(0); |
|
932 |
</xsl:text> |
|
933 |
<xsl:text>}, |
|
934 |
</xsl:text> |
|
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
935 |
</xsl:template> |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
936 |
<xsl:template mode="widget_defs" match="widget[@type='Input']"> |
2801
390acff12755
SVGHMI: Added init call to all widgets at startup to bind events. More features in Input widget : Edit and Change buttons. WIP HMI->PLC value update, incoherent data detected in C part on update.
Edouard Tisserant
parents:
2800
diff
changeset
|
937 |
<xsl:param name="hmi_element"/> |
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
|
938 |
<xsl:text>frequency: 5, |
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
|
939 |
</xsl:text> |
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
|
940 |
<xsl:call-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
|
941 |
<xsl:with-param name="hmi_element" select="$hmi_element"/> |
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
|
942 |
<xsl:with-param name="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
|
943 |
<test>value</test> |
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
|
944 |
</xsl:with-param> |
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
|
945 |
</xsl:call-template> |
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
|
946 |
<xsl:text>dispatch: function(value) { |
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
|
947 |
</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
|
948 |
<xsl:text> this.value_elt.textContent = String(value); |
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
|
949 |
</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
|
950 |
<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
|
951 |
</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
|
952 |
<xsl:variable name="edit_elt_id" select="$hmi_element/*[@inkscape:label='edit'][1]/@id"/> |
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
|
953 |
<xsl:text>init: function() { |
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
|
954 |
</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
|
955 |
<xsl:if test="$edit_elt_id"> |
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
|
956 |
<xsl:text> document.getElementById("</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
|
957 |
<xsl:value-of select="$edit_elt_id"/> |
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
|
958 |
<xsl:text>").addEventListener( |
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
|
959 |
</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
|
960 |
<xsl:text> "click", |
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
|
961 |
</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
|
962 |
<xsl:text> evt => alert('XXX TODO : Edit value')); |
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
|
963 |
</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
|
964 |
</xsl:if> |
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
|
965 |
<xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-][0-9]+')]"> |
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
|
966 |
<xsl:text> document.getElementById("</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
|
967 |
<xsl:value-of select="@id"/> |
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
|
968 |
<xsl:text>").addEventListener( |
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
|
969 |
</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
|
970 |
<xsl:text> "click", |
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
|
971 |
</xsl:text> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
972 |
<xsl:text> evt => {let new_val = change_hmi_value(this.indexes[0], "</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
|
973 |
<xsl:value-of select="@inkscape:label"/> |
2806
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
974 |
<xsl:text>"); |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
975 |
</xsl:text> |
7d0e81cdedb0
SVGHMI: Quicker update path for input widget when pressing on buttons, do not wait until data comes back, and simply update value text of the pressed widget. Updated PLC prog for more amimated value to display
Edouard Tisserant
parents:
2805
diff
changeset
|
976 |
<xsl:text> this.value_elt.textContent = String(new_val);}); |
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
|
977 |
</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
|
978 |
</xsl:for-each> |
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
|
979 |
<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
|
980 |
</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
|
981 |
</xsl:template> |
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
|
982 |
<xsl:template mode="widget_defs" match="widget[@type='Button']"/> |
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
|
983 |
<xsl:template mode="widget_defs" match="widget[@type='Toggle']"> |
2800
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
984 |
<xsl:text> frequency: 5, |
68cee1366b9c
SVGHMI: dispatching data to minimalist "Display" text widget.
Edouard Tisserant
parents:
2799
diff
changeset
|
985 |
</xsl:text> |
2797
c5ba1e77f054
SVGHMI: added a widgets description object, accessed by id. Added frequency to widgets, as separate template to allow future customization. Excluded non svg elements (i.e inkscape Sets) with HMI: labels from widgets.
Edouard Tisserant
parents:
2796
diff
changeset
|
986 |
</xsl:template> |
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
|
987 |
<xsl:template mode="widget_defs" match="widget[@type='Change']"> |
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
|
988 |
<xsl:text> frequency: 5, |
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
|
989 |
</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
|
990 |
</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
|
991 |
<xsl:template mode="widget_defs" match="widget[@type='Jump']"> |
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
|
992 |
<xsl:text>init: function() { |
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
|
993 |
</xsl:text> |
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
|
994 |
<xsl:text> this.element.addEventListener( |
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
|
995 |
</xsl:text> |
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
|
996 |
<xsl:text> "click", |
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
|
997 |
</xsl:text> |
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
|
998 |
<xsl:text> evt => switch_page(this.args[0])); |
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
|
999 |
</xsl:text> |
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
|
1000 |
<xsl:text>}, |
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
|
1001 |
</xsl:text> |
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
|
1002 |
</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
|
1003 |
</xsl:stylesheet> |