42d0eac359b41903291804a8368e73c67b5b16ce
[scilab.git] / scilab / modules / graphics / macros / datatips / datatipContextMenu.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 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at;
8 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
9 function  datatipContextMenu(ax)
10     //datatip utility function
11     f=gcf();
12
13     curve_handles=datatipGetEntities(ax);
14     [curve,dmin,ptmin,l]=datatipGetNearestEntity(pt,curve_handles)
15     if curve<>[]&dmin<10 then
16         ud=datatipGetStruct(curve);
17         items=[_("Delete all datatips")
18         _("Delete all datatips for the selected curve")
19         _("Delete nearest datatip")
20         _("Delete last datatip")
21         _("Delete selected datatip")
22         _("Open curve tip style editor")
23         _("Redraw all datatips")];
24     else
25         items=[_("Delete all datatips");
26         _("Delete selected datatip")];
27     end
28     sel=x_choose(items,"");
29     if sel>0 then
30         select items(sel)
31         case _("Delete all datatips") then
32             datatipRemoveAll(curve_handles);
33         case _("Delete all datatips for the selected curve") then;
34             datatipRemoveAll(curve);
35         case _("Delete nearest datatip") then
36             datatipRemoveNearest(curve,pt);
37         case _("Delete last datatip") then
38             //l=size(ud.tips,'*');
39             l=size(ud.tips.children,"*");
40             if l<>0 then
41                 datatipRemove(curve,1)
42             end
43         case _("Delete selected datatip") then
44             datatipDeleteSelected(curve_handles)
45         case _("Edit the curve tip display function") then
46             datatipSetDisplay(curve);
47         case _("select the curve tip display function")  then
48             datatipSelectFunction(curve);
49         case _("Enable interpolation") then
50             datatipSetInterp(curve,%T);
51         case _("Disable interpolation") then
52             datatipSetInterp(curve,%F);
53         case _("Multiple datatips mode") then
54             datatipSetReplaceMode(curve,%F);
55         case _("Unique datatip mode") then
56             datatipSetReplaceMode(curve,%t);
57         case _("Open curve tip style editor")  then
58             datatipsGUI(curve)
59             scf(f);
60             //datatipSetStyle(curve);
61         end
62     end
63 endfunction