diff -r 034b6ce4f885 -r ef13a4007538 svghmi/detachable_pages.ysl2 --- a/svghmi/detachable_pages.ysl2 Sun Apr 19 10:48:34 2020 +0200 +++ b/svghmi/detachable_pages.ysl2 Sun Apr 19 22:01:12 2020 +0200 @@ -7,9 +7,6 @@ const "hmi_pages_descs", "$parsed_widgets/widget[@type = 'Page']"; const "hmi_pages", "$hmi_elements[@id = $hmi_pages_descs/@id]"; -const "keypads_descs", "$parsed_widgets/widget[@type = 'Keypad']"; -const "keypads", "$hmi_elements[@id = $keypads_descs/@id]"; - const "default_page" choose { when "count($hmi_pages) > 1" { choose { @@ -25,6 +22,14 @@ otherwise > «func:widget($hmi_pages/@id)/arg[1]/@value» } +emit "preamble:default-page" { + | + | var default_page = "«$default_page»"; +} + +const "keypads_descs", "$parsed_widgets/widget[@type = 'Keypad']"; +const "keypads", "$hmi_elements[@id = $keypads_descs/@id]"; + // returns all directly or indirectly refered elements def "func:refered_elements" { param "elems"; @@ -94,6 +99,15 @@ const "_detachable_elements", "func:detachable_elements($hmi_pages | $keypads)"; const "detachable_elements", "$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"; +emit "epilogue:detachable-elements" { + | + | var detachable_elements = { + foreach "$detachable_elements"{ + | "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,` + } + | } +} + const "forEach_widgets_ids", "$parsed_widgets/widget[@type = 'ForEach']/@id"; const "forEach_widgets", "$hmi_elements[@id = $forEach_widgets_ids]"; const "in_forEach_widget_ids", "func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id"; @@ -154,11 +168,18 @@ | }`if "position()!=last()" > ,` } +emit "epilogue:page-desc" { + | + | var page_desc = { + apply "$hmi_pages", mode="page_desc"; + | } +} + template "*", mode="per_page_widget_template"; emit "debug:detachable-pages" { - + | | DETACHABLES: foreach "$detachable_elements"{ | «@id»