svghmi/hmi_tree.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 23 Mar 2020 21:44:28 +0100
branchsvghmi
changeset 2894 4cf9ad35e6d0
parent 2893 d57a12b8f5db
child 2900 3ef217f525ff
permissions -rw-r--r--
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     1
// hmi_tree.ysl2
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
     2
2843
94696b3f69fb SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents: 2842
diff changeset
     3
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     4
// HMI Tree computed from VARIABLES.CSV in svghmi.py
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
     5
const "hmitree", "ns:GetHMITree()";
2853
6d39beb19f38 SVGHMI: whitespaces and comments
Edouard Tisserant
parents: 2852
diff changeset
     6
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
     7
const "_categories" {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
     8
    noindex > HMI_PLC_STATUS
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
     9
    noindex > HMI_CURRENT_PAGE
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    10
}
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    11
const "categories", "exsl:node-set($_categories)";
2867
901c89c0cc08 SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents: 2866
diff changeset
    12
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    13
// HMI Tree Index
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    14
const "_indexed_hmitree" apply "$hmitree", mode="index";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    15
const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
2843
94696b3f69fb SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents: 2842
diff changeset
    16
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    17
template "*", mode="index" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    18
    param "index", "0";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    19
    param "parentpath", "''";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    20
    const "content" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    21
        const "path"
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    22
            choose {
2890
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2886
diff changeset
    23
                when "count(ancestor::*)=0" > /
ae8063127e95 SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2886
diff changeset
    24
                when "count(ancestor::*)=1" > /«@name»
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    25
                otherwise > «$parentpath»/«@name»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    26
            }
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    27
        choose {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    28
            when "not(local-name() = $categories/noindex)" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    29
                xsl:copy {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    30
                    attrib "index" > «$index»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    31
                    attrib "hmipath" > «$path»
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    32
                    foreach "@*" xsl:copy;
2791
d022523cb621 SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents: 2790
diff changeset
    33
                }
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    34
                apply "*[1]", mode="index"{
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    35
                     with "index", "$index + 1";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    36
                     with "parentpath" > «$path»
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    37
                }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    38
            }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    39
            otherwise {
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    40
                apply "*[1]", mode="index"{
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    41
                    with "index", "$index";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    42
                    with "parentpath" > «$path»
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    43
                }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    44
            }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    45
        }
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    46
    }
2842
2f73f001955a SVGHMI: attempt to optimize for webkit, because of really slow style recompute in svg:use : "unlink clones" (as in inkscape) but stop deep-copy when meeting a widget, and create a new clone instead.
Edouard Tisserant
parents: 2841
diff changeset
    47
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    48
    copy "$content";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    49
    apply "following-sibling::*[1]", mode="index" {
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    50
        with "index", "$index + count(exsl:node-set($content)/*)";
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    51
        with "parentpath" > «$parentpath»
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
    52
    }
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    53
}
2874
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    54
2882
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    55
//  Parses:
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    56
//  "HMI:WidgetType:param1:param2@path1@path2"
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    57
//
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    58
//  Into:
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2890
diff changeset
    59
//  widget type="WidgetType" id="blah456" {
2882
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    60
//      arg value="param1";
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    61
//      arg value="param2";
2893
d57a12b8f5db SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents: 2890
diff changeset
    62
//      path value="path1" index="345";
2882
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    63
//      path value="path2";
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    64
//  }
ac08a5d15c15 SVGHMI: moving comments
Edouard Tisserant
parents: 2877
diff changeset
    65
//
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
    66
template "*", mode="parselabel" {
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
    67
    const "label","@inkscape:label";
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    68
    const "description", "substring-after($label,'HMI:')";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    69
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    70
    const "_args", "substring-before($description,'@')";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    71
    const "args" choose {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    72
        when "$_args" value "$_args";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    73
        otherwise value "$description";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    74
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    75
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    76
    const "_type", "substring-before($args,':')";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    77
    const "type" choose {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    78
        when "$_type" value "$_type";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    79
        otherwise value "$args";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    80
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    81
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
    82
    if "$type" widget {
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
    83
        attrib "id" > «@id»
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    84
        attrib "type" > «$type»
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    85
        foreach "str:split(substring-after($args, ':'), ':')" {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    86
            arg {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    87
                attrib "value" > «.»
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    88
            }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    89
        }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    90
        const "paths", "substring-after($description,'@')";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    91
        foreach "str:split($paths, '@')" {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    92
            if "string-length(.) > 0" path {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    93
                attrib "value" > «.»
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    94
                const "path", ".";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    95
                const "item", "$indexed_hmitree/*[@hmipath = $path]";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    96
                if "count($item) = 1"
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    97
                    attrib "index" > «$item/@index»
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    98
            }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
    99
        }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
   100
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
   101
}
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2874
diff changeset
   102
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   103
const "_parsed_widgets" apply "$hmi_elements", mode="parselabel";
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   104
const "parsed_widgets","exsl:node-set($_parsed_widgets)";
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   105
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   106
def "func:widget" {
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   107
    param "id";
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   108
    result "$parsed_widgets/widget[@id = $id]";
2885
f398896b7ebf SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents: 2882
diff changeset
   109
}
f398896b7ebf SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents: 2882
diff changeset
   110
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   111
2894
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   112
def "func:is_descendant_path" {
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   113
    param "descend";
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   114
    param "ancest";
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   115
    // TODO : use HMI tree to answer more accurately
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   116
    result "string-length($ancest) > 0 and starts-with($descend,$ancest)";
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   117
}
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   118
4cf9ad35e6d0 SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2893
diff changeset
   119
2874
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   120
// Debug data
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   121
template "*", mode="testtree"{
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   122
    param "indent", "''";
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   123
    > «$indent» «local-name()» 
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   124
    foreach "@*" > «local-name()»="«.»" 
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   125
    > \n
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   126
    apply "*", mode="testtree" {
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   127
        with "indent" value "concat($indent,'>')"
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   128
    };
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   129
}
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   130
function "debug_hmitree" {
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   131
    | Raw HMI tree
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   132
    apply "$hmitree", mode="testtree";
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   133
    |
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   134
    | Indexed HMI tree
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   135
    apply "$indexed_hmitree", mode="testtree";
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   136
    |
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   137
    | Parsed Widgets
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   138
    copy "_parsed_widgets";
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   139
    apply "$parsed_widgets", mode="testtree";
2874
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   140
}
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
   141
!debug_output_calls.append("debug_hmitree")