* Bugs #11476 & #14956 fixed: clf('reset') misworked. clf page overhauled. 90/18890/4
Samuel GOUGEON [Tue, 17 Jan 2017 02:01:00 +0000 (03:01 +0100)]
 - http://bugzilla.scilab.org/11476
   reset applied to a figure docked to the desktop resized and moved
   the whole Scilab desktop.

 - http://bugzilla.scilab.org/14956
   Properties immediate_drawing, resize, resizefcn, closerequestfcn,
   toolbar_visible, menubar_visible, infobar_visible, default_axes, and
   icon were not reset

 - help page rewritten: main changes:
   - PDF rendering: http://bugzilla.scilab.org/attachment.cgi?id=4467
   - list of syntaxes clarified
   - usage on multiple figures was not described
   - usage on a vector of handles mixing figures and frames was not described
   - usage of showHiddenHandles protecting uimenus was not described
   - 'reset': the fact that .toolbar, .menubar, .layout, .layout_options
     and .dockable are not reset was not documented.
   - new subsection dedicated to partial clearings
   - See also improved and extended.

 - macro and test 7411 fixed: reforging datatips wrongly removed the
   disabling of event_handler_enable

Change-Id: I5a749080c0baf10b2187fb07477248410da94330

scilab/CHANGES.md
scilab/modules/graphics/help/en_US/figure_operations/clf.xml
scilab/modules/graphics/help/ja_JP/figure_operations/clf.xml [deleted file]
scilab/modules/graphics/help/pt_BR/figure_operations/clf.xml [deleted file]
scilab/modules/graphics/macros/clf.sci
scilab/modules/graphics/tests/nonreg_tests/bug_11476.tst [new file with mode: 0644]
scilab/modules/graphics/tests/nonreg_tests/bug_14956.tst [new file with mode: 0644]
scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref [deleted file]
scilab/modules/graphics/tests/nonreg_tests/bug_7411.tst

index f47196f..53819d8 100644 (file)
@@ -212,7 +212,7 @@ Help pages:
   `printf`, `sprintf`, `iconvert`, `stdev`, `xlabel`, `and_op`, `or_op`, `permute`, `tree2code`, `%helps`,
   `scilab|scilex`, `flipdim`
 * rewritten: `consolebox`, `double`, `isoview`, `pixel_drawing_mode`, `householder`, `or`, `and`, `format`, `typeof`,
-`brackets`, `setlanguage`, `sleep`, `isinf`, `bitor`, `bitxor`, `bitand`, `macr2tree`, `geomean`
+`brackets`, `setlanguage`, `sleep`, `isinf`, `bitor`, `bitxor`, `bitand`, `macr2tree`, `geomean`, `clf`
 * reorganized:
   - `else`, `elseif`, `end`, `try`, `sciargs`, `global`, `halt`, `empty`, `power`
   - `pixel_drawing_mode`, `show_window`, `twinkle`, `uigetcolor`, `winsid`, `xdel`, `xgrid`, `xname`, `xnumb`
@@ -364,6 +364,7 @@ Bug Fixes
 * [#10326](http://bugzilla.scilab.org/show_bug.cgi?id=10326): Adds a search engine for the palette browser.
 * [#10981](http://bugzilla.scilab.org/show_bug.cgi?id=10981): When the view property of Axes object is set at 2d, the rotation becomes impossible.
 * [#11375](http://bugzilla.scilab.org/show_bug.cgi?id=11375): When a localized help subdirectory has only a CHAPTER file specifying the section title, it was ignored.
+* [#11476](http://bugzilla.scilab.org/show_bug.cgi?id=11476): `clf("reset")` used on a docked figure resized and moved the whole docked block like the Scilab desktop.
 * [#11692](http://bugzilla.scilab.org/show_bug.cgi?id=11692): The summary of a help section built from both default en_US and localized files was never sorted overall.
 * [#11959](http://bugzilla.scilab.org/show_bug.cgi?id=11959): Allow "Zoom Area" to be clicked out of axes
 * [#12017](http://bugzilla.scilab.org/show_bug.cgi?id=12017): `figure.pixel_drawing_mode` is ignored for filled regular polygons and other shapes, still does not work for vectorial export (eps, pdf, etc).
@@ -445,6 +446,7 @@ Bug Fixes
 * [#14909](http://bugzilla.scilab.org/show_bug.cgi?id=14909): getlongpathname and getshortpathname return values with "\" instead of "/"
 * [#14941](http://bugzilla.scilab.org/show_bug.cgi?id=14941): `find` did not accept encoded integers
 * [#14942](http://bugzilla.scilab.org/show_bug.cgi?id=14942): Keep the Tkscale block label if block already has label.
+* [#14956](http://bugzilla.scilab.org/show_bug.cgi?id=14956): `clf("reset")` forgot resetting the `immediate_drawing`, `resize`, `resizefcn`, `closerequestfcn`, `toolbar_visible`, `menubar_visible`, `infobar_visible`, `default_axes`, and `icon` figure properties.
 
 ### Bugs fixed in 6.0.0 beta-2 and earlier 6.0.0 pre-releases:
 
index 7d256d3..025b1be 100644 (file)
@@ -2,7 +2,7 @@
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Serge Steer
  * Copyright (C) INRIA - Jean-Baptiste Silvy
- * Copyright (C) Samuel GOUGEON : update after fix of bug 7411
+ * Copyright (C) 2013, 2017 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
     <refnamediv>
         <refname>clf</refname>
         <refpurpose>
-            Clear or reset a figure or a frame uicontrol.
+            Clears and resets a figure or a frame uicontrol
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            clf([opt_job_arg])
-
-            clf(figureHandle[, opt_job_arg])
-            clf(num[, opt_job_arg])
-
-            clf(frameHandle[, opt_job_arg)
+            clf
+            clf reset
+            clf(numFig)
+            clf(numFig, "reset")
+            clf(figFrameHandle)
+            clf(figFrameHandle, "reset")
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>figureHandle</term>
+                <term>numFig</term>
                 <listitem>
-                    <para>A handle: the handle of the figure to clear or reset.</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>num</term>
-                <listitem>
-                    <para>An integer value: the figure_id of the figure to clear or reset.</para>
+                    <para>
+                        Vector of indices of figures to clear or reset (<literal>.figure_id</literal> values). By default, the current figure is targeted.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>frameHandle</term>
+                <term>figFrameHandle</term>
                 <listitem>
-                    <para>A handle: the handle of the frame to clear or reset.</para>
+                    <para>
+                        Vector of handles of figures or frame uicontrol to clear or reset. Mixing figures and frames is possible. By default, the current figure is targeted.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>opt_job_arg</term>
+                <term>"reset"</term>
                 <listitem>
-                    <para>
-                        A string which specifying the job for <function>clf</function>.
-                        Its value can be <literal>"clear"</literal> (default) or <literal>"reset"</literal>.
-                    </para>
+                    Provide this option keyword to reset properties of chosen figures to their default values, in addition to deleting the figures contents.
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            The <literal>clf</literal> command can be used to reset a figure to its default
-            values and/or to delete all its children. If can also be used to delete all the children of a frame.
+            The <literal>clf</literal> command can be used to delete all children of a given graphic window, hence clearing it.
+            If the <literal>"reset"</literal> keyword is used, in addition most of the figure properties are reset to their default values.
+            The detailled changes are now described:
         </para>
-        <variablelist>
-            <varlistentry>
-                <term>First input argument: </term>
+        <para>
+            <orderedlist>
                 <listitem>
-                    <variablelist>
-                        <varlistentry>
-                            <term>num</term>
-                            <listitem>
-                                <para>
-                                    <literal>clf(num,..)</literal> clears or resets the figure with <literal>figure_id==num</literal>
-                                </para>
-                            </listitem>
-                        </varlistentry>
-                        <varlistentry>
-                            <term>figureHandle</term>
-                            <listitem>
-                                <para>
-                                    <literal>clf(figureHandle,..)</literal> clears or resets the figure pointed to by the handle <literal>h</literal>
-                                </para>
-                            </listitem>
-                        </varlistentry>
-                        <varlistentry>
-                            <term>job</term>
-                            <listitem>
-                                <para>
-                                    <literal>clf(job)</literal> clears or resets the current figure.
-                                </para>
-                            </listitem>
-                        </varlistentry>
-                    </variablelist>
+                     The following default actions are always performed:
+                    <para>
+                    <itemizedlist>
+                        <listitem>
+                                All visible and invisible axes of each targeted figure or frame are deleted.
+                        </listitem>
+                        <listitem>
+                                All menus whose figure.children handles are not hidden are deleted. It is possible to protect them with <literal>set(get(0), "ShowHiddenHandles", "off")</literal>. This then applies to all opened figures and forthcoming ones. See <link linkend="console_properties">ShowHiddenHandles</link>.
+                        </listitem>
+                        <listitem>
+                                The message in the status bar of each figure is cleared.
+                        </listitem>
+                        <listitem>
+                                The event handler of each figure is disabled, but their references are kept .
+                        </listitem>
+                    </itemizedlist>
+                    </para>
+                    <para>
+                        Values of all <link linkend="figure_properties">figures properties</link> are unchanged, except <literal>.info_message=""</literal> and <literal>.event_handler_enable="off"</literal> that are forced.
+                    </para>
                 </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Second input argument:</term>
                 <listitem>
-                    <variablelist>
-                        <varlistentry>
-                            <term>"clear" (default)</term>
+                    <para>
+                        <literal>"reset"</literal>: in addition to default actions, <literal>"reset"</literal> resets most of figures properties to their default values, as specified by <function>gdf()</function>. This applies only to figures.
+                    </para>
+                    <warning>
+                        <itemizedlist>
                             <listitem>
-                                <para>
-                                    <literal>clf(.., "clear")</literal> clears the targeted figure or frame.
-                                    <itemizedlist>
-                                        <listitem>
-                                            All its <literal>children</literal> are deleted: axes, uicontrols, menus (for figures only), ...
-                                            To prevent menus and uicontrols from being deleted from a figure, the <literal>delete(gca())</literal> command
-                                            might be used instead.
-                                        </listitem>
-                                        <listitem>
-                                            Its event handler is disabled: <literal>.event_handler_enable = "off"</literal>
-                                        </listitem>
-                                        <listitem>
-                                            The message in the status bar is cleared: <literal>.info_message = ""</literal>
-                                        </listitem>
-                                    </itemizedlist>
-                                    All other figure's properties are unchanged.
-                                </para>
+                                <emphasis role="italic">Some properties are never reset</emphasis>: <literal>.toolbar</literal>,  <literal>.menubar</literal>, <literal>.layout</literal>,  <literal>.layout_options</literal>, and <literal>.dockable</literal> can be set only once and so are never resettable.
                             </listitem>
-                        </varlistentry>
-                        <varlistentry>
-                            <term>"reset"</term>
                             <listitem>
-                                <para>
-                                    Used for figures only, <literal>clf(.., "reset")</literal> deletes all children of the specified figure. In addition, all figure's
-                                    properties are reset to their default values as returned by <link linkend="gdf">gdf</link>. The only exception are the
-                                    <literal>axes_size</literal>
-                                    and <literal>figure_size</literal> properties, which can not be reset if the figure
-                                    is docked with other elements.
-                                </para>
+                                <emphasis role="italic">For docked figures</emphasis>: <literal>.figure_position</literal>, <literal>.figure_size</literal>, and <literal>.axes_size</literal> are unchanged if the parent figure is docked to the Scilab's desktop or to another Scilab interface. Changing their value would change the position or size of the whole block of docked interfaces, not only the targeted figure.
                             </listitem>
-                        </varlistentry>
-                    </variablelist>
+                        </itemizedlist>
+                    </warning>
                 </listitem>
-            </varlistentry>
-        </variablelist>
+            </orderedlist>
+        </para>
+        <refsect2>
+            <title>Clearing specific parts of a figure</title>
+            <itemizedlist>
+                <listitem>
+                    <literal>xname("")</literal> or <literal>gcf().name = ""</literal> clears the name of the window, displayed at its very top left corner.
+                </listitem>
+                <listitem>
+                    <literal>xinfo("")</literal> or <literal>gcf().info_message = ""</literal> clears the message displayed in the status bar of the current figure.
+                </listitem>
+                <listitem>
+                    <literal>delete(gca())</literal> deletes the current axes in the current window. All other components of the window are kept: other axes (if any), menus, interactive components, figure properties, etc.
+                </listitem>
+                <listitem>
+                    Deleting only all axes of a figure may be done with <literal>c=gcf().children; delete(c(c.type=="Axes"))</literal>. This keeps all its other components: menus, interactive components, etc.
+                </listitem>
+                <listitem>
+                    Deleting only menus: <literal>c=gcf().children; delete(c(c.type=="uimenu"))</literal>. This assumes that <literal>get(get(0), "ShowHiddenHandles")</literal> is <literal>"on"</literal>.
+                </listitem>
+            </itemizedlist>
+        </refsect2>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example">
-            f4=scf(4);  //creates figure with id==4 and make it the current one
+            f4 = scf(4);  //creates figure with id==4 and makes it the current one
             f4.color_map = jetcolormap(64);
             f4.figure_size = [400, 200];
             plot2d()
+            sleep(4000)   // wait and see for 4s
             clf(f4, "reset")
 
-            f0=scf(0); //creates figure with id==0 and make it the current one
-            f0.color_map = hotcolormap(128); // change color map
-            t=-%pi:0.3:%pi;
+            f0 = scf(0); //creates figure with id==0 and make it the current one
+            f0.color_map = hotcolormap(128); // changes color map
+            t = -%pi:0.3:%pi;
             plot3d1(t,t,sin(t)'*cos(t));
 
-            clf() // equivalent to clf(gcf(),"clear")
-            plot3d1(t,t,sin(t)'*cos(t)); // color_map unchanged
+            clf        // is clf(gcf(),"clear"). Keeps the current color_map
+            plot3d1(t,t,sin(t)'*cos(t));
 
-            clf(gcf(), "reset")
-            plot3d1(t,t,sin(t)'*cos(t)); // color_map changed (back to the default one with 32 colors)
+            clf reset  // resets the color_map to the default one with 32 colors
+            plot3d1(t,t,sin(t)'*cos(t));
 
             fr = uicontrol("Style", "frame", "Position", [20 20 200 200]);
-            a=newaxes(fr);
+            a = newaxes(fr);
             plot(1:10);
             clf(fr);
         </programlisting>
                 <link linkend="figure_properties">figure properties</link>
             </member>
             <member>
+                <link linkend="console_properties">ShowHiddenHandles</link>
+            </member>
+            <member>
+                <link linkend="xinfo">xinfo</link>
+            </member>
+            <member>
+                <link linkend="xname">xname</link>
+            </member>
+            <member>
+                <link linkend="uicontrol">frames</link>
+            </member>
+            <member>
+                <link linkend="uimenu">menus</link>
+            </member>
+            <member>
                 <link linkend="gcf">gcf</link>
             </member>
             <member>
                 <link linkend="gdf">gdf</link>
             </member>
             <member>
-                <link linkend="scf">scf</link>
+                <link linkend="colordef">colordef</link>
+            </member>
+            <member>
+                <link linkend="delete">delete</link>
             </member>
             <member>
-                <link linkend="set">set</link>
+                <link linkend="close">close</link>
             </member>
             <member>
-                <link linkend="get">get</link>
+                <link linkend="clc">clc</link>
             </member>
             <member>
-                <link linkend="graphics_entities">graphics_entities</link>
+                <link linkend="clear">clear</link>
             </member>
         </simplelist>
     </refsection>
             <revision>
                 <revnumber>5.5.0</revnumber>
                 <revremark>
-                    <function>clf</function> works for all axes parents (figures and frames).
+                    <literal>clf</literal> now clears frames as well.
                 </revremark>
             </revision>
         </revhistory>
diff --git a/scilab/modules/graphics/help/ja_JP/figure_operations/clf.xml b/scilab/modules/graphics/help/ja_JP/figure_operations/clf.xml
deleted file mode 100644 (file)
index 9fb3e67..0000000
+++ /dev/null
@@ -1,846 +0,0 @@
-<?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) INRIA - Jean-Baptiste Silvy
-
- *
-
-
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
-
- *
-
- -->
-
-
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="clf">
-
-
-
-    <refnamediv>
-
-
-
-        <refname>clf</refname>
-
-
-
-        <refpurpose>
-
-
-
-            図またはuicontrolフレームをクリアまたはリセットする
-
-
-
-        </refpurpose>
-
-
-
-    </refnamediv>
-
-
-
-    <refsynopsisdiv>
-
-
-
-        <title>呼び出し手順</title>
-
-
-
-        <synopsis>
-
-
-
-            clf([opt_job_arg])
-
-
-
-
-
-
-
-            clf(figureHandle[, opt_job_arg])
-
-
-
-            clf(num[, opt_job_arg])
-
-
-
-
-
-
-
-            clf(frameHandle[, opt_job_arg)
-
-
-
-        </synopsis>
-
-
-
-    </refsynopsisdiv>
-
-
-
-    <refsection>
-
-
-
-        <title>引数</title>
-
-
-
-        <variablelist>
-
-
-
-            <varlistentry>
-
-
-
-                <term>figureHandle</term>
-
-
-
-                <listitem>
-
-
-
-                    <para>ハンドル: クリアまたはリセットする図のハンドル</para>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-            <varlistentry>
-
-
-
-                <term>num</term>
-
-
-
-                <listitem>
-
-
-
-                    <para>整数値: クリアまたはリセットする図のfigure_id</para>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-            <varlistentry>
-
-
-
-                <term>frameHandle</term>
-
-
-
-                <listitem>
-
-
-
-                    <para>ハンドル: クリアまたはリセットするフレームのハンドル.</para>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-            <varlistentry>
-
-
-
-                <term>opt_job_arg</term>
-
-
-
-                <listitem>
-
-
-
-                    <para>
-
-
-
-                        <function>clf</function>の動作を指定する文字列.
-
-
-
-                        値には,<literal>"clear"</literal>または <literal>"reset"</literal>を指定します.
-
-
-
-                    </para>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-        </variablelist>
-
-
-
-    </refsection>
-
-
-
-    <refsection>
-
-
-
-        <title>説明</title>
-
-
-
-        <para>
-
-
-
-            <literal>clf</literal> コマンドは図をクリアし,デフォルト値にリセットすると共に
-
-
-
-            全ての子を削除します.
-
-
-
-            フレームの全ての子を削除する際にも使用できます.
-
-
-
-        </para>
-
-
-
-        <variablelist>
-
-
-
-            <varlistentry>
-
-
-
-                <term>最初の入力引数: </term>
-
-
-
-                <listitem>
-
-
-
-                    <variablelist>
-
-
-
-                        <varlistentry>
-
-
-
-                            <term>num</term>
-
-
-
-                            <listitem>
-
-
-
-                                <para>
-
-
-
-                                    <literal>clf(num,..)</literal> は,
-
-
-
-                                    <literal>figure_id==num</literal>を有する図を
-
-
-
-                                    クリアまたはリセットします.
-
-
-
-                                </para>
-
-
-
-                            </listitem>
-
-
-
-                        </varlistentry>
-
-
-
-                        <varlistentry>
-
-
-
-                            <term>figureHandle</term>
-
-
-
-                            <listitem>
-
-
-
-                                <para>
-
-
-
-                                    <literal>clf(figureHandle,..)</literal> はハンドル<literal>h</literal>
-
-
-
-                                    で指定された図をクリアまたはリセットします.
-
-
-
-                                </para>
-
-
-
-                            </listitem>
-
-
-
-                        </varlistentry>
-
-
-
-                        <varlistentry>
-
-
-
-                            <term>job</term>
-
-
-
-                            <listitem>
-
-
-
-                                <para>
-
-
-
-                                    <literal>clf(job)</literal> はカレントの図をクリアまたはリセットします.
-
-
-
-                                </para>
-
-
-
-                            </listitem>
-
-
-
-                        </varlistentry>
-
-
-
-                    </variablelist>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-            <varlistentry>
-
-
-
-                <term>2番目の入力引数:</term>
-
-
-
-                <listitem>
-
-
-
-                    <variablelist>
-
-
-
-                        <varlistentry>
-
-
-
-                            <term>"clear" (デフォルト)</term>
-
-
-
-                            <listitem>
-
-
-
-                                <para>
-
-
-
-                                    <literal>clf(.., "clear")</literal> は指定した
-
-
-
-                                    図またはフレームをクリアします.
-
-
-
-                                    <itemizedlist>
-
-
-
-                                        <listitem>
-
-
-
-                                            以下の全ての<literal>children</literal> が削除されます:
-
-
-
-                                            軸, uicontrols, メニュー (図のみ), ...
-
-
-
-                                            図でメニュー及びuicontrolsを削除対象から除くには,
-
-
-
-                                            <literal>delete(gca())</literal> コマンドを使用してください.
-
-
-
-                                        </listitem>
-
-
-
-                                        <listitem>
-
-
-
-                                            イベントハンドラを無効にしたする: <literal>.event_handler_enable = "off"</literal>
-
-
-
-                                        </listitem>
-
-
-
-                                        <listitem>
-
-
-
-                                            ステータスバーのメッセージをクリアする: <literal>.info_message = ""</literal>
-
-
-
-                                        </listitem>
-
-
-
-                                    </itemizedlist>
-
-
-
-                                    他の全ての図のプロパティは変更されません.
-
-
-
-                                </para>
-
-
-
-                            </listitem>
-
-
-
-                        </varlistentry>
-
-
-
-                        <varlistentry>
-
-
-
-                            <term>"reset"</term>
-
-
-
-                            <listitem>
-
-
-
-                                <para>
-
-
-
-                                    図のみで使用され, <literal>clf(.., "reset")</literal> は
-
-
-
-                                    指定した図の全ての子を削除します.
-
-
-
-                                    加えて,図のプロパティが<link linkend="gdf">gdf</link>で
-
-
-
-                                    返されるデフォルト値にリセットされます.
-
-
-
-                                    唯一の例外は,
-
-
-
-                                    <literal>axes_size</literal>および
-
-
-
-                                    <literal>figure_size</literal> プロパティで
-
-
-
-                                    図が他の要素にドックされた場合にはリセットできません.
-
-
-
-                                </para>
-
-
-
-                            </listitem>
-
-
-
-                        </varlistentry>
-
-
-
-                    </variablelist>
-
-
-
-                </listitem>
-
-
-
-            </varlistentry>
-
-
-
-        </variablelist>
-
-
-
-    </refsection>
-
-
-
-    <refsection>
-
-
-
-        <title>例</title>
-
-
-
-        <programlisting role="example">
-
-
-
-            f4=scf(4);  //id==4 を指定して図を作成し,カレントの図にする
-
-
-
-            f4.color_map = jetcolormap(64);
-
-
-
-            f4.figure_size = [400, 200];
-
-
-
-            plot2d()
-
-
-
-            clf(f4, "reset")
-
-
-
-
-
-
-
-            f0=scf(0); //id==0 を指定して図を作成し,カレントの図にする
-
-
-
-            f0.color_map = hotcolormap(128); // カラーマップを変更
-
-
-
-            t=-%pi:0.3:%pi;
-
-
-
-            plot3d1(t,t,sin(t)'*cos(t));
-
-
-
-
-
-
-
-            clf() // equivalent to clf(gcf(),"clear")
-
-
-
-            plot3d1(t,t,sin(t)'*cos(t)); // color_map を変更しない
-
-
-
-
-
-
-
-            clf(gcf(), "reset")
-
-
-
-            plot3d1(t,t,sin(t)'*cos(t)); // color_map を変更しない (デフォルト値を32色に戻す)
-
-
-
-
-
-
-
-            fr = uicontrol("Style", "frame", "Position", [20 20 200 200]);
-
-
-
-            a=newaxes(fr);
-
-
-
-            plot(1:10);
-
-
-
-            clf(fr);
-
-
-
-        </programlisting>
-
-
-
-    </refsection>
-
-
-
-    <refsection role="see also">
-
-
-
-        <title>参照</title>
-
-
-
-        <simplelist type="inline">
-
-
-
-            <member>
-
-
-
-                <link linkend="figure_properties">figure properties</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="gcf">gcf</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="gdf">gdf</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="scf">scf</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="set">set</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="get">get</link>
-
-
-
-            </member>
-
-
-
-            <member>
-
-
-
-                <link linkend="graphics_entities">graphics_entities</link>
-
-
-
-            </member>
-
-
-
-        </simplelist>
-
-
-
-    </refsection>
-
-
-
-    <refsection>
-
-
-
-        <title>履歴</title>
-
-
-
-        <revhistory>
-
-
-
-            <revision>
-
-
-
-                <revnumber>5.5.0</revnumber>
-
-
-
-                <revremark>
-
-
-
-                    <function>clf</function> は全ての軸の親で動作します (図及びフレーム).
-
-
-
-                </revremark>
-
-
-
-            </revision>
-
-
-
-        </revhistory>
-
-
-
-    </refsection>
-
-
-
-</refentry>
-
-
-
diff --git a/scilab/modules/graphics/help/pt_BR/figure_operations/clf.xml b/scilab/modules/graphics/help/pt_BR/figure_operations/clf.xml
deleted file mode 100644 (file)
index f7be171..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) INRIA - Serge Steer
- * Copyright (C) INRIA - Jean-Baptiste Silvy
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns: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="clf" xml:lang="pt">
-    <refnamediv>
-        <refname>clf</refname>
-        <refpurpose>Limpa ou reajusta a (janela da) figura gráfica corrente para
-            valores padrões
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>clf(&lt;opt_job_arg&gt;)
-            clf(h,&lt;opt_job_arg&gt;)
-            clf(num,&lt;opt_job_arg&gt;)
-        </synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Parâmetros</title>
-        <variablelist>
-            <varlistentry>
-                <term>h</term>
-                <listitem>
-                    <para>o manipulador da figura </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>num</term>
-                <listitem>
-                    <para>identificador da figura (figure_id) </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>&lt;opt_job_arg&gt;</term>
-                <listitem>
-                    <para>
-                        um string ( <literal>'clear' </literal>ou
-                        <literal>'reset'</literal> ) especificando o trabalho de
-                        <literal>clf</literal>.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Descrição</title>
-        <para>
-            O comando <literal>clf</literal> é utilizado para reajustar uma
-            figura para seus valores padrões e/ou deletar todos os seus galhos.
-        </para>
-        <para>
-            Se o valor do string <literal>opt_job_arg</literal> for
-            <literal>'clear'</literal> então todos os galhos da figura especificada
-            são deletados.
-        </para>
-        <para>
-            Se o valor do string <literal>opt_job_arg</literal> for
-            <literal>'reset'</literal>, então não só todos os galhos da figura são
-            deletados, mas os valores das propriedades da figura são reajustados para
-            seus valores padrões utilizando-se a figura modelo padrão (ver <link linkend="gdf">gdf</link>). As únicas exceções são as propriedades
-            <literal>axes_size</literal> e <literal>figure_size</literal> que não
-            podem ser reajustadas se a figura está "aportada" com outros
-            elementos.
-        </para>
-        <para>
-            <literal>clf(num)</literal> limpa, ou reajusta e limpa, a figura com
-            <literal>figure_id==num</literal>.
-        </para>
-        <para>
-            <literal>clf(h)</literal> limpa, ou reajusta e limpa, a figura
-            apontada pelo manipulador <literal>h</literal>.
-        </para>
-        <para>
-            <literal>clf()</literal> limpa, ou reajusta e limpa, a figura
-            existente corrente.
-        </para>
-        <para>
-            <literal>clf</literal> deleta todos os galhos de janelas
-            especificadas, incluindo menus e uicontrols adicionados pelo usuário. Para
-            evitar que menus e uicontrols sejam deletados, o comando
-            <literal>delete(gca())</literal> deve ser utilizado ao invés.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Exemplos</title>
-        <programlisting role="example"><![CDATA[
-f4=scf(4);  //criando figura com id==4 e tornando-a a figura corrente
-f4.color_map = jetcolormap(64);
-f4.figure_size = [400, 200];
-plot2d()
-clf(f4,'reset')
-
-f0=scf(0); //criando figura com id==0 e tornando-a a figura corrente
-f0.color_map=hotcolormap(128); // mudando o mapa de cores
-t=-%pi:0.3:%pi;
-plot3d1(t,t,sin(t)'*cos(t));
-
-clf() // equivalent to clf(gcf(),'clear')
-plot3d1(t,t,sin(t)'*cos(t));  // color_map inalterado
-
-clf(gcf(),'reset')
-plot3d1(t,t,sin(t)'*cos(t));  // color_map alterado (de volta ao padrão com 32 cores)
- ]]></programlisting>
-    </refsection>
-    <refsection role="see also">
-        <title>See also</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="gdf">gdf</link>
-            </member>
-            <member>
-                <link linkend="scf">scf</link>
-            </member>
-            <member>
-                <link linkend="graphics_entities">graphics_entities</link>
-            </member>
-        </simplelist>
-    </refsection>
-</refentry>
index 7203610..ee15708 100644 (file)
@@ -1,5 +1,7 @@
 // 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
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
@@ -14,55 +16,60 @@ function clf(varargin)
     nbArg = size(varargin);
 
     if nbArg==0 then
-        h=gcf()
-        job="clear"
+        h = gcf()
+        job = "clear"
     elseif nbArg==1 then
-        if type(varargin(1))==1 then // win num given
-            num=varargin(1)
-
-            h=[];for k=1:size(num,"*"),h=[h;get_figure_handle(num(k))];end
-
-            job="clear"
+        if type(varargin(1))==1 then     // win num given
+            num = varargin(1)
+            h = [];
+            for k = 1:size(num,"*")
+                h = [h ; get_figure_handle(num(k))];
+            end
+            job = "clear"
         elseif type(varargin(1))==9 then // handle given
-            h=varargin(1);job="clear"
+            h = varargin(1);
+            job = "clear"
         elseif type(varargin(1))==10 then // job given
-            h=gcf()
-            job=varargin(1)
+            h = gcf()
+            job = varargin(1)
         end
     elseif nbArg==2 then
-        if type(varargin(1))==1 then // win num given
-            num=varargin(1)
-
-            h=[];for k=1:size(num,"*"),h=[h;get_figure_handle(num(k))];end
-
+        if type(varargin(1))==1 then     // win num given
+            num = varargin(1)
+            h = [];
+            for k = 1:size(num,"*")
+                h = [h ; get_figure_handle(num(k))];
+            end
         elseif type(varargin(1))==9 then // handle given
-            h=varargin(1);
+            h = varargin(1);
         end
-        job=varargin(2);
+        job = varargin(2);
     else
-        error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected."), "clf", 0, 2));
+        msg = _("%s: Wrong number of input argument(s): %d to %d expected.")
+        error(msprintf(msg, "clf", 0, 2))
     end
 
     if and(job<>["clear","reset"]) then
-        error(msprintf(gettext("%s: Wrong value for input argument #%d: ''clear'' or ''reset'' expected."), "clf", nbArg));
+        msg = _("%s: Wrong value for input argument #%d: ''clear'' or ''reset'' expected.")
+        error(msprintf(msg, "clf", nbArg))
     end
 
     nbHandles = size(h,"*");
-
     if nbHandles == 0 then
-        return;
+        return
     end
 
     // check that all the handles are figures
-    for k=1:nbHandles
+    for k = 1:nbHandles
         curFig = h(k);
-        if curFig.type <> "Figure" & (curFig.type <> "uicontrol" | curFig.style <> "frame") then
-            error(msprintf(gettext("%s: Wrong type for input argument #%d: A vector of ''Figure'' or ''Frame'' handle expected."), "clf", 1));
+        if curFig.type <> "Figure" & (curFig.type <> "uicontrol" | curFig.style <> "frame")
+            msg = _("%s: Wrong type for input argument #%d: A vector of ''Figure'' or ''Frame'' handle expected.")
+            error(msprintf(msg, "clf", 1))
         end
     end
 
     // delete childrens
-    for k=1:nbHandles
+    for k = 1:nbHandles
         curFig = h(k)
         if curFig.type == "uicontrol" then
             haveAxes = %F;
@@ -77,64 +84,98 @@ function clf(varargin)
                 newaxes(curFig);
             end
         else
-            // drawlater
+            // Forces drawlater
             immediateMode = curFig.immediate_drawing;
             curFig.immediate_drawing = "off";
-
             delete(curFig.children);
-
-            // drawnow
+            curFig.info_message = "";            // Clears the infobar message
+            curFig.event_handler_enable = "off"; // Disables the event handler
+            // Restores the drawlater entry status:
             curFig.immediate_drawing = immediateMode;
-
-            curFig.info_message = "";
         end
     end
 
-
     // reset figures to default values if needed
     if (job == "reset") then
         defaultFig = gdf();
+        // This literal list should be replaced ASAP with a getproperties(gdf())
+        // when such a function will be available:
+        allprops = [
+            "children"
+            "figure_position"
+            "figure_size"
+            "axes_size"
+            "auto_resize"
+            "viewport"
+            "figure_name"
+            "figure_id"
+            "info_message"
+            "color_map"
+            "pixel_drawing_mode"
+            "anti_aliasing"
+            "immediate_drawing"
+            "background"
+            "visible"
+            "rotation_style"
+            "event_handler"
+            "event_handler_enable"
+            "user_data"
+            "resizefcn"
+            "closerequestfcn"
+            "resize"
+            "toolbar"
+            "toolbar_visible"
+            "menubar"
+            "menubar_visible"
+            "infobar_visible"
+            "dockable"
+            "layout"
+            "layout_options"
+            "default_axes"
+            "icon"
+            "tag"
+            ];
+        excluded0 = ["children" "dockable" "menubar" "toolbar" "immediate_drawing"]
+        excluded0 = [excluded0 "layout" "layout_options"] // http://bugzilla.scilab.org/14955
         for k = 1: nbHandles
             curFig = h(k);
             if curFig.type == "uicontrol" then
                 continue;
             end
 
-            // drawlater
-            immediateMode = curFig.immediate_drawing;
+            // Forces drawlater mode
             curFig.immediate_drawing = "off";
 
             // properties to set
-            defaultProps=["figure_position",
-            "axes_size",
-            "auto_resize",
-            "viewport",
-            "figure_name",
-            "color_map",
-            "info_message",
-            "pixel_drawing_mode",
-            "immediate_drawing",
-            "background",
-            "visible",
-            "rotation_style",
-            "event_handler",
-            "event_handler_enable",
-            "user_data",
-            "tag"];
+            excluded = excluded0
+            if isDocked(curFig)            // http://bugzilla.scilab.org/11476
+                excluded = [excluded "figure_position" "figure_size" "axes_size"]
+            end
+            defaultProps = setdiff(allprops, excluded);
 
+            // Settings
             for i = 1:size(defaultProps,"*")
                 defaultValue = get(defaultFig, defaultProps(i));
                 if (defaultProps(i) <> "figure_position" | defaultValue <> [-1,-1]) then
                     // don't reset figure pos is defaultValue is [-1,-1]
                     set(curFig, defaultProps(i), defaultValue);
                 end
-
             end
-
-            // drawnow
-            curFig.immediate_drawing = immediateMode;
+            set(curFig, "immediate_drawing", defaultFig.immediate_drawing)
         end
     end
+endfunction
 
+function yn = isDocked(fh)
+    // http://fileexchange.scilab.org/toolboxes/360000
+    sf = size(fh)
+    fh = fh(:)
+    fs = matrix(fh.figure_size,2,-1)'
+    as = matrix(fh.axes_size,2,-1)'
+
+    yn = (fh.dockable=="on" & ((fs(:,1)-as(:,1)) > 20)')
+   // A test on vertical dimensions is more complicated, due to switchable
+   // menubar, toolbar and infobar.
+    yn = matrix(yn, sf)
 endfunction
 
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_11476.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_11476.tst
new file mode 100644 (file)
index 0000000..66546ef
--- /dev/null
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 11476 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/11476
+//
+// <-- Short Description -->
+// clf('reset') applied to a docked figure moved and resized the whole block
+//              of docked objects, likely the Scilab's desktop.
+
+f = scf();
+plot2d()
+// Please dock the figure to the desktop
+fp = f.figure_position;
+fs = f.figure_size;
+as = f.axes_size;
+
+clf('reset')
+// The Scilab's desktop shall not have been moved nor resized
+assert_checkequal(f.figure_position, fp);
+assert_checkequal(f.figure_size, fs);
+assert_checkequal(f.axes_size, as);
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_14956.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_14956.tst
new file mode 100644 (file)
index 0000000..1533d06
--- /dev/null
@@ -0,0 +1,39 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 14956 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14956
+//
+// <-- Short Description -->
+// clf('reset') forgets resetting immediate_drawing, resize, resizefcn,
+//     closerequestfcn, toolbar_visible, menubar_visible, infobar_visible,
+//     default_axes, icon.
+
+cf = figure("resizefcn","a=1","resize","off", ..
+     "toolbar_visible","off","menubar_visible","off","infobar_visible","off",..
+     "closerequestfcn", "b=2", ..
+     "icon", SCI+"\modules\gui\images\icons\16x16\mimetypes\package-x-generic.png");
+plot2d()
+cf.default_axes = "off";
+cf.immediate_drawing = "off";
+
+clf('reset')
+assert_checkequal(cf.resize, "on");
+assert_checkequal(cf.resizefcn, "");
+assert_checkequal(cf.toolbar_visible, "on");
+assert_checkequal(cf.menubar_visible, "on");
+assert_checkequal(cf.infobar_visible, "on");
+//assert_checkequal(cf.layout, "none");
+//assert_checkequal(cf.layout_options, "OptNoLayout");
+assert_checkequal(cf.default_axes, "on");
+assert_checkequal(cf.immediate_drawing, "on");
+assert_checkequal(cf.icon, "");
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref
deleted file mode 100644 (file)
index f78fb25..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
-//
-//// This file is distributed under the same license as the Scilab package.
-// =============================================================================
-//
-// <-- TEST WITH GRAPHIC -->
-//
-// <-- Non-regression test for bug 7411 -->
-//
-// <-- Bugzilla URL -->
-// http://bugzilla.scilab.org/show_bug.cgi?id=7411
-//
-// <-- Short Description -->
-// clf() forgets to turn off the datatip mode
-clf();
-plot2d();
-datatipToggle();
-clf();
-h=gcf();
-assert_checkequal(h.event_handler_enable, "off");
-assert_checkequal(h.info_message, "");
-close;
index 3a9a4c3..9fd503e 100644 (file)
@@ -6,6 +6,7 @@
 // =============================================================================
 //
 // <-- TEST WITH GRAPHIC -->
+// <-- NO CHECK REF -->
 //
 // <-- Non-regression test for bug 7411 -->
 //
 // http://bugzilla.scilab.org/show_bug.cgi?id=7411
 //
 // <-- Short Description -->
-// clf() forgets to turn off the datatip mode
+// clf() forgets to turn off the event handler
 
-clf();
+f = scf();
 plot2d();
-datatipToggle();
-clf();
-h=gcf();
-assert_checkequal(h.event_handler_enable, "off");
-assert_checkequal(h.info_message, "");
-close;
+f.event_handler = "foo";
+f.event_handler_enable = "on";
+clf
+assert_checkequal(f.event_handler, "foo");
+assert_checkequal(f.event_handler_enable, "off");
+assert_checkequal(f.info_message, "");
+