1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2004-2006 - INRIA - Fabrice Leray
4 * Copyright (C) 2006 - INRIA - Allan Cornet
5 * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
6 * Copyright (C) 2010 - DIGITEO - Manuel Juliachs
7 * Copyright (C) 2011 - DIGITEO - Vincent Couvert
8 *
9 * Copyright (C) 2012 - 2016 - Scilab Enterprises
10 *
11 * This file is hereby licensed under the terms of the GNU GPL v2.0,
12 * pursuant to article 5.3.4 of the CeCILL v.2.1.
13 * This file was originally licensed under the terms of the CeCILL v2.1,
14 * and continues to be available under such terms.
15 * For more information, see the COPYING file which you should have received
16 * along with this program.
17 *
18 */
19
20 /*------------------------------------------------------------------------*/
21 /* file: get_legend_location_property.c */
22 /* desc : function to retrieve in Scilab the legend_location (place) field of */
23 /* a handle */
24 /*------------------------------------------------------------------------*/
25
26 #include <string.h>
27
28 #include "getHandleProperty.h"
29 #include "GetProperty.h"
30 #include "returnProperty.h"
31 #include "Scierror.h"
32 #include "localization.h"
33
34 #include "getGraphicObjectProperty.h"
35 #include "graphicObjectProperties.h"
36
37 /*------------------------------------------------------------------------*/
get_legend_location_property(void * _pvCtx,int iObjUID)38 void* get_legend_location_property(void* _pvCtx, int iObjUID)
39 {
40 int iLegendLocation = 0;
41 int* piLegendLocation = &iLegendLocation;
42
43 getGraphicObjectProperty(iObjUID, __GO_LEGEND_LOCATION__, jni_int, (void**)&piLegendLocation);
44
45 if (piLegendLocation == NULL)
46 {
47 Scierror(999, _("'%s' property does not exist for this handle.\n"), "legend_location");
48 return NULL;
49 }
50
51 if (iLegendLocation == 0)
52 {
53 return sciReturnString("in_upper_right");
54 }
55 else if (iLegendLocation == 1)
56 {
57 return sciReturnString("in_upper_left");
58 }
59 else if (iLegendLocation == 2)
60 {
61 return sciReturnString("in_lower_right");
62 }
63 else if (iLegendLocation == 3)
64 {
65 return sciReturnString("in_lower_left");
66 }
67 else if (iLegendLocation == 4)
68 {
69 return sciReturnString("out_upper_right");
70 }
71 else if (iLegendLocation == 5)
72 {
73 return sciReturnString("out_upper_left");
74 }
75 else if (iLegendLocation == 6)
76 {
77 return sciReturnString("out_lower_right");
78 }
79 else if (iLegendLocation == 7)
80 {
81 return sciReturnString("out_lower_left");
82 }
83 else if (iLegendLocation == 8)
84 {
85 return sciReturnString("upper_caption");
86 }
87 else if (iLegendLocation == 9)
88 {
89 return sciReturnString("lower_caption");
90 }
91 else if (iLegendLocation == 10)
92 {
93 return sciReturnString("by_coordinates");
94 }
95 else
96 {
97 Scierror(999, _("Wrong value for '%s' property.\n"), "legend_location");
98 }
99
100 return NULL;
101 }
102 /*------------------------------------------------------------------------*/
103