* Bug 13738: get_figure_handle() set obsolete 53/20953/6
Samuel GOUGEON [Fri, 19 Apr 2019 01:03:25 +0000 (03:03 +0200)]
  http://bugzilla.scilab.org/13738

Change-Id: I98fa12cd28e4447ca8f33f5a7132a7dcce2d41f4

21 files changed:
scilab/CHANGES.md
scilab/modules/demo_tools/macros/demo_gui.sci
scilab/modules/demo_tools/macros/demo_gui_update.sci
scilab/modules/graphics/help/en_US/figure_operations/scf.xml
scilab/modules/graphics/help/en_US/handle/get_figure_handle.xml
scilab/modules/graphics/help/ja_JP/figure_operations/scf.xml
scilab/modules/graphics/help/ja_JP/handle/get_figure_handle.xml
scilab/modules/graphics/help/pt_BR/figure_operations/scf.xml
scilab/modules/graphics/help/pt_BR/handle/get_figure_handle.xml
scilab/modules/graphics/macros/clf.sci
scilab/modules/graphics/macros/get_figure_handle.sci
scilab/modules/graphics/tests/nonreg_tests/bug_3999.dia.ref
scilab/modules/graphics/tests/nonreg_tests/bug_3999.tst
scilab/modules/graphics/tests/unit_tests/get_figure_handle.dia.ref [deleted file]
scilab/modules/graphics/tests/unit_tests/get_figure_handle.tst [deleted file]
scilab/modules/gui/demos/cb_uicontrol_plot3d.dem.sci
scilab/modules/gui/etc/graphics_menubar.xml
scilab/modules/gui/etc/graphics_toolbar.xml
scilab/modules/gui/macros/findobj.sci
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabCommonPanel.java
scilab/modules/slint/src/cpp/DeprecatedChecker.cpp

index d79cfff..e38b28b 100644 (file)
@@ -176,7 +176,7 @@ Obsolete functions or features
 * `sysdiag()` is obsolete. Please use `blockdiag()` instead.
 * `ric_desc` is obsolete and will be removed from Scilab 6.1.x. Please use `riccati` instead.
 * `noisegen` will be removed from Scilab 6.1.x. Please use `grand()` instead.
-
+* `get_figure_handle(n)` will be removed in Scilab 6.1.x. `findobj('figure_id',n)` replaces it.
 
 Removed Functions
 -----------------
@@ -224,6 +224,7 @@ Bug Fixes
 * [#10723](http://bugzilla.scilab.org/show_bug.cgi?id=10723): `subplot`'s action was unclearly described in its help page. Page improved.
 * [#11852](http://bugzilla.scilab.org/show_bug.cgi?id=11852): File browser didn't update after file creation or remove.
 * [#11363](http://bugzilla.scilab.org/show_bug.cgi?id=11363): show_window() did not raise the current graphics window.
+* [#13738](http://bugzilla.scilab.org/show_bug.cgi?id=13738): `get_figure_handle` was a specific duplicate of the more powerful `findobj('figure_id',n)` feature. It is now obsolete. 
 * [#12520](http://bugzilla.scilab.org/show_bug.cgi?id=12520): Vriable browser did not display the size of the variables.
 * [#12534](http://bugzilla.scilab.org/show_bug.cgi?id=12534): Variable browser did not display the size of the variables.
 * [#12837](http://bugzilla.scilab.org/show_bug.cgi?id=12837): `strcmpi` was an obsolete duplicate of `strcmp(,'i')`. It is removed.
index 434f4c0..b0b3644 100644 (file)
@@ -81,7 +81,6 @@ function demo_gui()
 
     lst_vars_locals = ["%h_delete";
     "demo_fig";
-    "get_figure_handle";
     "subdemolist";
     "demolistlock";
     "resize_demo_gui";
index 125e261..b6983a3 100644 (file)
@@ -24,7 +24,7 @@ function script_path = demo_gui_update()
     all_figs = winsid();
     all_figs = all_figs(all_figs >= 100001); // All Scilab graphic windows opened for demos
     for fig_index = 2:size(all_figs, "*")
-        fig_to_del = get_figure_handle(all_figs(fig_index));
+        fig_to_del = findobj("figure_id", all_figs(fig_index));
         if ~isempty(fig_to_del) then
             delete(fig_to_del);
         end
index 8841ad9..b2a2899 100644 (file)
  * 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="scf">
+<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="scf">
     <refnamediv>
         <refname>scf</refname>
         <refpurpose>set the current graphic figure
@@ -22,7 +25,8 @@
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>f = scf()
+        <synopsis>
+            f = scf()
             f = scf(h)
             f = scf(num)
         </synopsis>
@@ -98,7 +102,7 @@ plot3d() //draw in current figure (id=4)
                 <link linkend="clf">clf</link>
             </member>
             <member>
-                <link linkend="get_figure_handle">get_figure_handle</link>
+                <link linkend="winsid">winsid</link>
             </member>
             <member>
                 <link linkend="graphics_entities">graphics_entities</link>
index 1bebb40..94061ac 100644 (file)
@@ -16,7 +16,9 @@
 <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="get_figure_handle">
     <refnamediv>
         <refname>get_figure_handle</refname>
-        <refpurpose>get a figure handle from its id</refpurpose>
+        <refpurpose>
+            get a figure handle from its id <emphasis role="bold">(obsolete)</emphasis>
+        </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
     </refsection>
     <refsection>
         <title>Description</title>
+        <warning>
+            <emphasis role="bold">This function is obsolete</emphasis> and
+            will be removed in Scilab 6.1.x.
+            Please use <emphasis role="bold">findobj("figure_id",n)</emphasis> instead.
+        </warning>
         <para>
             <literal>get_figure_handle</literal> function allows to retrieve the handle
             of a graphic figure knowing its id. If a figure with the specified id exists
@@ -59,6 +66,7 @@ scf(12);
 f5 = get_figure_handle(5);
 // current figure remains the one with id 12
 gcf()
+
 // get a non existing figure
 f42 = get_figure_handle(42);
  ]]></programlisting>
@@ -83,4 +91,16 @@ f42 = get_figure_handle(42);
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    get_figure_handle(n) is declared obsolete.
+                    findobj("figure_id",n) is used instead.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 791bdcc..3079aec 100644 (file)
@@ -1,14 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
-
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-
  * Copyright (C) INRIA - Serge Steer
-
  *
-
-
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * 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="scf">
-
+<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="scf">
     <refnamediv>
-
         <refname>scf</refname>
-
         <refpurpose>カレントの図に指定する
-
             (window)
-
         </refpurpose>
-
     </refnamediv>
-
     <refsynopsisdiv>
-
         <title>呼び出し手順</title>
-
-        <synopsis>f = scf()
-
+        <synopsis>
+            f = scf()
             f = scf(h)
-
             f = scf(num)
-
         </synopsis>
-
     </refsynopsisdiv>
-
     <refsection>
-
         <title>引数</title>
-
         <variablelist>
-
             <varlistentry>
-
                 <term>h</term>
-
                 <listitem>
-
                     <para>図のハンドル (ハンドル型)</para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>num</term>
-
                 <listitem>
-
                     <para>figure_id (数値型)</para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>f</term>
-
                 <listitem>
-
                     <para>カレントの図のハンドル</para>
-
                 </listitem>
-
             </varlistentry>
-
         </variablelist>
-
     </refsection>
-
     <refsection>
-
         <title>説明</title>
-
         <para>
-
             カレントの図が描画対象となります.
-
             <literal>scf</literal>関数によりカレントの図を変更したり,
-
             まだ存在しない場合には作成することができます.
-
         </para>
-
         <para/>
-
         <para>
-
             <literal>scf(num)</literal> は<literal>figure_id==num</literal>の図を
-
             カレントの図に指定します.
-
             まだ存在しない場合には作成されます.
-
         </para>
-
         <para/>
-
         <para>
-
             <literal>scf(h)</literal> はハンドル<literal>h</literal>が指す
-
             図をカレントの図に指定します.まだ存在しない場合には作成されます.
-
         </para>
-
         <para>
-
             <literal>scf()</literal> は <literal>scf(max(winsid())+1) </literal>と等価で,
-
             新規にグラフィックウインドウを作成する際にしようすることができます
-
         </para>
-
     </refsection>
-
     <refsection>
-
         <title>例</title>
-
         <programlisting role="example"><![CDATA[
-
 f4=scf(4); //id==4 の図を作成し,カレントの図に設定
-
 f0=scf(0); //id==0 の図を作成し,カレントの図に設定
-
 plot2d() //カレントの図 (id=0)に描画
-
 scf(f4); // 最初に作成した図をカレントの図に設定
-
 plot3d() //カレントの図 (id=4)に描画
-
  ]]></programlisting>
-
     </refsection>
-
     <refsection>
-
         <title>参考</title>
-
         <simplelist type="inline">
-
             <member>
-
                 <link linkend="set">set</link>
-
             </member>
-
             <member>
-
                 <link linkend="get">get</link>
-
             </member>
-
             <member>
-
                 <link linkend="gcf">gcf</link>
-
             </member>
-
             <member>
-
                 <link linkend="clf">clf</link>
-
             </member>
-
             <member>
-
-                <link linkend="get_figure_handle">get_figure_handle</link>
-
+                <link linkend="winsid">winsid</link>
             </member>
-
             <member>
-
                 <link linkend="graphics_entities">graphics_entities</link>
-
             </member>
-
         </simplelist>
-
     </refsection>
-
-</refentry>
-
+</refentry>
\ No newline at end of file
index 4afc0a3..cb2d6c8 100644 (file)
@@ -1,14 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
-
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-
  * Copyright (C) INRIA - 2008 - Jean-Baptiste Silvy
-
  *
-
-
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * 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="get_figure_handle">
-
     <refnamediv>
-
         <refname>get_figure_handle</refname>
-
-        <refpurpose>指定したIDの図のハンドルを取得</refpurpose>
-
+        <refpurpose>
+            指定したIDの図のハンドルを取得
+            <emphasis role="bold">(obsolete)</emphasis>
+        </refpurpose>
     </refnamediv>
-
     <refsynopsisdiv>
-
         <title>呼び出し手順</title>
-
         <synopsis>f = get_figure_handle(figure_id)</synopsis>
-
     </refsynopsisdiv>
-
     <refsection>
-
         <title>パラメータ</title>
-
         <variablelist>
-
             <varlistentry>
-
                 <term>figure_id</term>
-
                 <listitem>
-
                     <para>整数, 取得する図のID.</para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>f</term>
-
                 <listitem>
-
                     <para>対応する図のハンドル.</para>
-
                 </listitem>
-
             </varlistentry>
-
         </variablelist>
-
     </refsection>
-
     <refsection>
-
         <title>説明</title>
-
+        <warning>
+            <emphasis role="bold">This function is obsolete</emphasis> and
+            will be removed in Scilab 6.1.x. 
+            Please use <emphasis role="bold">findobj("figure_id",n)</emphasis> instead.
+        </warning>
         <para>
-
             <literal>get_figure_handle</literal> 関数により
-
             IDが既知の図のハンドルを取得することが可能です.
-
             指定したIDを有する図が存在する場合,この関数はそのハンドルを返します.
-
             それ以外の場合,空の行列を返します.
-
         </para>
-
     </refsection>
-
     <refsection>
-
         <title>例</title>
-
         <programlisting role="example"><![CDATA[
-
 // いくつかの図を作成
-
 scf(0);
-
 scf(5);
-
 scf(12);
 
-
-
 // ID 5 の図のハンドルを取得
-
 f5 = get_figure_handle(5);
-
 // カレントの図は ID 12の図のままです
-
 gcf()
 
 // 存在しない図を取得
-
 f42 = get_figure_handle(42);
-
  ]]></programlisting>
-
     </refsection>
-
     <refsection role="see also">
-
         <title>参照</title>
-
         <simplelist type="inline">
-
             <member>
-
                 <link linkend="set">set</link>
-
             </member>
-
             <member>
-
                 <link linkend="get">get</link>
-
             </member>
-
             <member>
-
                 <link linkend="gcf">gcf</link>
-
             </member>
-
             <member>
-
                 <link linkend="scf">scf</link>
-
             </member>
-
             <member>
-
                 <link linkend="graphics_entities">graphics_entities</link>
-
             </member>
-
         </simplelist>
-
     </refsection>
-
-</refentry>
-
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    get_figure_handle(n) is declared obsolete.
+                    findobj("figure_id",n) is used instead.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index ac131f1..52acc0e 100644 (file)
  * 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:ns5="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="scf" 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:ns5="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="scf" xml:lang="pt">
     <refnamediv>
         <refname>scf</refname>
         <refpurpose>Ajusta a (janela) de figura gráfica corrente</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Seqüência de Chamamento</title>
-        <synopsis>f = scf()
+        <synopsis>
+            f = scf()
             f = scf(h)
             f = scf(num)
         </synopsis>
@@ -97,7 +101,7 @@ plot3d() //desenhando na figura corrente (id=4)
                 <link linkend="clf">clf</link>
             </member>
             <member>
-                <link linkend="get_figure_handle">get_figure_handle</link>
+                <link linkend="winsid">winsid</link>
             </member>
             <member>
                 <link linkend="graphics_entities">graphics_entities</link>
index 3094a8c..27aec74 100644 (file)
@@ -16,8 +16,9 @@
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="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="get_figure_handle" xml:lang="pt">
     <refnamediv>
         <refname>get_figure_handle</refname>
-        <refpurpose>Retorna o manipulador de uma figura a partir de seu
-            id
+        <refpurpose>
+            Retorna o manipulador de uma figura a partir de seu id
+             <emphasis role="bold">(obsolete)</emphasis>
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
     </refsection>
     <refsection>
         <title>Descrição</title>
+        <warning>
+            <emphasis role="bold">This function is obsolete</emphasis> and
+            will be removed in Scilab 6.1.x. 
+            Please use <emphasis role="bold">findobj("figure_id",n)</emphasis> instead.
+        </warning>
         <para>
             <literal>get_figure_handle</literal> permite recuperar o manipulador
             de uma figura gráfica desde que se conheça o seu identificador. Se uma
@@ -86,4 +92,16 @@ f42 = get_figure_handle(42);
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    get_figure_handle(n) is declared obsolete.
+                    findobj("figure_id",n) is used instead.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 4834c52..d0869d8 100644 (file)
@@ -1,8 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-// Copyright (C) 2017 - 2018 - Samuel GOUGEON
-//
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2017 - 2018 - 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.
@@ -39,7 +38,7 @@ function clf(varargin)
             num = varargin(1)
             h = [];
             for k = 1:size(num,"*")
-                h = [h ; get_figure_handle(num(k))];
+                h = [h ; findobj("figure_id",num(k))];
             end
             job = "clear"
         elseif type(varargin(1))==9 then // handle given
@@ -54,7 +53,7 @@ function clf(varargin)
             num = varargin(1)
             h = [];
             for k = 1:size(num,"*")
-                h = [h ; get_figure_handle(num(k))];
+                h = [h ; findobj("figure_id",num(k))];
             end
         elseif type(varargin(1))==9 then // handle given
             h = varargin(1);
index 36610ba..17b2ce7 100644 (file)
@@ -12,6 +12,8 @@
 
 function [fig]=get_figure_handle(index)
 
+    warnobsolete("findobj(""figure_id"", n)", "6.1.x")
+
     if argn(2)<>1 then
         error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "get_figure_handle", 1));
     end
@@ -32,4 +34,3 @@ function [fig]=get_figure_handle(index)
     scf(curFig);
 
 endfunction
-
index b7d1576..db352d5 100644 (file)
@@ -29,7 +29,7 @@ plot3d(x,x,cos(x)'*sin(x));
 // Erase all figures with index from 0 to 3 even if some of them do not exist
 clf(0:3);
 // Current figure must be empty
-fig = get_figure_handle(0);
+fig = findobj("figure_id",0);
 assert_checkequal(size(fig.children), [1,1]); // Default axes
 // No children below axes
 assert_checkequal(fig.children(1).children, []);
index 308d519..14bba13 100644 (file)
@@ -36,7 +36,7 @@ plot3d(x,x,cos(x)'*sin(x));
 clf(0:3);
 
 // Current figure must be empty
-fig = get_figure_handle(0);
+fig = findobj("figure_id",0);
 assert_checkequal(size(fig.children), [1,1]); // Default axes
 // No children below axes
 assert_checkequal(fig.children(1).children, []);
diff --git a/scilab/modules/graphics/tests/unit_tests/get_figure_handle.dia.ref b/scilab/modules/graphics/tests/unit_tests/get_figure_handle.dia.ref
deleted file mode 100644 (file)
index 9a67664..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- TEST WITH GRAPHIC -->
-// test get_figure_handle function
-// create some figures
-f0 = scf(0);
-f45 = scf(45);
-f200 = scf(200);
-// gcf is f200
-f45bis = get_figure_handle(45);
-// check that this is the same handle
-if (f45bis <> f45) then bugmes();quit;end;
-// check that gcf did not change
-if (gcf() <> f200) then bugmes();quit;end;
-// try to find a figure that does not exists
-if (get_figure_handle(12) <> []) then bugmes();quit;end
diff --git a/scilab/modules/graphics/tests/unit_tests/get_figure_handle.tst b/scilab/modules/graphics/tests/unit_tests/get_figure_handle.tst
deleted file mode 100644 (file)
index 51ea970..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-
-// <-- TEST WITH GRAPHIC -->
-
-// test get_figure_handle function
-
-// create some figures
-f0 = scf(0);
-f45 = scf(45);
-f200 = scf(200);
-
-// gcf is f200
-f45bis = get_figure_handle(45);
-// check that this is the same handle
-if (f45bis <> f45) then pause; end;
-// check that gcf did not change
-if (gcf() <> f200) then pause; end;
-
-// try to find a figure that does not exists
-if (get_figure_handle(12) <> []) then pause; end
-
index 3711d86..9235c46 100644 (file)
@@ -38,7 +38,7 @@ function uicontrol_plot3d()
 
     uimenu(h, ...
         "label"     , gettext("Close"), ...
-        "callback"  , "demo_plot3d=get_figure_handle(100001);delete(demo_plot3d);", ...
+        "callback"  , "demo_plot3d=findobj(""figure_id"",100001);delete(demo_plot3d);", ...
         "tag"       , "close_menu");
 
     demo_viewCode(SCI+ "/modules/gui/demos/cb_uicontrol_plot3d.dem.sci");
index abf04b3..3f64626 100644 (file)
@@ -28,7 +28,7 @@
                        if isempty(fileparts(%fileToSave, "extension")) then
                        %fileToSave = %fileToSave + ".scg";
                        end;
-                       xsave(%fileToSave, get_figure_handle([SCILAB_FIGURE_ID]));
+                       xsave(%fileToSave, findobj("figure_id",[SCILAB_FIGURE_ID]));
                        disp(msprintf(gettext("Figure saved.\n")));
                        end;
                        clear %fileToSave isempty;'
         <separator/>
         <submenu label="C&amp;lose" accelerator="OSSCKEY W">
             <callback instruction='
-                if (get(get_figure_handle([SCILAB_FIGURE_ID]), "event_handler_enable") == "on" );
-                    execstr(get(get_figure_handle([SCILAB_FIGURE_ID]), "event_handler")+"([SCILAB_FIGURE_ID], -1, -1, -1000)", "errcatch", "m");
+                if (findobj("figure_id",[SCILAB_FIGURE_ID]).event_handler_enable == "on" );
+                    execstr(findobj("figure_id",[SCILAB_FIGURE_ID]).event_handler +"([SCILAB_FIGURE_ID], -1, -1, -1000)", "errcatch", "m");
                 end;
-                delete(get_figure_handle([SCILAB_FIGURE_ID]));'
+                xdel([SCILAB_FIGURE_ID]);'
                 type="0"/>
         </submenu>
     </menu>
             <callback instruction='org.scilab.modules.renderer.CallRenderer.start_zoom([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <submenu label="&amp;Original View" icon="zoom-original">
-            <callback instruction='unzoom(get_figure_handle([SCILAB_FIGURE_ID]))' type="0"/>
+            <callback instruction='unzoom(findobj("figure_id",[SCILAB_FIGURE_ID]))' type="0"/>
         </submenu>
         <submenu label="Reframe to contents" icon="zoom-fit-drawing">
-            <callback instruction='replot(get_figure_handle([SCILAB_FIGURE_ID]))' type="0"/>
+            <callback instruction='replot(findobj("figure_id",[SCILAB_FIGURE_ID]))' type="0"/>
         </submenu>
         <separator/>
         <submenu label="2D/3D &amp;Rotation" icon="transform-rotate">
-            <callback instruction="set(get_figure_handle([SCILAB_FIGURE_ID]), 'info_message', 'Right click and drag to rotate.')" type="-2"/>
+            <callback instruction='findobj("figure_id",[SCILAB_FIGURE_ID]).info_message=_("Right click and drag to rotate.")' type="-2"/>
         </submenu>
     </menu>
 
@@ -91,7 +91,7 @@
             <callback instruction='scf([SCILAB_FIGURE_ID]);' type="0"/>
         </submenu>
         <submenu label="&amp;Clear figure">
-            <callback instruction='clf(get_figure_handle([SCILAB_FIGURE_ID]));' type="0"/>
+            <callback instruction='clf([SCILAB_FIGURE_ID]);' type="0"/>
         </submenu>
         <separator/>
         <submenu label="&amp;Figure properties">
index d929376..ed40841 100644 (file)
@@ -3,25 +3,25 @@
     <!-- [SCILAB_FIGURE_ID] pattern is replaced at generation of Java menu by the ID of the figure -->
     <!-- Rotate -->
     <button icon="transform-rotate" tooltiptext="Rotate">
-        <callback instruction="set(get_figure_handle([SCILAB_FIGURE_ID]), 'info_message', 'Right click and drag to rotate.')" type="-2"/>
+        <callback instruction="findobj('figure_id',[SCILAB_FIGURE_ID]).info_message = _('Right click and drag to rotate.')" type="-2"/>
     </button>
     <separator/>
     <!-- Zoom Area -->
     <button icon="zoom-fit-selection" tooltiptext="Zoom Area">
-        <callback instruction="zoom_rect(get_figure_handle([SCILAB_FIGURE_ID]))" type="-2"/>
+        <callback instruction="zoom_rect(findobj('figure_id',[SCILAB_FIGURE_ID]))" type="-2"/>
     </button>
     <!-- Original View -->
     <button icon="zoom-original" tooltiptext="Original View">
-        <callback instruction="unzoom(get_figure_handle([SCILAB_FIGURE_ID]))" type="-2"/>
+        <callback instruction="unzoom(findobj('figure_id',[SCILAB_FIGURE_ID]))" type="-2"/>
     </button>
     <!-- Fit to the data -->
     <button icon="zoom-fit-drawing" tooltiptext="Reframe to contents">
-        <callback instruction="replot(get_figure_handle([SCILAB_FIGURE_ID]))" type="-2"/>
+        <callback instruction="replot(findobj('figure_id',[SCILAB_FIGURE_ID]))" type="-2"/>
     </button>
     <separator/>
     <!-- Datatips -->
     <button icon="datatips" tooltiptext="Toggle datatip mode" toggle="true">
-        <callback instruction="datatipManagerMode(get_figure_handle([SCILAB_FIGURE_ID]))" type="-2"/>
+        <callback instruction="datatipManagerMode(findobj('figure_id',[SCILAB_FIGURE_ID]))" type="-2"/>
     </button>
     <!-- Scilab Graphic Editor -->
     <!--
index 6398e4d..66b6043 100644 (file)
@@ -42,6 +42,16 @@ function h =  findobj(propertyName, propertyValue)
 
     propertyName = convstr(propertyName,"l");
 
+    // Special fast case: finding a figure
+    if propertyName=="figure_id" then
+        if type(propertyValue)==1 & or(figureIds==propertyValue)
+            h = scf(propertyValue);
+            scf(currentFig);
+        end
+        return
+    end
+
+    // Otherwise:
     // Iterate over all figures
     for figureindex = 1:size(figureIds,2)
         // Does the figure match the propertyName/propertyValue set ?
index f82e2d9..bb59d4e 100644 (file)
@@ -130,8 +130,8 @@ public class SwingScilabCommonPanel {
                 }
 
                 /* Update callback */
-                String closingCommand = "if (get_figure_handle(" + figureId + ") <> []) then" + "  if (get(get_figure_handle(" + figureId + "), 'event_handler_enable') == 'on') then"
-                                        + "    execstr(get(get_figure_handle(" + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + "  end;" + "  delete(get_figure_handle("
+                String closingCommand = "if (findobj(\"figure_id\", " + figureId + ") <> []) then" + "  if (get(findobj(\"figure_id\", " + figureId + "), 'event_handler_enable') == 'on') then"
+                                        + "    execstr(get(findobj(\"figure_id\", " + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + "  end;" + "  delete(findobj(\"figure_id\", "
                                         + figureId + "));" + "end;";
                 component.setCallback(null);
                 component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand));
index c3e4c8c..6b70bde 100644 (file)
@@ -96,6 +96,7 @@ std::unordered_map<std::wstring, std::wstring> DeprecatedChecker::initDep()
     map.emplace(L"setPreferencesValue", L"xmlSetValues");
 
     // Scilab 6.0.x => 6.1.0
+    map.emplace(L"get_figure_handle", L"findobj(\'figure_id\',n)");
     map.emplace(L"champ1", L"champ.colored");
     map.emplace(L"%sn", L"ellipj");
     map.emplace(L"dirname", L"fileparts");