1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2004-2006 - INRIA - Farid Belahcene
// Copyright (C) 2013 - Samuel GOUGEON
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
function [fail] = setTitleLabelProperty(PropertyName,PropertyValue,titlelabel,current_figure,cur_draw_mode)
// SETTITLELABELPROPERTY function
// is used by the functions title, xlabel, ylabel, zlabel
// This function sets the title (or x_, y_, z_label) properties
fail=0;
//conversion to lower format
str = convstr(PropertyName);
//Property = ['foreground' 'clipping'];
[PName] = getTitleLabelPropertyNam(str, current_figure, cur_draw_mode)
if (PName==[])
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
select PName
/////////////////////////
case "font_size" // <=> fontsize
/////////////////////////
if (type(PropertyValue)<>1 | size(PropertyValue,"*")<>1)
warning(msprintf(gettext("%s: Wrong type for input argument #%d: A real matrix expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
titlelabel.font_size = PropertyValue
return
/////////////////////////
case "font_angle" // <=> rotation
/////////////////////////
if (type(PropertyValue)<>1 | size(PropertyValue,"*")<>1)
warning(msprintf(gettext("%s: Wrong type for input argument #%d: A real matrix expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
titlelabel.auto_rotation = "off"
newPropertyValue = modulo(PropertyValue,360)
titlelabel.font_angle = 360 - newPropertyValue
return
/////////////////////////
case "font_foreground" // <=> color or edgecolor
/////////////////////////
if (type(PropertyValue) == 10)
index = getColorIndex(PropertyValue);
ColorVal = ["red" "green" "blue" "cyan" "magenta" "yellow" "black" "black" "white"]
if index < 10
titlelabel.font_foreground = color(ColorVal(index));
elseif index == 10 // 'none' selected
titlelabel.color_mode = 0; // <=> - colormap(1) and not black at all!!
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
elseif (type(PropertyValue) == 1) // we entered plot(x,y,'Color',[R,G,B])
if (size(PropertyValue,"*")==3)
titlelabel.font_foreground = addcolor(PropertyValue);
else
titlelabel.font_foreground = PropertyValue;
end
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "foreground" // <=> foregroundcolor
/////////////////////////
if (type(PropertyValue) == 10)
index = getColorIndex(PropertyValue);
ColorVal = ["red" "green" "blue" "cyan" "magenta" "yellow" "black" "black" "white"]
if index < 10
titlelabel.fill_mode = "on"
titlelabel.foreground = color(ColorVal(index));
elseif index == 10 // 'none' selected
titlelabel.color_mode = 0; // <=> - colormap(1) and not black at all!!
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
elseif (type(PropertyValue) == 1) // we entered plot(x,y,'Color',[R,G,B])
if (size(PropertyValue,"*")==3)
titlelabel.fill_mode = "on"
titlelabel.foreground = addcolor(PropertyValue);
else
titlelabel.fill_mode = "on"
titlelabel.foreground = PropertyValue;
end
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "background" // <=> backgroundcolor
/////////////////////////
if (type(PropertyValue) == 10)
index = getColorIndex(PropertyValue);
ColorVal = ["red" "green" "blue" "cyan" "magenta" "yellow" "black" "black" "white"]
if index < 10
titlelabel.fill_mode = "on"
titlelabel.background = color(ColorVal(index));
elseif index == 10 // 'none' selected
titlelabel.color_mode = 0; // <=> - colormap(1) and not black at all!!
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
elseif (type(PropertyValue) == 1) // we entered plot(x,y,'Color',[R,G,B])
if (size(PropertyValue,"*")==3)
titlelabel.fill_mode = "on"
titlelabel.background = addcolor(PropertyValue);
else
titlelabel.fill_mode = "on"
titlelabel.background = PropertyValue;
end
else
warning(msprintf(gettext("%s: Wrong type for input argument #%d: Vector or index in the colormap expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "text" // <=> string
/////////////////////////
if (type(PropertyValue) == 10)
titlelabel.text = PropertyValue;
return
else
warning(msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "position" // <=> position, à completer: la position par rapport à z n'est pas pris en compte, de plus le vecteur position doit contenir des coordonnées utilisateur (coordonnées selon l'axe)
/////////////////////////
if type(PropertyValue) == 1 & size(PropertyValue,"*")<=3
titlelabel.auto_position = "off";
titlelabel.position = PropertyValue ;
return
else
warning(msprintf(gettext("%s: Wrong size or type for input argument #%d: A real matrix expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "visible" // <=> visible
/////////////////////////
if type(PropertyValue) == 10
if or(PropertyValue == ["off" "of"])
titlelabel.visible = "off";
return
elseif PropertyValue == "on"
titlelabel.visible = "on";
return
else
warning(_("Incorrect input: ..."));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
else
warning(msprintf(_("%s: Wrong type for input argument #%d: A string expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
/////////////////////////
case "font_style" // <=> fontangle
/////////////////////////
fonts = ["courrier" "symbol" "times" "times italic" "times bold" ..
"times bold italic" "helvetica" "helvetica italic" "helvetica bold"..
"helvetica bold italic" ]
if typeof(PropertyValue) == "string"
PropertyValue = convstr(PropertyValue,"l")
if or(PropertyValue == fonts)
titlelabel.font_style = find(fonts==PropertyValue)-1;
else
warning(msprintf(_("%s: Wrong value for input argument #%d: At least one ""%s"" expected.\n"),"setTitleLabelProperty",2, "font"));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
elseif typeof(PropertyValue) == "constant" & or(PropertyValue==(0:9))
titlelabel.font_style = PropertyValue;
else
warning(msprintf(_("%s: Wrong type for input argument #%d: A real matrix or a string matrix expected.\n"),"setTitleLabelProperty",2));
ResetFigureDDM(current_figure, cur_draw_mode);
return;
end
end
endfunction
function k = getIndexInStringTable(pattern, table)
str = convstr(pattern);
k = find(part(table,1:length(str))==str);
endfunction
|