--- a/svghmi/analyse_widget.xslt Fri Jun 03 11:49:13 2022 +0200
+++ b/svghmi/analyse_widget.xslt Fri Jun 10 09:39:10 2022 +0200
@@ -935,6 +935,23 @@
<xsl:text>format string for Y label</xsl:text>
+ <func:function name="func:check_curves_label_consistency"> + <xsl:param name="curve_elts"/> + <xsl:param name="number_to_check"/> + <xsl:variable name="res"> + <xsl:when test="$curve_elts[@inkscape:label = concat('curve_', string($number_to_check))]"> + <xsl:if test="$number_to_check > 0"> + <xsl:value-of select="func:check_curves_label_consistency($curve_elts, $number_to_check - 1)"/> + <xsl:value-of select="concat('missing curve_', string($number_to_check))"/> + <func:result select="$res"/> <xsl:template mode="document" match="@* | node()">
<xsl:apply-templates mode="document" select="@* | node()"/>
--- a/svghmi/gen_index_xhtml.xslt Fri Jun 03 11:49:13 2022 +0200
+++ b/svghmi/gen_index_xhtml.xslt Fri Jun 10 09:39:10 2022 +0200
@@ -5669,6 +5669,10 @@
<xsl:text> this.shift |= this.caps;
+ <xsl:text> if(this.virgin) + <xsl:text> this.editstr = ""; <xsl:text> this.editstr += syms[this.shift?syms.length-1:0];
<xsl:text> this.shift = false;
@@ -5805,7 +5809,9 @@
<xsl:text> this.result_callback_obj = callback_obj;
- <xsl:text> this.Info_elt.textContent = info;
+ <xsl:text> if(this.Info_elt) + <xsl:text> this.Info_elt.textContent = info; <xsl:text> this.shift = false;
@@ -5817,6 +5823,8 @@
<xsl:text> this.update();
+ <xsl:text> this.virgin = true; @@ -5825,6 +5833,8 @@
<xsl:text> if(this.editstr != this._editstr){
+ <xsl:text> this.virgin = false; <xsl:text> this._editstr = this.editstr;
<xsl:text> this.Value_elt.textContent = this.editstr;
@@ -5857,13 +5867,13 @@
<xsl:call-template name="defs_by_labels">
<xsl:with-param name="hmi_element" select="$hmi_element"/>
<xsl:with-param name="labels">
- <xsl:text>Esc Enter BackSpace Keys Info Value</xsl:text>
+ <xsl:text>Esc Enter BackSpace Keys Value</xsl:text> <xsl:call-template name="defs_by_labels">
<xsl:with-param name="hmi_element" select="$hmi_element"/>
<xsl:with-param name="labels">
- <xsl:text>Sign Space NumDot</xsl:text>
+ <xsl:text>Sign Space NumDot Info</xsl:text> <xsl:with-param name="mandatory" select="'no'"/>
@@ -5912,6 +5922,8 @@
<xsl:value-of select="$g/@y"/>
+ <xsl:text> virgin: false, <xsl:template match="widget[@type='List']" mode="widget_desc">
@@ -8044,7 +8056,7 @@
- <xsl:text> this.curves_data = this.curves.map(_unused => []);
+ <xsl:text> this.curves_data = []; @@ -8066,6 +8078,12 @@
+ <xsl:text> if(this.curves_data[index] === undefined){ + <xsl:text> this.curves_data[index] = []; <xsl:text> this.curves_data[index].push([time, value]);
<xsl:text> let data_length = this.curves_data[index].length;
@@ -8271,6 +8289,23 @@
+ <func:function name="func:check_curves_label_consistency"> + <xsl:param name="curve_elts"/> + <xsl:param name="number_to_check"/> + <xsl:variable name="res"> + <xsl:when test="$curve_elts[@inkscape:label = concat('curve_', string($number_to_check))]"> + <xsl:if test="$number_to_check > 0"> + <xsl:value-of select="func:check_curves_label_consistency($curve_elts, $number_to_check - 1)"/> + <xsl:value-of select="concat('missing curve_', string($number_to_check))"/> + <func:result select="$res"/> <xsl:template match="widget[@type='XYGraph']" mode="widget_defs">
<xsl:param name="hmi_element"/>
<xsl:call-template name="defs_by_labels">
@@ -8287,20 +8322,24 @@
<xsl:text> init_specific() {
- <xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label,'^curve_[0-9]+$')]">
+ <xsl:variable name="curves" select="$hmi_element/*[regexp:test(@inkscape:label,'^curve_[0-9]+$')]"/> + <xsl:variable name="curves_error" select="func:check_curves_label_consistency($curves,count($curves)-1)"/> + <xsl:if test="string-length($curves_error)"> + <xsl:message terminate="yes"> + <xsl:text>XYGraph id="</xsl:text> + <xsl:value-of select="@id"/> + <xsl:text>", label="</xsl:text> + <xsl:value-of select="@inkscape:label"/> + <xsl:text>" : </xsl:text> + <xsl:value-of select="$curves_error"/> + <xsl:for-each select="$curves"> <xsl:variable name="label" select="@inkscape:label"/>
- <xsl:variable name="id" select="@id"/>
- <xsl:if test="$hmi_element/*[not($id = @id) and @inkscape:label=$label]">
- <xsl:message terminate="yes">
- <xsl:text>XYGraph id="</xsl:text>
- <xsl:value-of select="$id"/>
- <xsl:text>", label="</xsl:text>
- <xsl:value-of select="$label"/>
- <xsl:text>" : elements with data_n label must be unique.</xsl:text>
+ <xsl:variable name="_id" select="@id"/> + <xsl:variable name="curve_num" select="substring(@inkscape:label, 7)"/> <xsl:text> this.curves[</xsl:text>
- <xsl:value-of select="substring(@inkscape:label, 7)"/>
+ <xsl:value-of select="$curve_num"/> <xsl:text>] = id("</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>"); /* </xsl:text>