--- a/svghmi/gen_index_xhtml.xslt Thu Apr 01 15:57:06 2021 +0200
+++ b/svghmi/gen_index_xhtml.xslt Thu Apr 01 16:00:58 2021 +0200
@@ -6715,7 +6715,10 @@
<xsl:variable name="regex" select="'^("[^"].*"|\-?[0-9]+|false|true)(#.*)?$'"/>
- <xsl:for-each select="$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]">
+ <xsl:variable name="subelts" select="$result_widgets[@id = $hmi_element/@id]//*"/> + <xsl:variable name="subwidgets" select="$subelts//*[@id = $hmi_widgets/@id]"/> + <xsl:variable name="accepted" select="$subelts[not(ancestor-or-self::*/@id = $subwidgets/@id)]"/> + <xsl:for-each select="$accepted[regexp:test(@inkscape:label,$regex)]"> <xsl:variable name="literal" select="regexp:match(@inkscape:label,$regex)[2]"/>
@@ -6770,15 +6773,7 @@
<xsl:text> //toggle state and apply
- <xsl:text> if (this.state) {
- <xsl:text> this.state = 0;
- <xsl:text> this.state = 1;
+ <xsl:text> this.state = this.state ? false : true; <xsl:text> this.apply_hmi_value(0, this.state);
@@ -6792,23 +6787,27 @@
+ <xsl:text> activate(val) { + <xsl:text> let [active, inactive] = val ? ["none",""] : ["", "none"]; + <xsl:text> if (this.active_elt) + <xsl:text> this.active_elt.style.display = active; + <xsl:text> if (this.inactive_elt) + <xsl:text> this.inactive_elt.style.display = inactive; - <xsl:text> // redraw toggle button on screen refresh
- <xsl:text> if (this.state) {
- <xsl:text> this.active_elt.setAttribute("style", this.active_style);
- <xsl:text> this.inactive_elt.setAttribute("style", "display:none");
- <xsl:text> this.inactive_elt.setAttribute("style", this.inactive_style);
- <xsl:text> this.active_elt.setAttribute("style", "display:none");
+ <xsl:text> // redraw toggle button on screen refresh + <xsl:text> this.activate(this.state); @@ -6816,23 +6815,9 @@
- <xsl:text> this.active_style = this.active_elt ? this.active_elt.style.cssText : undefined;
- <xsl:text> this.inactive_style = this.inactive_elt ? this.inactive_elt.style.cssText : undefined;
- <xsl:text> if (this.active_style && this.inactive_style) {
- <xsl:text> this.active_elt.setAttribute("style", "display:none");
- <xsl:text> this.inactive_elt.setAttribute("style", this.inactive_style);
- <xsl:text> this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)");
+ <xsl:text> this.activate(false); + <xsl:text> this.element.onclick = (evt) => this.on_click(evt); @@ -6848,8 +6833,6 @@
<xsl:with-param name="mandatory" select="'no'"/>
--- a/svghmi/widget_switch.ysl2 Thu Apr 01 15:57:06 2021 +0200
+++ b/svghmi/widget_switch.ysl2 Thu Apr 01 16:00:58 2021 +0200
@@ -20,7 +20,12 @@
const "regex",!"'^(\"[^\"].*\"|\-?[0-9]+|false|true)(#.*)?$'"!;
- foreach "$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]" {
+ const "subelts", "$result_widgets[@id = $hmi_element/@id]//*"; + const "subwidgets", "$subelts//*[@id = $hmi_widgets/@id]"; + const "accepted", "$subelts[not(ancestor-or-self::*/@id = $subwidgets/@id)]"; + foreach "$accepted[regexp:test(@inkscape:label,$regex)]" { const "literal", "regexp:match(@inkscape:label,$regex)[2]";
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Thu Apr 01 15:57:06 2021 +0200
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Thu Apr 01 16:00:58 2021 +0200
@@ -128,9 +128,9 @@
inkscape:current-layer="hmi0"
- inkscape:zoom="0.42177815"
- inkscape:cx="1614.7137"
- inkscape:cy="168.68416"
+ inkscape:zoom="1.1929688" + inkscape:cy="-68.272506" inkscape:window-width="1600"
inkscape:window-height="836"
@@ -2575,6 +2575,152 @@
style="fill:#8667bf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:connector-curvature="0" />
+ inkscape:label="HMI:Switch@/TARGETPRESSURE" + transform="matrix(0.5,0,0,0.5,699.09791,793.95217)" + style="stroke-width:2"> + transform="translate(-136.52022,250.47452)" + style="stroke-width:2"> + inkscape:transform-center-x="14.956371" + inkscape:transform-center-y="-3.6154501e-05" + d="m 622.6459,-170.03172 -51.81035,0 25.90517,-44.86908 z" + inkscape:randomized="0" + inkscape:flatsided="true" + sodipodi:arg2="1.5707963" + sodipodi:arg1="0.52359878" + sodipodi:r2="14.956361" + sodipodi:r1="29.912722" + sodipodi:cy="-184.98808" + sodipodi:cx="596.74072" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + transform="matrix(0,-2.0000001,1.9999999,0,1034.195,1298.6541)" /> + style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="stroke-width:1px">4</tspan></text> + transform="translate(-136.52022,250.47452)" + style="stroke-width:2"> + inkscape:transform-center-x="14.956364" + transform="rotate(-90,746.45698,-44.543641)" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + sodipodi:cx="596.74072" + sodipodi:cy="-216.2599" + sodipodi:r1="59.825443" + sodipodi:r2="29.912722" + sodipodi:arg1="0.52359878" + sodipodi:arg2="1.5707963" + inkscape:flatsided="true" + inkscape:randomized="0" + d="m 648.55108,-186.34718 -103.62071,0 51.81035,-89.73817 z" + inkscape:transform-center-y="-5.9989963e-06" /> + style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="stroke-width:1px" + sodipodi:role="line">3</tspan></text> + transform="translate(-416.52022,170.47452)" + style="stroke-width:2"> + inkscape:transform-center-x="-14.956365" + transform="matrix(0,-1,-1,0,1043.9134,701.91334)" + inkscape:transform-center-y="-5.5023185e-06" + d="m 648.55108,135.08534 -103.62071,0 51.81035,-89.738161 z" + inkscape:randomized="0" + inkscape:flatsided="true" + sodipodi:arg2="1.5707963" + sodipodi:arg1="0.52359878" + sodipodi:r2="29.912722" + sodipodi:r1="59.825443" + sodipodi:cy="105.17262" + sodipodi:cx="596.74072" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + sodipodi:type="star" /> + style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="stroke-width:1px" + sodipodi:role="line">2</tspan></text> + transform="translate(-416.52022,170.47452)" + style="stroke-width:2"> + inkscape:transform-center-x="-14.956349" + transform="matrix(0,-2.0000001,-1.9999999,0,1122.1514,1298.6541)" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + sodipodi:cx="596.74072" + sodipodi:cy="136.44444" + sodipodi:r1="29.912722" + sodipodi:r2="14.956361" + sodipodi:arg1="0.52359878" + sodipodi:arg2="1.5707963" + inkscape:flatsided="true" + inkscape:randomized="0" + d="m 622.6459,151.4008 -51.81035,0 25.90517,-44.86908 z" + inkscape:transform-center-y="-3.3040441e-05" /> + style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="stroke-width:1px">1</tspan></text> @@ -7172,4 +7318,47 @@
style="fill:#ffffff;fill-opacity:1;stroke-width:0.25px">page node</tspan></text>
+ transform="matrix(0.57180538,0,0,0.57180538,165.58244,517.80347)" + inkscape:label="HMI:ToggleButton@/PUMP0/BOOLIN" + style="stroke-width:1"> + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:#ff6600;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + inkscape:label="inactive" + inkscape:label="active" + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#fdfdfd;fill-opacity:1;fill-rule:nonzero;stroke:#ffd0b2;stroke-width:28.60938263;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" /> + style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#ff6600;fill-opacity:1;stroke:none;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:label="setting_jmp"><tspan + style="text-align:center;text-anchor:middle;fill:#ff6600;stroke-width:0.99999994px">up</tspan></text>