# HG changeset patch # User Edouard Tisserant # Date 1633049545 -7200 # Node ID 67069f4634b79a850a8b23edc45d8e37b353de14 # Parent 95015c0dcb8d0311789d01917482f0d5abf41a59 SVGHMI: add files missing in ee9e98c856a : Add TextList widget, add support for TextList in DropDown widget, move List, TextStyleList and TextList widget code in dedicated file with documentation. diff -r 95015c0dcb8d -r 67069f4634b7 svghmi/lists.ysl2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/lists.ysl2 Fri Oct 01 02:52:25 2021 +0200 @@ -0,0 +1,33 @@ +// lists.ysl2 +// +// compute list widget related constants +// for details, refer to : +// widget_list.ysl2 +// widget_textlist.ysl2 +// widget_textstulelist.ysl2 + + +// List widgets + +const "hmi_lists_descs", "$parsed_widgets/widget[@type = 'List']"; +const "hmi_lists", "$hmi_elements[@id = $hmi_lists_descs/@id]"; + + +// TextList widget + +const "hmi_textlists_descs", "$parsed_widgets/widget[@type = 'TextList']"; +const "hmi_textlists", "$hmi_elements[@id = $hmi_textlists_descs/@id]"; + +// TextStyleList widgets + +const "hmi_textstylelists_descs", "$parsed_widgets/widget[@type = 'TextStyleList']"; +const "hmi_textstylelists", "$hmi_elements[@id = $hmi_textstylelists_descs/@id]"; + +const "textstylelist_related" foreach "$hmi_textstylelists" list { + attrib "listid" value "@id"; + foreach "func:refered_elements(.)" elt { + attrib "eltid" value "@id"; + } +} +const "textstylelist_related_ns", "exsl:node-set($textstylelist_related)"; + diff -r 95015c0dcb8d -r 67069f4634b7 svghmi/widget_textlist.ysl2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/widget_textlist.ysl2 Fri Oct 01 02:52:25 2021 +0200 @@ -0,0 +1,28 @@ +// widget_textlist.ysl2 + +widget_desc("TextList") { + longdesc + || + TextList widget is a svg:group, list items are labeled elements + in that group. + + To use a TextList, clone (svg:use) one of the items inside the widget + that expects a TextList. + + In this list, (translated) text content is what matters. Nevertheless + text style of the cloned item will be applied in client widget. + || + + shortdesc > A named list of ordered texts + + arg name="listname" +} + +widget_defs("TextList") { + | texts: [ + foreach "func:refered_elements($hmi_element/*[@inkscape:label])[self::svg:text]" { + | id("«@id»"), + } + // could find a proper way in xpath to reverse() + | ].reverse(), +} diff -r 95015c0dcb8d -r 67069f4634b7 svghmi/widget_textstylelist.ysl2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/widget_textstylelist.ysl2 Fri Oct 01 02:52:25 2021 +0200 @@ -0,0 +1,28 @@ +// widget_textstylelist.ysl2 + +widget_desc("TextStyleList") { + longdesc + || + TextStyleList widget is a svg:group, list items are labeled elements + in that group. + + To use a TextStyleList, clone (svg:use) one of the items inside the widget + that expects a TextStyleList. + + In this list, only style matters. Text content is ignored. + || + + shortdesc > A named list of named texts + + arg name="listname" +} + +widget_defs("TextStyleList") { + | styles: { + foreach "$hmi_element/*[@inkscape:label]" { + const "style", "func:refered_elements(.)[self::svg:text]/@style"; + | «@inkscape:label»: "«$style»", + } + | }, +} + diff -r 95015c0dcb8d -r 67069f4634b7 svghmi/widgetlib/dropdown.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svghmi/widgetlib/dropdown.svg Fri Oct 01 02:52:25 2021 +0200 @@ -0,0 +1,106 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + sel_0 + + +