* Bug #13757 fixed - The toolbox menu dit not load properly ATOMS modules not autoloaded. 75/18175/6
Samuel GOUGEON [Fri, 20 May 2016 15:07:48 +0000 (17:07 +0200)]
Change-Id: I1785a6b2d1045dad6beda4e954616445b289656d

scilab/CHANGES.md
scilab/modules/core/macros/toolboxes.sci

index b29cb1b..f4fbdea 100644 (file)
@@ -229,9 +229,11 @@ Bug Fixes
 
 ### In 6.0.0:
 
+
 * [Bug #11959](http://bugzilla.scilab.org/show_bug.cgi?id=11959) fixed - Allow "Zoom Area" to be clicked out of axes
 * [Bug #12110](http://bugzilla.scilab.org/show_bug.cgi?id=12110) fixed - Unable to zoom multiple axes at once
 * [Bug #13597](http://bugzilla.scilab.org/show_bug.cgi?id=13597) fixed - `help format` claimed setting a number of digits instead of characters
+* [Bug #13757](http://bugzilla.scilab.org/show_bug.cgi?id=13757) fixed - The toolbox menu dit not load properly ATOMS modules not autoloaded.
 * [Bug #14192](http://bugzilla.scilab.org/show_bug.cgi?id=14192) fixed - `g_margin` error-ed for double integrator.
 * [Bug #14448](http://bugzilla.scilab.org/show_bug.cgi?id=14448) fixed - removed havewindow() was still documented
 * [Bug #14557](http://bugzilla.scilab.org/show_bug.cgi?id=14557) fixed - `csim` failed when the system has no state.
index 6e00e44..c9d4598 100644 (file)
@@ -1,7 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
 // Copyright (C) DIGITEO - 2009 - Allan CORNET
-// Copyright (C) 2012 - Samuel GOUGEON
+// Copyright (C) 2012 - 2015 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
@@ -22,18 +22,20 @@ function [y] = toolboxes(path)
     global %toolboxes_dir
     //===========================================================
     [lhs,rhs] = argn(0)
-    y = [];
+    y = []
+    // Action
     if (rhs == 1) & typeof(path)=="constant" then
         // return string to exec
         tmp = %toolboxes(path);
-        if part(tmp,1)=="!" then   // ATOMS module => Get the path
+        if part(tmp,1)=="!" then   // ATOMS module
             atomsMod = atomsGetInstalled();
             tmp = strtok(tmp, ",") // Trims the part of the release numbers
-            Path = atomsMod(find(atomsMod(:,1)==part(tmp, 2:length(tmp))),4);
+            name = atomsMod(find(atomsMod(:,1)==part(tmp, 2:length(tmp))),1);
+            y = "atomsLoad("""+name+""")"
         else
-            Path = %toolboxes_dir + tmp;
+            Path = %toolboxes_dir + stripblanks(tmp);
+            y = "exec(""" + pathconvert(Path) + filesep() + "loader.sce" + """);"
         end
-        y = "exec(""" + pathconvert(Path) + filesep() + "loader.sce" + """);";
         return
     end
 
@@ -57,21 +59,22 @@ function [y] = toolboxes(path)
     autoloading = atomsAutoloadList()
     for i = 1:size(installed,1)
         if and(installed(i,1)~=autoloading(:,1)) then
-            tmpath = installed(i,4)+filesep()+"loader.sce"
-            if isfile(tmpath) then
-                contribs = [contribs ; "!"+installed(i,1)+","+installed(i,2)]
-                // "!" => the path must be got from atomsGetInstalled
-            end
+            contribs = [contribs ; "!"+installed(i,1)+","+installed(i,2)]
         end
     end
 
+    // Creating the menu and its entries
     if (contribs <> []) & (getscilabmode() == "STD") then
+        contribs = gsort(contribs, "g", "i")
         delmenu(gettext("&Toolboxes"));
         h = uimenu("parent", 0, "label", gettext("&Toolboxes"));
         for k=1:size(contribs,"*")
-            tmp = strsubst(contribs(k),","," ");
-            tmp = strsubst(tmp,"!","");
-            m = uimenu(h,"label", tmp, "callback","execstr(toolboxes("+msprintf("%d",k)+"))");
+            ptitle = strsubst(contribs(k),","," ");
+            if part(ptitle,1)=="!"
+                ptitle = part(ptitle,2:$)+"  (atoms)";
+            end
+            m = uimenu(h,"label", ptitle, ..
+            "callback","execstr(toolboxes("+msprintf("%d",k)+"))");
         end
         unsetmenu(gettext("&Toolboxes"));
     end