summaryrefslogtreecommitdiffstats
path: root/scilab/modules/graphics
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-03-08 09:28:31 +0100
committerAllan CORNET <allan.cornet@scilab.org>2010-03-08 09:28:31 +0100
commitebc9ed15db4c2dd4b793d61002a52978390e8cec (patch)
treee8130210bec91d9fc40bad8cf9814cb73cebb483 /scilab/modules/graphics
parent8b7ac05e63459066060daee277f1a41d5b8905d3 (diff)
parent754079a86c585af7e088ede2e5bf3bc598d2c3a6 (diff)
downloadscilab-ebc9ed15db4c2dd4b793d61002a52978390e8cec.zip
scilab-ebc9ed15db4c2dd4b793d61002a52978390e8cec.tar.gz
Merge branch 'master' of git.scilab.org:scilab
Diffstat (limited to 'scilab/modules/graphics')
-rw-r--r--scilab/modules/graphics/help/en_US/hist3d.xml2
-rw-r--r--scilab/modules/graphics/help/fr_FR/hist3d.xml2
-rw-r--r--scilab/modules/graphics/macros/%h_load.sci1
-rw-r--r--scilab/modules/graphics/macros/%h_save.sci9
-rw-r--r--scilab/modules/graphics/macros/legend.sci5
-rw-r--r--scilab/modules/graphics/src/c/SetProperty.c9
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6531.dia.ref25
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6531.tst27
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref94
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst26
10 files changed, 188 insertions, 12 deletions
diff --git a/scilab/modules/graphics/help/en_US/hist3d.xml b/scilab/modules/graphics/help/en_US/hist3d.xml
index 8bff7c4..2d34751 100644
--- a/scilab/modules/graphics/help/en_US/hist3d.xml
+++ b/scilab/modules/graphics/help/en_US/hist3d.xml
@@ -59,7 +59,7 @@ hist3d(list(f,x,y),&lt;opt_args&gt;)</synopsis>
59 <listitem> 59 <listitem>
60 <para>where mtx is a matrix of size (m,n)defining the histogram 60 <para>where mtx is a matrix of size (m,n)defining the histogram
61 <literal>mtx(i,j)=F(x(i),y(j))</literal>, with <literal>x</literal> 61 <literal>mtx(i,j)=F(x(i),y(j))</literal>, with <literal>x</literal>
62 and <literal>y</literal> vectors of size (1,n+1) and (1,m+1).</para> 62 and <literal>y</literal> vectors of size (1,m+1) and (1,n+1).</para>
63 </listitem> 63 </listitem>
64 </varlistentry> 64 </varlistentry>
65 65
diff --git a/scilab/modules/graphics/help/fr_FR/hist3d.xml b/scilab/modules/graphics/help/fr_FR/hist3d.xml
index 3efb6f4..1723e9f 100644
--- a/scilab/modules/graphics/help/fr_FR/hist3d.xml
+++ b/scilab/modules/graphics/help/fr_FR/hist3d.xml
@@ -48,7 +48,7 @@ hist3d(list(f,x,y),&lt;opt_args&gt;)</synopsis>
48 <para>où mtx est une matrice de taille (m,n) définissant 48 <para>où mtx est une matrice de taille (m,n) définissant
49 l'histogramme <literal>mtx(i,j)=F(x(i),y(j))</literal>, avec 49 l'histogramme <literal>mtx(i,j)=F(x(i),y(j))</literal>, avec
50 <literal>x</literal> et <literal>y</literal> deux vecteurs de 50 <literal>x</literal> et <literal>y</literal> deux vecteurs de
51 tailles respectives (1,n+1) et (1,m+1).</para> 51 tailles respectives (1,m+1) et (1,n+1).</para>
52 </listitem> 52 </listitem>
53 </varlistentry> 53 </varlistentry>
54 54
diff --git a/scilab/modules/graphics/macros/%h_load.sci b/scilab/modules/graphics/macros/%h_load.sci
index 9080257..1937620 100644
--- a/scilab/modules/graphics/macros/%h_load.sci
+++ b/scilab/modules/graphics/macros/%h_load.sci
@@ -1451,6 +1451,7 @@ function links=get_links_from_path(ax,paths)
1451 links=[];ok=%t 1451 links=[];ok=%t
1452 for p=paths 1452 for p=paths
1453 e=ax; 1453 e=ax;
1454 p(1)=p(1)-1// the caption does not exists yet
1454 for kp=1:size(p,'*'), 1455 for kp=1:size(p,'*'),
1455 if or(e.type==['Axes','Compound'])&p(kp)<=size(e.children,'*') then 1456 if or(e.type==['Axes','Compound'])&p(kp)<=size(e.children,'*') then
1456 e=e.children(p(kp)), 1457 e=e.children(p(kp)),
diff --git a/scilab/modules/graphics/macros/%h_save.sci b/scilab/modules/graphics/macros/%h_save.sci
index d1823e0..774c4bb 100644
--- a/scilab/modules/graphics/macros/%h_save.sci
+++ b/scilab/modules/graphics/macros/%h_save.sci
@@ -706,15 +706,16 @@ function p=get_entity_path(e)
706// given a handle e on an entity this function returns its path relative 706// given a handle e on an entity this function returns its path relative
707// to its parent axes. 707// to its parent axes.
708// the path is a vector of child index. 708// the path is a vector of child index.
709 p=[]; 709 p=[];parent=e.parent;
710 while %t 710
711 parent=e.parent 711 while %t
712 pos=find(parent.children==e,1) 712 pos=find(parent.children==e,1)
713 if pos==[] then 713 if pos==[] then
714 error(msprintf(_("%s : Invalid entity %s\n"),"save","Legend")) 714 error(msprintf(_("%s : Invalid entity %s\n"),"save","Legend"))
715 end 715 end
716 p=[pos p] 716 p=[pos p]
717 if or(parent.type==['Axes' 'Figure']) then break,end 717 if parent.type=='Axes' then break,end
718 e=parent 718 e=parent
719 parent=e.parent;
719 end 720 end
720endfunction 721endfunction
diff --git a/scilab/modules/graphics/macros/legend.sci b/scilab/modules/graphics/macros/legend.sci
index 1586689..66471ea 100644
--- a/scilab/modules/graphics/macros/legend.sci
+++ b/scilab/modules/graphics/macros/legend.sci
@@ -86,6 +86,11 @@ options_codes=[1;2;3;
86 86
87 drawlater() 87 drawlater()
88 c=captions(H,leg) 88 c=captions(H,leg)
89 if options_codes(kopt)<0 then
90 c.background=f.background
91 else
92 c.background=Acur.background
93 end
89 if with_box then c.line_mode='on',else c.line_mode='off',end 94 if with_box then c.line_mode='on',else c.line_mode='off',end
90 c.legend_location=options_names(kopt) 95 c.legend_location=options_names(kopt)
91 if opt==5 then 96 if opt==5 then
diff --git a/scilab/modules/graphics/src/c/SetProperty.c b/scilab/modules/graphics/src/c/SetProperty.c
index 6abb8df..887c43d 100644
--- a/scilab/modules/graphics/src/c/SetProperty.c
+++ b/scilab/modules/graphics/src/c/SetProperty.c
@@ -218,10 +218,7 @@ void sciRecursiveUpdateBaW(sciPointObj *pobj, int old_m, int m)
218 sciSetNumColors (pobj,old_m); 218 sciSetNumColors (pobj,old_m);
219 219
220 220
221 if((sciGetEntityType(pobj) != SCI_TEXT) && 221 if((sciGetEntityType(pobj) != SCI_AXES) &&
222 (sciGetEntityType(pobj) != SCI_LEGEND) &&
223 (sciGetEntityType(pobj) != SCI_AXES) &&
224 (sciGetEntityType(pobj) != SCI_LABEL) &&
225 !sciIsAutomaticallyRedrawn(pobj)) 222 !sciIsAutomaticallyRedrawn(pobj))
226 { 223 {
227 if(old_m +1 == sciGetForeground(pobj)) { /* 0 => deals with Foreground */ 224 if(old_m +1 == sciGetForeground(pobj)) { /* 0 => deals with Foreground */
@@ -343,11 +340,11 @@ sciUpdateBaW (sciPointObj * pobj, int flag, int value)
343 case SCI_AXES: 340 case SCI_AXES:
344 case SCI_LABEL: /* F.Leray 28.05.04 */ 341 case SCI_LABEL: /* F.Leray 28.05.04 */
345 case SCI_TEXT: 342 case SCI_TEXT:
343 case SCI_LEGEND:
346 sciSetForeground(pobj,value); 344 sciSetForeground(pobj,value);
347 break; 345 break;
348 case SCI_UIMENU: 346 case SCI_UIMENU:
349 case SCI_AGREG: 347 case SCI_AGREG:
350 case SCI_LEGEND:
351 default: 348 default:
352 return -1; 349 return -1;
353 break; 350 break;
@@ -368,11 +365,11 @@ sciUpdateBaW (sciPointObj * pobj, int flag, int value)
368 case SCI_AXES: 365 case SCI_AXES:
369 case SCI_LABEL: /* F.Leray 28.05.04 */ 366 case SCI_LABEL: /* F.Leray 28.05.04 */
370 case SCI_TEXT: 367 case SCI_TEXT:
368 case SCI_LEGEND:
371 sciSetBackground(pobj,value); 369 sciSetBackground(pobj,value);
372 break; 370 break;
373 case SCI_UIMENU: 371 case SCI_UIMENU:
374 case SCI_AGREG: 372 case SCI_AGREG:
375 case SCI_LEGEND:
376 default: 373 default:
377 return -1; 374 return -1;
378 break; 375 break;
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6531.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_6531.dia.ref
new file mode 100644
index 0000000..43239f1
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6531.dia.ref
@@ -0,0 +1,25 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- TEST WITH GRAPHIC -->
8// <-- Non-regression test for bug 6531 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6531
12//
13// <-- Short Description -->
14// the caption's default background color changes when a color is added to the current colormap
15//
16plot(sin(0:10));e=gce();
17p=e.children(1);
18c=captions(p,'foo');
19c.background //-->-2 ok
20 ans =
21
22 - 2.
23p.foreground=color(200,128,33);
24// The caption's background color should remain equal to -2
25if (c.background <> -2) then bugmes();quit;end
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6531.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_6531.tst
new file mode 100644
index 0000000..97037ae
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6531.tst
@@ -0,0 +1,27 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- TEST WITH GRAPHIC -->
9
10// <-- Non-regression test for bug 6531 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=6531
14//
15// <-- Short Description -->
16// the caption's default background color changes when a color is added to the current colormap
17//
18
19plot(sin(0:10));e=gce();
20p=e.children(1);
21c=captions(p,'foo');
22c.background //-->-2 ok
23p.foreground=color(200,128,33);
24
25// The caption's background color should remain equal to -2
26if (c.background <> -2) then pause; end
27
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref
new file mode 100644
index 0000000..92c1d25
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref
@@ -0,0 +1,94 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- TEST WITH GRAPHIC -->
8// <-- Non-regression test for bug 6665 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6665
12//
13// <-- Short Description -->
14//legend (caption) nor properly saved or loaded
15plot2d()
16legend(['a';'b';'c'])
17 ans =
18
19Handle of type "Legend" with properties:
20========================================
21parent: Axes
22children: []
23visible = "on"
24text = ["a";"b";"c"]
25font_style = 6
26font_size = 1
27font_color = -1
28fractional_font = "off"
29links = ["Polyline";"Polyline";"Polyline"]
30legend_location = "in_upper_right"
31position = [0.7491013,0.1332972]
32line_mode = "on"
33thickness = 1
34foreground = -1
35fill_mode = "on"
36background = -2
37clip_state = "off"
38clip_box = []
39user_data = []
40f=gcf()
41 f =
42
43Handle of type "Figure" with properties:
44========================================
45children: "Axes"
46figure_position = [200,200]
47figure_size = [624,596]
48axes_size = [612,461]
49auto_resize = "on"
50viewport = [0,0]
51figure_name = "Figure n°%d"
52figure_id = 0
53info_message = ""
54color_map= matrix 32x3
55pixmap = "off"
56pixel_drawing_mode = "copy"
57anti_aliasing = "off"
58immediate_drawing = "on"
59background = -2
60visible = "on"
61rotation_style = "unary"
62event_handler = ""
63event_handler_enable = "off"
64user_data = []
65tag = ""
66save(TMPDIR+'/foo.scg',f)
67clf()
68load(TMPDIR+'/foo.scg')
69if f.children.children(1).type<>'Legend' then bugmes();quit;end
70l=f.children.children(1)
71 l =
72
73Handle of type "Legend" with properties:
74========================================
75parent: Axes
76children: []
77visible = "on"
78text = ["a";"b";"c"]
79font_style = 6
80font_size = 1
81font_color = -1
82fractional_font = "off"
83links = ["Polyline";"Polyline";"Polyline"]
84legend_location = "in_upper_right"
85position = [0.7491013,0.1332972]
86line_mode = "on"
87thickness = 1
88foreground = -1
89fill_mode = "on"
90background = -2
91clip_state = "off"
92clip_box = []
93user_data = []
94if or(l.text<>['a';'b';'c']) then bugmes();quit;end
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst
new file mode 100644
index 0000000..8aecc47
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst
@@ -0,0 +1,26 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- TEST WITH GRAPHIC -->
9
10// <-- Non-regression test for bug 6665 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=6665
14//
15// <-- Short Description -->
16//legend (caption) nor properly saved or loaded
17plot2d()
18legend(['a';'b';'c'])
19f=gcf()
20save(TMPDIR+'/foo.scg',f)
21clf()
22load(TMPDIR+'/foo.scg')
23if f.children.children(1).type<>'Legend' then pause,end
24l=f.children.children(1)
25if or(l.text<>['a';'b';'c']) then pause,end
26