Partially revert modifications from: 65/14265/1
Vincent COUVERT [Tue, 1 Apr 2014 08:55:13 +0000 (10:55 +0200)]
https://codereview.scilab.org/#/c/14193/
https://codereview.scilab.org/#/c/14174/
https://codereview.scilab.org/#/c/14238/

Change-Id: Iee97ebdcbceff5d97109fdfdf1e5fb78c9749c49

26 files changed:
scilab/modules/cacsd/macros/zgrid.sci
scilab/modules/graphics/demos/2d_3d_plots/fgrayplot.dem.sce
scilab/modules/graphics/demos/2d_3d_plots/grayplot.dem.sce
scilab/modules/graphics/demos/2d_3d_plots/plot3d.dem.sce
scilab/modules/graphics/demos/2d_3d_plots/plot3d1.dem.sce
scilab/modules/graphics/demos/2d_3d_plots/zgrid.dem.sce
scilab/modules/graphics/demos/matplot/classical.dem.sce
scilab/modules/graphics/demos/matplot/classical_1.dem.sce
scilab/modules/graphics/macros/%_Matplot.sci
scilab/modules/graphics/macros/%_Matplot1.sci
scilab/modules/graphics/macros/%_grayplot.sci
scilab/modules/graphics/macros/%_plot3d.sci
scilab/modules/graphics/macros/%_plot3d1.sci
scilab/modules/graphics/macros/Sgrayplot.sci
scilab/modules/graphics/macros/fgrayplot.sci
scilab/modules/graphics/macros/polarplot.sci
scilab/modules/graphics/tests/nonreg_tests/bug_1257.dia.ref
scilab/modules/graphics/tests/nonreg_tests/bug_1257.tst
scilab/modules/graphics/tests/unit_tests/auto_clear.dia.ref
scilab/modules/graphics/tests/unit_tests/auto_clear.tst
scilab/modules/graphics/tests/unit_tests/newaxes.dia.ref
scilab/modules/graphics/tests/unit_tests/newaxes.tst
scilab/modules/graphics/tests/unit_tests/plot3d_demo.dia.ref
scilab/modules/graphics/tests/unit_tests/plot3d_demo.tst
scilab/modules/gui/tests/unit_tests/frameWithAxes.dia.ref
scilab/modules/gui/tests/unit_tests/frameWithAxes.tst

index a6258bc..cab7706 100644 (file)
@@ -43,10 +43,6 @@ function []=zgrid(varargin)
         wn=defaultwn
         zeta = defaultzeta
         colors = defaultcolors
-        fig = scf();
-        my_plot_desc    = "zgrid";
-        fig.figure_name = my_plot_desc;
-        xtitle(my_plot_desc," "," "," ");
     case 1 then
         zeta =  varargin(1)
         if type(zeta)<>1|~isreal(zeta) then
index 5d3fd78..9eb41a9 100644 (file)
@@ -6,10 +6,18 @@
 
 function demo_fgrayplot()
 
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("fgrayplot.dem.sce");
 
     // DEMO START
+
+    my_plot_desc          = "fgrayplot";
+    my_handle.figure_name = my_plot_desc;
+
     fgrayplot();
+    xtitle(my_plot_desc," "," "," ");
+
     // DEMO END
 
 endfunction
index f43ac42..5550941 100644 (file)
@@ -7,11 +7,14 @@
 
 function demo_grayplot()
 
+    my_handle = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("grayplot.dem.sce");
 
-    // DEMO START
+    my_plot_desc          = "grayplot";
+    my_handle.figure_name = my_plot_desc;
     grayplot();
-    // DEMO END
+    xtitle(my_plot_desc," "," "," ");
 
 endfunction
 
index ab25da1..4867533 100644 (file)
@@ -6,10 +6,15 @@
 
 function demo_plot3d()
 
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("plot3d.dem.sce");
 
     // DEMO START
+    my_plot_desc          = "plot3d : z=sin(x)*cos(y)";
+    my_handle.figure_name = my_plot_desc;
     plot3d();
+    xtitle(my_plot_desc," "," "," ");
     // DEMO END
 
 endfunction
index bb16618..2acf5c9 100644 (file)
@@ -6,10 +6,18 @@
 
 function demo_plot3d1()
 
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("plot3d1.dem.sce");
 
     // DEMO START
+
+    my_plot_desc          = "plot3d1 : z=sin(x)*cos(y)";
+    my_handle.figure_name = my_plot_desc;
+
     plot3d1();
+    xtitle(my_plot_desc," "," "," ");
+
     // DEMO END
 
 endfunction
index 07b5754..38b0c56 100644 (file)
@@ -7,10 +7,17 @@
 
 function demo_zgrid()
 
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("zgrid.dem.sce");
 
     // DEMO START
+
+    my_plot_desc          = "zgrid";
+    my_handle.figure_name = my_plot_desc;
+
     zgrid();
+    xtitle(my_plot_desc," "," "," ");
     // DEMO END
 
 endfunction
index 7789be4..7960a07 100644 (file)
@@ -4,11 +4,17 @@
 // This file is released under the 3-clause BSD license. See COPYING-BSD.
 
 function demo_classical()
-
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("classical.dem.sce");
 
     // DEMO START
+
+    my_plot_desc          = _("Classical Matplot");
+    my_handle.figure_name = my_plot_desc;
+
     Matplot();
+
     // DEMO END
 
 endfunction
index 230ecd6..b5ea644 100644 (file)
@@ -5,10 +5,17 @@
 
 function demo_classical_1()
 
+    my_handle             = scf(100001);
+    clf(my_handle,"reset");
     demo_viewCode("classical_1.dem.sce");
 
     // DEMO START
+
+    my_plot_desc          = _("Classical Matplot1");
+    my_handle.figure_name = my_plot_desc;
+
     Matplot1();
+
     // DEMO END
 
 endfunction
index c70a1d0..d017ef1 100644 (file)
@@ -14,11 +14,14 @@ function %_Matplot()
     ny = 400;
     nx = 300;
     M = pmodulo((0:(ny-1))'*ones(1:nx) + ones(ny,1)*(0:nx-1),ceil(max(nx,ny)/3));
-    f = scf(100001);
+
+    Matplot(M)
+
+    f = gcf();
     my_plot_desc  = _("Classical Matplot");
     f.figure_name = my_plot_desc;
     f.color_map = coolcolormap(nx);
-    Matplot(M)
+
     a = gca();
     a.tight_limits = "on";
     a.isoview = "on";
index 6d10410..6f63732 100644 (file)
 //
 
 function %_Matplot1()
-    f = scf(100001);
-    my_plot_desc  = _("Classical Matplot1");
-    f.figure_name = my_plot_desc;
     nc = 200    // Number of colors
     np = 2      // Number of periods
     nx = 350
     ny = 300
-    f.color_map = hsvcolormap(nc);
     [X,Y] = meshgrid(-nx/2:nx/2, -ny/2:ny/2);
     R = sqrt(X.^2+Y.^2);
     R = (R-min(R))/(max(R)-min(R))*nc*np;
     R = 1+pmodulo(R,nc);
     xmin = -15, xmax = 40, ymin = -0.03, ymax = 0.01
 
-    Matplot1(R,[xmin ymin xmax ymax])
+    Matplot1(R,[xmin ymin xmax ymax]);
+
+    f = gcf();
+    my_plot_desc  = _("Classical Matplot1");
+    f.figure_name = my_plot_desc;
+    f.color_map = hsvcolormap(nc);
 
     a = gca()
     a.data_bounds=[xmin ymin ; xmax ymax];
index 53646dd..b469fd8 100644 (file)
 function [] = %_grayplot()
     t=-%pi:0.05:%pi;
     m=sin(t)'*cos(t);
-    f = scf(100001);
+    grayplot(t,t,m);
+    f = gcf();
     my_plot_desc  = "grayplot";
     f.figure_name = my_plot_desc;
     xtitle(my_plot_desc," "," "," ");
     f.color_map = hotcolormap(128);
-    grayplot(t,t,m);
 endfunction
index b9d0525..1b6ea15 100644 (file)
 function [] = %_plot3d()
     x = %pi * [-1:0.05:1]';
     z = sin(x)*cos(x)';
-    f = scf();
+    plot3d(x, x, z, 70, 70);
+    e=gce();
+    e.color_flag = 1;
+    f = gcf();
     my_plot_desc  = "plot3d: z=sin(x)*cos(y)";
     f.figure_name = my_plot_desc;
     xtitle(my_plot_desc," "," "," ");
     f.color_map = jetcolormap(32);
-    plot3d(x, x, z, 70, 70);
-    e=gce();
-    e.color_flag = 1;
 endfunction
index 0541ebb..c26d586 100644 (file)
 function [] = %_plot3d1()
     x = %pi * [-1:0.05:1]';
     z = sin(x)*cos(x)';
-    f = scf(100001);
+    plot3d1(x, x, z, 70, 70);
+    f = gcf();
     my_plot_desc  = "plot3d1: z=sin(x)*cos(y)";
     f.figure_name = my_plot_desc;
     xtitle(my_plot_desc," "," "," ");
     f.color_map = jetcolormap(32);
-    plot3d1(x, x, z, 70, 70);
 endfunction
index 5e0e125..792f9fe 100644 (file)
@@ -31,7 +31,7 @@ function []=Sgrayplot(x,y,z, strf, rect, nax, zminmax, colminmax, mesh, colout)
 
         t=-%pi:0.1:%pi;
         m=sin(t)'*cos(t)
-        f=scf();
+        f=gcf();
         f.color_map = jetcolormap(64);
         f.immediate_drawing = "off";
         colorbar(-1,1);
index 6f02353..3da068a 100644 (file)
@@ -23,13 +23,13 @@ function []=fgrayplot(x,y,f,strf,rect,nax,void)
     [lhs,rhs]=argn(0);
 
     if rhs <= 0 then   // demo
-        f = scf(100001);
+        deff("[z]=Surf(x,y)","z=cos(x).^2+sin(y).^2");
+        fgrayplot(-%pi:0.1:%pi,-%pi:0.1:%pi, Surf);
+        f = gcf();
         my_plot_desc  = "fgrayplot";
         f.figure_name = my_plot_desc;
         xtitle(my_plot_desc," "," "," ");
         f.color_map = coolcolormap(100);
-        deff("[z]=Surf(x,y)","z=cos(x).^2+sin(y).^2");
-        fgrayplot(-%pi:0.1:%pi,-%pi:0.1:%pi, Surf);
         return
     end
 
index 5886bb6..74330c1 100644 (file)
@@ -12,7 +12,7 @@ function polarplot(theta,rho,style,strf,leg,rect)
     if rhs<=0 then
         theta=0:.01:2*%pi;
         rho=sin(2*theta).*cos(2*theta)
-        scf();
+        clf();
         polarplot(theta,rho)
         return
     end
index 3892746..c0d1534 100644 (file)
@@ -14,7 +14,7 @@
 // When rotation_style is set to multiple, all axes does not
 // rotate when modifying rotation_angles property.
 // create two plots
-f = scf(100001);
+f = gcf();
 f.rotation_style = "multiple";
 subplot(1,2,1)
 plot3d()
index 1d1f8d5..f551eff 100644 (file)
@@ -17,7 +17,7 @@
 // rotate when modifying rotation_angles property.
 
 // create two plots
-f = scf(100001);
+f = gcf();
 f.rotation_style = "multiple";
 subplot(1,2,1)
 plot3d()
index 2c362f5..8b9b186 100644 (file)
@@ -6,9 +6,9 @@
 // =============================================================================
 // <-- TEST WITH GRAPHIC -->
 // test auto_clear behaviour
-plot3d();
 a = gca();
 a.auto_clear = "on";
+plot3d();
 assert_checkequal(size(a.children), [1 1]);
 assert_checkequal(a.children(1).type, "Plot3d");
 plot2d();
index 410aca4..385becf 100644 (file)
@@ -9,11 +9,11 @@
 
 // test auto_clear behaviour
 
-plot3d();
-
 a = gca();
 a.auto_clear = "on";
 
+plot3d();
+
 assert_checkequal(size(a.children), [1 1]);
 assert_checkequal(a.children(1).type, "Plot3d");
 
index 33ac0c2..3d96dfc 100644 (file)
@@ -5,7 +5,7 @@
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 // <-- TEST WITH GRAPHIC -->
-f = scf(100001);
+f = scf();
 plot();
 frame1 = uicontrol(f, "style", "frame", ...
 "position", [0, 0, 200, 200]);
@@ -16,11 +16,12 @@ frame2 = uicontrol(f, "style", "frame", ...
 newaxes(frame2);
 plot3d();
 // Plot demo => 2 Axes
-// Axes 1 has 0 children
+// Axes 1 has 41 children
 // Axes 2 has 3 children
 assert_checkequal(size(f.children, "*"), 4);
 assert_checkequal(f.children(3).type, "Axes");
-assert_checkequal(size(f.children(3).children(1).children, "*"), 0);
+assert_checkequal(f.children(3).children(1).type, "Compound");
+assert_checkequal(size(f.children(3).children(1).children, "*"), 41);
 assert_checkequal(f.children(4).type, "Axes");
 assert_checkequal(f.children(4).children(1).type, "Compound");
 assert_checkequal(size(f.children(4).children(1).children, "*"), 3);
@@ -28,7 +29,7 @@ assert_checkequal(size(f.children(4).children(1).children, "*"), 3);
 assert_checkequal(f.children(1).type, "uicontrol");
 assert_checkequal(f.children(1).style, "frame");
 assert_checkequal(f.children(1).children(1).type, "Axes");
-assert_checkequal(f.children(3).children(1).type, "Plot3d");
+assert_checkequal(f.children(1).children(1).children(1).type, "Plot3d");
 // Plot2d Demo => Compound + 3 children
 assert_checkequal(f.children(2).type, "uicontrol");
 assert_checkequal(f.children(2).style, "frame");
index 7288187..356df97 100644 (file)
@@ -6,7 +6,7 @@
 // =============================================================================
 
 // <-- TEST WITH GRAPHIC -->
-f = scf(100001);
+f = scf();
 
 plot();
 
@@ -21,11 +21,12 @@ newaxes(frame2);
 plot3d();
 
 // Plot demo => 2 Axes
-// Axes 1 has 0 children
+// Axes 1 has 41 children
 // Axes 2 has 3 children
 assert_checkequal(size(f.children, "*"), 4);
 assert_checkequal(f.children(3).type, "Axes");
-assert_checkequal(size(f.children(3).children(1).children, "*"), 0);
+assert_checkequal(f.children(3).children(1).type, "Compound");
+assert_checkequal(size(f.children(3).children(1).children, "*"), 41);
 assert_checkequal(f.children(4).type, "Axes");
 assert_checkequal(f.children(4).children(1).type, "Compound");
 assert_checkequal(size(f.children(4).children(1).children, "*"), 3);
@@ -34,7 +35,7 @@ assert_checkequal(size(f.children(4).children(1).children, "*"), 3);
 assert_checkequal(f.children(1).type, "uicontrol");
 assert_checkequal(f.children(1).style, "frame");
 assert_checkequal(f.children(1).children(1).type, "Axes");
-assert_checkequal(f.children(3).children(1).type, "Plot3d");
+assert_checkequal(f.children(1).children(1).children(1).type, "Plot3d");
 
 // Plot2d Demo => Compound + 3 children
 assert_checkequal(f.children(2).type, "uicontrol");
index fffb64d..6e22568 100644 (file)
@@ -18,7 +18,7 @@ e = a.children(1);
 assert_checkequal(f.auto_resize, "on");
 assert_checkequal(f.viewport, [0,0]);
 assert_checkequal(f.figure_name, gettext("plot3d: z=sin(x)*cos(y)"));
-assert_checkequal(f.figure_id, 100001);
+assert_checkequal(f.figure_id, 0);
 assert_checkequal(f.pixel_drawing_mode, "copy");
 assert_checkequal(f.anti_aliasing, "off");
 assert_checkequal(f.immediate_drawing, "on");
index 5208685..f758b45 100644 (file)
@@ -22,7 +22,7 @@ e = a.children(1);
 assert_checkequal(f.auto_resize, "on");
 assert_checkequal(f.viewport, [0,0]);
 assert_checkequal(f.figure_name, gettext("plot3d: z=sin(x)*cos(y)"));
-assert_checkequal(f.figure_id, 100001);
+assert_checkequal(f.figure_id, 0);
 assert_checkequal(f.pixel_drawing_mode, "copy");
 assert_checkequal(f.anti_aliasing, "off");
 assert_checkequal(f.immediate_drawing, "on");
index 52e6280..be69010 100644 (file)
@@ -12,7 +12,7 @@ for i = 1:2
         "layout", "border", ...
         "constraints", createConstraints("gridbag", [i, j, 1, 1], [1,1], "both"));
         newaxes(frame);
-        plot2d();
+        plot3d();
     end
 end
 assert_checkequal(size(f.children, "*"), 4);
@@ -20,6 +20,6 @@ for i = 1:4
     assert_checkequal(f.children(i).type, "uicontrol");
     assert_checkequal(f.children(i).style, "frame");
     assert_checkequal(f.children(i).children(1).type, "Axes");
-    assert_checkequal(f.children(i).children(1).children(1).type, "Compound");
+    assert_checkequal(f.children(i).children(1).children(1).type, "Plot3d");
     assert_checkequal(f.children(i).position(3:4), [400, 400]);
 end
index f390e5b..b50e42b 100644 (file)
@@ -14,7 +14,7 @@ for i = 1:2
         "layout", "border", ...
         "constraints", createConstraints("gridbag", [i, j, 1, 1], [1,1], "both"));
         newaxes(frame);
-        plot2d();
+        plot3d();
     end
 end
 
@@ -23,6 +23,6 @@ for i = 1:4
     assert_checkequal(f.children(i).type, "uicontrol");
     assert_checkequal(f.children(i).style, "frame");
     assert_checkequal(f.children(i).children(1).type, "Axes");
-    assert_checkequal(f.children(i).children(1).children(1).type, "Compound");
+    assert_checkequal(f.children(i).children(1).children(1).type, "Plot3d");
     assert_checkequal(f.children(i).position(3:4), [400, 400]);
 end