Xcos CURVE_c: avoid figure popup on error when edit window mode is off. 26/20626/3
Clement DAVID [Mon, 29 Oct 2018 08:02:31 +0000 (09:02 +0100)]
Change-Id: Idb19adc793d98a736d85b0053e8d8e34917a4897

scilab/CHANGES.md
scilab/modules/scicos_blocks/macros/Sources/CURVE_c.sci
scilab/modules/scicos_blocks/macros/Sources/Sigbuilder.sci

index 92e3dfe..7cefb74 100644 (file)
@@ -134,8 +134,8 @@ User Interface improvements:
 Xcos
 ----
 
-* Default ending time reduced from 100000 to 30, to fit default scope block
-
+* Default ending time reduced from 100000 to 30, to fit default scope block.
+* `CURVE_c` settings did not always display a window.
 
 API modification
 ----------------
index fe8fb1f..60b8ac2 100644 (file)
@@ -54,6 +54,12 @@ function [x,y,typ]=CURVE_c(job,arg1,arg2)
                 exprs(4)="n";
                 PO=0;
             end
+            if graf=="y" | graf=="Y" then
+                gui=1;
+            else
+                exprs(5)="n";
+                gui=0;
+            end
 
             mtd=int(Method);
             if mtd<0 then
@@ -83,7 +89,7 @@ function [x,y,typ]=CURVE_c(job,arg1,arg2)
                 N= size(xy,"r");
                 exprs(5)="n";// exprs.graf='n'
 
-                if graf=="y" | graf=="Y" then //_______Graphic editor___________
+                if gui then //_______Graphic editor___________
                     ipar=[N;mtd;PO];
                     rpar=[];
 
@@ -1207,7 +1213,11 @@ function [X,Y,orpar]=Do_Spline(N,order,x,y)
             Y = interp(X, x, y, d);
             orpar=d(:);
         catch
-            gcf().info_message = "ERROR in SPLINE: "+METHOD
+       if gui then
+       gcf().info_message = "ERROR in SPLINE: "+METHOD
+       else
+       messagebox(lasterror(), "ERROR in SPLINE: "+METHOD);
+       end
         end
 
     end
@@ -1221,7 +1231,11 @@ function [X,Y,orpar]=Do_Spline(N,order,x,y)
             Y = interp(X, x, y, d);
             orpar=d(:);
         catch
-            gcf().info_message = "ERROR in SPLINE: " + METHOD
+       if gui then
+       gcf().info_message = "ERROR in SPLINE: "+METHOD
+       else
+       messagebox(lasterror(), "ERROR in SPLINE: "+METHOD);
+       end
         end
     end
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1231,7 +1245,11 @@ function [X,Y,orpar]=Do_Spline(N,order,x,y)
             Y = interp(X, x, y, d);
             orpar=d(:);
         catch
-            gcf().info_message = "ERROR in SPLINE: " + METHOD
+       if gui then
+       gcf().info_message = "ERROR in SPLINE: "+METHOD
+       else
+       messagebox(lasterror(), "ERROR in SPLINE: "+METHOD);
+       end
         end
 
     end
@@ -1242,7 +1260,11 @@ function [X,Y,orpar]=Do_Spline(N,order,x,y)
             Y = interp(X, x, y, d);
             orpar=d(:);
         catch
-            gcf().info_message = "ERROR in SPLINE:  " + METHOD
+       if gui then
+       gcf().info_message = "ERROR in SPLINE: "+METHOD
+       else
+       messagebox(lasterror(), "ERROR in SPLINE: "+METHOD);
+       end
         end
     end
     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -1252,7 +1274,11 @@ function [X,Y,orpar]=Do_Spline(N,order,x,y)
             Y = interp(X, x, y, d);
             orpar=d(:);
         catch
-            gcf().info_message = "ERROR in SPLINE: " + METHOD
+       if gui then
+       gcf().info_message = "ERROR in SPLINE: "+METHOD
+       else
+       messagebox(lasterror(), "ERROR in SPLINE: "+METHOD);
+       end
         end
     end
 
index cf930ca..8fd7110 100644 (file)
@@ -103,6 +103,12 @@ function [x,y,typ] = Sigbuilder(job,arg1,arg2)
                 end
                 //parameter or states changed
                 arg1(spath)=xxn// Update
+                label = xxn.graphics.exprs(3);
+                if grep(label, "/[a-zA-Z][a-zA-Z0-9_]*/", 'r') then
+                    arg1.graphics.style = "Sigbuilder;displayedLabel="+label;
+                else
+                    arg1.graphics.style = "Sigbuilder";
+                end
                 newpar(size(newpar)+1)=path// Notify modification
                 y=max(y,needcompile)
             end