* Bug #7411 fixed - clf() forgot to turn off the datatip mode. 69/11869/6
Charlotte HECQUET [Tue, 2 Jul 2013 11:42:39 +0000 (13:42 +0200)]
Change-Id: I8c02aa99cde92b82275ad5f84a884fee2c598e30

scilab/CHANGES_5.5.X
scilab/modules/graphics/help/en_US/figure_operations/clf.xml
scilab/modules/graphics/macros/clf.sci
scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref [new file with mode: 0644]
scilab/modules/graphics/tests/nonreg_tests/bug_7411.tst [new file with mode: 0644]

index 7782a59..2f047ab 100644 (file)
@@ -265,6 +265,8 @@ Bug fixes
 
 * Bug #7296 fixed - Enabled %nan, %inf and -%inf for the cdf* functions.
 
+* Bug #7411 fixed - clf() forgot to turn off the datatip mode.
+
 * Bug #7486 fixed - DGELSY and ZGELSY closer to the upstream, to propose our modifications to LAPACK.
 
 * Bug #7596 fixed - Same error happening in different places now yields the same error message.
index b60f728..7671d35 100644 (file)
@@ -1,8 +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) INRIA - Jean-Baptiste Silvy
+ * Copyright (C) Samuel GOUGEON : update after fix of bug 7411
  * 
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
  *
  -->
-<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="clf">
+ <refentry xml:lang="en" xml:id="clf">
     <refnamediv>
         <refname>clf</refname>
-        <refpurpose>clear or reset the current graphic figure
-            (window) to default values
+        <refpurpose>
+            clear or reset the current graphic figure (window) to default values
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Calling Sequence</title>
-        <synopsis>clf(&lt;opt_job_arg&gt;)
+        <synopsis>
+            clf(&lt;opt_job_arg&gt;)
             clf(h,&lt;opt_job_arg&gt;)
             clf(num,&lt;opt_job_arg&gt;)
         </synopsis>
@@ -44,8 +45,8 @@
                 <term>&lt;opt_job_arg&gt;</term>
                 <listitem>
                     <para>
-                        a string ( <literal>'clear' </literal>or <literal>'reset'</literal> )
-                        specifying the job for <literal>clf</literal>.
+                        string <literal>'clear'</literal> (default) or <literal>'reset'</literal>,
+                        specifying the job for <literal>clf</literal>. 
                     </para>
                 </listitem>
             </varlistentry>
             The <literal>clf</literal> command is used to reset a figure to its default
             values and/or to delete all its children.
         </para>
-        <para>
-            If <literal>opt_job_arg</literal> string value is <literal>'clear'</literal> then
-            all children of the specified figure are deleted.
-        </para>
-        <para>
-            If <literal>opt_job_arg</literal> string value is <literal>'reset'</literal> then
-            not only all children of the specified figure are deleted but the figure
-            properties are reset to their default values using the default figure
-            model (see <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>
-        <para>
-            <literal>clf(num)</literal> clear or reset the figure with
-            <literal>figure_id==num</literal>.
-        </para>
-        <para>
-            <literal>clf(h)</literal> clear or reset the figure pointed to by
-            the handle <literal>h</literal>.
-        </para>
-        <para>
-            <literal>clf()</literal> clear or reset the current figure.
-        </para>
-        <para>
-            <literal>clf</literal> function delete every children of specified windows including
-            menus and uicontrols added by user.
-            To prevent menus and uicontrols from being deleted, the <literal>delete(gca())</literal> command
-            might be used instead.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
+        <variablelist>
+            <varlistentry>
+                <term>First input argument: </term>
+                <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>h</term>
+                            <listitem>
+                                <para>
+                                    <literal>clf(h,..)</literal> clears or resets the figure pointed to by the handle <literal>h</literal>
+                                </para>
+                            </listitem>
+                        </varlistentry>
+                        <varlistentry>
+                            <term>(none)</term>
+                            <listitem>
+                                <para>
+                                    <literal>clf(..)</literal> clears or resets the current figure.
+                                                               </para>
+                                               </listitem>
+                                           </varlistentry>
+                                       </variablelist>
+                           </listitem>
+                       </varlistentry>
+                       <varlistentry>
+                           <term>opt_job_arg</term>
+                           <listitem>
+                               <variablelist>
+                                   <varlistentry>
+                                       <term>'clear' (default)</term>
+                                       <listitem>
+                                           <para>
+                                               <literal>clf(..,'clear')</literal> clears the targetted figure:
+                                                                       <itemizedlist>
+                                                                           <listitem>all its <literal>children</literal> are deleted: axes, uicontrols, menus, and others. 
+                                                                               To prevent menus and uicontrols from being deleted, 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>
+                            </listitem>
+                        </varlistentry>
+                        <varlistentry>
+                            <term>'reset'</term>
+                            <listitem>
+                                <para><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.clears or resets the current figure.
+                                                               </para>
+                                                       </listitem>
+                                               </varlistentry>
+                                       </variablelist>
+                               </listitem>
+                       </varlistentry>
+               </variablelist>
+       </refsection>
+       <refsection>
+           <title>Examples</title>
+           <programlisting role="example"> 
 f4=scf(4);  //creates figure with id==4 and make it the current one
 f4.color_map = jetcolormap(64);
 f4.figure_size = [400, 200];
@@ -106,16 +148,13 @@ plot3d1(t,t,sin(t)'*cos(t));  // color_map unchanged
    
 clf(gcf(),'reset')
 plot3d1(t,t,sin(t)'*cos(t));  // color_map changed (back to the default one with 32 colors)
- ]]></programlisting>
+        </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>
+                <link linkend="figure_properties">figure properties</link>
             </member>
             <member>
                 <link linkend="gcf">gcf</link>
@@ -127,6 +166,12 @@ plot3d1(t,t,sin(t)'*cos(t));  // color_map changed (back to the default one with
                 <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>
index 9e7de7d..0ff9cde 100644 (file)
@@ -63,11 +63,16 @@ function clf(varargin)
         curFig.immediate_drawing = "off";
 
         delete(curFig.children);
-
+        
         // drawnow
         curFig.immediate_drawing = immediateMode;
     end
 
+    if curFig.event_handler == "datatipEventhandler" then
+        curFig.event_handler_enable="off";
+        curFig.info_message="";
+    end
+
     // reset figures to default values if needed
     if (job == "reset") then
         defaultFig = gdf();
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_7411.dia.ref
new file mode 100644 (file)
index 0000000..f78fb25
--- /dev/null
@@ -0,0 +1,24 @@
+// =============================================================================
+// 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;
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_7411.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_7411.tst
new file mode 100644 (file)
index 0000000..3a9a4c3
--- /dev/null
@@ -0,0 +1,25 @@
+// =============================================================================
+// 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;