SVGHMI: update generated xslt file svghmi
authorEdouard Tisserant
Wed, 25 Nov 2020 14:47:47 +0100
branchsvghmi
changeset 3079 1021c6c74dde
parent 3078 d345673610b0
child 3080 e5fa1f49f0b9
SVGHMI: update generated xslt file
svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt	Wed Nov 25 14:47:23 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Wed Nov 25 14:47:47 2020 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions">
-  <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
+<xsl:stylesheet xmlns:ns="beremiz" xmlns:definitions="definitions" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:func="http://exslt.org/functions" xmlns:epilogue="epilogue" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:declarations="declarations" xmlns:debug="debug" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0">
+  <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
   <xsl:variable name="svg" select="/svg:svg"/>
   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
@@ -5942,9 +5942,9 @@
     <xsl:comment>
       <xsl:apply-templates select="document('')/*/debug:*"/>
     </xsl:comment>
-    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
       <head/>
-      <body style="margin:0;overflow:hidden;">
+      <body style="margin:0;overflow:hidden;user-select:none;">
         <xsl:copy-of select="$result_svg"/>
         <script>
           <xsl:text>
@@ -6511,7 +6511,7 @@
 </xsl:text>
           <xsl:text>
 </xsl:text>
-          <xsl:text>quotes = {"'":null, '"':null};
+          <xsl:text>const quotes = {"'":null, '"':null};
 </xsl:text>
           <xsl:text>
 </xsl:text>
@@ -6809,9 +6809,15 @@
 </xsl:text>
           <xsl:text>var edit_callback;
 </xsl:text>
+          <xsl:text>const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null}
+</xsl:text>
           <xsl:text>function edit_value(path, valuetype, callback, initial, size) {
 </xsl:text>
-          <xsl:text>
+          <xsl:text>    if(valuetype in localtypes){
+</xsl:text>
+          <xsl:text>        valuetype = (typeof initial) == "number" ? "HMI_REAL" : "HMI_STRING";
+</xsl:text>
+          <xsl:text>    }
 </xsl:text>
           <xsl:text>    let [keypadid, xcoord, ycoord] = keypads[valuetype];
 </xsl:text>
@@ -6825,6 +6831,10 @@
 </xsl:text>
           <xsl:text>
 </xsl:text>
+          <xsl:text>
+</xsl:text>
+          <xsl:text>
+</xsl:text>
           <xsl:text>var current_modal; /* TODO stack ?*/
 </xsl:text>
           <xsl:text>