BUG DESCRIPTION:
----------------
All features enabling to display, explore, or even edit complex data in containers are very welcome.
On this topic, tree_show() is a main function. However, it deserves several improvements.
We propose to implement the following:
A) The display of the following contents should be more explicit:
-------------------------------------------------------------
- implicitlist objects like $:-1:3
- only "implicitlist" is displayed.
- proposal: display the value (e.g. $:-1:3)
- Scilab macro (type 13):
- only "function" is displayed.
- proposal: display the function name and the number of logical lines defining it.
- Scilab libraries (type 14):
- only "library" is displayed.
- proposal: display the name, the path, and the number of public functions of the library.
- Rationals: proposal: remove the display of dt=[]
- cells were displayed as mlists => update the display (see bug 16120)
- For all containers: Proposals:
- if the container is empty: directly displays its empty form.
- else:
- displays the type of container on its root node.
- If the container is sizeable and is not scalar: displays its sizes on its root node.
- Examples:
list(), [list]
{}, [cell], [2x3 cell], [2x3x4 cell]
struct(), [struct], [2x3x4 struct]
tlist(""), [<type> tlist], [4x3x2 <type> tlist]
mlist(""), [<type> mlist], [4x3x2 <type> mlist]
B) For non-scalar array of containers (cells, structures, array of mlist or of tlist)
----------------------------------------------------------------------------------
Presently, the displayed address of each component is its linearized index in the array.
This is satisfying if the array is a 1D one (a row or column vector of cell sor structs, etc..)
Otherwise, this is not handy: the user should have had good reasons to define a 2D or ND array.
Proposal: in case of 2D or ND array, display the detailled indices (i,j,..) as address.
in case of vector, keep the display of the linearized index.
Example: tree_show({%pi, %i, %z-%i; "abc", {}, list({0,"1",2+0*%z},2.5)})
[2x3 cell]
(1,1) : 3.1415927
(2,1) : "abc"
(1,2) : i
(2,2) : { }
(1,3) : -i+z
(2,3) : [list]
1: [1x3 cell]
1: 0
2: "1"
3: 2
2: 2.5
C) rootTitle: new option to set a title at the root node of the tree
-----------------------------------------------------------------
It is presently not possible to set a given text as root's label.
Proposal: add an input option (single string) setting the label.
D) New arrayByFields option, for any non-scalar array of structures or lists with fields:
-------------------------------------------------------------------------------------
Presently, tree_show() first lists the fields, and for each of them,
lists the values of the array components:
films(1) = struct("Title", "A.I. Artificial Intelligence",..
"Year", 2001, ..
"Director", "Steven Spielberg", ..
"Duration", 140);
films(2) = struct("Title", "I, robot", ..
"Year", 2004, ..
"Director", "Alex Proyas", ..
"Duration", 120);
films(3) = struct("Title", "2001: A space odyssey", ..
"Year", 1968, ..
"Director", "Stanley Kubrick", ..
"Duration", 141);
tree_show(films) // result:
Root
Title
1: "A.I. Artificial Intelligence"
2: "I, robot"
3: "2001: A space odyssey"
Year
1: 2001
2: 2004
3: 1968
Director
1: "Steven Spielberg"
2: "Alex Proyas"
3: "Stanley Kubrick"
Duration
1: 140
2: 120
3: 141
This only display mode prevents presenting each component as an object in its whole.
Proposal: add an arrayByFields scalar boolean input option:
- if %T: the present historical display is used.
- if %F (default): The display first lists components, and for each of them, lists its fields:
tree_show(films,,,%f) // Result:
[3x1 struct]
1:
Title: "A.I. Artificial Intelligence"
Year: 2001
Director: "Steven Spielberg"
Duration: 140
2:
Title: "I, robot"
Year: 2004
Director: "Alex Proyas"
Duration: 120
3:
Title: "2001: A space odyssey"
Year: 1968
Director: "Stanley Kubrick"
Duration: 141
E) New styles input option (single string) for addresses and contents
------------------------------------------------------------------
Presently, it is not possible to customize the style of addresses
(indices or/and fields names) or/and the style of displayed contents.
Proposal: add a styles option = single string using HTML.4 fonts styling tags.
Default: we propose to display addresses in blue.
Cancellation: "" returns to black
OTHER INFORMATION:
------------------
See also the bug 16120 and the bug 16121.