* Bugs 10476 12516 12532 fixed: browsevar() edits/views more vars content 19/21519/5
Samuel GOUGEON [Wed, 1 Jul 2020 21:21:52 +0000 (23:21 +0200)]
  http://bugzilla.scilab.org/10476
  http://bugzilla.scilab.org/12516
  http://bugzilla.scilab.org/12532

  Updated page (PDF): http://bugzilla.scilab.org/attachment.cgi?id=5154
  Tests: try the enriched example

Change-Id: I9afe0adee26210541069acbdb64cce57109c280f

12 files changed:
scilab/CHANGES.md
scilab/modules/ui_data/etc/ui_data.start
scilab/modules/ui_data/help/en_US/browsevar.xml
scilab/modules/ui_data/help/images/cell_view.png [new file with mode: 0644]
scilab/modules/ui_data/help/images/library_view.png [new file with mode: 0644]
scilab/modules/ui_data/help/images/list_view.png [new file with mode: 0644]
scilab/modules/ui_data/help/images/structure_view.png [new file with mode: 0644]
scilab/modules/ui_data/help/ja_JP/browsevar.xml [deleted file]
scilab/modules/ui_data/help/ru_RU/browsevar.xml [new file with mode: 0644]
scilab/modules/ui_data/macros/browsevar_seeSpecial.sci [new file with mode: 0644]
scilab/modules/ui_data/macros/buildmacros.sce
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variablebrowser/SwingScilabVariableBrowser.java

index 3a36ca1..dcba5ab 100644 (file)
@@ -211,6 +211,7 @@ User Interface improvements:
 * The `ans` variable is editable as any other variable in Editvar.
 * Commands history is saved before executing a command to have the correct history on a crash.
 * 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.
 
 Xcos
@@ -272,6 +273,9 @@ Bug Fixes
 * [#3188](https://bugzilla.scilab.org/3188): `part()` was slower than in Scilab 4.1.2.
 * [#8059](https://bugzilla.scilab.org/8059): A local `.wgetrc` config file could make troubles in `atomsDownload`.
 * [#9909](https://bugzilla.scilab.org/9909): In the help browser, add a way to open the online version of the current page.
+* [#10476](https://bugzilla.scilab.org/10476): From `browsevar`, displaying the content of lists, structures, cells, or other custom tlists or mlists was not possible.
+* [#12516](https://bugzilla.scilab.org/12516): From `browsevar`, clicking on any graphical handle did not edit its figure with `ged`.
+* [#12532](https://bugzilla.scilab.org/12532): From `browsevar`, clicking on any function did not edit it with `edit`. The content of libraries could not be displayed either.
 * [#12889](https://bugzilla.scilab.org/12889): In the help browser, add a menu allowing to select the language of help pages, regardless of the language of the session.
 * [#14873](https://bugzilla.scilab.org/14873): `setfield` page: The output and the 6.0 history were documented only on the en_US version. The input was wrongly restricted to matrices, while any Scilab object is acceptable. The specific role of `setfield` for mlists was not really described nor illustrated. The example did not include any call to setfield.
 * [#15839](https://bugzilla.scilab.org/15839): `gsort`: the only sparse possible input were real or complex vectors, and only with the `g` method.
index e69de29..52dc7e6 100644 (file)
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009-2011 - DIGITEO
+// 
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// 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.
+
+// Load  functions libraries
+// =============================================================================
+  load('SCI/modules/ui_data/macros/lib');
index b93bbb4..0b9121f 100644 (file)
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-a=rand(10,10);
-b="my string";
+a = rand(10,10);
+b = "my string";
+myCell = makecell([2 4],%t, int(-67),rand(2,3),1-%i,(1-%z)^3,1/(1-%z), "abcd", {"are", 45});
+myList = list("Hello", grand(2,4,"uin",-100,100), [%t %f %f ]', (1-%z).^[1 2]);
+myStru = struct("num",{3.1415, -1, %i}, "pol", {%z (1-%z) 2+%z^3}, "txt",{"Hi" "Hello" "Hola"});
+function r = myTest(a,b), c = 2; r = a*c - b; endfunction
+statLib = statisticslib;
+plot2d()
+curves = gce();
+
 browsevar();
  ]]></programlisting>
+    <para>Then click on some variables in the browser, to edit or display them.</para>
+    <table>
+        <tr>
+            <td valign="top" align="center">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/cell_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+                <para/>
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/library_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </td>
+            <td valign="top">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/list_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+                <para/>
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/structure_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </td>
+        </tr>
+    </table>
+    </refsection>
+    <refsection role="see also">
+        <title>See also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="editvar">editvar</link>
+            </member>
+            <member>
+                <link linkend="who">who</link>
+            </member>
+            <member>
+                <link linkend="whos">whos</link>
+            </member>
+            <member>
+                <link linkend="ged">ged</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection>
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.1.1</revnumber>
+                <revremark>
+                    Clicking on a variable of type graphic, function, library, list, structure,
+                    cell, syslin, or any custom tlist or mlist now displays it.
+                </revremark>
+            </revision>
+        </revhistory>
     </refsection>
 </refentry>
diff --git a/scilab/modules/ui_data/help/images/cell_view.png b/scilab/modules/ui_data/help/images/cell_view.png
new file mode 100644 (file)
index 0000000..2905e6c
Binary files /dev/null and b/scilab/modules/ui_data/help/images/cell_view.png differ
diff --git a/scilab/modules/ui_data/help/images/library_view.png b/scilab/modules/ui_data/help/images/library_view.png
new file mode 100644 (file)
index 0000000..d3df3ad
Binary files /dev/null and b/scilab/modules/ui_data/help/images/library_view.png differ
diff --git a/scilab/modules/ui_data/help/images/list_view.png b/scilab/modules/ui_data/help/images/list_view.png
new file mode 100644 (file)
index 0000000..0a9d969
Binary files /dev/null and b/scilab/modules/ui_data/help/images/list_view.png differ
diff --git a/scilab/modules/ui_data/help/images/structure_view.png b/scilab/modules/ui_data/help/images/structure_view.png
new file mode 100644 (file)
index 0000000..106a0a9
Binary files /dev/null and b/scilab/modules/ui_data/help/images/structure_view.png differ
diff --git a/scilab/modules/ui_data/help/ja_JP/browsevar.xml b/scilab/modules/ui_data/help/ja_JP/browsevar.xml
deleted file mode 100644 (file)
index cb9de56..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) Jaime Urzua
- * Copyright (C) Allan CORNET - DIGITEO - 2010
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * 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.
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="browsevar">
-    <refnamediv>
-        <refname>browsevar</refname>
-        <refpurpose>Scilab変数ブラウザ</refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>呼び出し手順</title>
-        <synopsis>browsevar()</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>説明</title>
-        <para>
-            <literal>browsevar</literal> は標準のScilab変数ブラウザです.
-        </para>
-        <para>
-            <literal>browsevar</literal> は全ての変数を表示できます.
-            <literal>browsevar</literal> は全ての変数または特定の型の変数を表示するようカスタマイズすることが
-            できます.
-            除外する変数名を指定することも可能です.
-        </para>
-    </refsection>
-    <refsection>
-        <title>例</title>
-        <programlisting role="example"><![CDATA[
-browsevar();
- ]]></programlisting>
-    </refsection>
-</refentry>
diff --git a/scilab/modules/ui_data/help/ru_RU/browsevar.xml b/scilab/modules/ui_data/help/ru_RU/browsevar.xml
new file mode 100644 (file)
index 0000000..e2e4e52
--- /dev/null
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Jaime Urzua
+ * Copyright (C) Allan CORNET - DIGITEO - 2010
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * 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.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="browsevar">
+    <refnamediv>
+        <refname>browsevar</refname>
+        <refpurpose>браузер переменных Scilab</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Синтаксис</title>
+        <synopsis>browsevar()</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Описание</title>
+        <para>
+            <literal>browsevar</literal> является встроенным в Scilab браузером
+            переменных.
+        </para>
+        <para>
+            <literal>browsevar</literal> составляет список всех переменных
+            пользователя в текущем окружении.
+        </para>
+        <para>
+            <literal>browsevar</literal> имеет несколько особенностей:
+            <itemizedlist>
+                <listitem>
+                    <para>
+                        Простой и понятный список
+                        <para/>
+                        <para>
+                            <inlinemediaobject>
+                                <imageobject>
+                                    <imagedata fileref="../images/browsevar_list.png"/>
+                                </imageobject>
+                            </inlinemediaobject>
+                        </para>
+                        <para/>
+                    </para>
+                </listitem>
+                <listitem>
+                    <para>
+                        Лёгкие подсказки по размерам и типам
+                        <para/>
+                        <para>
+                            <inlinemediaobject>
+                                <imageobject>
+                                    <imagedata fileref="../images/browsevar_tooltip.png"/>
+                                </imageobject>
+                            </inlinemediaobject>
+                        </para>
+                        <para/>
+                    </para>
+                </listitem>
+                <listitem>
+                    <para>
+                        Сортировка по столбцам
+                        <para/>
+                        <para>
+                            <inlinemediaobject>
+                                <imageobject>
+                                    <imagedata fileref="../images/browsevar_sort.png"/>
+                                </imageobject>
+                            </inlinemediaobject>
+                        </para>
+                        <para/>
+                    </para>
+                </listitem>
+                <listitem><para>
+                        Прямое соединение с <link linkend="editvar">компонентами editvar</link>
+                        через двойной клик по имени переменной
+                        <para/>
+                    </para>
+                </listitem>
+                <listitem><para>
+                        Фильтр по типу через меню
+                        <para/>
+                        <para>
+                            <inlinemediaobject>
+                                <imageobject>
+                                    <imagedata fileref="../images/browsevar_filter.png"/>
+                                </imageobject>
+                            </inlinemediaobject>
+                        </para>
+                        <para/>
+                    </para>
+                </listitem>
+                <listitem>
+                    <para>
+                        Отфильтрация предопределённых переменных Scilab (SCI,
+                        SCIHOME, %pi, etc) через меню
+                        <para/>
+                        <para>
+                            <inlinemediaobject>
+                                <imageobject>
+                                    <imagedata fileref="../images/browsevar_filtersci.png"/>
+                                </imageobject>
+                            </inlinemediaobject>
+                        </para>
+                        <para/>
+                    </para>
+                </listitem>
+            </itemizedlist>
+        </para>
+    </refsection>
+    <refsection>
+        <title>Примеры</title>
+        <programlisting role="example"><![CDATA[
+a = rand(10,10);
+b = "my string";
+myCell = makecell([2 4],%t, int(-67),rand(2,3),1-%i,(1-%z)^3,1/(1-%z), "abcd", {"are", 45});
+myList = list("Hello", grand(2,4,"uin",-100,100), [%t %f %f ]', (1-%z).^[1 2]);
+myStru = struct("num",{3.1415, -1, %i}, "pol", {%z (1-%z) 2+%z^3}, "txt",{"Hi" "Hello" "Hola"});
+function r = myTest(a,b), c = 2; r = a*c - b; endfunction
+statLib = statisticslib;
+plot2d()
+curves = gce();
+
+browsevar();
+ ]]></programlisting>
+    <para>
+        Затем щелчок по некоторым переменным в браузере, чтобы редактировать или отобразить их.
+    </para>
+    <table>
+        <tr>
+            <td valign="top" align="center">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/cell_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+                <para/>
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/library_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </td>
+            <td valign="top">
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/list_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+                <para/>
+                <inlinemediaobject>
+                    <imageobject>
+                        <imagedata fileref="../images/structure_view.png"/>
+                    </imageobject>
+                </inlinemediaobject>
+            </td>
+        </tr>
+    </table>
+    </refsection>
+    <refsection role="see also">
+        <title>Смотрите также</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="editvar">editvar</link>
+            </member>
+            <member>
+                <link linkend="who">who</link>
+            </member>
+            <member>
+                <link linkend="whos">whos</link>
+            </member>
+            <member>
+                <link linkend="ged">ged</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection>
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.1.1</revnumber>
+                <revremark>
+                    Щелчок по переменной типа graphic, function, library, list,
+                    structure, cell, syslin или любого пользовательского tlist
+                    или mlist теперь отображает её.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/ui_data/macros/browsevar_seeSpecial.sci b/scilab/modules/ui_data/macros/browsevar_seeSpecial.sci
new file mode 100644 (file)
index 0000000..28b8e2d
--- /dev/null
@@ -0,0 +1,69 @@
+// 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 browsevar_seeSpecial(Var, varname)
+    // Internal function called by browsevar
+    tv = type(Var)
+    if tv==9 then   // graphic handles
+        // We call ged() for the figure of the first component
+        Var = Var(1) // In case of vector, we consider only the 1st element
+        if Var.type=="Figure"
+            ged(8, Var.figure_id)
+        elseif Var.type=="Axes"
+            prevAxes = gca()
+            sca(Var)
+            ged(9, Var.parent.figure_id)
+            sca(prevAxes)
+        else
+            while and(Var.type <> ["Figure" "Axes"])
+                Var = Var.parent
+            end
+            browsevar_seeSpecial(Var, varname)
+        end
+
+    elseif tv==13   // function
+        edit(varname)
+
+    elseif tv==14   // library of functions
+        tmp = string(Var)
+        path = tmp(1)
+        funs = tmp(2:$)
+        [?, k] = gsort(convstr(funs), "g", "i")
+        funs = funs(k);
+        n = size(funs,"*")
+        nr = ceil(sqrt(n*1.5))
+        nc = floor(n/nr)
+        nr = ceil(n/nc)
+        funs = [funs ; emptystr(nr*nc-n,1)]
+        funs = matrix(funs,nr,-1)
+        funs = prettyprint(funs,"html","",%f,%f)
+        funs = strsubst(funs, " align=""center""", "")
+        nl = ascii(10)
+        tmp = "<tr><td colspan=""%d"">%s%s%s%s</td></tr>"
+        funs = "<table cellspacing=""0"" cellpadding=""2"">" + nl + ..
+            msprintf(tmp, nc,"<b>",_("Library "), "</b>", varname) + nl + ..
+            msprintf(tmp, nc,"<b>",_("Path = "),"</b>", path) + nl + ..
+            msprintf(tmp, nc,"<b>",_("Functions:"),"</b>", "") + nl + ..
+            funs + ..
+            "</table>";
+        messagebox(funs, varname)
+
+    elseif typeof(Var)=="st"
+        tree_show(Var, varname)
+
+    elseif or(typeof(Var)==["ce" "syslin"])
+        p = prettyprint(Var, "html", "_")
+        messagebox("<html>" + p, varname)
+
+    elseif or(tv==[15 16 17])
+        tree_show(Var, varname)
+    end
+
+endfunction
index e8d04bd..4a901eb 100644 (file)
@@ -15,5 +15,5 @@ if (isdef("genlib") == %f) then
     exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce");
 end
 
-//genlib("ui_datalib","SCI/modules/ui_data/macros",%f,%t);
+genlib("ui_datalib","SCI/modules/ui_data/macros",%f,%t);
 
index fa3bc39..e552e94 100644 (file)
@@ -644,21 +644,25 @@ public final class SwingScilabVariableBrowser extends SwingScilabDockablePanel i
         try {
             asynchronousScilabExec(null,
                                    "if exists(\"" + variableName + "\") == 1 then "
-                                   + "  try "
-                                   + "    editvar(\"" + variableName + "\"); "
-                                   + "  catch "
-                                   + "    messagebox(\"Variables of type \"\"\" + typeof ("
-                                   + variableName + ") + \"\"\" can not be edited.\""
-                                   + ",\"" + UiDataMessages.VARIABLE_EDITOR + "\", \"error\", \"modal\");"
-                                   + "    clear ans;"   // clear return value of messagebox
-                                   + "  end "
-                                   + "else "
-                                   + "  messagebox(\"Variable \"\""
-                                   + variableName + "\"\" no more exists.\""
-                                   + ",\"" + UiDataMessages.VARIABLE_EDITOR + "\", \"error\", \"modal\");"
-                                   + "  clear ans;"  // clear return value of messagebox
-                                   + "  browsevar();" // Reload browsevar to remove cleared variables
-                                   + "end");
+                                 + "  if or(type(" + variableName + ")==[9 13 14 15 16 17]) "
+                                 + "    browsevar_seeSpecial(" + variableName + ",\"" + variableName + "\"); "
+                                 + "  else "
+                                 + "    try "
+                                 + "      editvar(\"" + variableName + "\"); "
+                                 + "    catch "
+                                 + "      messagebox(\"Variables of type \"\"\" + typeof ("
+                                 + variableName + ") + \"\"\" can not be edited.\""
+                                 + ",\"" + UiDataMessages.VARIABLE_EDITOR + "\", \"error\", \"modal\");"
+                                 + "      clear ans;"   // clear return value of messagebox
+                                 + "    end "
+                                 + "  end "
+                                 + "else "
+                                 + "  messagebox(\"Variable \"\""
+                                 + variableName + "\"\" no more exists.\""
+                                 + ",\"" + UiDataMessages.VARIABLE_EDITOR + "\", \"error\", \"modal\");"
+                                 + "  clear ans;"  // clear return value of messagebox
+                                 + "  browsevar();" // Reload browsevar to remove cleared variables
+                                 + "end");
         } catch (InterpreterException e1) {
             System.err.println("An error in the interpreter has been catched: " + e1.getLocalizedMessage());
         }