view code disappeared at the end of the demo and the demo failed if the display is... 03/9303/2
Adeline CARNIS [Thu, 27 Sep 2012 09:43:12 +0000 (11:43 +0200)]
Change-Id: I52cb82d62677be5c48a63f7a33252af0214a209b

scilab/modules/graphics/demos/2d_3d_plots/contourf2.dem.sce
scilab/modules/graphics/demos/2d_3d_plots/polarplot.dem.sce
scilab/modules/graphics/demos/basic_functions/basic_functions_4.dem.sce

index f98777c..779d13c 100644 (file)
@@ -10,7 +10,7 @@ function demo_contourf2()
 
   my_handle             = scf(100001);
   clf(my_handle,"reset");
-  demo_viewCode("contourf2.dem.sce");
+  
 
 
   function z=peaks(x,y)
@@ -40,11 +40,17 @@ function demo_contourf2()
   
   contourf([],[],z,[-6:-1,-logspace(-5,0,10),logspace(-5,0,10),1:8],0*ones(1,m))
   xset('fpf','');
+  halt(_("Press Return to continue ... \n"));
+  
+  if is_handle_valid(my_handle) == %f then
+      return;
+  end
 
   clf();
   contourf([],[],z,[-6:-1,-logspace(-5,0,10),logspace(-5,0,10),1:8]);
+  demo_viewCode("contourf2.dem.sce");
 
 endfunction
 
 demo_contourf2();
-clear demo_contourf2;
\ No newline at end of file
+clear demo_contourf2;
index 12facb2..7980933 100644 (file)
 
 
 function demo_polarplot()
-  my_handle             = scf(100001);
-  clf(my_handle);
-  demo_viewCode("polarplot.dem.sce");
-
-// DEMO START
-
-  my_plot_desc          = "polarplot";
-  my_handle.figure_name = my_plot_desc;
-  tmp = gettext("Please press enter into the Scilab console to see more polarplot examples")
-  messagebox(tmp,"modal");
-  nextMessage = gettext("Press enter to go on...");
-  t=linspace(0,1,100)*%pi*2;
-// only 1 quadrant:
-  clf, polarplot(t/4,sin(t/10))
-  title(gettext("polarplot(): Only quadrant(s) reached by data are displayed"))
-  show_window(my_handle)
-  input(nextMessage,"s");
-  clf, polarplot(t/4+%pi/2,sin(t/10))
-  title(gettext("Still a single quadrant...")), show_window(my_handle)
-  input(nextMessage,"s"); 
-  clf, polarplot(t/4+%pi,sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s")
-  clf, polarplot(t/4-%pi/2,sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-// 2 quadrants:
-  clf, polarplot(t/2,sin(t/10)), show_window(my_handle)
-  title(gettext("on 2 quadrants..."))
-  input(nextMessage,"s");
-  clf, polarplot(t/2+%pi/2,sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-  clf, polarplot(t/2+%pi,sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-  clf, polarplot(t/2-%pi/2,sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-// else : full circle:
-  clf, polarplot(t,sin(t/10))
-  title(gettext("Data on the full circle ..."))
-  input(nextMessage,"s");
-// with rect=
-  clf, polarplot(t/4-1,sin(t/10)-0.3,rect=[-0.18 -0.02 0.27 0.3])
-  title(gettext("A partial viewport may be set with clipping"))
-  input(nextMessage,"s");
-
-// with negative radii:
-  r = sin(t/10)-0.5;
-  clf, polarplot(t,sin(t/10)-0.5), show_window(my_handle)
-  title(msprintf(gettext("Negative radii are supported:")+" r_min = %.2f",min(r)))
-  input(nextMessage,"s");
-  
-  t=linspace(0,1,200)*%pi*2;
-  clf, polarplot(t/10-%pi,4600*sin(t/10)), show_window(my_handle)
-  title(gettext("Big radii are supported..."))
-  input(nextMessage,"s");
-  clf, polarplot(t/2,4600*sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-  clf,   xstring(0,0,"$\magnification{1600}\ $"); // for LaTeXed labels
-  polarplot(t/2,3e5*sin(t/10)), show_window(my_handle)
-  title(gettext("even huge radii, with properly formatted labels..."))
-
-  input(nextMessage,"s");
-  clf, polarplot(t/4,3e5*sin(t/10)), show_window(my_handle)
-  input(nextMessage,"s");
-  clf, polarplot(t/4,1.4e-5*sin(t/10)), show_window(my_handle)
-  title(gettext("... as well as very tiny radii"))
-  input(nextMessage,"s");
-
-  clf, t= 0:.01:2*%pi; 
-  polarplot([sin(2*t') sin(4*t')],[cos(4*t') cos(2*t')],[1,2])
-  title(gettext("Several curves may be plotted at the same time"))
-  show_window(my_handle)
-  
-
-// DEMO END
+    my_handle             = scf(100001);
+    clf(my_handle);
+
+    // DEMO START
+
+    my_plot_desc          = "polarplot";
+    my_handle.figure_name = my_plot_desc;
+    tmp = gettext("Please press enter into the Scilab console to see more polarplot examples")
+    messagebox(tmp,"modal");
+    nextMessage = gettext("Press enter to go on...");
+    t=linspace(0,1,100)*%pi*2;
+
+    // only 1 quadrant:
+    clf, polarplot(t/4,sin(t/10))
+    title(gettext("polarplot(): Only quadrant(s) reached by data are displayed"))
+    show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/4+%pi/2,sin(t/10))
+    title(gettext("Still a single quadrant...")), show_window(my_handle)
+    input(nextMessage,"s"); 
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/4+%pi,sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s")
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/4-%pi/2,sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    // 2 quadrants:
+    clf, polarplot(t/2,sin(t/10)), show_window(my_handle)
+    title(gettext("on 2 quadrants..."))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/2+%pi/2,sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/2+%pi,sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/2-%pi/2,sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    // else : full circle:
+    clf, polarplot(t,sin(t/10))
+    title(gettext("Data on the full circle ..."))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    // with rect=
+    clf, polarplot(t/4-1,sin(t/10)-0.3,rect=[-0.18 -0.02 0.27 0.3])
+    title(gettext("A partial viewport may be set with clipping"))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end    
+
+    // with negative radii:
+    r = sin(t/10)-0.5;
+    clf, polarplot(t,sin(t/10)-0.5), show_window(my_handle)
+    title(msprintf(gettext("Negative radii are supported:")+" r_min = %.2f",min(r)))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    t=linspace(0,1,200)*%pi*2;
+    clf, polarplot(t/10-%pi,4600*sin(t/10)), show_window(my_handle)
+    title(gettext("Big radii are supported..."))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/2,4600*sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf,   xstring(0,0,"$\magnification{1600}\ $"); // for LaTeXed labels
+    polarplot(t/2,3e5*sin(t/10)), show_window(my_handle)
+    title(gettext("even huge radii, with properly formatted labels..."))
+
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/4,3e5*sin(t/10)), show_window(my_handle)
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, polarplot(t/4,1.4e-5*sin(t/10)), show_window(my_handle)
+    title(gettext("... as well as very tiny radii"))
+    input(nextMessage,"s");
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    clf, t= 0:.01:2*%pi; 
+    polarplot([sin(2*t') sin(4*t')],[cos(4*t') cos(2*t')],[1,2])
+    title(gettext("Several curves may be plotted at the same time"))
+    show_window(my_handle)
+
+    if is_handle_valid(my_handle) == %f then
+        return
+    end
+
+    demo_viewCode("polarplot.dem.sce");
+
+
+    // DEMO END
 endfunction
 
 demo_polarplot();
index 5af9e72..e0e99b8 100644 (file)
@@ -11,7 +11,7 @@ function demo_basic_function4()
 
   my_handle             = scf(100001);
   clf(my_handle,"reset");
-  demo_viewCode("basic_functions_4.dem.sce");
+  
 
   my_plot_desc          = "General functions";
   my_handle.figure_name = my_plot_desc;
@@ -40,6 +40,7 @@ function demo_basic_function4()
   "show_window();";]
   messagebox(["[IV.2] Creating window number 0";expr],"modal");
   execstr(expr);
+  demo_viewCode("basic_functions_4.dem.sce");
 
 endfunction