summaryrefslogtreecommitdiffstats
path: root/scilab/modules/gui
diff options
context:
space:
mode:
authorClément David <clement.david@esi-group.com>2021-07-15 15:50:48 +0200
committerClément David <clement.david@esi-group.com>2021-07-15 15:50:48 +0200
commit81a9cc049332de0c712cf56da585fcd25c8e59e3 (patch)
treef365c25a05c1782a16b2985bf7481116c106952d /scilab/modules/gui
parentb0937f19e4b8ddf416ca9a9a433bcbbd3f4ef2c0 (diff)
parent90b4ecb9b57ac6ad4e00d4a99b0d8bd1a6424403 (diff)
downloadscilab-master.zip
scilab-master.tar.gz
Merge remote-tracking branch 'origin/6.1'HEADmaster
Change-Id: I5d26fc380a28efe0bb6d0096fe9684b274b55bfe
Diffstat (limited to 'scilab/modules/gui')
-rw-r--r--scilab/modules/gui/Makefile.in2
-rw-r--r--scilab/modules/gui/help/en_US/close.xml95
-rw-r--r--scilab/modules/gui/help/en_US/x_matrix.xml167
-rw-r--r--scilab/modules/gui/help/images/x_matrix_booleans.pngbin0 -> 4139 bytes
-rw-r--r--scilab/modules/gui/help/images/x_matrix_complex.pngbin0 -> 7592 bytes
-rw-r--r--scilab/modules/gui/help/images/x_matrix_header_scrollbars.pngbin0 -> 8061 bytes
-rw-r--r--scilab/modules/gui/help/images/x_matrix_integers.pngbin0 -> 5218 bytes
-rw-r--r--scilab/modules/gui/help/images/x_matrix_reals.pngbin0 -> 6417 bytes
-rw-r--r--scilab/modules/gui/help/images/x_matrix_text.pngbin0 -> 6660 bytes
-rw-r--r--scilab/modules/gui/help/ja_JP/close.xml100
-rw-r--r--scilab/modules/gui/help/ja_JP/x_matrix.xml51
-rw-r--r--scilab/modules/gui/help/ru_RU/close.xml95
-rw-r--r--scilab/modules/gui/macros/close.sci57
-rw-r--r--scilab/modules/gui/macros/x_matrix.sci84
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabSpinner.java28
-rw-r--r--scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java14
-rw-r--r--scilab/modules/gui/tests/unit_tests/close.tst74
-rw-r--r--scilab/modules/gui/tests/unit_tests/x_matrix.tst48
18 files changed, 687 insertions, 128 deletions
diff --git a/scilab/modules/gui/Makefile.in b/scilab/modules/gui/Makefile.in
index 140c1ae..7799f3c 100644
--- a/scilab/modules/gui/Makefile.in
+++ b/scilab/modules/gui/Makefile.in
@@ -735,9 +735,11 @@ NMEDIT = @NMEDIT@
735OBJDUMP = @OBJDUMP@ 735OBJDUMP = @OBJDUMP@
736OBJEXT = @OBJEXT@ 736OBJEXT = @OBJEXT@
737OCAMLC = @OCAMLC@ 737OCAMLC = @OCAMLC@
738OCAMLCFLAGS = @OCAMLCFLAGS@
738OCAMLDEP = @OCAMLDEP@ 739OCAMLDEP = @OCAMLDEP@
739OCAMLLEX = @OCAMLLEX@ 740OCAMLLEX = @OCAMLLEX@
740OCAMLOPT = @OCAMLOPT@ 741OCAMLOPT = @OCAMLOPT@
742OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
741OCAMLYACC = @OCAMLYACC@ 743OCAMLYACC = @OCAMLYACC@
742OPENMPI_CC = @OPENMPI_CC@ 744OPENMPI_CC = @OPENMPI_CC@
743OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ 745OPENMPI_CFLAGS = @OPENMPI_CFLAGS@
diff --git a/scilab/modules/gui/help/en_US/close.xml b/scilab/modules/gui/help/en_US/close.xml
index 8d73ef5..c57991b 100644
--- a/scilab/modules/gui/help/en_US/close.xml
+++ b/scilab/modules/gui/help/en_US/close.xml
@@ -1,16 +1,37 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2012 - 2016 - Scilab Enterprises
5 * Copyright (C) 2020 - Samuel GOUGEON
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 -->
2<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" 15<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook" 16 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
4 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="close"> 17 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="close">
5 <refnamediv> 18 <refnamediv>
6 <refname>close</refname> 19 <refname>close</refname>
7 <refpurpose>closes graphic figures, progressionbars or waitbars</refpurpose> 20 <refpurpose>
21 Closes graphic figures, progression or wait bars, the help browser, xcos,
22 the variables browser or editor.
23 </refpurpose>
8 </refnamediv> 24 </refnamediv>
9 <refsynopsisdiv> 25 <refsynopsisdiv>
10 <title>Syntax</title> 26 <title>Syntax</title>
11 <synopsis> 27 <synopsis>
12 close 28 close
13 close(H) 29 close(H)
30 close help
31 close xcos
32 close xcos!
33 close editvar
34 close browsevar
14 </synopsis> 35 </synopsis>
15 </refsynopsisdiv> 36 </refsynopsisdiv>
16 <refsection role="parameters"> 37 <refsection role="parameters">
@@ -22,18 +43,37 @@
22 <para>Vector of graphic figures handles or ids, or of handles of progression bar 43 <para>Vector of graphic figures handles or ids, or of handles of progression bar
23 or wait bar. 44 or wait bar.
24 </para> 45 </para>
25 <para>
26 By default, the current graphic figure is considered.
27 </para>
28 </listitem> 46 </listitem>
29 </varlistentry> 47 </varlistentry>
30 </variablelist> 48 </variablelist>
31 </refsection> 49 </refsection>
32 <refsection role="description"> 50 <refsection role="description">
33 <title>Description</title> 51 <title>Description</title>
34 <para>Graphic windows based on the Tk technology (such as still used by imshow() in the SIVP 52 <para>
35 external module) may be closed as well by providing their number that is their handle. 53 <emphasis role="bold">close</emphasis> closes the current graphic figure (if any).
36 </para> 54 </para>
55 <para>
56 <emphasis role="bold">close(H)</emphasis> closes the figures, waitbar or
57 progression bars whose handles or indices are in <varname>H</varname>.
58 </para>
59 <para>
60 <emphasis role="bold">close help</emphasis> closes the help browser.
61 </para>
62 <para>
63 <emphasis role="bold">close browsevar</emphasis> closes the variable browser.
64 </para>
65 <para>
66 <emphasis role="bold">close editvar</emphasis> closes the variable editor
67 (it must not be docked).
68 </para>
69 <para>
70 <emphasis role="bold">close xcos</emphasis> closes all opened xcos windows.
71 If some diagrams have unsaved changes, the user is asked for confirmation.
72 </para>
73 <para>
74 <emphasis role="bold">close xcos!</emphasis> forces closing all opened xcos windows
75 without asking for any confirmation.
76 </para>
37 </refsection> 77 </refsection>
38 <refsection role="examples"> 78 <refsection role="examples">
39 <title>Examples</title> 79 <title>Examples</title>
@@ -68,6 +108,30 @@ gcf().figure_position(1) = 700;
68sleep(5000); // Watch at them! 108sleep(5000); // Watch at them!
69close([25 200 111]) // Finished! 109close([25 200 111]) // Finished!
70 ]]></programlisting> 110 ]]></programlisting>
111 <para/>
112 <programlisting role="example"><![CDATA[
113// You are reading this example in the help browser. Now, bye:
114close help
115 ]]></programlisting>
116 <para/>
117 <programlisting role="example"><![CDATA[
118xcos
119sleep(5000)
120close xcos
121 ]]></programlisting>
122 <para/>
123 <programlisting role="example"><![CDATA[
124browsevar
125sleep(5000)
126close browsevar
127 ]]></programlisting>
128 <para/>
129 <programlisting role="example"><![CDATA[
130a = rand(3,5);
131editvar a
132sleep(5000)
133close editvar
134 ]]></programlisting>
71 </refsection> 135 </refsection>
72 <refsection role="see also"> 136 <refsection role="see also">
73 <title>See also</title> 137 <title>See also</title>
@@ -76,13 +140,13 @@ close([25 200 111]) // Finished!
76 <link linkend="delete">delete</link> 140 <link linkend="delete">delete</link>
77 </member> 141 </member>
78 <member> 142 <member>
79 <link linkend="figure">figure</link> 143 <link linkend="exit">exit</link>
80 </member> 144 </member>
81 <member> 145 <member>
82 <link linkend="scf">scf</link> 146 <link linkend="mclose">mclose</link>
83 </member> 147 </member>
84 <member> 148 <member>
85 <link linkend="gcf">gcf</link> 149 <link linkend="h5close">h5close</link>
86 </member> 150 </member>
87 </simplelist> 151 </simplelist>
88 </refsection> 152 </refsection>
@@ -92,7 +156,16 @@ close([25 200 111]) // Finished!
92 <revision> 156 <revision>
93 <revnumber>6.1.1</revnumber> 157 <revnumber>6.1.1</revnumber>
94 <revdescription> 158 <revdescription>
95 Vector of several figures ids now accepted. 159 <itemizedlist>
160 <listitem>
161 Vector of several figures ids now accepted.
162 </listitem>
163 <listitem>
164 Extension to <literal>close help</literal>, <literal>close xcos</literal>,
165 <literal>close xcos!</literal>, <literal>close browsevar</literal>,
166 and <literal>close editvar</literal>
167 </listitem>
168 </itemizedlist>
96 </revdescription> 169 </revdescription>
97 </revision> 170 </revision>
98 </revhistory> 171 </revhistory>
diff --git a/scilab/modules/gui/help/en_US/x_matrix.xml b/scilab/modules/gui/help/en_US/x_matrix.xml
index 71fbf4d..5c359ed 100644
--- a/scilab/modules/gui/help/en_US/x_matrix.xml
+++ b/scilab/modules/gui/help/en_US/x_matrix.xml
@@ -1,26 +1,59 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<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="en" xml:id="x_matrix"> 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2006-2008 - INRIA
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="x_matrix">
3 <refnamediv> 19 <refnamediv>
4 <refname>x_matrix</refname> 20 <refname>x_matrix</refname>
5 <refpurpose>Xwindow editing of matrix</refpurpose> 21 <refpurpose>Edits a matrix and waits for validation (modal)</refpurpose>
6 </refnamediv> 22 </refnamediv>
7 <refsynopsisdiv> 23 <refsynopsisdiv>
8 <title>Syntax</title> 24 <title>Syntax</title>
9 <synopsis>[result]=x_matrix(label,matrix-init)</synopsis> 25 <synopsis>
26 matrixOut = x_matrix(Header, matrixIn)</synopsis>
10 </refsynopsisdiv> 27 </refsynopsisdiv>
11 <refsection> 28 <refsection>
12 <title>Arguments</title> 29 <title>Arguments</title>
13 <variablelist> 30 <variablelist>
14 <varlistentry> 31 <varlistentry>
15 <term>label</term> 32 <term>Header</term>
16 <listitem> 33 <listitem>
17 <para>character string (name of matrix)</para> 34 column vector of text: Text displayed before the matrix.
35 Extended UTF-8 characters are supported.
36 Any element starting with "&lt;body>" can use HTML.4 tags
37 afterward.
38 <para/>
18 </listitem> 39 </listitem>
19 </varlistentry> 40 </varlistentry>
20 <varlistentry> 41 <varlistentry>
21 <term>matrix-init</term> 42 <term>matrixIn</term>
22 <listitem> 43 <listitem>
23 <para>real matrix</para> 44 Initial vector or matrix of booleans, encoded integers, real or complex numbers,
45 or text.
46 <para/>
47 </listitem>
48 </varlistentry>
49 <varlistentry>
50 <term>matrixOut</term>
51 <listitem>
52 Modified matrix, of the same type than <varname>matrixIn</varname>,
53 if <emphasis role="bold">"OK"</emphasis> is pressed.
54 Or <literal>[]</literal> if <emphasis role="bold">"Cancel"</emphasis>
55 is pressed.
56 <para/>
24 </listitem> 57 </listitem>
25 </varlistentry> 58 </varlistentry>
26 </variablelist> 59 </variablelist>
@@ -28,14 +61,104 @@
28 <refsection> 61 <refsection>
29 <title>Description</title> 62 <title>Description</title>
30 <para> 63 <para>
31 For reading or editing a matrix . 64 Edits a matrix in a modal way: Scilab is paused while the matrix is displayed and
65 the user can modify it. One of both buttons "OK" or "Cancel" must be clicked
66 to validate or cancel modifications. Either the modified matrix or []
67 is returned accordingly. Then Scilab resumes the execution of next instructions.
68 </para>
69 <para>
70 The pop-up is sized according to the displayed matrix. It can be resized interactively.
71 If it becomes narrower than the matrix or the header,
72 long header lines are wrapped, and some scroll bars appear.
32 </para> 73 </para>
33 </refsection> 74 </refsection>
34 <refsection> 75 <refsection>
35 <title>Examples</title> 76 <title>Examples</title>
36 <programlisting role="example"><![CDATA[ 77 <programlisting role="example"><![CDATA[
37m=evstr(x_matrix('enter a 3x3 matrix ',rand(3,3))) 78i = int8(grand(3,4,"uin",-150,150))
38 ]]></programlisting> 79
80// With booleans
81b = i > 0
82m = x_matrix("<html><body>Matrix of <b>booleans", b)
83
84// With encoded integers
85m = x_matrix("<html><body>Matrix of <b>int8 integers", i)
86
87// With real numbers
88c = grand(5,4,"uin",-15,15) + grand(5,4,"uin",0,9)/10;
89c([14 8 16]) = [%nan %inf -%inf]
90m = x_matrix("<html><body>Matrix of <b>decimal numbers", c)
91
92// With complex numbers
93c = grand(5,3,"uin",-15,15) + grand(5,3,"uin",-15,15)*%i;
94c(2,2) = 3-1.24e-31*%i;
95c(4,3) = complex(0,%nan)
96m = x_matrix("<body>Matrix of <b>complex numbers", c)
97
98// With texts
99t = ["ab" "I don''t" "αβδεϵζ"
100 "j" """Yes""" "àéêèïôûù"]
101m = x_matrix("<body>Matrix of <b>text", t)
102 ]]></programlisting>
103 <para/>
104 <table>
105 <tr>
106 <td valign="top">
107 <inlinemediaobject>
108 <imageobject>
109 <imagedata fileref="../images/x_matrix_booleans.png" />
110 </imageobject>
111 </inlinemediaobject>
112 <inlinemediaobject>
113 <imageobject>
114 <imagedata fileref="../images/x_matrix_integers.png" />
115 </imageobject>
116 </inlinemediaobject>
117 <inlinemediaobject>
118 <imageobject>
119 <imagedata fileref="../images/x_matrix_text.png" />
120 </imageobject>
121 </inlinemediaobject>
122 </td>
123 </tr>
124 <tr>
125 <td valign="top">
126 <inlinemediaobject>
127 <imageobject>
128 <imagedata fileref="../images/x_matrix_reals.png" />
129 </imageobject>
130 </inlinemediaobject>
131 <inlinemediaobject>
132 <imageobject>
133 <imagedata fileref="../images/x_matrix_complex.png" />
134 </imageobject>
135 </inlinemediaobject>
136 </td>
137 </tr>
138 </table>
139 <para/>
140 <para>
141 With a multiple-line and styled header:
142 </para>
143 <programlisting role="example"><![CDATA[
144//
145online = "https://help.scilab.org/docs/current/en_US/x_matrix.html";
146header = ["<body><h3>Head line"
147 "<body><b>Presentation:</b>"
148 "The pop-up can be resized. Some scroll bars may appear."
149 "<body>This <font color=''red''><b>word</b></font> is bold and red. " + ..
150 "<body>x_matrix <a href=''" + online + "''>online page</a>."
151 ]
152b = grand(4,14,"uin",-2,1) < 0
153m = x_matrix(header, b)
154 ]]></programlisting>
155 <para>
156 <inlinemediaobject>
157 <imageobject>
158 <imagedata fileref="../images/x_matrix_header_scrollbars.png" />
159 </imageobject>
160 </inlinemediaobject>
161 </para>
39 </refsection> 162 </refsection>
40 <refsection role="see also"> 163 <refsection role="see also">
41 <title>See also</title> 164 <title>See also</title>
@@ -46,6 +169,30 @@ m=evstr(x_matrix('enter a 3x3 matrix ',rand(3,3)))
46 <member> 169 <member>
47 <link linkend="x_dialog">x_dialog</link> 170 <link linkend="x_dialog">x_dialog</link>
48 </member> 171 </member>
172 <member>
173 <link linkend="editvar">editvar</link>
174 </member>
175 <member>
176 <link linkend="uicontrol">uicontrol table</link>
177 </member>
178 <member>
179 <link linkend="messagebox">messagebox</link>
180 </member>
181 <member>
182 <link linkend="prettyprint">prettyprint</link>
183 </member>
49 </simplelist> 184 </simplelist>
50 </refsection> 185 </refsection>
186 <refsection role="history">
187 <title>History</title>
188 <revhistory>
189 <revision>
190 <revnumber>6.1.1</revnumber>
191 <revdescription>
192 Booleans, encoded integers, and text are supported.
193 The display of real and complex matrices is improved.
194 </revdescription>
195 </revision>
196 </revhistory>
197 </refsection>
51</refentry> 198</refentry>
diff --git a/scilab/modules/gui/help/images/x_matrix_booleans.png b/scilab/modules/gui/help/images/x_matrix_booleans.png
new file mode 100644
index 0000000..477daf5
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_booleans.png
Binary files differ
diff --git a/scilab/modules/gui/help/images/x_matrix_complex.png b/scilab/modules/gui/help/images/x_matrix_complex.png
new file mode 100644
index 0000000..1c1f6d4
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_complex.png
Binary files differ
diff --git a/scilab/modules/gui/help/images/x_matrix_header_scrollbars.png b/scilab/modules/gui/help/images/x_matrix_header_scrollbars.png
new file mode 100644
index 0000000..9bb4d30
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_header_scrollbars.png
Binary files differ
diff --git a/scilab/modules/gui/help/images/x_matrix_integers.png b/scilab/modules/gui/help/images/x_matrix_integers.png
new file mode 100644
index 0000000..9e7635a
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_integers.png
Binary files differ
diff --git a/scilab/modules/gui/help/images/x_matrix_reals.png b/scilab/modules/gui/help/images/x_matrix_reals.png
new file mode 100644
index 0000000..3ec7f5e
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_reals.png
Binary files differ
diff --git a/scilab/modules/gui/help/images/x_matrix_text.png b/scilab/modules/gui/help/images/x_matrix_text.png
new file mode 100644
index 0000000..69cce23
--- /dev/null
+++ b/scilab/modules/gui/help/images/x_matrix_text.png
Binary files differ
diff --git a/scilab/modules/gui/help/ja_JP/close.xml b/scilab/modules/gui/help/ja_JP/close.xml
index cc7e4c3..813569b 100644
--- a/scilab/modules/gui/help/ja_JP/close.xml
+++ b/scilab/modules/gui/help/ja_JP/close.xml
@@ -1,23 +1,43 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2012 - 2016 - Scilab Enterprises
5 * Copyright (C) 2020 - Samuel GOUGEON
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 -->
2<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" 15<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook" 16 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
4 xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="close"> 17 xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="close">
5 <refnamediv> 18 <refnamediv>
6 <refname>close</refname> 19 <refname>close</refname>
7 <refpurpose>図を閉じる</refpurpose> 20 <refpurpose>
21 グラフィックフィギュア,進行バーまたは待機バー,ヘルプブラウザ,xcos,browsevar,またはeditvarを閉じます
22 </refpurpose>
8 </refnamediv> 23 </refnamediv>
9 <refsynopsisdiv> 24 <refsynopsisdiv>
10 <title>Syntax</title> 25 <title>Syntax</title>
11 <synopsis> 26 <synopsis>
12 close 27 close
13 close(h) 28 close(H)
29 close help
30 close xcos
31 close xcos!
32 close editvar
33 close browsevar
14 </synopsis> 34 </synopsis>
15 </refsynopsisdiv> 35 </refsynopsisdiv>
16 <refsection> 36 <refsection>
17 <title>引数</title> 37 <title>引数</title>
18 <variablelist> 38 <variablelist>
19 <varlistentry> 39 <varlistentry>
20 <term>h</term> 40 <term>H</term>
21 <listitem> 41 <listitem>
22 <para>Vector of graphic figures handles or ids, or of handles of progression bar 42 <para>Vector of graphic figures handles or ids, or of handles of progression bar
23 or wait bar. 43 or wait bar.
@@ -28,11 +48,31 @@
28 </refsection> 48 </refsection>
29 <refsection> 49 <refsection>
30 <title>説明</title> 50 <title>説明</title>
31 <para> 51 <para>
32 このルーチンはtksci図(トップレベルウインドウ)を閉じます. 52 <emphasis role="bold">close</emphasis> closes the current graphic figure (if any).
33 ハンドルが指定された場合,このハンドルに対応する図が閉じられます. 53 </para>
34 それ以外の場合,カレントの(アクティブな)図が閉じられます. 54 <para>
35 </para> 55 <emphasis role="bold">close(H)</emphasis> closes the figures, waitbar or
56 progression bars whose handles or indices are in <varname>H</varname>.
57 </para>
58 <para>
59 <emphasis role="bold">close help</emphasis> closes the help browser.
60 </para>
61 <para>
62 <emphasis role="bold">close browsevar</emphasis> closes the variable browser.
63 </para>
64 <para>
65 <emphasis role="bold">close editvar</emphasis> closes the variable editor
66 (it must not be docked).
67 </para>
68 <para>
69 <emphasis role="bold">close xcos</emphasis> closes all opened xcos windows.
70 If some diagrams have unsaved changes, the user is asked for confirmation.
71 </para>
72 <para>
73 <emphasis role="bold">close xcos!</emphasis> forces closing all opened xcos windows
74 without asking for any confirmation.
75 </para>
36 </refsection> 76 </refsection>
37 <refsection> 77 <refsection>
38 <title>例</title> 78 <title>例</title>
@@ -63,18 +103,45 @@ gcf().figure_position(1) = 700;
63sleep(5000); // Watch at them! 103sleep(5000); // Watch at them!
64close([25 200 111]) // Finished! 104close([25 200 111]) // Finished!
65 ]]></programlisting> 105 ]]></programlisting>
106 <para/>
107 <programlisting role="example"><![CDATA[
108// You are reading this example in the help browser. Now, bye:
109close help
110 ]]></programlisting>
111 <para/>
112 <programlisting role="example"><![CDATA[
113xcos
114sleep(5000)
115close xcos
116 ]]></programlisting>
117 <para/>
118 <programlisting role="example"><![CDATA[
119browsevar
120sleep(5000)
121close browsevar
122 ]]></programlisting>
123 <para/>
124 <programlisting role="example"><![CDATA[
125a = rand(3,5);
126editvar a
127sleep(5000)
128close editvar
129 ]]></programlisting>
66 </refsection> 130 </refsection>
67 <refsection role="see also"> 131 <refsection role="see also">
68 <title>参照</title> 132 <title>参照</title>
69 <simplelist type="inline"> 133 <simplelist type="inline">
70 <member> 134 <member>
71 <link linkend="figure">figure</link> 135 <link linkend="delete">delete</link>
72 </member> 136 </member>
73 <member> 137 <member>
74 <link linkend="gcf">gcf</link> 138 <link linkend="exit">exit</link>
75 </member> 139 </member>
76 <member> 140 <member>
77 <link linkend="delete">delete</link> 141 <link linkend="mclose">mclose</link>
142 </member>
143 <member>
144 <link linkend="h5close">h5close</link>
78 </member> 145 </member>
79 </simplelist> 146 </simplelist>
80 </refsection> 147 </refsection>
@@ -84,7 +151,16 @@ close([25 200 111]) // Finished!
84 <revision> 151 <revision>
85 <revnumber>6.1.1</revnumber> 152 <revnumber>6.1.1</revnumber>
86 <revdescription> 153 <revdescription>
87 Vector of several figures ids now accepted. 154 <itemizedlist>
155 <listitem>
156 Vector of several figures ids now accepted.
157 </listitem>
158 <listitem>
159 Extension to <literal>close help</literal>, <literal>close xcos</literal>,
160 <literal>close xcos!</literal>, <literal>close browsevar</literal>,
161 and <literal>close editvar</literal>
162 </listitem>
163 </itemizedlist>
88 </revdescription> 164 </revdescription>
89 </revision> 165 </revision>
90 </revhistory> 166 </revhistory>
diff --git a/scilab/modules/gui/help/ja_JP/x_matrix.xml b/scilab/modules/gui/help/ja_JP/x_matrix.xml
deleted file mode 100644
index 601d139..0000000
--- a/scilab/modules/gui/help/ja_JP/x_matrix.xml
+++ /dev/null
@@ -1,51 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<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="x_matrix">
3 <refnamediv>
4 <refname>x_matrix</refname>
5 <refpurpose>行列を編集する Xwindow </refpurpose>
6 </refnamediv>
7 <refsynopsisdiv>
8 <title>呼び出し手順</title>
9 <synopsis>[result]=x_matrix(label,matrix-init)</synopsis>
10 </refsynopsisdiv>
11 <refsection>
12 <title>引数</title>
13 <variablelist>
14 <varlistentry>
15 <term>label</term>
16 <listitem>
17 <para>文字列 (行列の名前)</para>
18 </listitem>
19 </varlistentry>
20 <varlistentry>
21 <term>matrix-init</term>
22 <listitem>
23 <para>実数の行列</para>
24 </listitem>
25 </varlistentry>
26 </variablelist>
27 </refsection>
28 <refsection>
29 <title>説明</title>
30 <para>
31 行列を読込または編集します.
32 </para>
33 </refsection>
34 <refsection>
35 <title>例</title>
36 <programlisting role="example"><![CDATA[
37m=evstr(x_matrix('enter a 3x3 matrix ',rand(3,3)))
38 ]]></programlisting>
39 </refsection>
40 <refsection role="see also">
41 <title>参照</title>
42 <simplelist type="inline">
43 <member>
44 <link linkend="x_mdialog">x_mdialog</link>
45 </member>
46 <member>
47 <link linkend="x_dialog">x_dialog</link>
48 </member>
49 </simplelist>
50 </refsection>
51</refentry>
diff --git a/scilab/modules/gui/help/ru_RU/close.xml b/scilab/modules/gui/help/ru_RU/close.xml
index 1e923b8..1bbedee 100644
--- a/scilab/modules/gui/help/ru_RU/close.xml
+++ b/scilab/modules/gui/help/ru_RU/close.xml
@@ -1,11 +1,25 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2012 - 2016 - Scilab Enterprises
5 * Copyright (C) 2020 - Samuel GOUGEON
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 -->
2<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" 15<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook" 16 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
4 xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="close"> 17 xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="close">
5 <refnamediv> 18 <refnamediv>
6 <refname>close</refname> 19 <refname>close</refname>
7 <refpurpose> 20 <refpurpose>
8 закрывает графические окна, панели прогресса и панели состояния 21 Закрывает графические окна, панели прогресса или состояния, браузер справки, xcos,
22 браузер переменных или редактор.
9 </refpurpose> 23 </refpurpose>
10 </refnamediv> 24 </refnamediv>
11 <refsynopsisdiv> 25 <refsynopsisdiv>
@@ -13,6 +27,11 @@
13 <synopsis> 27 <synopsis>
14 close 28 close
15 close(H) 29 close(H)
30 close help
31 close xcos
32 close xcos!
33 close editvar
34 close browsevar
16 </synopsis> 35 </synopsis>
17 </refsynopsisdiv> 36 </refsynopsisdiv>
18 <refsection role="parameters"> 37 <refsection role="parameters">
@@ -25,20 +44,37 @@
25 вектор дескрипторов графических окон или идентификаторов, 44 вектор дескрипторов графических окон или идентификаторов,
26 либо дескрипторов панели прогресса и панели состояния. 45 либо дескрипторов панели прогресса и панели состояния.
27 </para> 46 </para>
28 <para>
29 По умолчанию рассматривается текущее графическое окно.
30 </para>
31 </listitem> 47 </listitem>
32 </varlistentry> 48 </varlistentry>
33 </variablelist> 49 </variablelist>
34 </refsection> 50 </refsection>
35 <refsection role="description"> 51 <refsection role="description">
36 <title>Описание</title> 52 <title>Описание</title>
37 <para> 53 <para>
38 Графические окна, основанные на технологии Tk (такие, как по-прежнему 54 <emphasis role="bold">close</emphasis> закрывает текущее графическое окно (если есть).
39 используемое imshow() во внешнем модуле SIVP), могут быть закрыты 55 </para>
40 также по указанию их номера, который является их дескриптором. 56 <para>
41 </para> 57 <emphasis role="bold">close(H)</emphasis> закрывает графические окна,панели состояния
58 или прогресса, чьи индикаторы или индексы находятся в <varname>H</varname>.
59 </para>
60 <para>
61 <emphasis role="bold">close help</emphasis> закрывает браузер справки.
62 </para>
63 <para>
64 <emphasis role="bold">close browsevar</emphasis> закрывает браузер переменных.
65 </para>
66 <para>
67 <emphasis role="bold">close editvar</emphasis> закрывает редактор переменных
68 (он не должен быть встроенным).
69 </para>
70 <para>
71 <emphasis role="bold">close xcos</emphasis> закрывает все открытые окна xcos.
72 Если какие-то диаграммы имеют несохранённые изменения, то у пользователя запросят подтверждение.
73 </para>
74 <para>
75 <emphasis role="bold">close xcos!</emphasis> принудительное закрытие всех открытых
76 окон xcos без запроса какого-либо подтверждения.
77 </para>
42 </refsection> 78 </refsection>
43 <refsection role="examples"> 79 <refsection role="examples">
44 <title>Примеры</title> 80 <title>Примеры</title>
@@ -73,6 +109,30 @@ gcf().figure_position(1) = 700;
73sleep(5000); // смотрим на них! 109sleep(5000); // смотрим на них!
74close([25 200 111]) // конец! 110close([25 200 111]) // конец!
75 ]]></programlisting> 111 ]]></programlisting>
112 <para/>
113 <programlisting role="example"><![CDATA[
114// Вы читаете этот пример в браузере справки. Теперь до свидания:
115close help
116 ]]></programlisting>
117 <para/>
118 <programlisting role="example"><![CDATA[
119xcos
120sleep(5000)
121close xcos
122 ]]></programlisting>
123 <para/>
124 <programlisting role="example"><![CDATA[
125browsevar
126sleep(5000)
127close browsevar
128 ]]></programlisting>
129 <para/>
130 <programlisting role="example"><![CDATA[
131a = rand(3,5);
132editvar a
133sleep(5000)
134close editvar
135 ]]></programlisting>
76 </refsection> 136 </refsection>
77 <refsection role="see also"> 137 <refsection role="see also">
78 <title>Смотрите также</title> 138 <title>Смотрите также</title>
@@ -81,13 +141,13 @@ close([25 200 111]) // конец!
81 <link linkend="delete">delete</link> 141 <link linkend="delete">delete</link>
82 </member> 142 </member>
83 <member> 143 <member>
84 <link linkend="figure">figure</link> 144 <link linkend="exit">exit</link>
85 </member> 145 </member>
86 <member> 146 <member>
87 <link linkend="scf">scf</link> 147 <link linkend="mclose">mclose</link>
88 </member> 148 </member>
89 <member> 149 <member>
90 <link linkend="gcf">gcf</link> 150 <link linkend="h5close">h5close</link>
91 </member> 151 </member>
92 </simplelist> 152 </simplelist>
93 </refsection> 153 </refsection>
@@ -97,7 +157,16 @@ close([25 200 111]) // конец!
97 <revision> 157 <revision>
98 <revnumber>6.1.1</revnumber> 158 <revnumber>6.1.1</revnumber>
99 <revdescription> 159 <revdescription>
100 Теперь принимаются идентификаторы нескольких окон. 160 <itemizedlist>
161 <listitem>
162 Теперь принимаются идентификаторы нескольких окон.
163 </listitem>
164 <listitem>
165 Расширение до <literal>close help</literal>, <literal>close xcos</literal>,
166 <literal>close xcos!</literal>, <literal>close browsevar</literal>
167 и <literal>close editvar</literal>
168 </listitem>
169 </itemizedlist>
101 </revdescription> 170 </revdescription>
102 </revision> 171 </revision>
103 </revhistory> 172 </revhistory>
diff --git a/scilab/modules/gui/macros/close.sci b/scilab/modules/gui/macros/close.sci
index dc95907..debf7d5 100644
--- a/scilab/modules/gui/macros/close.sci
+++ b/scilab/modules/gui/macros/close.sci
@@ -12,11 +12,13 @@
12 12
13function close(h) 13function close(h)
14 14
15 // Close a graphic figure or delete an uimenu or an uicontrol 15 // Close a graphic figure, or delete an uimenu or an uicontrol,
16 // or close editvar, browsevar, helpbrowser, or all xcos GUI
17
16 // This function has been written for compatibility with old TK uicontrols/uimenus 18 // This function has been written for compatibility with old TK uicontrols/uimenus
17 19
18 // handle has been given ? 20 // handle has been given ?
19 rhs=argn(2); 21 rhs = argn(2);
20 22
21 if rhs < 1 then 23 if rhs < 1 then
22 // No handle given so destroy current figure 24 // No handle given so destroy current figure
@@ -25,9 +27,9 @@ function close(h)
25 end 27 end
26 else 28 else
27 if type(h) == 9 then // Graphics handle 29 if type(h) == 9 then // Graphics handle
28 delete(h) 30 delete(h);
29 31
30 elseif type(h) == 1 then // vector of Figures ids 32 elseif type(h) == 1 then
31 for i = 1:length(h) 33 for i = 1:length(h)
32 tmp = findobj("figure_id",h(i)); 34 tmp = findobj("figure_id",h(i));
33 if tmp <> [] then 35 if tmp <> [] then
@@ -35,9 +37,56 @@ function close(h)
35 end 37 end
36 end 38 end
37 39
40 elseif type(h)==10
41 for i = 1:size(h,"*")
42 gui = h(i)
43 select gui
44 case "help"
45 jimport org.scilab.modules.gui.helpbrowser.ScilabHelpBrowser
46 hb = ScilabHelpBrowser.getHelpBrowserWithoutCreation()
47 if type(hb) <> 1
48 hb.close()
49 end
50
51 case "editvar"
52 jimport org.scilab.modules.ui_data.variableeditor.ScilabVariableEditor
53 ve = ScilabVariableEditor.getVariableEditor()
54 if type(ve) <> 1 // <=> ve <> []
55 ve.close()
56 end
57
58 case "browsevar"
59 jimport org.scilab.modules.ui_data.variablebrowser.ScilabVariableBrowser
60 if ScilabVariableBrowser.isBrowseVarOpened()
61 vb = ScilabVariableBrowser.getVariableBrowser()
62 vb.close()
63 end
64
65 case "xcos" // ask for confirmation in case of unsaved changes
66 javaclasspath(SCI + "/modules/xcos/jar/org.scilab.modules.xcos.jar");
67 jimport org.scilab.modules.xcos.Xcos
68 try
69 // Closes all opened Xcos instances: ask for confirmation
70 Xcos.closeSession(%t)
71 end
72
73 case "xcos!" // Do not ask for confirmation in case of unsaved changes
74 javaclasspath(SCI + "/modules/xcos/jar/org.scilab.modules.xcos.jar");
75 jimport org.scilab.modules.xcos.Xcos
76 try
77 inst = Xcos.getInstance()
78 inst.closeXcosFromScilab()
79 end
80
81 else
82 msg = _("%s: Argument #%d: Unknown GUI name ''%s''.\n")
83 warning(msprintf(msg, "close", 1, h(i)))
84 end
85 end
38 else 86 else
39 // Do not know what to do 87 // Do not know what to do
40 error(msprintf(gettext("%s: Wrong type for input argument #%d: A graphic handle or a real expected.\n"), "close", 1)); 88 error(msprintf(gettext("%s: Wrong type for input argument #%d: A graphic handle or a real expected.\n"), "close", 1));
41 end 89 end
42 end 90 end
43endfunction 91endfunction
92
diff --git a/scilab/modules/gui/macros/x_matrix.sci b/scilab/modules/gui/macros/x_matrix.sci
index 2fdcb712..d479894 100644
--- a/scilab/modules/gui/macros/x_matrix.sci
+++ b/scilab/modules/gui/macros/x_matrix.sci
@@ -1,6 +1,6 @@
1// Copyright (C) INRIA 1// Copyright (C) INRIA
2//
3// Copyright (C) 2012 - 2016 - Scilab Enterprises 2// Copyright (C) 2012 - 2016 - Scilab Enterprises
3// Copyright (C) 2020 - Samuel GOUGEON
4// 4//
5// This file is hereby licensed under the terms of the GNU GPL v2.0, 5// This file is hereby licensed under the terms of the GNU GPL v2.0,
6// pursuant to article 5.3.4 of the CeCILL v.2.1. 6// pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -8,26 +8,82 @@
8// and continues to be available under such terms. 8// and continues to be available under such terms.
9// For more information, see the COPYING file which you should have received 9// For more information, see the COPYING file which you should have received
10// along with this program. 10// along with this program.
11function [y] = x_matrix(mes, x) 11
12function y = x_matrix(mes, x)
12 13
13 [lhs, rhs] = argn(0); 14 [lhs, rhs] = argn(0);
14 if rhs < 2 then 15 if rhs < 2 then
15 error(sprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "x_matrix", 2)); 16 error(sprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "x_matrix", 2));
16 end 17 end
17 18
18 if type(x)<>1 then 19 if and(type(x) <> [1 4 8 10]) then
19 error(msprintf(gettext("%s: Wrong type for input argument #%d: A real expected.\n"), "x_matrix", 2)); 20 error(msprintf(_("%s: Argument #%d: Booleans, numbers, or text expected.\n"), "x_matrix", 2));
20 end 21 end
21 [n1,n2] = size(x); 22
22 z = string(x); 23 // Encoding
23 y = []; 24 // --------
24 for i=1:n1, 25 select type(x)
25 y = [y; strcat(z(i,:), ", ")]; 26 case 1
27 isReal = %T
28 rx = real(x)
29 sr = string(rx)
30 sr(rx>=0) = ascii(160) + sr(rx>=0)
31 sr = strsubst(justify(sr,"l"), ascii(160), " ")
32 if ~isreal(x,0) then
33 isReal = %f
34 im = imag(x)
35 si = string(abs(im)) + "i"
36 im = im >= 0
37 si(im) = "+ " + si(im)
38 si(~im) = "- " + si(~im)
39 y = sr + " " + justify(si,"l")
40 y = strcat(y, ", ", "c")
41 else
42 y = strcat(sr, ", ", "c")
43 end
44 case 4 // booleans
45 y = strcat(string(x), " ","c")
46 case 8 // integer
47 y = string(x)
48 y = strcat(justify(y, "r"), ", ", "c")
49 case 10 // strings
50 y = strsubst(x, """", """""")
51 y = strsubst(y, "''", "''''")
52 y = """" + y + """"
53 y = strcat(justify(y, "l"),", ","c")
54 if mes <> [] & stripblanks(mes) <> ""
55 mes = [mes ; ""]
56 end
57 mes = [mes ; _("<html>(quotes <b>"" ''</b> inside texts must be doubled)")]
26 end 58 end
27 y(1) = "["+y(1); 59
28 for i=2:n1, 60 // Modal prompt
29 y(i) = " "+y(i); 61 // ------------
62 y = x_dialog(mes, y);
63
64 // Decoding
65 // --------
66 if y <> [] then
67 select type(x)
68 case 1
69 if ~isReal then
70 y = strsubst(y, " ", "")
71 fn = tempname()
72 csvWrite(y, fn, ",");
73 y = csvRead(fn, ",")
74 else
75 y = evstr(y)
76 end
77 case 4
78 y = strsubst(stripblanks(y), "T", "%T")
79 y = strsubst(y, "F", "%F")
80 y = "[" + strcat(y, ";") + "]"
81 y = evstr(y)
82 case 8
83 y = iconvert(evstr(y), inttype(x))
84 case 10
85 y = "[" + strcat(y, "; ") + "]"
86 y = evstr(y)
87 end
30 end 88 end
31 y(n1) = y(n1)+"]";
32 y = evstr(x_dialog(mes,y));
33endfunction 89endfunction
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabSpinner.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabSpinner.java
index 5424a2b..1729d83 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabSpinner.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabSpinner.java
@@ -3,6 +3,7 @@ package org.scilab.modules.gui.bridge.editbox;
3import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__; 3import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
4import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__; 4import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
5import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__; 5import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
6import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SNAPTOTICKS__;
6import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__; 7import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
7 8
8import java.awt.Color; 9import java.awt.Color;
@@ -15,6 +16,10 @@ import javax.swing.UIManager;
15import javax.swing.border.Border; 16import javax.swing.border.Border;
16import javax.swing.event.ChangeEvent; 17import javax.swing.event.ChangeEvent;
17import javax.swing.event.ChangeListener; 18import javax.swing.event.ChangeListener;
19import javax.swing.JFormattedTextField;
20import javax.swing.text.NumberFormatter;
21
22
18 23
19import org.scilab.modules.graphic_objects.graphicController.GraphicController; 24import org.scilab.modules.graphic_objects.graphicController.GraphicController;
20import org.scilab.modules.gui.SwingViewObject; 25import org.scilab.modules.gui.SwingViewObject;
@@ -55,6 +60,14 @@ public class SwingScilabSpinner extends JSpinner implements SwingViewObject, Wid
55 addChangeListener(new ChangeListener() { 60 addChangeListener(new ChangeListener() {
56 public void stateChanged(ChangeEvent e) { 61 public void stateChanged(ChangeEvent e) {
57 Double val = (Double)getValue(); 62 Double val = (Double)getValue();
63 double userMin = (double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
64 double userMax = (double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
65 Double[] userStep = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__);
66 val = Math.max(Math.min(userMax,val),userMin);
67 if ((boolean)GraphicController.getController().getProperty(uid, __GO_UI_SNAPTOTICKS__)) {
68 val = (userMin/userStep[0]+Math.round((val-userMin)/userStep[0]))*userStep[0];
69 }
70 setValue(val);
58 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, new Double[] {val}); 71 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, new Double[] {val});
59 if (callback != null) { 72 if (callback != null) {
60 callback.actionPerformed(null); 73 callback.actionPerformed(null);
@@ -171,23 +184,20 @@ public class SwingScilabSpinner extends JSpinner implements SwingViewObject, Wid
171 Double[] step = (Double[]) controller.getProperty(getId(), __GO_UI_SLIDERSTEP__); 184 Double[] step = (Double[]) controller.getProperty(getId(), __GO_UI_SLIDERSTEP__);
172 Double[] val = (Double[]) controller.getProperty(getId(), __GO_UI_VALUE__); 185 Double[] val = (Double[]) controller.getProperty(getId(), __GO_UI_VALUE__);
173 Double v = (val != null && val.length != 0) ? val[0] : 0.0; 186 Double v = (val != null && val.length != 0) ? val[0] : 0.0;
174 if (v > max) {
175 v = max;
176 }
177 187
178 if (v < min) { 188 //adjust value to current min,max,step
179 v = min;
180 }
181
182 //adjust value to current step
183 if (step[0] != 0) { 189 if (step[0] != 0) {
184 v = Math.floor((v / step[0])) * step[0]; 190 v = Math.min(max, min+Math.max(0,Math.round((v-min) / step[0])) * step[0]);
185 } else { 191 } else {
186 v = min; 192 v = min;
187 } 193 }
188 194
189 controller.setProperty(uid, __GO_UI_VALUE__, new Double[] {v}); 195 controller.setProperty(uid, __GO_UI_VALUE__, new Double[] {v});
190 setModel(new SpinnerNumberModel(v, min, max, step[0])); 196 setModel(new SpinnerNumberModel(v, min, max, step[0]));
197 JFormattedTextField txt = ((JSpinner.NumberEditor) getEditor()).getTextField();
198 ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false);
199 ((NumberFormatter) txt.getFormatter()).setCommitsOnValidEdit(true);
200
191 break; 201 break;
192 } 202 }
193 case __GO_UI_VALUE__: { 203 case __GO_UI_VALUE__: {
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
index bb59d4e6..77b8287 100644
--- a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
+++ b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
@@ -130,9 +130,15 @@ public class SwingScilabCommonPanel {
130 } 130 }
131 131
132 /* Update callback */ 132 /* Update callback */
133 String closingCommand = "if (findobj(\"figure_id\", " + figureId + ") <> []) then" + " if (get(findobj(\"figure_id\", " + figureId + "), 'event_handler_enable') == 'on') then" 133 String closingCommand = "%closing_fig = findobj('figure_id', " + figureId + ", '-flat');"
134 + " execstr(get(findobj(\"figure_id\", " + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + " end;" + " delete(findobj(\"figure_id\", " 134 + "if (%closing_fig <> []) then"
135 + figureId + "));" + "end;"; 135 + " if (get(%closing_fig, 'event_handler_enable') == 'on') then"
136 + " execstr(get(%closing_fig, 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');"
137 + " end;"
138 + " delete(%closing_fig);"
139 + "end;"
140 + "clear('%closing_fig');";
141
136 component.setCallback(null); 142 component.setCallback(null);
137 component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand)); 143 component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand));
138 /* Update menus callback */ 144 /* Update menus callback */
@@ -196,7 +202,7 @@ public class SwingScilabCommonPanel {
196 int state = component.getParentWindow().getExtendedState(); 202 int state = component.getParentWindow().getExtendedState();
197 if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) { 203 if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
198 component.getParentWindow().setExtendedState(state - SwingScilabWindow.ICONIFIED); 204 component.getParentWindow().setExtendedState(state - SwingScilabWindow.ICONIFIED);
199 } 205 }
200 } 206 }
201 break; 207 break;
202 case __GO_INFOBAR_VISIBLE__: { 208 case __GO_INFOBAR_VISIBLE__: {
diff --git a/scilab/modules/gui/tests/unit_tests/close.tst b/scilab/modules/gui/tests/unit_tests/close.tst
new file mode 100644
index 0000000..ea0a4f7
--- /dev/null
+++ b/scilab/modules/gui/tests/unit_tests/close.tst
@@ -0,0 +1,74 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2020 - Samuel GOUGEON
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- TEST WITH GRAPHIC -->
9// <-- NO CHECK REF -->
10//
11// <-- Short Description -->
12// Unitary tests for close()
13
14// Figures
15// -------
16close(winsid())
17scf(7);
18scf(3);
19scf(10);
20scf(6);
21close(6)
22assert_checkequal(winsid(), [7 3 10]);
23close()
24assert_checkequal(winsid(), [3 10]);
25close([10 3])
26assert_checkequal(winsid(), []);
27
28// Help
29// ----
30help
31sleep(200)
32close help
33jimport org.scilab.modules.gui.helpbrowser.ScilabHelpBrowser
34hb = ScilabHelpBrowser.getHelpBrowserWithoutCreation()
35sleep(100)
36assert_checkequal(hb, [])
37
38// Editvar
39// -------
40a = 1;
41editvar a
42sleep(200)
43close editvar
44jimport org.scilab.modules.ui_data.variableeditor.ScilabVariableEditor
45ve = ScilabVariableEditor.getVariableEditor();
46assert_checkequal(ve, []);
47
48// Browsevar
49// ---------
50browsevar
51sleep(200)
52close browsevar
53jimport org.scilab.modules.ui_data.variablebrowser.ScilabVariableBrowser
54assert_checkfalse(ScilabVariableBrowser.isBrowseVarOpened())
55
56// Xcos
57// ----
58xcos
59sleep(600)
60close xcos
61//
62javaclasspath(SCI + "/modules/xcos/jar/org.scilab.modules.xcos.jar");
63jimport org.scilab.modules.xcos.Xcos
64inst = Xcos.getInstance();
65od = inst.openedDiagrams();
66assert_checkequal(od.size(), int32(0));
67
68xcos
69sleep(600)
70close xcos!
71//
72inst = Xcos.getInstance();
73od = inst.openedDiagrams();
74assert_checkequal(od.size(), int32(0));
diff --git a/scilab/modules/gui/tests/unit_tests/x_matrix.tst b/scilab/modules/gui/tests/unit_tests/x_matrix.tst
new file mode 100644
index 0000000..e2bee7d
--- /dev/null
+++ b/scilab/modules/gui/tests/unit_tests/x_matrix.tst
@@ -0,0 +1,48 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2020 - Samuel GOUGEON
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// unit tests for x_matrix() function
9// =============================================================================
10
11// <-- INTERACTIVE TEST -->
12// <-- TEST WITH GRAPHIC -->
13
14i = int8(grand(3,4,"uin",-150,150))
15
16// With booleans
17// -------------
18b = i > 0
19m = x_matrix("<html><body>Matrix of <b>booleans", b)
20assert_checkequal(type(m), 4);
21assert_checkequal(size(m), size(b));
22
23// With encoded integers
24// ---------------------
25m = x_matrix("<html><body>Matrix of <b>int8 integers", i)
26assert_checkequal(inttype(m), inttype(i));
27assert_checkequal(size(m), size(i));
28
29// With real numbers
30// -----------------
31c = grand(5,4,"uin",-15,15) + grand(5,4,"uin",0,9)/10;
32c([14 8 16]) = [%nan %inf -%inf]
33m = x_matrix("<html><body>Matrix of <b>decimal numbers", c)
34
35// With complex numbers
36// --------------------
37c = grand(5,3,"uin",-15,15) + grand(5,3,"uin",-15,15)*%i;
38c(2,2) = 3-1.24e-31*%i;
39c(4,3) = complex(0,%nan)
40m = x_matrix("<body>Matrix of <b>complex numbers", c)
41
42// With text
43// ---------
44t = ["ab" "I don''t" "αβδεϵζ"
45 "j" """Yes""" "àéêèïôûù"]
46m = x_matrix("<body>Matrix of <b>text", t)
47assert_checkequal(type(m), 10);
48