@@ DEV @@ : Try to use Java MVC for graphics component.
[scilab.git] / scilab / modules / graphics / macros / %h_p.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) INRIA
3 // This file must be used under the terms of the CeCILL.
4 // This source file is licensed as described in the file COPYING, which
5 // you should have received as part of this distribution.  The terms
6 // are also available at
7 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
8
9 function %h_p(h)
10     if size(h,'*')>1 then
11             T=matrix(h.type,size(h))
12             t=''
13         for k=1:size(h,2)
14             t=t+part(T(:,k),1:max(length(T(:,k)))+1)
15         end
16         t1=string(size(h,1))+' by '+string(size(h,2))+' matrix of handles:'
17         t1=[t1;part('=',ones(1,length(t1)))]
18         t=[t1;t]
19     else
20         if (h.type=="Waitbar" | h.type=="Progressionbar")
21             t="Handle of type """+h.type+"""";
22         else
23             t="Handle of type """+h.type+""" with properties:"
24             t=[t;part('=',ones(1,length(t)))]
25         end
26
27         select h.type
28
29         // Polyline
30         // =====================================================================
31
32         case "Polyline"
33
34             if size(h.data,'*') > 10 then
35                 d="matrix "+strcat(string(size(h.data)),'x')
36             else
37                 d=sci2exp(h.data,0)
38                 if length(d)>70 then d="matrix "+strcat(string(size(h.data)),'x'),end
39             end
40
41             if size(h.x_shift,'*') > 10 then
42                 bxs="matrix "+strcat(string(size(h.x_shift)),'x')
43             else
44                 bxs=sci2exp(h.x_shift,0)
45                 if length(bxs)>70 then bxs="matrix "+strcat(string(size(h.x_shift)),'x'),end
46             end
47
48             if size(h.y_shift,'*') > 10 then
49                 bys="matrix "+strcat(string(size(h.y_shift)),'x')
50             else
51                 bys=sci2exp(h.y_shift,0)
52                 if length(bys)>70 then bys="matrix "+strcat(string(size(h.y_shift)),'x'),end
53             end
54
55             if size(h.z_shift,'*') > 10 then
56                 bzs="matrix "+strcat(string(size(h.z_shift)),'x')
57             else
58                 bzs=sci2exp(h.z_shift,0)
59                 if length(bzs)>70 then bzs="matrix "+strcat(string(size(h.z_shift)),'x'),end
60             end
61
62             u=h.user_data;
63             t=[t;
64                 "parent: "+h.parent.type
65                 "children: "+fmtchildren(h.children)
66                 "visible = "+sci2exp(h.visible)
67                 "data = "+d
68                 "closed = "+sci2exp(h.closed)
69                 "line_mode = "+sci2exp(h.line_mode)
70                 "fill_mode = "+sci2exp(h.fill_mode)
71                 "line_style = "+string(h.line_style)
72                 "thickness = "+string(h.thickness)
73                 "arrow_size_factor = "+string(h.arrow_size_factor)
74                 "polyline_style = "+string(h.polyline_style)
75                 "foreground = "+string(h.foreground)
76                 "background = "+string(h.background)
77                 "interp_color_vector = "+sci2exp(h.interp_color_vector)
78                 "interp_color_mode = "+sci2exp(h.interp_color_mode)
79                 "mark_mode = "+sci2exp(h.mark_mode)
80                 "mark_style = "+sci2exp(h.mark_style)
81                 "mark_size_unit = "+sci2exp(h.mark_size_unit)
82                 "mark_size = "+string(h.mark_size)
83                 "mark_foreground = "+string(h.mark_foreground)
84                 "mark_background = "+string(h.mark_background)
85                 "x_shift = "+bxs
86                 "y_shift = "+bys
87                 "z_shift = "+bzs
88                 "bar_width = "+sci2exp(h.bar_width)
89                 "clip_state = "+sci2exp(h.clip_state)
90                 "clip_box = "+sci2exp(h.clip_box)
91                 "user_data = "+fmtuser_data(u)
92             ]
93
94         // Compound
95         // =====================================================================
96
97         case "Compound"
98             u=h.user_data
99             t=[t;
100             "parent: "+h.parent.type
101             "children: "+fmtchildren(h.children)
102             "visible = "+sci2exp(h.visible)
103             "user_data = "+fmtuser_data(u)]
104
105         // Axes
106         // =====================================================================
107
108         case "Axes"
109
110             T=h.x_ticks
111             if size(T.locations,'*')>9 then
112                 locx="matrix "+strcat(string(size(T.locations)),'x')
113                 labx="matrix "+strcat(string(size(T.labels)),'x')
114             else
115                 locx=sci2exp(T.locations,0)
116                 labx=sci2exp(T.labels,0)
117                 if length(locx)>70 then locx="matrix "+strcat(string(size(T.locations)),'x'), end
118                 if length(labx)>70 then labx="matrix "+strcat(string(size(T.labels)),'x'), end
119             end
120
121             T=h.y_ticks
122             if size(T.locations,'*')>9 then
123                 locy="matrix "+strcat(string(size(T.locations)),'x')
124                 laby="matrix "+strcat(string(size(T.labels)),'x')
125             else
126                 locy=sci2exp(T.locations,0)
127                 laby=sci2exp(T.labels,0)
128                 if length(locy)>70 then locx="matrix "+strcat(string(size(T.locations)),'x'), end
129                 if length(laby)>70 then labx="matrix "+strcat(string(size(T.labels)),'x'), end
130             end
131
132             T=h.z_ticks
133             if size(T.locations,'*')>9 then
134                 locz="matrix "+strcat(string(size(T.locations)),'x')
135                 labz="matrix "+strcat(string(size(T.labels)),'x')
136             else
137                 locz=sci2exp(T.locations,0)
138                 labz=sci2exp(T.labels,0)
139                 if length(locz)>70 then locx="matrix "+strcat(string(size(T.locations)),'x'), end
140                 if length(labz)>70 then labx="matrix "+strcat(string(size(T.labels)),'x'), end
141             end
142
143             u=h.user_data
144             t=[t;
145                 "parent: "+h.parent.type
146                 "children: "+fmtchildren(h.children)
147                 " "
148                 "visible = "+sci2exp(h.visible)
149                 "axes_visible = "+sci2exp(h.axes_visible)
150                 "axes_reverse = "+sci2exp(h.axes_reverse)
151                 "grid = "+sci2exp(h.grid,0)
152                                 "grid_position = "+sci2exp(h.grid_position)
153                 "x_location = "+sci2exp(h.x_location)
154                 "y_location = "+sci2exp(h.y_location)
155                 "title: "+fmtchildren(h.title)
156                 "x_label: "+fmtchildren(h.x_label)
157                 "y_label: "+fmtchildren(h.y_label)
158                 "z_label: "+fmtchildren(h.z_label)
159                 "auto_ticks = "+sci2exp(h.auto_ticks)
160                 "x_ticks.locations = "+locx
161                 "y_ticks.locations = "+locy
162                 "z_ticks.locations = "+locz
163                 "x_ticks.labels = "+labx
164                 "y_ticks.labels = "+laby
165                 "z_ticks.labels = "+labz
166                 "box = "+sci2exp(h.box)
167                 "filled = " + sci2exp(h.filled)
168                 "sub_ticks = "+sci2exp(h.sub_ticks,0)
169                 "font_style = "+string(h.font_style)
170                 "font_size = "+string(h.font_size)
171                 "font_color = "+string(h.font_color)
172                 "fractional_font = " + sci2exp(h.fractional_font)
173                 " "
174                 "isoview = "+sci2exp(h.isoview)
175                 "cube_scaling = "+sci2exp(h.cube_scaling)
176                 "view = "+sci2exp(h.view)
177                 "rotation_angles = "+sci2exp(h.rotation_angles,0)
178                 "log_flags = "+sci2exp(h.log_flags)
179                 "tight_limits = "+sci2exp(h.tight_limits)
180                 "data_bounds = "+sci2exp(h.data_bounds,0)
181                 "zoom_box = "+sci2exp(h.zoom_box,0)
182                 "margins = "+sci2exp(h.margins,0)
183                 "axes_bounds = "+sci2exp(h.axes_bounds,0)
184                 " "
185                 "auto_clear = "+sci2exp(h.auto_clear)
186                 "auto_scale = "+sci2exp(h.auto_scale)
187                 " "
188                 "hidden_axis_color = " + string(h.hidden_axis_color);
189                 "hiddencolor = "+string(h.hiddencolor)
190                 "line_mode = "+sci2exp(h.line_mode)
191                 "line_style = "+string(h.line_style)
192                 "thickness = "+string(h.thickness)
193                 "mark_mode = "+sci2exp(h.mark_mode)
194                 "mark_style = "+sci2exp(h.mark_style,0)
195                 "mark_size_unit = "+sci2exp(h.mark_size_unit)
196                 "mark_size = "+sci2exp(h.mark_size,0)
197                 "mark_foreground = "+string(h.mark_foreground)
198                 "mark_background = "+string(h.mark_background)
199                 "foreground = "+string(h.foreground)
200                 "background = "+string(h.background)
201                 "arc_drawing_method = " + sci2exp(h.arc_drawing_method)
202                 "clip_state = "+sci2exp(h.clip_state)
203                 "clip_box = "+sci2exp(h.clip_box,0)
204                 "user_data = "+fmtuser_data(h.user_data)
205             ]
206
207         // Legend
208         // =====================================================================
209
210         case "Legend"
211           t=[t;
212              "parent: "+h.parent.type
213              "children: "+fmtchildren(h.children)
214              "visible = "+sci2exp(h.visible)
215              "text = "+sci2exp(h.text)
216              "font_style = "+string(h.font_style)
217              "font_size = "+string(h.font_size)
218              "font_color = "+string(h.font_color)
219              "fractional_font = " + sci2exp(h.fractional_font)
220              "links = " +  fmtchildren(h.links)
221              "legend_location = " + sci2exp(h.legend_location)
222              "position = " + sci2exp(h.position)
223              "line_mode = "+sci2exp(h.line_mode)
224              "thickness = "+string(h.thickness)
225              "foreground = "+string(h.foreground)
226              "fill_mode = "+sci2exp(h.fill_mode)
227              "background = "+string(h.background)
228              "clip_state = "+sci2exp(h.clip_state)
229              "clip_box = "+sci2exp(h.clip_box,0)
230              "user_data = "+fmtuser_data(h.user_data)
231               ]
232
233         // Rectangle
234         // =====================================================================
235
236         case "Rectangle"
237             u=h.user_data
238             t=[t;
239                 "parent: "+h.parent.type
240                 "children: "+fmtchildren(h.children)
241                 "mark_mode = "+sci2exp(h.mark_mode)
242                 "mark_style = "+string(h.mark_style)
243                 "mark_size_unit = "+sci2exp(h.mark_size_unit)
244                 "mark_size = "+string(h.mark_size)
245                 "mark_foreground = "+string(h.mark_foreground)
246                 "mark_background = "+string(h.mark_background)
247                 "line_mode = "+sci2exp(h.line_mode)
248                 "fill_mode = "+sci2exp(h.fill_mode)
249                 "line_style = "+string(h.line_style)
250                 "thickness = "+string(h.thickness)
251                 "foreground = "+string(h.foreground)
252                 "background = "+string(h.background)
253                 "data = "+sci2exp(h.data,0)
254                 "visible = "+sci2exp(h.visible)
255                 "clip_state = "+sci2exp(h.clip_state)
256                 "clip_box = "+sci2exp(h.clip_box,0)
257                 "user_data = "+fmtuser_data(u)
258             ]
259
260         // Arc
261         // =====================================================================
262
263         case "Arc"
264             u=h.user_data
265             t=[t;
266                 "parent: "+h.parent.type
267                 "children: "+fmtchildren(h.children)
268                 "thickness = "+string(h.thickness)
269                 "line_style = "+string(h.line_style)
270                 "line_mode = "+sci2exp(h.line_mode)
271                 "fill_mode = "+sci2exp(h.fill_mode)
272                 "foreground = "+string(h.foreground)
273                 "background = "+string(h.background)
274                 "data = "+sci2exp(h.data,0)
275                 "visible = "+sci2exp(h.visible)
276                 "arc_drawing_method = " + sci2exp(h.arc_drawing_method)
277                 "clip_state = "+sci2exp(h.clip_state)
278                 "clip_box = "+sci2exp(h.clip_box,0)
279                 "user_data = "+fmtuser_data(u)
280             ]
281
282         // Figure
283         // =====================================================================
284
285         case "Figure"
286             u=h.user_data
287             t=[t;
288                 "children: "+fmtchildren(h.children)
289                 "figure_position = "+sci2exp(h.figure_position,0)
290                 "figure_size = "+sci2exp(h.figure_size,0)
291                 "axes_size = "+sci2exp(h.axes_size,0)
292                 "auto_resize = "+sci2exp(h.auto_resize)
293                 "viewport = "+sci2exp(h.viewport)
294                 "figure_name = "+sci2exp(h.figure_name,0)
295                 "figure_id = "+sci2exp(h.figure_id,0)
296                 "info_message = "+sci2exp(h.info_message)
297                 "color_map= matrix "+strcat(string(size(h.color_map)),'x')
298                 "pixmap = "+sci2exp(h.pixmap)
299                 "pixel_drawing_mode = "+sci2exp(h.pixel_drawing_mode,0)
300                                 "anti_aliasing = " + sci2exp(h.anti_aliasing)
301                 "immediate_drawing = "+sci2exp(h.immediate_drawing)
302                 "background =  "+string(h.background)
303                 "visible = "+sci2exp(h.visible)
304                 "rotation_style = "+sci2exp(h.rotation_style)
305                 "event_handler = " + sci2exp( h.event_handler ) ;
306                 "event_handler_enable = " + sci2exp( h.event_handler_enable ) ;
307                 "user_data = "+fmtuser_data(u)
308                 "tag = "+sci2exp(h.tag)
309                 "UID = "+sci2exp(h.UID)
310             ]
311
312         // Grayplot
313         // =====================================================================
314
315         case "Grayplot"
316             Data = h.data
317             if size(Data.x,'*') > 10 then
318                 dx="matrix "+strcat(string(size(Data.x)),'x')
319             else
320                 dx=sci2exp(Data.x,0)
321                 if length(dx)>70 then d="matrix "+strcat(string(size(Data.x)),'x'),end
322             end
323
324             if size(Data.y,'*') > 10 then
325                 dy="matrix "+strcat(string(size(Data.y)),'x')
326             else
327                 dy=sci2exp(Data.y,0)
328                 if length(dy)>70 then d="matrix "+strcat(string(size(Data.y)),'x'),end
329             end
330
331             if size(Data.z,'*') > 10 then
332                 dz="matrix "+strcat(string(size(Data.z)),'x')
333             else
334                 dz=sci2exp(Data.z,0)
335                 if length(dz)>70 then d="matrix "+strcat(string(size(Data.z)),'x'),end
336             end
337
338             u=h.user_data
339             t=[t;
340                 "parent: "+h.parent.type
341                 "children: "+fmtchildren(h.children)
342                 "visible = "+sci2exp(h.visible)
343                 "data.x = "+dx
344                 "data.y = "+dy
345                 "data.z = "+dz
346                 "data_mapping = "+sci2exp(h.data_mapping)
347                 "clip_state = "+sci2exp(h.clip_state)
348                 "clip_box = "+sci2exp(h.clip_box,0)
349                 "user_data = "+fmtuser_data(u)
350             ]
351
352         // Matplot
353         // =====================================================================
354
355
356         case "Matplot"
357             if size(h.data,'*') > 10 then
358                 d="matrix "+strcat(string(size(h.data)),'x')
359             else
360                 d=sci2exp(h.data,0)
361                 if length(d)>70 then d="matrix "+strcat(string(size(h.data)),'x'),end
362             end
363             u=h.user_data
364             t=[t;
365                 "parent: "+h.parent.type
366                 "children: "+fmtchildren(h.children)
367                 "visible = "+sci2exp(h.visible)
368                 "data = "+d
369                 "clip_state = "+sci2exp(h.clip_state)
370                 "clip_box = "+sci2exp(h.clip_box,0)
371                 "user_data = "+fmtuser_data(u)
372             ]
373
374         // Fec
375         // =====================================================================
376         case "Fec"
377             u=h.user_data
378             if size(h.data,'*') > 10 then
379                 d="matrix "+strcat(string(size(h.data)),'x')
380             else
381                 d=sci2exp(h.data,0)
382                 if length(d)>70 then d="matrix "+strcat(string(size(h.data)),'x'),end
383             end
384
385             if size(h.triangles,'*') > 10 then
386                 f="matrix "+strcat(string(size(h.triangles)),'x')
387             else
388                 f=sci2exp(h.triangles,0)
389                 if length(f)>70 then f="matrix "+strcat(string(size(h.triangles)),'x'),end
390             end
391
392             t=[t;
393                 "parent: "+h.parent.type
394                 "children: "+fmtchildren(h.children)
395                 "visible = "+sci2exp(h.visible)
396                 "data = "+d
397                 "triangles = "+f
398                 "z_bounds = "+sci2exp(h.z_bounds,0)
399                                 "color_range = " + sci2exp(h.color_range, 0);
400                                 "outside_colors = " + sci2exp(h.outside_colors, 0);
401                                 "line_mode = " + sci2exp(h.line_mode);
402                                 "foreground = " + sci2exp(h.foreground);
403                 "clip_state = "+sci2exp(h.clip_state)
404                 "clip_box = "+sci2exp(h.clip_box,0)
405                 "user_data = "+fmtuser_data(u)
406             ]
407
408         // Segs
409         // =====================================================================
410
411         case "Segs"
412             if size(h.data,'*') > 10 then
413                 d="matrix "+strcat(string(size(h.data)),'x')
414             else
415                 d=sci2exp(h.data,0)
416                 if length(d)>70 then d="matrix "+strcat(string(size(h.data)),'x'),end
417             end
418
419             if size(h.segs_color,'*') > 10 then
420                 c="matrix "+strcat(string(size(h.segs_color)),'x')
421             else
422                 c=sci2exp(h.segs_color,0)
423                 if length(c)>70 then c="matrix "+strcat(string(size(h.segs_color)),'x'),end
424             end
425
426             u=h.user_data
427             t=[t;
428                 "parent: "+h.parent.type
429                 "children: "+fmtchildren(h.children)
430                 "visible = "+sci2exp(h.visible)
431                 "data = "+d
432                 "line_mode = "+sci2exp(h.line_mode)
433                 "line_style = "+string(h.line_style)
434                 "thickness = "+string(h.thickness)
435                 "arrow_size = "+string(h.arrow_size)
436                 "segs_color = "+c
437                 "mark_mode = "+sci2exp(h.mark_mode)
438                 "mark_style = "+sci2exp(h.mark_style)
439                 "mark_size_unit = "+sci2exp(h.mark_size_unit)
440                 "mark_size = "+string(h.mark_size)
441                 "mark_foreground = "+string(h.mark_foreground)
442                 "mark_background = "+string(h.mark_background)
443                 "clip_state = "+sci2exp(h.clip_state)
444                 "clip_box = "+sci2exp(h.clip_box,0)
445                 "user_data = "+fmtuser_data(u)
446             ]
447
448         // Champ
449         // =====================================================================
450
451         case "Champ"
452             Data = h.data
453             if size(Data.x,'*') > 10 then
454                 dx="matrix "+strcat(string(size(Data.x)),'x')
455             else
456                 dx=sci2exp(Data.x,0)
457                 if length(dx)>70 then d="matrix "+strcat(string(size(Data.x)),'x'),end
458             end
459
460             if size(Data.y,'*') > 10 then
461                 dy="matrix "+strcat(string(size(Data.y)),'x')
462             else
463                 dy=sci2exp(Data.y,0)
464                 if length(dy)>70 then d="matrix "+strcat(string(size(Data.y)),'x'),end
465             end
466
467             if size(Data.fx,'*') > 10 then
468                 dfx="matrix "+strcat(string(size(Data.fx)),'x')
469             else
470                 dfx=sci2exp(Data.fx,0)
471                 if length(dfx)>70 then d="matrix "+strcat(string(size(Data.fx)),'x'),end
472             end
473
474             if size(Data.fy,'*') > 10 then
475                 dfy="matrix "+strcat(string(size(Data.fy)),'x')
476             else
477                 dfy=sci2exp(Data.fy,0)
478                 if length(dfy)>70 then d="matrix "+strcat(string(size(Data.fy)),'x'),end
479             end
480
481             u=h.user_data
482             t=[t;
483                 "parent: "+h.parent.type
484                 "children: "+fmtchildren(h.children)
485                 "visible = "+sci2exp(h.visible)
486                 "data.x = "+dx
487                 "data.y = "+dy
488                 "data.fx = "+dfx
489                 "data.fy = "+dfy
490                 "line_style = "+string(h.line_style)
491                 "thickness = "+string(h.thickness)
492                 "colored = "+sci2exp(h.colored)
493                 "arrow_size = "+string(h.arrow_size)
494                 "clip_state = "+sci2exp(h.clip_state)
495                 "clip_box = "+sci2exp(h.clip_box,0)
496                 "user_data = "+fmtuser_data(u)
497             ]
498
499         // Text
500         // =====================================================================
501
502         case "Text"
503             u=h.user_data
504             T=sci2exp(h.text,0)
505             if length(T)>70 then T="string array "+strcat(string(size(h.text)),'x'),end
506             t=[t;
507                 "parent: "+h.parent.type
508                 "children: "+fmtchildren(h.children)
509                 "visible = "+sci2exp(h.visible)
510                 "text = "+T
511                 "alignment = "+sci2exp(h.alignment) ;
512                 "data = "+sci2exp(h.data,0)
513                 "box = "+sci2exp(h.box)
514                 "line_mode = " + sci2exp(h.line_mode);
515                 "fill_mode = " + sci2exp(h.fill_mode);
516                 "text_box = "+sci2exp(h.text_box,0)
517                 "text_box_mode = "+sci2exp(h.text_box_mode,0)
518                 "font_foreground = "+string(h.font_foreground)
519                 "foreground = "+string(h.foreground)
520                 "background = "+string(h.background)
521                 "font_style = "+string(h.font_style)
522                 "font_size = "+string(h.font_size)
523                 "fractional_font = " + sci2exp(h.fractional_font)
524                 "auto_dimensionning = " + sci2exp(h.auto_dimensionning)
525                 "font_angle = "+string(h.font_angle)
526                 "clip_state = "+sci2exp(h.clip_state)
527                 "clip_box = "+sci2exp(h.clip_box,0)
528                 "user_data = "+fmtuser_data(u)
529             ]
530
531         // Title
532         // =====================================================================
533
534         case "Title"
535             T=sci2exp(h.text,0)
536             if length(T)>70 then T="string array "+strcat(string(size(h.text)),'x'),end
537             t=[t;
538                 "parent: "+h.parent.type
539                 "children: "+fmtchildren(h.children)
540                 "visible = "+sci2exp(h.visible)
541                 "text = "+T
542                 "foreground = "+string(h.foreground)
543                 "font_style = "+string(h.font_style)
544                 "font_size = "+string(h.font_size)
545                 "fractional_font = " + sci2exp(h.fractional_font)
546                 "font_angle = "+string(h.font_angle)
547             ]
548
549         // Label
550         // =====================================================================
551
552         case "Label"
553             T=sci2exp(h.text,0)
554             if length(T)>70 then T="string array "+strcat(string(size(h.text)),'x'),end
555             t=[t;
556                 "parent: "+h.parent.type
557                 "visible = "+sci2exp(h.visible)
558                 "text = "+T;
559                 "font_foreground = " + string(h.font_foreground) ;
560                 "foreground = "+string(h.foreground)
561                 "background = "+string(h.background)
562                 "fill_mode = "+sci2exp(h.fill_mode)
563                 "font_style = "+string(h.font_style)
564                 "font_size = "+string(h.font_size)
565                 "fractional_font = " + sci2exp(h.fractional_font)
566                 "font_angle = "+string(h.font_angle)
567                 "auto_position = "+sci2exp(h.auto_position)
568                 "position = "+sci2exp(h.position,0)
569                 "auto_rotation = "+sci2exp(h.auto_rotation)
570             ]
571
572         // Plot3d
573         // =====================================================================
574         case "Plot3d"
575             Data = h.data
576             if size(Data.x,'*') > 10 then
577                 dx="matrix "+strcat(string(size(Data.x)),'x')
578             else
579                 dx=sci2exp(Data.x,0)
580                 if length(dx)>70 then d="matrix "+strcat(string(size(Data.x)),'x'),end
581             end
582
583             if size(Data.y,'*') > 10 then
584                 dy="matrix "+strcat(string(size(Data.y)),'x')
585             else
586                 dy=sci2exp(Data.y,0)
587                 if length(dy)>70 then d="matrix "+strcat(string(size(Data.y)),'x'),end
588             end
589
590             if size(Data.z,'*') > 10 then
591                 dz="matrix "+strcat(string(size(Data.z)),'x')
592             else
593                 dz=sci2exp(Data.z,0)
594                 if length(dz)>70 then d="matrix "+strcat(string(size(Data.z)),'x'),end
595             end
596
597             u=h.user_data
598
599             if size(Data) == 5 then // There is a color
600                 if size(Data.color,'*') > 10 then
601                     dcolor="matrix "+strcat(string(size(Data.color)),'x')
602                 else
603                     dcolor=sci2exp(Data.color,0)
604                     if length(dcolor)>70 then dcolor="matrix "+strcat(string(size(Data.color)),'x'),end
605                 end
606
607                 t=[t;
608                     "parent: "+h.parent.type
609                     "children: "+fmtchildren(h.children)
610                     "visible = "+sci2exp(h.visible)
611                     "surface_mode = "+sci2exp(h.surface_mode)
612                     "foreground = "+string(h.foreground)
613                     "thickness = "+string(h.thickness)
614                     "mark_mode = "+sci2exp(h.mark_mode)
615                     "mark_style = "+sci2exp(h.mark_style)
616                     "mark_size_unit = "+sci2exp(h.mark_size_unit)
617                     "mark_size = "+string(h.mark_size)
618                     "mark_foreground = "+string(h.mark_foreground)
619                     "mark_background = "+string(h.mark_background)
620                     "data.x = "+dx
621                     "data.y = "+dy
622                     "data.z "+dz
623                     "data.color (not used) = "+dcolor
624                     "color_mode = "+string(h.color_mode)
625                     "color_flag = "+sci2exp(h.color_flag,0)
626                     "hiddencolor = "+string(h.hiddencolor)
627                     "clip_state = "+sci2exp(h.clip_state)
628                     "clip_box = "+sci2exp(h.clip_box,0)
629                     "user_data = "+fmtuser_data(u)
630                 ]
631             else
632                 t=[t;
633                     "parent: "+h.parent.type
634                     "children: "+fmtchildren(h.children)
635                     "visible = "+sci2exp(h.visible)
636                     "surface_mode = "+sci2exp(h.surface_mode)
637                     "foreground = "+string(h.foreground)
638                     "thickness = "+string(h.thickness)
639                     "mark_mode = "+sci2exp(h.mark_mode)
640                     "mark_style = "+sci2exp(h.mark_style)
641                     "mark_size_unit = "+sci2exp(h.mark_size_unit)
642                     "mark_size = "+string(h.mark_size)
643                     "mark_foreground = "+string(h.mark_foreground)
644                     "mark_background = "+string(h.mark_background)
645                     "data.x = "+dx
646                     "data.y = "+dy
647                     "data.z = "+dz
648                     "color_mode = "+string(h.color_mode)
649                     "color_flag = "+sci2exp(h.color_flag,0)
650                     "hiddencolor = "+string(h.hiddencolor)
651                     "clip_state = "+sci2exp(h.clip_state)
652                     "clip_box = "+sci2exp(h.clip_box,0)
653                     "user_data = "+fmtuser_data(u)
654                 ]
655             end
656
657         // Fac3d
658         // =====================================================================
659
660         case "Fac3d"
661             Data = h.data
662             if size(Data.x,'*') > 10 then
663                 dx="matrix "+strcat(string(size(Data.x)),'x')
664             else
665                 dx=sci2exp(Data.x,0)
666                 if length(dx)>70 then d="matrix "+strcat(string(size(Data.x)),'x'),end
667             end
668
669             if size(Data.y,'*') > 10 then
670                 dy="matrix "+strcat(string(size(Data.y)),'x')
671             else
672                 dy=sci2exp(Data.y,0)
673                 if length(dy)>70 then d="matrix "+strcat(string(size(Data.y)),'x'),end
674             end
675
676             if size(Data.z,'*') > 10 then
677                 dz="matrix "+strcat(string(size(Data.z)),'x')
678             else
679                 dz=sci2exp(Data.z,0)
680                 if length(dz)>70 then d="matrix "+strcat(string(size(Data.z)),'x'),end
681             end
682
683             u=h.user_data;
684
685             if size(Data) == 5 then // There is a color
686                 if size(Data.color,'*') > 10 then
687                     dcolor="matrix "+strcat(string(size(Data.color)),'x')
688                 else
689                     dcolor=sci2exp(Data.color,0)
690                     if length(dcolor)>70 then dcolor="matrix "+strcat(string(size(Data.color)),'x'),end
691                 end
692
693                 t=[t;
694                     "parent: "+h.parent.type
695                     "children: "+fmtchildren(h.children)
696                     "visible = "+sci2exp(h.visible)
697                     "surface_mode = "+sci2exp(h.surface_mode)
698                     "foreground = "+string(h.foreground)
699                     "thickness = "+string(h.thickness)
700                     "mark_mode = "+sci2exp(h.mark_mode)
701                     "mark_style = "+sci2exp(h.mark_style)
702                     "mark_size_unit = "+sci2exp(h.mark_size_unit)
703                     "mark_size = "+string(h.mark_size)
704                     "mark_foreground = "+string(h.mark_foreground)
705                     "mark_background = "+string(h.mark_background)
706                     "data.x = "+dx
707                     "data.y = "+dy
708                     "data.z = "+dz
709                     "data.color = "+dcolor
710                     "color_mode = "+string(h.color_mode)
711                     "color_flag = "+sci2exp(h.color_flag,0)
712                     "cdata_mapping = "+sci2exp(h.cdata_mapping)
713                     "hiddencolor = "+string(h.hiddencolor)
714                     "clip_state = "+sci2exp(h.clip_state)
715                     "clip_box = "+sci2exp(h.clip_box,0)
716                     "user_data = "+fmtuser_data(u)
717                 ]
718             else
719                 t=[t;
720                     "parent: "+h.parent.type
721                     "children: "+fmtchildren(h.children)
722                     "visible = "+sci2exp(h.visible)
723                     "surface_mode = "+sci2exp(h.surface_mode)
724                     "foreground = "+string(h.foreground)
725                     "thickness = "+string(h.thickness)
726                     "mark_mode = "+sci2exp(h.mark_mode)
727                     "mark_style = "+sci2exp(h.mark_style)
728                     "mark_size_unit = "+sci2exp(h.mark_size_unit)
729                     "mark_size = "+string(h.mark_size)
730                     "mark_foreground = "+string(h.mark_foreground)
731                     "mark_background = "+string(h.mark_background)
732                     "data.x = "+dx
733                     "data.y = "+dy
734                     "data.z = "+dz
735                     "color_mode = "+string(h.color_mode)
736                     "color_flag = "+sci2exp(h.color_flag,0)
737                     "hiddencolor = "+string(h.hiddencolor)
738                     "clip_state = "+sci2exp(h.clip_state)
739                     "clip_box = "+sci2exp(h.clip_box,0)
740                     "user_data = "+fmtuser_data(u)
741                 ]
742             end
743
744         // Param3d
745         // =====================================================================
746
747         case "Param3d"
748             u=h.user_data;
749             if size(h.data,'*') > 10 then
750                 d="matrix "+strcat(string(size(h.data)),'x')
751             else
752                 d=sci2exp(h.data,0)
753                 if length(d)>70 then d="matrix "+strcat(string(size(h.data)),'x'),end
754             end
755
756             if size(h.surface_color,'*') > 10 then
757                 c="matrix "+strcat(string(size(h.surface_color)),'x')
758             else
759                 c=sci2exp(h.surface_color,0)
760                 if length(c)>70 then c="matrix "+strcat(string(size(h.surface_color)),'x'),end
761             end
762
763             t=[t;
764                 "parent: "+h.parent.type
765                 "children: "+fmtchildren(h.children)
766                 "visible = "+sci2exp(h.visible)
767                 "line_mode = "+sci2exp(h.line_mode)
768                 "foreground = "+string(h.foreground)
769                 "thickness = "+string(h.thickness)
770                 "mark_mode = "+sci2exp(h.mark_mode)
771                 "mark_style = "+sci2exp(h.mark_style)
772                 "mark_size_unit = "+sci2exp(h.mark_size_unit)
773                 "mark_size = "+string(h.mark_size)
774                 "mark_foreground = "+string(h.mark_foreground)
775                 "mark_background = "+string(h.mark_background)
776                 "data = "+d
777                 "clip_state = "+sci2exp(h.clip_state)
778                 "clip_box = "+sci2exp(h.clip_box,0)
779                 "color_mode = "+string(h.color_mode)
780                 "surface_color = "+c
781                 "user_data = "+fmtuser_data(u)
782             ]
783
784         // Axis
785         // =====================================================================
786
787         case "Axis"
788             u=h.user_data;
789             T=sci2exp(h.tics_labels,0)
790             if length(T)>70 then T="string array "+strcat(string(size(h.tics_labels)),'x'),end
791             t=[t;
792                 "parent: "+h.parent.type
793                 "visible = "+sci2exp(h.visible)
794                 "tics_direction = "+sci2exp(h.tics_direction)
795                 "xtics_coord = "+sci2exp(h.xtics_coord,0)
796                 "ytics_coord = "+sci2exp(h.ytics_coord,0)
797                 "tics_color = "+string(h.tics_color)
798                 "tics_segment = "+sci2exp(h.tics_segment)
799                 "tics_style = "+sci2exp(h.tics_style)
800                 "sub_tics = "+string(h.sub_tics)
801                 "tics_labels = "+T
802                 "format_n = "+sci2exp(h.format_n)
803                 "labels_font_size = "+string(h.labels_font_size)
804                 "labels_font_color = "+string(h.labels_font_color)
805                 "fractional_font = " + sci2exp(h.fractional_font)
806                 "clip_state = "+sci2exp(h.clip_state)
807                 "clip_box = "+sci2exp(h.clip_box,0)
808                 "user_data = "+fmtuser_data(u)
809             ]
810
811         // uimenu
812         // =====================================================================
813
814         case "uimenu"
815             t=[t;
816                 "Parent: "+h.parent.type
817                 "Children: "+fmtchildren(h.children)
818                 "Enable = "+sci2exp(h.enable)
819                 "Foregroundcolor = "+sci2exp(h.foregroundcolor,0)
820                 "Label = "+h.label
821                 //"Handle_visible = "+sci2exp(h.handle_visible)
822                 //"Position = "+sci2exp(h.position,0)
823                 "Visible = "+sci2exp(h.visible)
824                 "Callback = "+h.callback
825                 "CallbackType = "+sci2exp(h.callback_type,0)
826                 "Checked: "+sci2exp(h.checked)
827                 "Tag = "+h.tag
828             ]
829
830         // uicontextmenu
831         // =====================================================================
832
833         case "uicontextmenu"
834             t=[t;
835                 "Parent: "+h.parent.type
836                 "Children: "+fmtchildren(h.children)
837                 ]
838
839         // uicontrol
840         // =====================================================================
841
842         case "uicontrol"
843             u=h.user_data;
844             t=[t;
845             "Parent: "+h.parent.type
846             "Children: "+fmtchildren(h.children)
847             "BackgroundColor = "+sci2exp(h.backgroundcolor,0)
848             "Enable = "+sci2exp(h.enable)
849             "FontAngle = "+h.fontangle
850             "FontName = "+h.fontname
851             "FontSize = "+sci2exp(h.fontsize)
852             "FontUnits = "+h.fontunits
853             "FontWeight = "+h.fontweight
854             "ForegroundColor = "+sci2exp(h.foregroundcolor,0)
855             "HorizontalAlignment = "+h.horizontalalignment
856             "ListboxTop = "+sci2exp(h.listboxtop,0)
857             "Max = "+sci2exp(h.max)
858             "Min = "+sci2exp(h.min)
859             "Position = "+sci2exp(h.position,0)
860             "Relief = "+h.relief
861             "SliderStep = "+sci2exp(h.sliderstep)
862             "String = "+fmtuser_data(h.string)
863             "Style = "+h.style
864             "Units = "+h.units
865             "Value = "+sci2exp(h.value,0)
866             "VerticalAlignment = "+h.verticalalignment
867             "Visible = "+sci2exp(h.visible)
868             "Callback = "+h.callback
869             "CallbackType = "+sci2exp(h.callback_type,0)
870             //"Handle_visible = "+sci2exp(h.handle_visible)
871             "Userdata = "+fmtuser_data(u)
872             "Tag = "+h.tag
873             ]
874
875         end
876     end
877     write(%io(2),t)
878 endfunction
879
880
881
882
883 function t=fmtchildren(c)
884     if c==[] then
885         t='[]'
886     else
887         if size(c,'*')<10 then
888             t=sci2exp(c.type,0)
889             if length(t)>70 then t="matrix "+strcat(string(size(c)),'x'),end
890         else
891             t="matrix "+strcat(string(size(c)),'x')
892         end
893     end
894 endfunction
895
896
897 function t=fmtuser_data(d)
898     td= type(d)
899     if or(td==[1 2 3 4 8 10 15]) then
900         t=sci2exp(d,0)
901         if length(t)>70 then t=typeof(d)+" "+strcat(string(size(d)),'x'),end
902     elseif or(td==16) then
903         t=typeof(d)+" "+strcat(string(size(d)),'x'),
904     elseif or(td==17) then
905         if typeof(d)=="ce" then
906             t="cell "+strcat(string(size(d)),'x'),
907         elseif typeof(d)=="st" then
908             T=getfield(1,d)
909             t="struct with fields: "+strcat(T(3:$),' '),
910         else
911             t=typeof(d)
912         end
913     else
914         t=typeof(d)
915     end
916 endfunction