svghmi/widgets_common.ysl2
branchwxPython4
changeset 3688 c2992796a859
parent 3686 a3c509e66695
child 3702 6dc619fa28aa
equal deleted inserted replaced
3679:b6bca75bf3fa 3688:c2992796a859
   132     }
   132     }
   133 
   133 
   134     |   "«@id»": new «$widget/@type»Widget ("«@id»",«$freq»,[«$args»],[«$variables»],«$enable_expr»,{
   134     |   "«@id»": new «$widget/@type»Widget ("«@id»",«$freq»,[«$args»],[«$variables»],«$enable_expr»,{
   135     if "$widget/@enable_expr" {
   135     if "$widget/@enable_expr" {
   136 
   136 
   137     |       assignments: [],
   137     |       enable_assignments: [],
   138     |       compute_enable: function(value, oldval, varnum) {
   138     |       compute_enable: function(value, oldval, varnum) {
   139     |         let result = false;
   139     |         let result = false;
   140     |         do {
   140     |         do {
   141         foreach "$widget/path" {
   141         foreach "$widget/path" {
   142             const "varid","generate-id()";
   142             const "varid","generate-id()";
   143             const "varnum","position()-1";
   143             const "varnum","position()-1";
   144             if "@assign" foreach "$widget/path[@assign]" if "$varid = generate-id()" {
   144             if "@assign" foreach "$widget/path[@assign]" if "$varid = generate-id()" {
   145     |           if(varnum == «$varnum») this.assignments[«position()-1»] = value;
   145     |           if(varnum == «$varnum») this.enable_assignments[«position()-1»] = value;
   146     |           let «@assign» = this.assignments[«position()-1»];
   146     |           let «@assign» = this.enable_assignments[«position()-1»];
   147     |           if(«@assign» == undefined) break;
   147     |           if(«@assign» == undefined) break;
   148             }
   148             }
   149         }
   149         }
   150     |           result = «$widget/@enable_expr»;
   150     |           result = «$widget/@enable_expr»;
   151     |         } while(0);
   151     |         } while(0);
   598     ||
   598     ||
   599     warning > «@type» widget is used in SVG but widget type is not declared
   599     warning > «@type» widget is used in SVG but widget type is not declared
   600 }
   600 }
   601 
   601 
   602 const "included_ids","$parsed_widgets/widget[not(@type = $excluded_types) and not(@id = $discardable_elements/@id)]/@id";
   602 const "included_ids","$parsed_widgets/widget[not(@type = $excluded_types) and not(@id = $discardable_elements/@id)]/@id";
       
   603 const "page_ids","$parsed_widgets/widget[@type = 'Page']/@id";
   603 const "hmi_widgets","$hmi_elements[@id = $included_ids]";
   604 const "hmi_widgets","$hmi_elements[@id = $included_ids]";
       
   605 const "page_widgets","$hmi_elements[@id = $page_ids]";
   604 const "result_widgets","$result_svg_ns//*[@id = $hmi_widgets/@id]";
   606 const "result_widgets","$result_svg_ns//*[@id = $hmi_widgets/@id]";
   605 
   607 
   606 emit "declarations:hmi-elements" {
   608 emit "declarations:hmi-elements" {
   607     | var hmi_widgets = {
   609     | var hmi_widgets = {
   608     apply "$hmi_widgets", mode="hmi_widgets";
   610     apply "$hmi_widgets | $page_widgets", mode="hmi_widgets";
   609     | }
   611     | }
   610     |
   612     |
   611 }
   613 }
   612 
   614 
   613 function "defs_by_labels" {
   615 function "defs_by_labels" {