# HG changeset patch # User Edouard Tisserant # Date 1572344338 -3600 # Node ID 63b9a37b73c707d5a254d30816a11437bef496a7 # Parent b9c5402532639cf0e98a39af18dc613756b16247 SVGHMI: various insignificant code moves, commenting and typos fixes. diff -r b9c540253263 -r 63b9a37b73c7 svghmi/gen_index_xhtml.xslt --- 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 @@ /* TODO hide / show widgets */ - /* TODO move viewport */ - /* remove subsribers of previous page if any */ @@ -783,78 +781,6 @@ //})(); - - - { - - var path, role, name, priv; - - var id = " - - "; - - - name = " - - "; - - - /* -------------- */ - - - - - /* -------------- */ - - res.push({ - - path:path, - - role:role, - - name:name, - - priv:priv - - }) - - } - - - - ID: - - x: - - y: - - w: - - h: - - - - - - - - - - - - - = - - - - - - - - - - - @@ -903,7 +829,7 @@ - value min max needle range + value min max needle range dispatch: function(value) { @@ -940,7 +866,7 @@ - value + value dispatch: function(value) { diff -r b9c540253263 -r 63b9a37b73c7 svghmi/gen_index_xhtml.ysl2 --- 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}; }; istylesheet @@ -144,6 +144,19 @@ } } + /* + Parses: + "HMI:WidgetType:param1:param2@path1@path2" + + Into: + widget type="WidgetType" { + arg value="param1"; + arg value="param2"; + path value="path1"; + path value="path2"; + } + */ + func:function name="func:parselabel" { param "label"; const "description", "substring-after($label,'HMI:')"; @@ -263,53 +276,38 @@ | //})(); } + // template "*", mode="code_from_descs" { + // || + // { + // var path, role, name, priv; + // var id = "«@id»"; + // || + + // /* if label is used, use it as default name */ + // if "@inkscape:label" + // |> name = "«@inkscape:label»"; + + // | /* -------------- */ + + // // this breaks indent, but fixing indent could break string literals + // value "substring-after(svg:desc, $mark)"; + // // nobody reads generated code anyhow... + + // || + + // /* -------------- */ + // res.push({ + // path:path, + // role:role, + // name:name, + // priv:priv + // }) + // } + // || + // } + + /* - Parses: - "HMI:WidgetType:param1:param2@path1@path2" - - Into: - widget type="WidgetType" { - arg value="param1"; - arg value="param2"; - path value="path1"; - path value="path2"; - } - */ - - template "*", mode="page_desc" { - } - - template "*", mode="code_from_descs" { - || - { - var path, role, name, priv; - var id = "«@id»"; - || - - /* if label is used, use it as default name */ - if "@inkscape:label" - |> name = "«@inkscape:label»"; - - | /* -------------- */ - - // this breaks indent, but fixing indent could break string literals - value "substring-after(svg:desc, $mark)"; - // nobody reads generated code anyhow... - - || - - /* -------------- */ - res.push({ - path:path, - role:role, - name:name, - priv:priv - }) - } - || - } - - 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" { param "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); | }, | origin: undefined, diff -r b9c540253263 -r 63b9a37b73c7 svghmi/svghmi.js --- 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; diff -r b9c540253263 -r 63b9a37b73c7 tests/svghmi/svghmi_0@svghmi/svghmi.svg --- 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 @@ showgrid="false" units="px" 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" inkscape:window-x="0" @@ -679,13 +679,14 @@ 000