--- a/svghmi/gen_index_xhtml.xslt Tue Oct 29 09:10:10 2019 +0100
+++ b/svghmi/gen_index_xhtml.xslt Tue Oct 29 11:18:58 2019 +0100
@@ -700,8 +700,6 @@
<xsl:text> /* TODO hide / show widgets */
- <xsl:text> /* TODO move viewport */
<xsl:text> /* remove subsribers of previous page if any */
@@ -783,78 +781,6 @@
- <xsl:template mode="page_desc" match="*"/>
- <xsl:template mode="code_from_descs" match="*">
- <xsl:text> var path, role, name, priv;
- <xsl:text> var id = "</xsl:text>
- <xsl:value-of select="@id"/>
- <xsl:if test="@inkscape:label">
- <xsl:text>name = "</xsl:text>
- <xsl:value-of select="@inkscape:label"/>
- <xsl:text>/* -------------- */
- <xsl:value-of select="substring-after(svg:desc, $mark)"/>
- <xsl:text> /* -------------- */
- <xsl:template mode="testgeo" match="bbox">
- <xsl:text>ID: </xsl:text>
- <xsl:value-of select="@Id"/>
- <xsl:text> x: </xsl:text>
- <xsl:value-of select="@x"/>
- <xsl:text> y: </xsl:text>
- <xsl:value-of select="@y"/>
- <xsl:text> w: </xsl:text>
- <xsl:value-of select="@w"/>
- <xsl:text> h: </xsl:text>
- <xsl:value-of select="@h"/>
- <xsl:template mode="testtree" match="*">
- <xsl:param name="indent" select="''"/>
- <xsl:value-of select="$indent"/>
- <xsl:value-of select="local-name()"/>
- <xsl:for-each select="@*">
- <xsl:value-of select="local-name()"/>
- <xsl:value-of select="."/>
- <xsl:apply-templates mode="testtree" select="*">
- <xsl:with-param name="indent">
- <xsl:value-of select="concat($indent,'>')"/>
<xsl:template name="defs_by_labels">
<xsl:param name="labels" select="''"/>
<xsl:param name="mandatory" select="'yes'"/>
@@ -903,7 +829,7 @@
<xsl:call-template name="defs_by_labels">
<xsl:with-param name="hmi_element" select="$hmi_element"/>
<xsl:with-param name="labels">
- <test>value min max needle range</test>
+ <xsl:text>value min max needle range</xsl:text> <xsl:text>dispatch: function(value) {
@@ -940,7 +866,7 @@
<xsl:call-template name="defs_by_labels">
<xsl:with-param name="hmi_element" select="$hmi_element"/>
<xsl:with-param name="labels">
+ <xsl:text>value</xsl:text> <xsl:text>dispatch: function(value) {
--- a/svghmi/gen_index_xhtml.ysl2 Tue Oct 29 09:10:10 2019 +0100
+++ b/svghmi/gen_index_xhtml.ysl2 Tue Oct 29 11:18:58 2019 +0100
@@ -5,7 +5,7 @@
in xsl decl labels(*ptr, name="defs_by_labels") alias call-template {
with "hmi_element", "$hmi_element";
- with "labels"{test *ptr};
+ with "labels"{text *ptr}; @@ -144,6 +144,19 @@
+ "HMI:WidgetType:param1:param2@path1@path2" + widget type="WidgetType" { func:function name="func:parselabel" {
const "description", "substring-after($label,'HMI:')";
@@ -263,53 +276,38 @@
- "HMI:WidgetType:param1:param2@path1@path2"
+ // template "*", mode="code_from_descs" { + // var path, role, name, priv;
- widget type="WidgetType" {
+ // /* if label is used, use it as default name */ + // if "@inkscape:label" + // |> name = "«@inkscape:label»"; - template "*", mode="page_desc" {
- template "*", mode="code_from_descs" {
- var path, role, name, priv;
+ // | /* -------------- */ - /* if label is used, use it as default name */
- |> name = "«@inkscape:label»";
+ // // this breaks indent, but fixing indent could break string literals + // value "substring-after(svg:desc, $mark)"; + // // nobody reads generated code anyhow...
- // this breaks indent, but fixing indent could break string literals
- value "substring-after(svg:desc, $mark)";
- // nobody reads generated code anyhow...
+ // /* -------------- */ template "bbox", mode="testgeo"{
| ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
@@ -323,7 +321,7 @@
with "indent" value "concat($indent,'>')"
function "defs_by_labels" {
@@ -363,6 +361,7 @@
| let [min,max,totallength] = this.range;
| let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min)));
| let tip = this.range_elt.getPointAtLength(length);
+ // TODO : deal with transformations between needle and range | this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y);
--- a/svghmi/svghmi.js Tue Oct 29 09:10:10 2019 +0100
+++ b/svghmi/svghmi.js Tue Oct 29 11:18:58 2019 +0100
@@ -180,7 +180,6 @@
let old_desc = page_desc[current_page];
let new_desc = page_desc[page_name];
/* TODO hide / show widgets */
- /* TODO move viewport */
/* remove subsribers of previous page if any */
if(old_desc) for(let widget of old_desc.widgets){
@@ -197,6 +196,7 @@
svg_root.setAttribute('viewBox',new_desc.bbox.join(" "));
+ // TODO dispatch current cache in newly opened page current_page = page_name;
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Tue Oct 29 09:10:10 2019 +0100
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Tue Oct 29 11:18:58 2019 +0100
@@ -117,8 +117,8 @@
inkscape:zoom="0.8046875"
- inkscape:cx="283.03663"
- inkscape:cy="-454.38089"
+ inkscape:cx="478.76479" + inkscape:cy="-403.42943" inkscape:window-width="1600"
inkscape:window-height="886"
@@ -679,13 +679,14 @@
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ff6600;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- inkscape:label="value"><tspan
+ transform="rotate(90)"><tspan
style="text-align:center;text-anchor:middle;fill:#ff6600;stroke-width:0.26458332px"
id="tspan102">000</tspan></text>