* bug #13651 fixed - an axes couldn't be copied in a uicontrol frame
[scilab.git] / scilab / modules / graphics / macros / %h_copy.sci
index 5091f29..823d9c7 100644 (file)
@@ -2,6 +2,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
 // Copyright (C) 2013-2013 - Scilab Enterprises - Bruno JOFRET
+// Copyright (C) 2016 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
@@ -12,9 +13,8 @@
 // For more information, see the COPYING file which you should have received
 // along with this program.
 //
-//
 
-function h=%h_copy(h,ax)
+function h = %h_copy(h,ax)
     filename = tempname();
     save(filename,"h")
     if argn(2)<2 then
@@ -25,6 +25,18 @@ function h=%h_copy(h,ax)
             set("current_axes", ax)
             load(filename)
             set("current_axes", a)
+
+        elseif ax.type=="uicontrol" & ax.style=="frame"
+            set("current_entity",ax)
+            if h.type=="Axes"
+                na = newaxes(ax)
+                load(filename)
+                swap_handles(ax.parent.children(1),na)
+                delete(ax.parent.children(1))
+            else
+                load(filename)
+            end
+
         else
             a = gcf()
             scf(ax)
@@ -32,5 +44,5 @@ function h=%h_copy(h,ax)
             scf(a)
         end
     end
-    mdelete(filename);
+    mdelete(filename)
 endfunction