* Used memory per variable is displayed by BrowserVar to give the user numbers on memory usage repartition and let the user `clear` the big ones first.
* In browsevar, clicking on any function, library, list, cell, structure, custom tlist or mlist, or graphic handle now edits or displays their content.
* Autoscroll of console in GUI mode is disabled when the user scrolls up until he scrolls to the bottom.
+* Help browser improved:
+ - The browser's language can be set independently of the session's language
+ - The menu "Online" allows to display in your web browser the online version of the current page
+ - The menu "Issues" allows to display bugzilla entries related to the feature of the current page
+ - ATOMS chapters are automatically loaded in the browser.
+ - The page left at exit is restored at next startup.
Xcos
----
* [#9221](https://bugzilla.scilab.org/9221): There was no way in Scilab to easily access to sets of unicode symbols like greek letters, etc.
* [#9909](https://bugzilla.scilab.org/9909): In the help browser, add a way to open the online version of the current page.
* [#10046](https://bugzilla.scilab.org/10046): By default, the `MAXMIN` block did not propose 2 input ports to work in an element-wise way (unlike MIN_f and MAX_f), which is its most original working mode.
+* [#10465](https://bugzilla.scilab.org/10465): At Scilab exit, the help browser is not saved nor restored.
* [#10476](https://bugzilla.scilab.org/10476): From `browsevar`, displaying the content of lists, structures, cells, or other custom tlists or mlists was not possible.
* [#10490](https://bugzilla.scilab.org/10490): The `mapsound` page was poor with a single interesting example.
* [#11677](https://bugzilla.scilab.org/11677): The original Arnoldi functions were obsolete.
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2007-2008 - INRIA
// Copyright (C) 2009-2011 - DIGITEO
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - 2020 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
clear atomsSystemInit;
end
+// Helpbrowser: ========================================================
+// If the browser is open, restore the page left at last exit
+helpbrowser_update("startup");
+clear helpbrowser_update
// Protect variable previously defined ================================
clear = clear // special case: http://bugzilla.scilab.org/12198
<ActionMapping>
<Action name="HELP" className="org.scilab.modules.console.HelpAction"/>
</ActionMapping>
+ <HelpBrowser index="Whatsnew" lang=""/>
</Profile>
%helps = this_help;
end
+ // Update the help browser (if open)
+ // =========================================================================
+ [?, w] = where()
+ if grep(w, "atomsAutoload") == []
+ helpbrowser_update()
+ // otherwise: We update the browser from scilab.start AFTER atomsAutoload().
+ // to not make the browser blinking.
+ end
+
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA - Vincent COUVERT
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2020 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
function help(varargin)
- [lhs,rhs]=argn(0);
+ if findfiles("SCI/modules/helptools/jar","*_help.jar") == [] then
+ error(msprintf(gettext("%s: help file(.jar) is not installed.\n"), "help"));
+ end
+ if getscilabmode() == "NWNI" then
+ error(msprintf(gettext("%s: The help browser is disabled in %s mode.\n"), "help", getscilabmode()));
+ end
- if rhs >= 1 then
+ if argn(2) >= 1 then
key = varargin(1);
+ if type(key) <> 10 then
+ error(msprintf(_("%s: Wrong type for input argument #%d: string expected.\n"),"help",1));
+ end
else
key = "";
end
- if (findfiles("SCI/modules/helptools/jar","*_help.jar") <> []) then
-
- if getscilabmode() <> "NWNI" then
-
- // No input argument: launch help browser
- if argn(2)==0 then
- global %helps
- helpbrowser(%helps(:,1), getlanguage());
- return
- end
-
- if type(key) <> 10 then
- error(msprintf(_("%s: Wrong type for input argument #%d: string expected.\n"),"help",1));
- end
-
- // Search a function name
- key=stripblanks(key)
-
- global %helps
- symbols = strsplit("()[]{}%''"":*/\.<>&^|~+-")';
- exceptions = ["%t" "%T" "%f" "%F" "%onprompt"]; // http://bugzilla.scilab.org/15356
- if or(part(key,1)==symbols) & exists(key)==0 & and(key~=exceptions) then
- key="symbols";
- end
-
- // Treat "$" apart because contrarily to the previous symbols, "$" is an existing variable in Scilab
- if part(key,1)=="$" & (exists(key)==0 | length(key)==1) then
- key="symbols";
- end
+ global %helps
+ // Retrieving the browser language and former page:
+ filename = SCIHOME + filesep() + "configuration.xml"
+ res = xmlGetValues("//Setting/Profile/HelpBrowser", ["index" "lang"], filename);
+ if key == "" then
+ key = res(1)
+ end
+ if res(2) == ""
+ lang = getlanguage()
+ else
+ lang = res(2)
+ end
- helpbrowser(%helps(:,1), key, getlanguage(), %f);
+ key = stripblanks(key)
- // If the function name does not exist, then full-text search is done (See Java code)
+ symbols = strsplit("()[]{}%''"":*/\.<>&^|~+-")';
+ exceptions = ["%t" "%T" "%f" "%F" "%onprompt"]; // http://bugzilla.scilab.org/15356
+ if or(part(key,1)==symbols) & exists(key)==0 & and(key~=exceptions) then
+ key = "symbols";
+ end
- else
- error(msprintf(gettext("%s: The help browser is disabled in %s mode.\n"), "help", getscilabmode()));
- end
- else
- error(msprintf(gettext("%s: help file(.jar) is not installed.\n"), "help"));
+ // Treat "$" apart because contrarily to the previous symbols, "$" is an existing variable in Scilab
+ if part(key,1)=="$" & (exists(key)==0 | length(key)==1) then
+ key = "symbols";
end
+ // Calling the browser
+ helpbrowser(%helps(:,1), key, lang, %f);
+ // If the key is not a xml:id, then full-text search is done (See Java code)
endfunction
url = hb.getCurrentURL()
[?,?,?, currentLang] = regexp(url, "/scilab_(.+?)_help.jar/")
id = hb.getCurrentID()
+ if id==[] then
+ id = basename(url)
+ end
isSection = grep(id, "/^section_/", "r") <> []
tmp = msprintf("#^jar:file:/%s/modules/helptools/jar#", SCI)
isExternal = grep(url, tmp, "r") == []
else
global %helps
helpbrowser(%helps(:,1), id, param, %f);
+
+ // Recording the new lang in user's profile
+ filename = SCIHOME + filesep() + "configuration.xml"
+ doc = xmlRead(filename)
+ xmlSetValues("//Setting/Profile/HelpBrowser", ["lang" ; param], doc)
+ xmlWrite(doc, filename);
+ xmlDelete(doc)
end
case "online"
if isExternal
end
url = "https://help.scilab.org/docs/%s/%s/%s.html"
url = msprintf(url, v, currentLang, id)
+
openURL(url)
case "bugs"
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2020 - Samuel GOUGEON
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function helpbrowser_update(startup)
+ // Internal called by add_help_chapter() and atomsLoad()
+
+ if or(getscilabmode()==["STD" "NW"])
+ jimport org.scilab.modules.gui.helpbrowser.ScilabHelpBrowser
+ hb = ScilabHelpBrowser.getHelpBrowserWithoutCreation()
+ global %helps
+ if ~isempty(hb)
+ if isdef("startup", "l")
+ // for scilab.start
+ id = xmlGetValues("//Setting/Profile/HelpBrowser","index",SCIHOME+"/configuration.xml")
+ // No way to retrieve as well the helpbrowser language, if it's
+ // different from the session's one.
+ help(id)
+ else
+ // for atomsLoad and add_help_chapter
+ id = hb.getCurrentID()
+ // Get the current language of the browser
+ jar = hb.getCurrentURL()
+ [?,?,?,lang] = regexp(jar, "/scilab_([a-z]{2}_[A-Z]{2})_help\.jar/", "o")
+ if lang=="en_US" // it may be a default external page in en_US,
+ // despite the browser is in another language
+ help("ones") // We are sure this page is translated
+ jar = hb.getCurrentURL();
+ [?,?,?,lang] = regexp(jar, "/scilab_([a-z]{2}_[A-Z]{2})_help\.jar/", "o")
+ end
+ // Update the browser
+ helpbrowser(%helps(:,1), id, lang, %f)
+ end
+ end
+ jremove hb ScilabHelpBrowser
+ end
+
+endfunction
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 10455 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/10455
+//
+// <-- Short Description -->
+// In STD or NW mode, when the help browser is opened,
+// A) when Scilab is quit, the browser restored at the next startup
+// - did not display the page left when exiting
+// - did not list help chapters of autoloaded ATOMS modules.
+//
+// B) the help browser was not updated with the new chapter when
+// - an ATOMS module is loaded in the session, or
+// - a help chapter is added with add_help_chapter()
+
+
+function restart_scilab()
+ if getos()=="Windows"
+ host("Start """" """+sciargs()+"""")
+ else
+ host(sciargs()+" &")
+ end
+ exit
+endfunction
+
+// Be sure that at least one ATOMS module (with help pages) is installed and autoloaded
+// ------------------------------------------------------------------------------------
+// If it's not already the case, do the following:
+// -----------------------------------------------
+offline = atomsGetConfig("offline");
+atomsSetConfig("offline","True")
+in = atomsInstall(SCI+"/modules/atoms/tests/unit_tests/toolbox_7V6_1.0-1.bin.zip")
+atomsSetConfig("offline", offline);
+atomsAutoloadAdd(in(1));
+restart_scilab()
+// Otherwise: continue
+
+// Then:
+// ====
+// WITH A NATIVE current help page:
+// -------------------------------
+help linspace
+restart_scilab()
+// In the new fresh session:
+// CHECK: The help browser must be opened, and at the linspace page
+
+// WITH a page from an ATOMS EXTERNAL MODULE:
+// -----------------------------------------
+// Now, open a help page belonging to an autoloaded module
+// help <the_page>
+help t1_function1
+// Keep the help browser open, and:
+restart_scilab()
+
+// In the new fresh session:
+// CHECK: The help browser must be opened, and at the <the_page> ATOMS module page
+
+// Cleaning
+atomsRemove("toolbox_7V6")
+
+
+// ====================================
+// When Loading an ATOMS module by hand
+// ====================================
+// In the ongoing session, let's Consider an installed but not loaded ATOMS module. Say plotplot.
+
+global %helps
+setlanguage en
+helpbrowser(%helps(:,1), "linspace", "ru_RU", %f)
+// Check that the page is in Russian
+atomsLoad plotplot
+// Check that the plotplot help chapter is listed in the browser.
+// Check that the displayed page is still linspace in Russian.
+
+
+// ================
+// ADDITIONAL TESTS
+// ================
+// In the ongoing Scilab session, CHECK :
+// * When the loaded external module has some dependencies
+// (ex: MatrixMarket depends on and installs apifun),
+// the updated browser must list chapters of the dependencies as well.