# HG changeset patch # User Edouard Tisserant # Date 1633049675 -7200 # Node ID b16e9561a3c1e6a9e4feec196203c5aab618648c # Parent 819b0bdfa705ce55fdf13432b69435667cd15ce2 SVGHMI: update generated xslt (List related changes) diff -r 819b0bdfa705 -r b16e9561a3c1 svghmi/analyse_widget.xslt --- a/svghmi/analyse_widget.xslt Fri Oct 01 02:52:25 2021 +0200 +++ b/svghmi/analyse_widget.xslt Fri Oct 01 02:54:35 2021 +0200 @@ -339,9 +339,11 @@ - It needs "text" (svg:text), "box" (svg:rect), "button" (svg:*), - - and "highlight" (svg:rect) labeled elements. + It needs "text" (svg:text or svg:use referring to svg:text), + + "box" (svg:rect), "button" (svg:*), and "highlight" (svg:rect) + + labeled elements. @@ -353,11 +355,19 @@ - When only one argument is given, and argment contains "#langs" then list of - - texts is automatically set to the list of human-readable languages supported - - by this HMI. + When only one argument is given and argment contains "#langs" then list of + + texts is automatically set to the human-readable list of supported + + languages by this HMI. + + + + If "text" labeled element is of type svg:use and refers to a svg:text + + element part of a TextList widget, no argument is expected. In that case + + list of texts is set to TextList content. @@ -529,6 +539,30 @@ + + List widget is a svg:group, list items are labeled elements + + in that group. + + + + To use a List, clone (svg:use) one of the items inside the widget that + + expects a List. + + + + Positions of items are relative to each other, and they must all be in the + + same place. In order to make editing easier it is therefore recommanded to + + make stacked clones of svg elements spread nearby the list. + + + + A named list of named graphical elements + + @@ -634,6 +668,58 @@ value to compare to labels + + + + + + 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. + + + + A named list of ordered texts + + + + + + + + + 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. + + + + A named list of named texts + + + diff -r 819b0bdfa705 -r b16e9561a3c1 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Fri Oct 01 02:52:25 2021 +0200 +++ b/svghmi/gen_index_xhtml.xslt Fri Oct 01 02:54:35 2021 +0200 @@ -432,6 +432,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -526,9 +549,7 @@ - - - + @@ -1883,6 +1904,17 @@ + + + + + + + + + + + class AnimateWidget @@ -3715,9 +3747,11 @@ - It needs "text" (svg:text), "box" (svg:rect), "button" (svg:*), - - and "highlight" (svg:rect) labeled elements. + It needs "text" (svg:text or svg:use referring to svg:text), + + "box" (svg:rect), "button" (svg:*), and "highlight" (svg:rect) + + labeled elements. @@ -3729,11 +3763,19 @@ - When only one argument is given, and argment contains "#langs" then list of - - texts is automatically set to the list of human-readable languages supported - - by this HMI. + When only one argument is given and argment contains "#langs" then list of + + texts is automatically set to the human-readable list of supported + + languages by this HMI. + + + + If "text" labeled element is of type svg:use and refers to a svg:text + + element part of a TextList widget, no argument is expected. In that case + + list of texts is set to TextList content. @@ -3759,6 +3801,8 @@ init() { + this.init_specific(); + this.button_elt.onclick = this.on_button_click.bind(this); // Save original size of rectangle @@ -3849,7 +3893,7 @@ // if valid selection resolve content - display_str = this.content[value]; + display_str = gettext(this.content[value]); this.last_selection = value; @@ -4061,7 +4105,7 @@ let span=spans[c]; - span.textContent = item; + span.textContent = gettext(item); let sel = c; @@ -4193,7 +4237,7 @@ }else{ - span.textContent = this.content[i]; + span.textContent = gettext(this.content[i]); let sel = i; @@ -4411,16 +4455,54 @@ - text box button highlight + box button highlight - content: + + init_specific: function() { + - langs + this.text_elt = id(" + + "); + + this.content = langs; + + + + + + No argrument for HMI:DropDown widget id=" + + " and "text" labeled element is not a svg:use element + + + + this.text_elt = id(" + + "); + + + + + + HMI:DropDown widget id=" + + " "text" labeled element does not point to a svg:text owned by a HMI:List widget + + + this.content = hmi_widgets[" + + "].texts; + - [ + this.text_elt = id(" + + "); + + this.content = [ " @@ -4428,10 +4510,36 @@ ", - ] + ]; + - , + } + + + + + + + /* + + */ + + + + function gettext(o) { + + if(typeof(o) == "string"){ + + return o; + + } + + return svg_text_to_multiline(o); + + }; + + @@ -5116,25 +5224,6 @@ . - - - - - - - - - - - - - - - - - - - @@ -6009,6 +6098,30 @@ + + List widget is a svg:group, list items are labeled elements + + in that group. + + + + To use a List, clone (svg:use) one of the items inside the widget that + + expects a List. + + + + Positions of items are relative to each other, and they must all be in the + + same place. In order to make editing easier it is therefore recommanded to + + make stacked clones of svg elements spread nearby the list. + + + + A named list of named graphical elements + + @@ -6025,25 +6138,6 @@ }, - - - - - - styles: { - - - - - - : " - - ", - - - }, - - @@ -7332,6 +7426,87 @@ ], + + + + + + 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. + + + + A named list of ordered texts + + + + + + texts: [ + + + id(" + + "), + + + ].reverse(), + + + + + + + + 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. + + + + A named list of named texts + + + + + + styles: { + + + + + + : " + + ", + + + }, + +