* Bug 15067 fixed: adds D&D of XMI files
[scilab.git] / scilab / modules / graphics / macros / datatips / datatipSetStruct.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2010 - INRIA - Serge Steer <serge.steer@inria.fr>
3 //
4 // Copyright (C) 2012 - 2016 - Scilab Enterprises
5 //
6 // This file is hereby licensed under the terms of the GNU GPL v2.0,
7 // pursuant to article 5.3.4 of the CeCILL v.2.1.
8 // This file was originally licensed under the terms of the CeCILL v2.1,
9 // and continues to be available under such terms.
10 // For more information, see the COPYING file which you should have received
11 // along with this program.
12
13 function ok=datatipSetStruct(curve,t)
14     if argn(2)<>2 then
15         error(msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"),...
16         "datatipSetStruct",2))
17     end
18     if type(curve)<>9|size(curve,"*")<>1|or(curve.type<>"Polyline") then
19         error(msprintf(_("%s: Wrong type for input argument #%d: A ''%s'' handle expected.\n"),...
20         "datatipSetType",1,"Polyline"))
21     end
22
23     ok=%t
24     %datatips_i_s=generic_i_s
25     %datatips_i_st=generic_i_st
26     u_d=get(curve,"user_data")
27     if u_d==[] then
28         u_d.datatips=t
29     else
30         if typeof(u_d)=="st"  then
31             u_d.datatips=t
32         elseif typeof(u_d)=="datatips" //for compatibilty
33             u.datatips=u_d
34             u_d=u
35         else
36             ok=%f
37             warning(msprintf(_("%s: Wrong type for curve user_data field: a struct expected.\n"),...
38             "datatipSetStruct"))
39         end
40     end
41     set(curve,"user_data",u_d)
42 endfunction