Add a closeEditvar() function 39/10339/4
Calixte DENIZET [Mon, 28 Jan 2013 15:17:37 +0000 (16:17 +0100)]
Change-Id: Iebb4bff60e3bd01a7c7386586ab40a5f284f42ab

12 files changed:
scilab/modules/ui_data/Makefile.am
scilab/modules/ui_data/Makefile.in
scilab/modules/ui_data/help/en_US/closeEditvar.xml [new file with mode: 0644]
scilab/modules/ui_data/help/en_US/editvar.xml
scilab/modules/ui_data/includes/gw_ui_data.h
scilab/modules/ui_data/sci_gateway/c/gw_ui_data.c
scilab/modules/ui_data/sci_gateway/cpp/sci_closeEditvar.cpp [new file with mode: 0644]
scilab/modules/ui_data/sci_gateway/ui_data_gateway.xml
scilab/modules/ui_data/src/c/ui_data.vcxproj
scilab/modules/ui_data/src/c/ui_data.vcxproj.filters
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/EditVar.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/variableeditor/ScilabVariableEditor.java

index c45621b..0110497 100644 (file)
@@ -61,7 +61,8 @@ GATEWAY_C_SOURCES = sci_gateway/c/gw_ui_data.c
 GATEWAY_CXX_SOURCES = sci_gateway/cpp/sci_editvar.cpp \
                      sci_gateway/cpp/sci_browsevar.cpp \
                      sci_gateway/cpp/sci_filebrowser.cpp \
-                       sci_gateway/cpp/sci_updatebrowsevar.cpp
+                       sci_gateway/cpp/sci_updatebrowsevar.cpp \
+                       sci_gateway/cpp/sci_closeEditvar.cpp
 
 
 libsciui_data_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
index 23aa31f..bfa5eea 100644 (file)
@@ -164,7 +164,8 @@ am__objects_5 = libsciui_data_la-gw_ui_data.lo
 am__objects_6 = libsciui_data_la-sci_editvar.lo \
        libsciui_data_la-sci_browsevar.lo \
        libsciui_data_la-sci_filebrowser.lo \
-       libsciui_data_la-sci_updatebrowsevar.lo
+       libsciui_data_la-sci_updatebrowsevar.lo \
+       libsciui_data_la-sci_closeEditvar.lo
 am_libsciui_data_la_OBJECTS = $(am__objects_5) $(am__objects_6)
 libsciui_data_la_OBJECTS = $(am_libsciui_data_la_OBJECTS)
 libsciui_data_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -504,7 +505,8 @@ GATEWAY_C_SOURCES = sci_gateway/c/gw_ui_data.c
 GATEWAY_CXX_SOURCES = sci_gateway/cpp/sci_editvar.cpp \
                      sci_gateway/cpp/sci_browsevar.cpp \
                      sci_gateway/cpp/sci_filebrowser.cpp \
-                       sci_gateway/cpp/sci_updatebrowsevar.cpp
+                       sci_gateway/cpp/sci_updatebrowsevar.cpp \
+                       sci_gateway/cpp/sci_closeEditvar.cpp
 
 libsciui_data_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
                        -I$(srcdir)/includes/ \
@@ -745,6 +747,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_disable_la-noui_data.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-gw_ui_data.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-sci_browsevar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-sci_closeEditvar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-sci_editvar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-sci_filebrowser.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsciui_data_la-sci_updatebrowsevar.Plo@am__quote@
@@ -882,6 +885,13 @@ libsciui_data_la-sci_updatebrowsevar.lo: sci_gateway/cpp/sci_updatebrowsevar.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciui_data_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciui_data_la-sci_updatebrowsevar.lo `test -f 'sci_gateway/cpp/sci_updatebrowsevar.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_updatebrowsevar.cpp
 
+libsciui_data_la-sci_closeEditvar.lo: sci_gateway/cpp/sci_closeEditvar.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciui_data_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsciui_data_la-sci_closeEditvar.lo -MD -MP -MF $(DEPDIR)/libsciui_data_la-sci_closeEditvar.Tpo -c -o libsciui_data_la-sci_closeEditvar.lo `test -f 'sci_gateway/cpp/sci_closeEditvar.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_closeEditvar.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libsciui_data_la-sci_closeEditvar.Tpo $(DEPDIR)/libsciui_data_la-sci_closeEditvar.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_closeEditvar.cpp' object='libsciui_data_la-sci_closeEditvar.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciui_data_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsciui_data_la-sci_closeEditvar.lo `test -f 'sci_gateway/cpp/sci_closeEditvar.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_closeEditvar.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
diff --git a/scilab/modules/ui_data/help/en_US/closeEditvar.xml b/scilab/modules/ui_data/help/en_US/closeEditvar.xml
new file mode 100644 (file)
index 0000000..459cfd3
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2013 - Scilab Enterprises - Calixte Denizet
+ * 
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-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="closeEditvar">
+    <refnamediv>
+        <refname>closeEditvar</refname>
+        <refpurpose>Close the variable editor</refpurpose>
+    </refnamediv>
+    <refsynopsisdiv>
+        <title>Calling Sequence</title>
+        <synopsis>closeEditvar</synopsis>
+    </refsynopsisdiv>
+    <refsection>
+        <title>Description</title>
+        <para>
+            <literal>closeEditvar</literal> closes the variable editor.
+        </para>
+    </refsection>
+    <refsection>
+        <title>Examples</title>
+        <programlisting role="example"><![CDATA[ 
+a=rand(10,10);
+editvar a;
+closeEditvar();
+ ]]></programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="editvar">editvar</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection>
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>5.4.1</revnumber>
+                <revremark>
+                    Function <literal>closeEditvar()</literal> introduced
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
+    
+</refentry>
index 95c3ba5..a2a3358 100644 (file)
@@ -221,4 +221,12 @@ sp=sparse([1,2;4,5;3,10],[1,2,3])
 editvar("sp");
  ]]></programlisting>
     </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="closeEditvar">closeEditvar</link>
+            </member>
+        </simplelist>
+    </refsection>
 </refentry>
index 162d0ae..1eacc08 100644 (file)
@@ -20,6 +20,7 @@ UI_DATA_IMPEXP int sci_editvar(char* fname, unsigned long l);
 UI_DATA_IMPEXP int sci_browsevar(char* fname, unsigned long l);
 UI_DATA_IMPEXP int sci_filebrowser(char* fname, unsigned long l);
 UI_DATA_IMPEXP int sci_updatebrowsevar(char* fname, unsigned long l);
+UI_DATA_IMPEXP int sci_closeEditvar(char* fname, unsigned long l);
 /*--------------------------------------------------------------------------*/
 #endif /* __GW_UI_DATA__ */
 /*--------------------------------------------------------------------------*/
index d7f0f81..805bf41 100644 (file)
@@ -27,33 +27,34 @@ static gw_generic_table Tab[]=
     {sci_editvar, "editvar"},
     {sci_browsevar, "browsevar"},
     {sci_filebrowser, "filebrowser"},
-    {sci_updatebrowsevar, "updatebrowsevar"}
+    {sci_updatebrowsevar, "updatebrowsevar"},
+    {sci_closeEditvar, "closeEditvar"}
 };
 /*--------------------------------------------------------------------------*/
 int gw_ui_data(void)
 {
-       Rhs = Max(0, Rhs);
+    Rhs = Max(0, Rhs);
 
-       if ( getScilabMode() == SCILAB_NWNI)
-       {
-               Scierror(999,_("Scilab '%s' module disabled in -nogui or -nwni mode.\n"), "ui_data");
-               return 0;
-       }
+    if ( getScilabMode() == SCILAB_NWNI)
+    {
+        Scierror(999,_("Scilab '%s' module disabled in -nogui or -nwni mode.\n"), "ui_data");
+        return 0;
+    }
 
-/*     if (!loadedDep)
-       {
-               loadOnUseClassPath("ui_data");
-               loadedDep = TRUE;
-       }
+/*      if (!loadedDep)
+        {
+        loadOnUseClassPath("ui_data");
+        loadedDep = TRUE;
+        }
 */
 
     if(pvApiCtx == NULL)
-       {
-               pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
-       }
+    {
+        pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
+    }
 
-       pvApiCtx->pstName = (char*)Tab[Fin-1].name;
-       callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
-       return 0;
+    pvApiCtx->pstName = (char*)Tab[Fin-1].name;
+    callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/ui_data/sci_gateway/cpp/sci_closeEditvar.cpp b/scilab/modules/ui_data/sci_gateway/cpp/sci_closeEditvar.cpp
new file mode 100644 (file)
index 0000000..1046b61
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "EditVar.hxx"
+#include "GiwsException.hxx"
+
+extern "C"
+{
+#include "gw_ui_data.h"
+#include "getScilabJavaVM.h"
+#include "api_scilab.h"
+}
+
+using namespace org_scilab_modules_ui_data;
+
+/*--------------------------------------------------------------------------*/
+int sci_closeEditvar(char *fname, unsigned long fname_len)
+{
+    CheckOutputArgument(pvApiCtx, 1, 1);
+    CheckInputArgument(pvApiCtx, 0, 0);
+
+    EditVar::closeVariableEditor(getScilabJavaVM());
+
+    AssignOutputVariable(pvApiCtx, 1) = 0;
+    ReturnArguments(pvApiCtx);
+
+    return 0;
+}
index 25b63c9..46cf92b 100644 (file)
@@ -27,4 +27,5 @@
 <PRIMITIVE gatewayId="67" primitiveId="2" primitiveName="browsevar" />
 <PRIMITIVE gatewayId="67" primitiveId="3" primitiveName="filebrowser" />
 <PRIMITIVE gatewayId="67" primitiveId="4" primitiveName="updatebrowsevar" />
+<PRIMITIVE gatewayId="67" primitiveId="5" primitiveName="closeEditvar" />
 </GATEWAY>
index ba7fec1..20d888a 100644 (file)
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_closeEditvar.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_filebrowser.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_updatebrowsevar.cpp" />
     <ClCompile Include="..\cpp\FileBrowserChDir.cpp" />
index ff0f400..9208ffe 100644 (file)
@@ -65,6 +65,9 @@
     <ClCompile Include="..\..\sci_gateway\cpp\sci_updatebrowsevar.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_closeEditvar.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\jni\BrowseVar.hxx">
index 297012b..664f2f1 100644 (file)
@@ -485,6 +485,6 @@ public final class EditVar {
      * Close Variable Editor
      */
     public static void closeVariableEditor() {
-        ScilabVariableEditor.getVariableEditor().close();
+        ScilabVariableEditor.closeEditVar();
     }
 }
index 2c9fe6a..d429c08 100644 (file)
@@ -71,6 +71,15 @@ public final class ScilabVariableEditor extends SwingScilabWindow implements Var
 
     /**
      * Close the edition of the variable
+     */
+    public static void closeEditVar() {
+        if (instance != null) {
+            instance.close();
+        }
+    }
+
+    /**
+     * Close the edition of the variable
      * @param name the variable
      */
     public static void close(String name) {