svghmi/detachable_pages.ysl2
author Edouard Tisserant <edouard@beremiz.fr>
Fri, 30 Aug 2024 11:50:23 +0200
changeset 4008 f30573e98600
parent 3923 77a1846390ef
permissions -rw-r--r--
IDE: allow structures to be located.
2885
f398896b7ebf SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents: 2877
diff changeset
     1
// detachable_pages.ysl2
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
     2
//
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
     3
// compute what elements are required by pages
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
     4
// and decide where to cut when removing/attaching
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
     5
// pages elements on page switch
2779
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     6
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
     7
const "hmi_pages_descs", "$parsed_widgets/widget[@type = 'Page']";
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
     8
const "hmi_pages", "$hmi_elements[@id = $hmi_pages_descs/@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: 2876
diff changeset
     9
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    10
const "default_page" choose {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    11
    when "count($hmi_pages) > 1" {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    12
        choose {
2887
30cea13267b4 SVGHMI: cosmetic changes
Edouard Tisserant
parents: 2886
diff changeset
    13
            when "$hmi_pages_descs/arg[1]/@value = 'Home'" > Home
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    14
            otherwise {
3117
f058542d0caa SVGHMI: Make an error when pages are nested
Edouard Tisserant
parents: 3107
diff changeset
    15
                error > No Home page defined!
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    16
            }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    17
        }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    18
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    19
    when "count($hmi_pages) = 0" {
3117
f058542d0caa SVGHMI: Make an error when pages are nested
Edouard Tisserant
parents: 3107
diff changeset
    20
        error > No page defined!
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    21
    }
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
    22
    otherwise > «func:widget($hmi_pages/@id)/arg[1]/@value»
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    23
}
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    24
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    25
emit "preamble:default-page" {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    26
    |
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    27
    | var default_page = "«$default_page»";
3653
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    28
    const "screensaverpage", "$hmi_pages_descs[arg[1]/@value = 'ScreenSaver']";
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    29
    const "delay" choose {
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    30
        when "$screensaverpage" {
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    31
            const "delaystr", "$screensaverpage/arg[2]/@value";
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    32
            if "not(regexp:test($delaystr,'^[0-9]+$'))"
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    33
                error > ScreenSaver page has missing or malformed delay argument.
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    34
            value "$delaystr";
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    35
        }
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    36
        otherwise > null
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    37
    }
d5ff60e906b0 SVGHMI: add ScreenSaver feature. Automatically jumps to a page named "ScreenSaver" after timeout defined in page arguments.
Edouard Tisserant
parents: 3622
diff changeset
    38
    | var screensaver_delay = «$delay»;
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    39
}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    40
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    41
const "keypads_descs", "$parsed_widgets/widget[@type = 'Keypad']";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    42
const "keypads", "$hmi_elements[@id = $keypads_descs/@id]";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
    43
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    44
// returns all directly or indirectly refered elements
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    45
def "func:refered_elements" {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    46
    param "elems";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    47
    const "descend", "$elems/descendant-or-self::svg:*";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    48
    const "clones", "$descend[self::svg:use]";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    49
    const "originals", "//svg:*[concat('#',@id) = $clones/@xlink:href]";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    50
    choose {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    51
        when "$originals"
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    52
            result "$descend | func:refered_elements($originals)";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    53
        otherwise
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    54
            result "$descend";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    55
    }
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    56
}
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    57
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    58
// variable "overlapping_geometry" was added for optimization.
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    59
// It avoids calling func:overlapping_geometry 3 times for each page
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    60
// (apparently libxml doesn't cache exslt function results)
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    61
// in order to optimize further, func:overlapping_geometry 
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    62
// should be implemented in python or even C,
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    63
// as this is still the main bottleneck here
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    64
const "_overlapping_geometry" {
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    65
    foreach "$hmi_pages | $keypads" {
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
    66
        const "k", "concat('overlapping:', @id)";
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
    67
        value "ns:ProgressStart($k, concat('collecting membership of ', @inkscape:label))";
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    68
        elt {
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    69
            attrib "id" > «@id»
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    70
            copy "func:overlapping_geometry(.)";
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    71
        }
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
    72
        value "ns:ProgressEnd($k)";
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
    73
    }
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    74
}
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    75
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    76
const "overlapping_geometry", "exsl:node-set($_overlapping_geometry)";
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    77
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    78
def "func:all_related_elements" {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    79
    param "page";
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    80
    const "page_overlapping_geometry", "$overlapping_geometry/elt[@id = $page/@id]/*";
3923
77a1846390ef SVGHMI: add "DISCARD:" prefix to force discarding an SVG element
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3877
diff changeset
    81
    const "overlapping_candidates", "//svg:*[not(starts-with((ancestor::svg:g | .) /@inkscape:label, 'DISCARD:'))]";
77a1846390ef SVGHMI: add "DISCARD:" prefix to force discarding an SVG element
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3877
diff changeset
    82
    const "page_overlapping_elements", "$overlapping_candidates[@id = $page_overlapping_geometry/@Id]";
3622
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
    83
    const "page_widgets_elements", """
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
    84
        $hmi_elements[not(@id=$page/@id)
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
    85
                      and descendant-or-self::svg:*/@id = $page_overlapping_elements/@id]
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
    86
        /descendant-or-self::svg:*""";
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
    87
    const "page_sub_elements", "func:refered_elements($page | $page_overlapping_elements | $page_widgets_elements)";
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    88
    result "$page_sub_elements";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    89
}
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
    90
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
    91
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    92
def "func:required_elements" {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    93
    param "pages"; 
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    94
    choose{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    95
        when "$pages"{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    96
            result """func:all_related_elements($pages[1])
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    97
                      | func:required_elements($pages[position()!=1])""";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    98
        }otherwise{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
    99
            result "/..";
2844
eee5dcd9fc92 SVGHMI: detachable and discardable elements sets, Reworked geometric intersection, toward more accurate page content detection.
Edouard Tisserant
parents: 2843
diff changeset
   100
        }
eee5dcd9fc92 SVGHMI: detachable and discardable elements sets, Reworked geometric intersection, toward more accurate page content detection.
Edouard Tisserant
parents: 2843
diff changeset
   101
    }
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   102
}
2844
eee5dcd9fc92 SVGHMI: detachable and discardable elements sets, Reworked geometric intersection, toward more accurate page content detection.
Edouard Tisserant
parents: 2843
diff changeset
   103
3186
1e9b9d7451cd SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
Edouard Tisserant
parents: 3170
diff changeset
   104
const "required_page_elements",
1e9b9d7451cd SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
Edouard Tisserant
parents: 3170
diff changeset
   105
    "func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*";
1e9b9d7451cd SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
Edouard Tisserant
parents: 3170
diff changeset
   106
3384
bd337d21f686 SVGHMI: changes that should fix some corner cases about unlinking and discardable element that still didn't show until now.
Edouard Tisserant
parents: 3381
diff changeset
   107
const "required_list_elements", "func:refered_elements(($hmi_lists | $hmi_textlists)[@id = $required_page_elements/@id])/ancestor-or-self::svg:*";
3186
1e9b9d7451cd SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
Edouard Tisserant
parents: 3170
diff changeset
   108
3199
1582753e409b SVGHMI: Filter unseen geometry from inkscape CSV output.
Edouard Tisserant
parents: 3186
diff changeset
   109
const "required_elements", "$defs | $required_list_elements | $required_page_elements";
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
   110
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   111
const "discardable_elements", "//svg:*[not(@id = $required_elements/@id)]";
2844
eee5dcd9fc92 SVGHMI: detachable and discardable elements sets, Reworked geometric intersection, toward more accurate page content detection.
Edouard Tisserant
parents: 2843
diff changeset
   112
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   113
def "func:sumarized_elements" {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   114
    param "elements";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   115
    const "short_list", "$elements[not(ancestor::*/@id = $elements/@id)]";
3877
ecb947e5bbb4 SVGHMI: fix JS error loading empty single page
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3685
diff changeset
   116
    const "filled_groups", """$short_list/parent::svg:g[
3161
edd558965f58 SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3121
diff changeset
   117
        not(child::*[
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   118
            not(@id = $discardable_elements/@id) and
3161
edd558965f58 SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3121
diff changeset
   119
            not(@id = $short_list/@id)
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   120
        ])]""";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   121
    const "groups_to_add", "$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]";
3161
edd558965f58 SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3121
diff changeset
   122
    result "$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@id)]";
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   123
}
2844
eee5dcd9fc92 SVGHMI: detachable and discardable elements sets, Reworked geometric intersection, toward more accurate page content detection.
Edouard Tisserant
parents: 2843
diff changeset
   124
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   125
def "func:detachable_elements" {
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   126
    param "pages";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   127
    choose{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   128
        when "$pages"{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   129
            result """func:sumarized_elements(func:all_related_elements($pages[1]))
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   130
                      | func:detachable_elements($pages[position()!=1])""";
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   131
        }otherwise{
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   132
            result "/..";
2846
7b1db17287b6 SVGHMI: now compute discardable elements first so that we can do better grouping of required elements when sumarizing.
Edouard Tisserant
parents: 2845
diff changeset
   133
        }
7b1db17287b6 SVGHMI: now compute discardable elements first so that we can do better grouping of required elements when sumarizing.
Edouard Tisserant
parents: 2845
diff changeset
   134
    }
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   135
}
2846
7b1db17287b6 SVGHMI: now compute discardable elements first so that we can do better grouping of required elements when sumarizing.
Edouard Tisserant
parents: 2845
diff changeset
   136
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   137
// Avoid nested detachables
2911
211d6a185e31 SVGHMI: More infrastructure for editing values with a keypad.
Edouard Tisserant
parents: 2904
diff changeset
   138
const "_detachable_elements", "func:detachable_elements($hmi_pages | $keypads)";
2875
6a12e1084deb SVGHMI: created detachable_elements.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2874
diff changeset
   139
const "detachable_elements", "$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]";
2846
7b1db17287b6 SVGHMI: now compute discardable elements first so that we can do better grouping of required elements when sumarizing.
Edouard Tisserant
parents: 2845
diff changeset
   140
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   141
emit "declarations:page-class" {
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   142
    | class PageWidget extends Widget{}
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   143
}
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   144
2943
304e88bae115 SVGHMI: added more meaningful namespaces to emit javascript code from.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2941
diff changeset
   145
emit "declarations:detachable-elements" {
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   146
    |
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   147
    | var detachable_elements = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   148
    foreach "$detachable_elements"{
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   149
    |     "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,`
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   150
    }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   151
    | }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   152
}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   153
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   154
const "forEach_widgets_ids", "$parsed_widgets/widget[@type = 'ForEach']/@id";
3121
8094494113b6 SVGHMI: Prevent excluded widget to appear in generated pages' widget list.
Edouard Tisserant
parents: 3117
diff changeset
   155
const "forEach_widgets", "$hmi_widgets[@id = $forEach_widgets_ids]";
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   156
const "in_forEach_widget_ids", "func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id";
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   157
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   158
template "svg:*", mode="page_desc" {
3117
f058542d0caa SVGHMI: Make an error when pages are nested
Edouard Tisserant
parents: 3107
diff changeset
   159
    if "ancestor::*[@id = $hmi_pages/@id]" error > HMI:Page «@id» is nested in another HMI:Page
f058542d0caa SVGHMI: Make an error when pages are nested
Edouard Tisserant
parents: 3107
diff changeset
   160
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   161
2886
6c82fad8be65 SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2885
diff changeset
   162
    const "desc", "func:widget(@id)";
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   163
    const "pagename", "$desc/arg[1]/@value";
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   164
    const "msg", "concat('generating page description ', $pagename)";
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   165
    value "ns:ProgressStart($pagename, $msg)";
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   166
    const "page", ".";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   167
    const "p", "$geometry[@Id = $page/@id]";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   168
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   169
    const "page_all_elements", "func:all_related_elements($page)";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   170
3121
8094494113b6 SVGHMI: Prevent excluded widget to appear in generated pages' widget list.
Edouard Tisserant
parents: 3117
diff changeset
   171
    const "all_page_widgets","$hmi_widgets[@id = $page_all_elements/@id and @id != $page/@id]";
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2894
diff changeset
   172
    const "page_managed_widgets","$all_page_widgets[not(@id=$in_forEach_widget_ids)]";
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   173
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   174
    const "page_root_path", "$desc/path[not(@assign)]";
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   175
    if "count($page_root_path)>1"
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   176
        error > Page id="«$page/@id»" : only one root path can be declared
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   177
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   178
    const "page_relative_widgets",
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   179
        "$page_managed_widgets[func:is_descendant_path(func:widget(@id)/path/@value, $page_root_path/@value)]";
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   180
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   181
    // Take closest ancestor in detachable_elements
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   182
    // since nested detachable elements are filtered out
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   183
    const "sumarized_page", 
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   184
        """func:sumarized_elements($page_all_elements)""";
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   185
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   186
    const "required_detachables", 
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   187
        """$sumarized_page/
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   188
           ancestor-or-self::*[@id = $detachable_elements/@id]""";
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   189
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   190
    |   "«$pagename»": {
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   191
    |     bbox: [«$p/@x», «$p/@y», «$p/@w», «$p/@h»],
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   192
    if "count($page_root_path)=1"{
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   193
        if "count($page_root_path/@index)=0"
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   194
            warning > Page id="«$page/@id»" : No match for path "«$page_root_path/@value»" in HMI tree
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   195
    |     page_index: «$page_root_path/@index»,
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   196
    |     page_class: "«$indexed_hmitree/*[@hmipath = $page_root_path/@value]/@class»",
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   197
    }
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   198
    |     widgets: [
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   199
    |         [hmi_widgets["«$page/@id»"], []],
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   200
    foreach "$page_managed_widgets" {
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   201
        const "widget_paths_relativeness" 
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   202
            foreach "func:widget(@id)/path" {
3685
570a738239f4 SVGHMI: Add arbitrary variable assignment when entering Pages
Edouard Tisserant
parents: 3653
diff changeset
   203
                value "func:is_descendant_path(@value, $page_root_path/@value)";
3005
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   204
                if "position()!=last()" > ,
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   205
            }
ff9ae4f4e3be SVGHMI: widgets are not anymore binary relative or absolute, but have a "relativeness".
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2955
diff changeset
   206
    |         [hmi_widgets["«@id»"], [«$widget_paths_relativeness»]]`if "position()!=last()" > ,`
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   207
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   208
    |     ],
2903
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2901
diff changeset
   209
    |     jumps: [
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2901
diff changeset
   210
    foreach "$parsed_widgets/widget[@id = $all_page_widgets/@id and @type='Jump']" {
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2901
diff changeset
   211
    |         hmi_widgets["«@id»"]`if "position()!=last()" > ,`
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2901
diff changeset
   212
    }
881d0248b3ce SVGHMI: Jump widget can now display as active or inactive, if corresponfing "active" and "inactive labeled elements are provided.
Edouard Tisserant
parents: 2901
diff changeset
   213
    |     ],
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   214
    |     required_detachables: {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   215
    foreach "$required_detachables" {
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   216
    |         "«@id»": detachable_elements["«@id»"]`if "position()!=last()" > ,`
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   217
    }
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   218
    |     }
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3199
diff changeset
   219
    apply "$parsed_widgets/widget[@id = $all_page_widgets/@id]", mode="widget_page"{
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2894
diff changeset
   220
        with "page_desc", "$desc";
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2894
diff changeset
   221
    }
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   222
    |   }`if "position()!=last()" > ,`
3170
aaa203270ab0 SVGHMI: Make build log less redundant, and refactor progress information code a bit, to make it also a bit less redundant.
Edouard Tisserant
parents: 3165
diff changeset
   223
    value "ns:ProgressEnd($pagename)";
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   224
}
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
   225
3007
360300a8b995 SVGHMI : have to move some JS declarations from "preamble" to "declarations" and others from "declarations" to "definitions" section to make room for JS libraries that would be used by widget classes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3005
diff changeset
   226
emit "definitions:page-desc" {
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   227
    |
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   228
    | var page_desc = {
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   229
    apply "$hmi_pages", mode="page_desc";
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   230
    | }
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   231
}
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   232
3232
7bdb766c2a4d SVGHMI: In order to allow widget signature and description to coexist in same ysl2 file, introduced widget_class, widget_defs to declare widget codegen templates and gen_index_xhtml to mark templates that are only usefull in gen_index_xhtml.xslt.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3199
diff changeset
   233
template "*", mode="widget_page";
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2894
diff changeset
   234
2904
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2903
diff changeset
   235
2940
034b6ce4f885 SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2939
diff changeset
   236
emit "debug:detachable-pages" {
2941
ef13a4007538 SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2940
diff changeset
   237
    |
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   238
    | DETACHABLES:
2876
d2adbc273125 SVGHMI: moved debug code
Edouard Tisserant
parents: 2875
diff changeset
   239
    foreach "$detachable_elements"{
d2adbc273125 SVGHMI: moved debug code
Edouard Tisserant
parents: 2875
diff changeset
   240
        |  «@id»
d2adbc273125 SVGHMI: moved debug code
Edouard Tisserant
parents: 2875
diff changeset
   241
    }
3622
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
   242
    | DISCARDABLES:
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
   243
    foreach "$discardable_elements"{
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
   244
        |  «@id»
98ce26040117 SVGHMI: do not discard out-of-page elements inside widgets that are ovelapping pages.
Edouard Tisserant
parents: 3384
diff changeset
   245
    }
2888
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   246
    | In Foreach:
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   247
    foreach "$in_forEach_widget_ids"{
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   248
        |  «.»
7beddc62a388 SVGHMI: Exclude (again) sub-widgets of forEach widget from page-switch managed widget.
Edouard Tisserant
parents: 2887
diff changeset
   249
    }
3165
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   250
    | Overlapping 
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   251
    apply "$overlapping_geometry", mode="testtree";
2db69e2c5673 SVGHMI: Optimized overlapping geometry (widget ot page belonging) computation. Added human readable messages for progress. Includes updated XSLT.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3161
diff changeset
   252
}