- It can now sort any sparse 2D matrix, in all `g, r, c, lr, lc` methods, including sparse booleans and in multi-level mode. It was formerly limited to sparse real or complex vectors and only to the `g` mode.
- Any hypermatrix can be sorted along a dimension > 2.
* `unique` is enabled for any 2D sparse arrays, in simple, 'c' and 'r' modes.
-<<<<<<< HEAD
* `%chars` constant added, to easily access to some selected sets of unicode symbols.
* Lists are displayed in a more compact and comprehensive way.
* `interp1` is upgraded:
* `close` is extended to close the help browser, xcos, or the variables browser or editor GUIs.
* `polyint` is introduced to compute polynomial antiderivatives.
* Listbox uicontrol callback is now triggered by item click in single selection mode. For example, it allows successive execution of a demo in the demonstrations gui.
-
-=======
-* %chars constant added, to easily access to some selected sets of unicode symbols.
* `det` is now actually extended to sparse matrices.
->>>>>>> 608020c6bbd (* Bug 16636 fixed: det(sparse) now actually implemented)
+
Help pages:
-----------
* [#16631](https://bugzilla.scilab.org/16631): read-only handle properties were reported as unknown when trying to set them.
* [#16632](https://bugzilla.scilab.org/16632): Scilab did not start with unsupported locale on macOS.
* [#16636](https://bugzilla.scilab.org/16636): `det(sparse)` most often yielded `Nan`. `[e,m]=det(sparse)` was not actually implemented.
+* [#16638](https://bugzilla.scilab.org/16638): `getcolor` shew a bunch of issues.
* [#16644](https://bugzilla.scilab.org/16644): `input("message:")` yielded a wrong error message about `mprintf` in case of non-interpretable input.
* [#16654](https://bugzilla.scilab.org/16654): `interp` was leaking memory.
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2021 - 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.
* 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="en" xml:id="getcolor">
+<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="getcolor">
<refnamediv>
<refname>getcolor</refname>
- <refpurpose>opens a dialog to show colors in the current colormap</refpurpose>
+ <refpurpose>opens a dialog to show colors of the current or default colormap</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>c=getcolor(title,[cini])
- c=getcolor()
+ <synopsis>
+ c = getcolor()
+ c = getcolor(title)
+ c = getcolor(title, cini)
</synopsis>
</refsynopsisdiv>
<refsection>
<varlistentry>
<term>cini</term>
<listitem>
- <para>initial selected color id. Default value is 1.</para>
+ <para>initial selected color index. Default value is 1.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>c</term>
<listitem>
- <para>selected color id or [] if the selection is cancelled.</para>
+ <para>index of the selected color, or [] if the selection is canceled.</para>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Description</title>
<para>
- <literal>getcolor</literal> opens a window displaying the palette of the current colormap.
- The user can click on a color to show its id and RGB values.
- <literal>getcolor</literal> returns the id of the selected color or [] if the "Cancel" button has been clicked or the window closed.
+ <literal>getcolor</literal> opens a window displaying the palette of the current
+ colormap, or of the default one if no graphical figure exists.
+ The user can click on a color to show its index and its RGB values
+ in the bottom bar.
+ <literal>getcolor</literal> returns the index of the selected color, or [] if the "Cancel"
+ button has been clicked or the window has been closed.
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-getcolor();
+c = getcolor();
-getcolor("Title foo");
+c = getcolor("Title foo", color("red")); // preselects the red
-getcolor("foo",21); // Select the red
- ]]></programlisting>
+c = getcolor("Please choose a color");
+ ]]></programlisting>
+ <para/>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../../images/getcolor.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ <para/>
+ <screen><![CDATA[
+--> c = getcolor("Please choose a color")
+ c =
+ 28.
+]]></screen>
</refsection>
<refsection role="see also">
<title>See also</title>
<simplelist type="inline">
<member>
+ <link linkend="uigetcolor">uigetcolor</link>
+ </member>
+ <member>
+ <link linkend="color_list">color_list</link>
+ </member>
+ <member>
<link linkend="color">color</link>
</member>
<member>
<?xml version="1.0" encoding="UTF-8"?>
-
<!--
-
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-
* Copyright (C) INRIA
-
- *
-
-
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2021 - 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.
* 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="getcolor">
-
+<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="getcolor">
<refnamediv>
-
<refname>getcolor</refname>
-
<refpurpose>カレントのカラーマップの色を示すダイアログをオープンする</refpurpose>
-
</refnamediv>
-
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
- <synopsis>c=getcolor(title,[cini])
-
- c=getcolor()
-
+ <synopsis>
+ c = getcolor()
+ c = getcolor(title)
+ c = getcolor(title, cini)
</synopsis>
-
</refsynopsisdiv>
-
<refsection>
-
<title>引数</title>
-
<variablelist>
-
<varlistentry>
-
<term>title</term>
-
<listitem>
-
<para>文字列, ダイアログのタイトル.</para>
-
</listitem>
-
</varlistentry>
-
<varlistentry>
-
<term>cini</term>
-
<listitem>
-
<para>選択された初期値の色ID.デフォルト値はs 1.</para>
-
</listitem>
-
</varlistentry>
-
<varlistentry>
-
<term>c</term>
-
<listitem>
-
<para>選択された色IDまたは
-
選択がキャンセルされた場合に [].
-
</para>
-
</listitem>
-
</varlistentry>
-
</variablelist>
-
</refsection>
-
<refsection>
-
<title>説明</title>
-
<para>
-
<literal>getcolor</literal> はカレントのカラーマップのパレットを表示する
-
ウインドウをオープンします.
-
ユーザはそのIDとRGB値を表示するために色をクリックすることができます.
-
<literal>getcolor</literal> は選択された色のID,または
-
"Cancel"ボタンがクリックされたかウインドウがクローズされた場合に []を返します.
-
</para>
-
</refsection>
-
<refsection>
-
<title>例</title>
-
<programlisting role="example"><![CDATA[
-
-getcolor();
-
-
-
-getcolor("Title foo");
-
-
-
-getcolor("foo",21); // 赤を選択
-
- ]]></programlisting>
-
+c = getcolor();
+c = getcolor("Title foo", color("red")); // 赤を選択
+c = getcolor("Please choose a color");
+ ]]></programlisting>
+ <para/>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../../images/getcolor.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ <para/>
+ <screen><![CDATA[
+--> c = getcolor("Please choose a color")
+ c =
+ 28.
+]]></screen>
</refsection>
-
-
-
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
+ <link linkend="uigetcolor">uigetcolor</link>
+ </member>
+ <member>
+ <link linkend="color_list">color_list</link>
+ </member>
+ <member>
<link linkend="color">color</link>
-
</member>
-
<member>
-
<link linkend="colormap">colormap</link>
-
</member>
-
</simplelist>
-
</refsection>
-
-</refentry>
-
+</refentry>
\ No newline at end of file
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) INRIA
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2021 - 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.
* 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:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getcolor" xml:lang="pt">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:id="getcolor" xml:lang="pt">
<refnamediv>
<refname>getcolor</refname>
- <refpurpose>abre um diálogo que exibe as cores no mapa de cores
+ <refpurpose>abre um diálogo que exibe as cores no mapa de cores atual ou padrão
corrente
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>c=getcolor(title,[cini])
- c=getcolor()
+ <synopsis>
+ c = getcolor()
+ c = getcolor(title)
+ c = getcolor(title, cini)
</synopsis>
</refsynopsisdiv>
<refsection>
<varlistentry>
<term>cini</term>
<listitem>
- <para>identificador da cor selecionada inicial. O valor padrão é
- 1.
+ <para>número da cor selecionada inicial. O valor padrão é 1.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>c</term>
<listitem>
- <para>identificador da cor selecionada ou [] se o usuário tiver
+ <para>número da cor selecionada, ou [] se o usuário tiver
clicado no botão "Cancel" (cancelar).
</para>
</listitem>
<refsection>
<title>Descrição</title>
<para>
- <literal>getcolor</literal> abre uma janela que exibe o palete do
- mapa de cores corrente. O usuário pode clicar numa cor para exibir seu
- identificador e valores RGB. <literal>getcolor</literal> retorna o
- identificador da cor selecionada ou [] se o usuário clicar no botão
- "Cancel".
+ <literal>getcolor</literal> abre uma janela que exibe o palete do mapa
+ de cores corrente o padrão. O usuário pode clicar numa cor para exibir seu
+ número e valores RGB. <literal>getcolor</literal> retorna o
+ número da cor selecionada, ou [] se o usuário clicar no botão "Cancel".
</para>
</refsection>
+ <refsection>
+ <title>Exemplos</title>
+ <programlisting role="example"><![CDATA[
+c = getcolor();
+
+c = getcolor("Title foo", color("red")); // preselects the red
+
+c = getcolor("Please choose a color");
+ ]]></programlisting>
+ <para/>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../../images/getcolor.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ <para/>
+ <screen><![CDATA[
+--> c = getcolor("Please choose a color")
+ c =
+ 28.
+]]></screen>
+ </refsection>
<refsection role="see also">
<title>Ver Também</title>
<simplelist type="inline">
<member>
+ <link linkend="uigetcolor">uigetcolor</link>
+ </member>
+ <member>
+ <link linkend="color_list">color_list</link>
+ </member>
+ <member>
<link linkend="color">color</link>
</member>
<member>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) INRIA
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2021 - 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.
+ *
+ -->
+<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="getcolor">
+ <refnamediv>
+ <refname>getcolor</refname>
+ <refpurpose>
+ открывает диалог для показа цветов текущей цветовой карты или цветовой
+ карты по умолчанию
+ </refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <title>Синтаксис</title>
+ <synopsis>
+ c = getcolor()
+ c = getcolor(title)
+ c = getcolor(title, cini)
+ </synopsis>
+ </refsynopsisdiv>
+ <refsection>
+ <title>Аргументы</title>
+ <variablelist>
+ <varlistentry>
+ <term>title</term>
+ <listitem>
+ <para>строка, название диалога.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>cini</term>
+ <listitem>
+ <para>
+ индекс исходного выбранного цвета. Значению по умолчанию 1.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>c</term>
+ <listitem>
+ <para>
+ индекс выбранного цвета или <literal>[]</literal>, если
+ выбор отменён.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+ <refsection>
+ <title>Описание</title>
+ <para>
+ <literal>getcolor</literal> открывает окно, отображающее палитру текущей
+ цветовой карты, либо цветовой карты по умолчанию, если не существует
+ графического окна. Пользователь может щёлкнуть по цвету чтобы показать
+ его индекс и его RGB-значения на панели снизу.
+ <literal>getcolor</literal> возвращает индекс выбранного цвета, либо
+ <literal>[]</literal>, если выбор нажата кнопка "Отмена", либо окно
+ было закрыто.
+ </para>
+ </refsection>
+ <refsection>
+ <title>Примеры</title>
+ <programlisting role="example"><![CDATA[
+c = getcolor();
+
+c = getcolor("Title foo", color("red")); // предварительно выбран красный
+
+c = getcolor("Пожалуйста, выберите цвет");
+ ]]></programlisting>
+ <para/>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="../../images/getcolor.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ <para/>
+ <screen><![CDATA[
+--> c = getcolor("Please choose a color")
+ c =
+ 28.
+]]></screen>
+ </refsection>
+
+ <refsection role="see also">
+ <title>Смотрите также</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="uigetcolor">uigetcolor</link>
+ </member>
+ <member>
+ <link linkend="color_list">color_list</link>
+ </member>
+ <member>
+ <link linkend="color">color</link>
+ </member>
+ <member>
+ <link linkend="colormap">colormap</link>
+ </member>
+ </simplelist>
+ </refsection>
+</refentry>
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
-// Copyright (C) 2017 - Samuel GOUGEON
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2017, 2021 - 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.
else
cmap = []
curwin = []
- end;
+ end
// create the window for getcolor
- fig = scf();
- fig.visible = "off";
+ fig = figure("visible","off","background",-2); //scf();
win = fig.figure_id;
sdf; // quite agressive. Not sure it is actually useful
sda; // same remark
if cmap~=[] then
fig.color_map = cmap;
+ fig.figure_name = gettext("Current colormap")
else
cmap = fig.color_map;
+ fig.figure_name = gettext("Default colormap")
end;
N = size(cmap,1);
wdim = [1,1];
- r = wdim(1)/wdim(2);
- n = round(sqrt(N/r));
- m = int(n*r);
- H = m*45; // These numbers set the size of the getcolor window
- W = n*45;
- fig.figure_size = [H,W];
+ m = ceil(sqrt(N));
+ n = ceil(N/m);
+ [W, H] = (max(m*35,320), n*40) // minW=320 for infos in status bar
+ fig.axes_size = [W,H];
+ // position = center of screen:
+ c = get(0,"screensize_px")
+ fig.figure_position = [c(3)-W, c(4)-fig.figure_size(2)]/2
toolbar(win, "off")
-
delmenu(win, gettext("&File"))
delmenu(win, gettext("&Tools"))
delmenu(win, gettext("&Edit"))
end;
rects = [rects,R+[x;y;0;0]];
y = y-dy;
- end;
+ end
if Title~="" then
xsetech([-1/8,0,1+1/6,1+1/6-1/8],[0,0,wdim(1),wdim(2)]);
else
xsetech([-1/8,-1/8,1+1/6,1+1/6],[0,0,wdim(1),wdim(2)]);
- end;
+ end
// rectangles with the colors
xrects(rects,1:N);
+
// frame around the colors
r = m*n-N;
ddx = 0.05*dx;
ddy = 0.05*dy;
- if r==0 then
+ if abs(r)<0.1 then
xpoly([-ddx,1,1,-ddx],[0,0,1+ddy,1+ddy],"lines",1);
else
- xpoly([-ddx,1-1/n,1-1/n,1,1,-ddx],[0,0,r/m,r/m,1+ddy,1+ddy],"lines",1);
- end;
+ xpoly([-ddx, 1-dx, 1-dx, 1 , 1 ,-ddx],..
+ [ 0 , 0 , r*dy, r*dy, 1+ddy,1+ddy], "lines",1);
+ end
// title
if Title~="" then
- xtitle(Title);
- t = gce();
- t.font_size = 4;
- t.font_style = 6;
- end;
+ title(Title, "fontsize",3, "font_style",6)
+ end
k1 = min(max(cini,1),N);
xrects(rects(eye(),k1),-k1);
addmenu(win, gettext("Ok"));
addmenu(win, gettext("Cancel"));
+ set(gca(),"tight_limits","on","axes_bounds",[0 0 1 1],"margins",[.05 .05 .15 .05]);
fig.visible = "on";
c_i = 0;
elseif (c_i== -2) then
if str==Ok then k = k1; c = k; break;end;
if str==Cancel then k = []; c = []; break;end;
- end;
+ end
mc = int(cx/dx)+1;
nc = n-int(cy/dy);
if curwin~=[] then
scf(curwin);
- end;
-
-
+ end
endfunction