Enable export via driver/xinit/xend 34/6934/4
Calixte DENIZET [Wed, 11 Apr 2012 15:49:01 +0000 (17:49 +0200)]
Change-Id: Id8506b1c9c34f0a2e3935bdd7209f0f4ceef4cfa

28 files changed:
scilab/modules/graphic_export/Makefile.am
scilab/modules/graphic_export/Makefile.in
scilab/modules/graphic_export/graphic_export.vcxproj
scilab/modules/graphic_export/graphic_export.vcxproj.filters
scilab/modules/graphic_export/includes/gw_graphic_export.h
scilab/modules/graphic_export/macros/driver.sci [deleted file]
scilab/modules/graphic_export/macros/xend.sci [deleted file]
scilab/modules/graphic_export/macros/xinit.sci [deleted file]
scilab/modules/graphic_export/sci_gateway/c/gw_graphic_export.c
scilab/modules/graphic_export/sci_gateway/cpp/sci_driver.cpp [new file with mode: 0644]
scilab/modules/graphic_export/sci_gateway/cpp/sci_xend.cpp [new file with mode: 0644]
scilab/modules/graphic_export/sci_gateway/cpp/sci_xinit.cpp [new file with mode: 0644]
scilab/modules/graphic_export/sci_gateway/graphic_export_gateway.xml
scilab/modules/graphic_export/src/c/xs2file.c
scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Driver.java [new file with mode: 0644]
scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Export.java
scilab/modules/graphic_export/src/jni/Driver.cpp [new file with mode: 0644]
scilab/modules/graphic_export/src/jni/Driver.giws.xml [new file with mode: 0644]
scilab/modules/graphic_export/src/jni/Driver.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/ScilabView.hxx
scilab/modules/gui/Makefile.am
scilab/modules/gui/Makefile.in
scilab/modules/gui/src/c/gui.vcxproj
scilab/modules/gui/src/c/gui.vcxproj.filters
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/jni/SwingView.cpp [new file with mode: 0644]
scilab/modules/gui/src/jni/SwingView.giws.xml [new file with mode: 0644]
scilab/modules/gui/src/jni/SwingView.hxx [new file with mode: 0644]

index e57de4c..5d297d3 100644 (file)
@@ -26,6 +26,7 @@ libscigraphic_export_la_etc_DATA = etc/graphic_export.quit etc/graphic_export.st
 # List of the c files
 GRAPHIC_EXPORT_CPP_SOURCES = src/cpp/exportToFile.cpp \
 src/jni/FileExporter.cpp \
+src/jni/Driver.cpp \
 src/cpp/GL2PSConstant.cpp \
 src/cpp/GL2PSWrapping.cpp \
 src/cpp/JoGLInterface.cpp  \
@@ -49,7 +50,9 @@ sci_gateway/c/sci_xs2eps.c \
 sci_gateway/c/sci_xs2pdf.c \
 sci_gateway/c/sci_xs2png.c
 
-GATEWAY_CPP_SOURCES = 
+GATEWAY_CPP_SOURCES = sci_gateway/cpp/sci_driver.cpp \
+sci_gateway/cpp/sci_xinit.cpp \
+sci_gateway/cpp/sci_xend.cpp
 
 # Includes need for the compilation
 libscigraphic_export_la_CPPFLAGS =     $(JAVA_JNI_INCLUDE) \
@@ -65,7 +68,8 @@ libscigraphic_export_la_CPPFLAGS =    $(JAVA_JNI_INCLUDE) \
                                -I$(top_srcdir)/modules/api_scilab/includes \
                                -I$(top_srcdir)/modules/commons/src/jni \
                                -I$(top_srcdir)/libs/doublylinkedlist/includes \
-                               -I$(top_srcdir)/modules/graphic_objects/includes
+                               -I$(top_srcdir)/modules/graphic_objects/includes \
+                               -I$(top_srcdir)/modules/gui/src/jni
 
 # All the sources needed by libscigraphic_export.la
 libscigraphic_export_algo_la_SOURCES = $(GRAPHIC_EXPORT_C_SOURCES) $(GRAPHIC_EXPORT_CPP_SOURCES)
index db12af1..f97c4ea 100644 (file)
@@ -132,6 +132,7 @@ am__objects_1 = libscigraphic_export_algo_la-xs2file.lo \
        libscigraphic_export_algo_la-gl2ps.lo
 am__objects_2 = libscigraphic_export_algo_la-exportToFile.lo \
        libscigraphic_export_algo_la-FileExporter.lo \
+       libscigraphic_export_algo_la-Driver.lo \
        libscigraphic_export_algo_la-GL2PSConstant.lo \
        libscigraphic_export_algo_la-GL2PSWrapping.lo \
        libscigraphic_export_algo_la-JoGLInterface.lo \
@@ -158,13 +159,16 @@ am__objects_3 = libscigraphic_export_la-gw_graphic_export.lo \
        libscigraphic_export_la-sci_xs2eps.lo \
        libscigraphic_export_la-sci_xs2pdf.lo \
        libscigraphic_export_la-sci_xs2png.lo
-am__objects_4 =
+am__objects_4 = libscigraphic_export_la-sci_driver.lo \
+       libscigraphic_export_la-sci_xinit.lo \
+       libscigraphic_export_la-sci_xend.lo
 am_libscigraphic_export_la_OBJECTS = $(am__objects_3) $(am__objects_4)
 libscigraphic_export_la_OBJECTS =  \
        $(am_libscigraphic_export_la_OBJECTS)
-libscigraphic_export_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(libscigraphic_export_la_LDFLAGS) $(LDFLAGS) -o $@
+libscigraphic_export_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(libscigraphic_export_la_LDFLAGS) $(LDFLAGS) -o \
+       $@
 @GUI_TRUE@am_libscigraphic_export_la_rpath = -rpath $(pkglibdir)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
@@ -463,6 +467,7 @@ libscigraphic_export_la_etc_DATA = etc/graphic_export.quit etc/graphic_export.st
 # List of the c files
 GRAPHIC_EXPORT_CPP_SOURCES = src/cpp/exportToFile.cpp \
 src/jni/FileExporter.cpp \
+src/jni/Driver.cpp \
 src/cpp/GL2PSConstant.cpp \
 src/cpp/GL2PSWrapping.cpp \
 src/cpp/JoGLInterface.cpp  \
@@ -487,7 +492,10 @@ sci_gateway/c/sci_xs2eps.c \
 sci_gateway/c/sci_xs2pdf.c \
 sci_gateway/c/sci_xs2png.c
 
-GATEWAY_CPP_SOURCES = 
+GATEWAY_CPP_SOURCES = sci_gateway/cpp/sci_driver.cpp \
+sci_gateway/cpp/sci_xinit.cpp \
+sci_gateway/cpp/sci_xend.cpp
+
 
 # Includes need for the compilation
 libscigraphic_export_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
@@ -503,7 +511,8 @@ libscigraphic_export_la_CPPFLAGS = $(JAVA_JNI_INCLUDE) \
                                -I$(top_srcdir)/modules/api_scilab/includes \
                                -I$(top_srcdir)/modules/commons/src/jni \
                                -I$(top_srcdir)/libs/doublylinkedlist/includes \
-                               -I$(top_srcdir)/modules/graphic_objects/includes
+                               -I$(top_srcdir)/modules/graphic_objects/includes \
+                               -I$(top_srcdir)/modules/gui/src/jni
 
 
 # All the sources needed by libscigraphic_export.la
@@ -694,6 +703,7 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_algo_la-Driver.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_algo_la-FileExporter.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_algo_la-GL2PSConstant.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_algo_la-GL2PSConstant_wrap.Plo@am__quote@
@@ -707,6 +717,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_algo_la-xs2file.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_disable_la-nographic_export.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-gw_graphic_export.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_driver.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_xend.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_xinit.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_xs2bmp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_xs2eps.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_export_la-sci_xs2gif.Plo@am__quote@
@@ -878,6 +891,13 @@ libscigraphic_export_algo_la-FileExporter.lo: src/jni/FileExporter.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) $(libscigraphic_export_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_algo_la-FileExporter.lo `test -f 'src/jni/FileExporter.cpp' || echo '$(srcdir)/'`src/jni/FileExporter.cpp
 
+libscigraphic_export_algo_la-Driver.lo: src/jni/Driver.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_export_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_export_algo_la-Driver.lo -MD -MP -MF $(DEPDIR)/libscigraphic_export_algo_la-Driver.Tpo -c -o libscigraphic_export_algo_la-Driver.lo `test -f 'src/jni/Driver.cpp' || echo '$(srcdir)/'`src/jni/Driver.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_export_algo_la-Driver.Tpo $(DEPDIR)/libscigraphic_export_algo_la-Driver.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/jni/Driver.cpp' object='libscigraphic_export_algo_la-Driver.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) $(libscigraphic_export_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_algo_la-Driver.lo `test -f 'src/jni/Driver.cpp' || echo '$(srcdir)/'`src/jni/Driver.cpp
+
 libscigraphic_export_algo_la-GL2PSConstant.lo: src/cpp/GL2PSConstant.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_export_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_export_algo_la-GL2PSConstant.lo -MD -MP -MF $(DEPDIR)/libscigraphic_export_algo_la-GL2PSConstant.Tpo -c -o libscigraphic_export_algo_la-GL2PSConstant.lo `test -f 'src/cpp/GL2PSConstant.cpp' || echo '$(srcdir)/'`src/cpp/GL2PSConstant.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_export_algo_la-GL2PSConstant.Tpo $(DEPDIR)/libscigraphic_export_algo_la-GL2PSConstant.Plo
@@ -913,6 +933,27 @@ libscigraphic_export_algo_la-JOGLConstant.lo: src/jni/JOGLConstant.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) $(libscigraphic_export_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_algo_la-JOGLConstant.lo `test -f 'src/jni/JOGLConstant.cpp' || echo '$(srcdir)/'`src/jni/JOGLConstant.cpp
 
+libscigraphic_export_la-sci_driver.lo: sci_gateway/cpp/sci_driver.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_export_la-sci_driver.lo -MD -MP -MF $(DEPDIR)/libscigraphic_export_la-sci_driver.Tpo -c -o libscigraphic_export_la-sci_driver.lo `test -f 'sci_gateway/cpp/sci_driver.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_driver.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_export_la-sci_driver.Tpo $(DEPDIR)/libscigraphic_export_la-sci_driver.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_driver.cpp' object='libscigraphic_export_la-sci_driver.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) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_la-sci_driver.lo `test -f 'sci_gateway/cpp/sci_driver.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_driver.cpp
+
+libscigraphic_export_la-sci_xinit.lo: sci_gateway/cpp/sci_xinit.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_export_la-sci_xinit.lo -MD -MP -MF $(DEPDIR)/libscigraphic_export_la-sci_xinit.Tpo -c -o libscigraphic_export_la-sci_xinit.lo `test -f 'sci_gateway/cpp/sci_xinit.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xinit.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_export_la-sci_xinit.Tpo $(DEPDIR)/libscigraphic_export_la-sci_xinit.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_xinit.cpp' object='libscigraphic_export_la-sci_xinit.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) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_la-sci_xinit.lo `test -f 'sci_gateway/cpp/sci_xinit.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xinit.cpp
+
+libscigraphic_export_la-sci_xend.lo: sci_gateway/cpp/sci_xend.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_export_la-sci_xend.lo -MD -MP -MF $(DEPDIR)/libscigraphic_export_la-sci_xend.Tpo -c -o libscigraphic_export_la-sci_xend.lo `test -f 'sci_gateway/cpp/sci_xend.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xend.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_export_la-sci_xend.Tpo $(DEPDIR)/libscigraphic_export_la-sci_xend.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_xend.cpp' object='libscigraphic_export_la-sci_xend.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) $(libscigraphic_export_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_export_la-sci_xend.lo `test -f 'sci_gateway/cpp/sci_xend.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xend.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 38ad466..b7948be 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;../gui/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_EXPORT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -111,7 +111,7 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;../gui/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;GRAPHIC_EXPORT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
@@ -140,7 +140,7 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;../gui/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_EXPORT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -175,7 +175,7 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;../jvm/includes;../localization/includes;../fileio/includes;../graphics/includes;../graphics/includes/handleDrawing;src/cpp;../../libs/doublylinkedlist/includes;../../libs/MALLOC/includes;../core/includes;../output_stream/includes;../../java/jdk/include;../../java/jdk/include/win32;src/jni;../../libs/intl;../renderer/includes;src/c;../api_scilab/includes;../commons/src/jni;../graphic_objects/includes;../gui/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;GRAPHIC_EXPORT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -204,7 +204,11 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="sci_gateway\cpp\sci_driver.cpp" />
+    <ClCompile Include="sci_gateway\cpp\sci_xend.cpp" />
+    <ClCompile Include="sci_gateway\cpp\sci_xinit.cpp" />
     <ClCompile Include="src\cpp\exportToFile.cpp" />
+    <ClCompile Include="src\jni\Driver.cpp" />
     <ClCompile Include="src\jni\FileExporter.cpp" />
     <ClCompile Include="src\cpp\GL2PSConstant.cpp" />
     <ClCompile Include="src\jni\GL2PSToJOGL.cpp" />
@@ -234,6 +238,7 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     <ClInclude Include="src\cpp\JoGLInterface.h" />
     <ClInclude Include="includes\xs2file.h" />
     <ClInclude Include="src\cpp\exportToFile.hxx" />
+    <ClInclude Include="src\jni\Driver.hxx" />
     <ClInclude Include="src\jni\FileExporter.hxx" />
     <ClInclude Include="src\cpp\GL2PSConstant.hxx" />
     <ClInclude Include="src\cpp\GL2PSWrapping.hxx" />
@@ -273,6 +278,9 @@ lib /DEF:"$(ProjectDir)renderer_Import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platfo
     <ProjectReference Include="..\graphic_objects\src\c\graphic_objects.vcxproj">
       <Project>{30f9ee41-587b-4618-8de7-698d3fba4985}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\gui\src\c\gui.vcxproj">
+      <Project>{45ca5b12-7601-4968-ae16-16069fd1a152}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\jvm\libjvm.vcxproj">
       <Project>{8ba2dda8-bd04-4d4d-8ee6-6caa955f7470}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
index efa7ea1..6ccb721 100644 (file)
     <ClCompile Include="src\c\xs2file.c">
       <Filter>Source Files\c</Filter>
     </ClCompile>
+    <ClCompile Include="sci_gateway\cpp\sci_driver.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_gateway\cpp\sci_xend.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="sci_gateway\cpp\sci_xinit.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\jni\Driver.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\dynlib_graphic_export.h">
     <ClInclude Include="src\jni\GL2PSToJOGL.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="src\jni\Driver.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="graphic_export.rc">
index f2eba34..5d8e442 100644 (file)
@@ -29,6 +29,9 @@ GRAPHIC_EXPORT_IMPEXP int sci_xs2png( char * fname, unsigned long fname_len ) ;
 GRAPHIC_EXPORT_IMPEXP int sci_xs2ppm( char * fname, unsigned long fname_len ) ;
 GRAPHIC_EXPORT_IMPEXP int sci_xs2svg( char * fname, unsigned long fname_len ) ;
 GRAPHIC_EXPORT_IMPEXP int sci_xs2ps( char * fname, unsigned long fname_len ) ;
+GRAPHIC_EXPORT_IMPEXP int sci_driver( char * fname, unsigned long fname_len ) ;
+GRAPHIC_EXPORT_IMPEXP int sci_xinit( char * fname, unsigned long fname_len ) ;
+GRAPHIC_EXPORT_IMPEXP int sci_xend( char * fname, unsigned long fname_len ) ;
 /*--------------------------------------------------------------------------*/ 
 #endif /* __GW_GRAPHIC_EXPORT__ */
 /*--------------------------------------------------------------------------*/ 
diff --git a/scilab/modules/graphic_export/macros/driver.sci b/scilab/modules/graphic_export/macros/driver.sci
deleted file mode 100644 (file)
index 098802e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste Silvy
-//
-// 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
-
-function  [curDriver] = driver(driverName)
-  // set or get the current driver
-
-  global %driverName;
-
-  if (argn(2) < 1) then
-    // no param just return the current driver
-    curDriver = %driverName;
-  elseif (argn(2) == 1) then
-    if (type(driverName) <> 10) then
-      // wrong type for driverName
-      error(55, 1);
-      return;
-    end
-    
-    if (~checkDriverName(driverName)) then
-      error(msprintf(gettext("%s: Wrong value for input argument #%d: ''%s'', ''%s'', ''%s'', ''%s'', ''%s'' or ''%s'' expected.\n"),"driver",1,"Rec","X11","Pos","PPM","GIF","Fig"));
-     return;
-    end
-    
-    %driverName = driverName;
-    curDriver = driverName;
-
-    if (driverName <> "Rec" | driverName <> "X11") then
-      // to avoid drawing when in export mode
-      // However, drawlater should not create any graphic window
-      // when called
-      scf();
-      drawlater();
-    end
-
-  else
-    // incorrect number of arguments
-    error(39);
-    return;
-  end
-
-
-endfunction
-
-function [check] = checkDriverName(driverName)
-// check that the driver name is obne of the admissible ones
-check =   driverName == "Rec"..
-        | driverName == "X11"..
-        | driverName == "Pos"..
-        | driverName == "GIF"..
-        | driverName == "PPM"..
-        | driverName == "Fig";
-
-endfunction
-
diff --git a/scilab/modules/graphic_export/macros/xend.sci b/scilab/modules/graphic_export/macros/xend.sci
deleted file mode 100644 (file)
index 8b84022..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste Silvy
-//
-// 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
-
-function xend()
-  // export a file using already set fileName and file Type
-
-  global %exportFileName;
-  global %driverName;
-
-  if (%exportFileName == []) then
-    // filed not already selected : xinit has not been called
-    error(msprintf(gettext("%s: %s must be called before any action.\n"),"xend","xinit"));
-    return;
-  end
-
-  curFig = gcf();
-  curFigId = curFig.figure_id;
-
-  // choose export type depending on driver name
-  // for "Rec" and "X11" drivers thare actually nothing to do
-  select %driverName,
-    case "Pos" then
-      drawnow();
-      xs2ps(curFigId, %exportFileName);
-      // delete figure used for export
-      delete(curFig);
-    case "GIF" then
-      drawnow();
-      xs2gif(curFigId, %exportFileName);
-      // delete figure used for export
-      delete(curFig);
-    case "PPM" then
-      drawnow();
-      xs2ppm(curFigId, %exportFileName);
-      // delete figure used for export
-      delete(curFig);
-    case "Fig" then
-      drawnow();
-      xs2fig(curFigId, %exportFileName);
-      // delete figure used for export
-      delete(curFig);
-  end
-
-  // export done reset exportFileName
-  %exportFileName = [];
-
-endfunction
-
diff --git a/scilab/modules/graphic_export/macros/xinit.sci b/scilab/modules/graphic_export/macros/xinit.sci
deleted file mode 100644 (file)
index 81c932d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste Silvy
-//
-// 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
-
-function  xinit(fileName)
-  // set name of the file to export
-
-  global %exportFileName;
-
-  rhs = argn(2);
-
-  global %driverName;
-  if (%driverName == "Rec" | %driverName == "X11" | %driverName == "" | %driverName == []) then
-    // screen display, should be xinit without argument
-    if (rhs <> 0) then
-      error(msprintf(gettext("%s: Wrong number of input arguments: Function has no input argument with ''%s'' or ''%s'' drivers.\n"), "xinit","Rec","X11"));
-    end
-    scf();
-  else
-    // file driver
-    if (rhs <> 1) then
-         error(msprintf(gettext("%s: Wrong number of input argument: String expected with ''%s'', ''%s'', ''%s'' or ''%s'' drivers.\n"), "xinit","GIF","PPM","POS","Fig"));
-
-    end
-
-    if (type(fileName) <> 10) then
-      // wrong type for driverName
-      error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"), "xinit",1));
-      return;
-    end
-  
-    %exportFileName = fileName;
-    
-  end
-
-endfunction
-
-
index 0cd8a30..384fa86 100644 (file)
@@ -3,11 +3,11 @@
  * Copyright (C) 2008 - INRIA - Allan CORNET
  * Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY
  *
- * 
+ *
  * 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    
+ * are also available at
  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
  *
  */
 static BOOL loadedDep = FALSE;
 static BOOL loadedDepVectorialExport = FALSE;
 /*--------------------------------------------------------------------------*/
-static gw_generic_table Tab[] = 
+static gw_generic_table Tab[] =
 {
-  {sci_xs2bmp,"xs2bmp"},
-  {sci_xs2gif,"xs2gif"},
-  {sci_xs2jpg,"xs2jpg"},
-  {sci_xs2png,"xs2png"},
-  {sci_xs2ppm,"xs2ppm"},
-  {sci_xs2eps,"xs2eps"},
-  {sci_xs2pdf,"xs2pdf"},
-  {sci_xs2svg,"xs2svg"},
-  {sci_xs2ps,"xs2ps"}
+    {sci_xs2bmp, "xs2bmp"},
+    {sci_xs2gif, "xs2gif"},
+    {sci_xs2jpg, "xs2jpg"},
+    {sci_xs2png, "xs2png"},
+    {sci_xs2ppm, "xs2ppm"},
+    {sci_xs2eps, "xs2eps"},
+    {sci_xs2pdf, "xs2pdf"},
+    {sci_xs2svg, "xs2svg"},
+    {sci_xs2ps, "xs2ps"},
+    {sci_driver, "driver"},
+    {sci_xinit, "xinit"},
+    {sci_xend, "xend"}
 };
 /*--------------------------------------------------------------------------*/
 int gw_graphic_export(void)
-{  
-       Rhs = Max(0, Rhs);
+{
+    Rhs = Max(0, Rhs);
 
-       if(pvApiCtx == NULL)
-       {
-               pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
-       }
+    if(pvApiCtx == NULL)
+    {
+        pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
+    }
 
-       pvApiCtx->pstName = (char*)Tab[Fin-1].name;
+    pvApiCtx->pstName = (char*)Tab[Fin-1].name;
 
     if ( getScilabMode() != SCILAB_NWNI )
-       {
-               if (!loadedDep) 
-               {
-                       loadOnUseClassPath("graphics");
-                       loadedDep=TRUE;
-               }
-               if (!loadedDepVectorialExport && (strcmp(Tab[Fin-1].name, "xs2eps")==0
-                           || strcmp(Tab[Fin-1].name, "xs2pdf")==0
-                           || strcmp(Tab[Fin-1].name, "xs2svg")==0
-                           || strcmp(Tab[Fin-1].name, "xs2ps")==0))
-          {
+    {
+        if (!loadedDep)
+        {
+            loadOnUseClassPath("graphics");
+            loadedDep=TRUE;
+        }
+        if (!loadedDepVectorialExport && (strcmp(Tab[Fin-1].name, "xs2eps")==0
+                                          || strcmp(Tab[Fin-1].name, "xs2pdf")==0
+                                          || strcmp(Tab[Fin-1].name, "xs2svg")==0
+                                          || strcmp(Tab[Fin-1].name, "xs2ps")==0))
+        {
             loadOnUseClassPath("pdf_ps_eps_graphic_export");
             loadedDepVectorialExport = TRUE;
-          }
+        }
 
-               callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
-       }
-       else
-       {
-               Scierror(999,_("Scilab graphic module disabled -nogui or -nwni mode.\n"));
-       }
-       return 0;
+        callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
+    }
+    else
+    {
+        Scierror(999,_("Scilab graphic module disabled -nogui or -nwni mode.\n"));
+    }
+    return 0;
 }
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/graphic_export/sci_gateway/cpp/sci_driver.cpp b/scilab/modules/graphic_export/sci_gateway/cpp/sci_driver.cpp
new file mode 100644 (file)
index 0000000..8c8d92b
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * 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 <string.h>
+
+extern "C"
+{
+#include "getScilabJavaVM.h"
+#include "Scierror.h"
+#include "api_scilab.h"
+#include "localization.h"
+
+#include "gw_graphic_export.h"
+}
+
+#include "SwingView.hxx"
+#include "Driver.hxx"
+
+#if _MSC_VER
+#define strcasecmp _stricmp
+#endif
+
+/*--------------------------------------------------------------------------*/
+int sci_driver(char * fname, unsigned long fname_len )
+{
+    SciErr err;
+    int * addr = 0;
+    char * driver = 0;
+    bool ok = true;
+
+    CheckRhs(1, 1);
+
+    err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
+    if (err.iErr)
+    {
+        printError(&err, 0);
+        Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
+        return 0;
+    }
+
+    if (!isStringType(pvApiCtx, addr) || !checkVarDimension(pvApiCtx, addr, 1, 1))
+    {
+        Scierror(999, gettext("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 1);
+        return 0;
+    }
+
+    if (getAllocatedSingleString(pvApiCtx, addr, &driver) != 0)
+    {
+        Scierror(999, _("%s: No more memory.\n"), fname);
+        return 0;
+    }
+
+    ok = org_scilab_modules_graphic_export::Driver::setDriver(getScilabJavaVM(), driver);
+    if (!ok)
+    {
+        Scierror(999, _("%s: Invalid driver: %s.\n"), fname, driver);
+        freeAllocatedSingleString(driver);
+        return 0;
+    }
+
+    org_scilab_modules_gui::SwingView::setHeadless(getScilabJavaVM(), strcasecmp(driver, "X11") && strcasecmp(driver, "Rec"));
+
+    freeAllocatedSingleString(driver);
+
+    LhsVar(1) = 0;
+    PutLhsVar();
+    return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/graphic_export/sci_gateway/cpp/sci_xend.cpp b/scilab/modules/graphic_export/sci_gateway/cpp/sci_xend.cpp
new file mode 100644 (file)
index 0000000..371666f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ */
+
+extern "C"
+{
+#include "getScilabJavaVM.h"
+#include "Scierror.h"
+#include "api_scilab.h"
+#include "localization.h"
+
+#include "gw_graphic_export.h"
+}
+
+#include "ScilabView.hxx"
+#include "SwingView.hxx"
+#include "Driver.hxx"
+
+/*--------------------------------------------------------------------------*/
+int sci_xend(char * fname, unsigned long fname_len )
+{
+    CheckRhs(0, 0);
+
+    org_scilab_modules_graphic_export::Driver::end(getScilabJavaVM(), ScilabView::getCurrentFigure());
+    ScilabView::deleteObject(ScilabView::getCurrentFigure());
+    org_scilab_modules_gui::SwingView::setHeadless(getScilabJavaVM(), false);
+
+    LhsVar(1) = 0;
+    PutLhsVar();
+    return 0;
+}
+/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/graphic_export/sci_gateway/cpp/sci_xinit.cpp b/scilab/modules/graphic_export/sci_gateway/cpp/sci_xinit.cpp
new file mode 100644 (file)
index 0000000..de23b8e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
+ */
+
+extern "C"
+{
+#include "getScilabJavaVM.h"
+#include "Scierror.h"
+#include "api_scilab.h"
+#include "localization.h"
+#include "expandPathVariable.h"
+
+#include "gw_graphic_export.h"
+}
+
+#include "Driver.hxx"
+
+/*--------------------------------------------------------------------------*/
+int sci_xinit(char * fname, unsigned long fname_len )
+{
+    SciErr err;
+    int * addr = 0;
+    char * path = 0;
+    char * realPath = 0;
+
+    CheckRhs(1, 1);
+
+    err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
+    if (err.iErr)
+    {
+        printError(&err, 0);
+        Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
+        return 0;
+    }
+
+    if (!isStringType(pvApiCtx, addr) || !checkVarDimension(pvApiCtx, addr, 1, 1))
+    {
+        Scierror(999, gettext("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 1);
+        return 0;
+    }
+
+    if (getAllocatedSingleString(pvApiCtx, addr, &path) != 0)
+    {
+        Scierror(999, _("%s: No more memory.\n"), fname);
+        return 0;
+    }
+
+    realPath = expandPathVariable(path);
+
+    org_scilab_modules_graphic_export::Driver::setPath(getScilabJavaVM(), realPath);
+    freeAllocatedSingleString(path);
+
+    LhsVar(1) = 0;
+    PutLhsVar();
+    return 0;
+}
+/*--------------------------------------------------------------------------*/
index 8ad9d15..92e2842 100644 (file)
@@ -38,8 +38,7 @@
   <PRIMITIVE gatewayId="57" primitiveId="7" primitiveName="xs2pdf" />
   <PRIMITIVE gatewayId="57" primitiveId="8" primitiveName="xs2svg" />
   <PRIMITIVE gatewayId="57" primitiveId="9" primitiveName="xs2ps" />
-
-
-
-
+  <PRIMITIVE gatewayId="57" primitiveId="10" primitiveName="driver" />
+  <PRIMITIVE gatewayId="57" primitiveId="11" primitiveName="xinit" />
+  <PRIMITIVE gatewayId="57" primitiveId="12" primitiveName="xend" />
 </GATEWAY>
index e52ee41..06ae3ad 100644 (file)
@@ -30,6 +30,7 @@
 #include "FigureList.h"
 #include "freeArrayOfString.h"
 #include "../../../graphics/src/c/getHandleProperty/getPropertyAssignedValue.h"
+#include "HandleManagement.h"
 /*--------------------------------------------------------------------------*/
 static BOOL isVectorialExport(ExportFileType fileType);
 /*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Driver.java b/scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Driver.java
new file mode 100644 (file)
index 0000000..573e61a
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
+ */
+
+package org.scilab.modules.graphic_export;
+
+/**
+ * Class to map driver function
+ *
+ * @author Calixte DENIZET
+ */
+public class Driver {
+
+    private static String driver;
+    private static String filename;
+
+    /**
+     * Set the driver
+     * @param driver the driver to use
+     */
+    public static boolean setDriver(String driver) {
+        String d = driver.toLowerCase();
+        if (!d.equals("x11") && !d.equals("rec") && Export.getType(d) == -1) {
+            return false;
+        }
+        Driver.driver = driver;
+
+        return true;
+    }
+
+    /**
+     * Set the path
+     * @param path the path
+     */
+    public static void setPath(String path) {
+        Driver.filename = path;
+    }
+
+    /**
+     * Export the current figure
+     * @param uid the uid of the current figure
+     */
+    public static void end(String uid) {
+        if (!driver.equalsIgnoreCase("X11") && !driver.equalsIgnoreCase("Rec")) {
+            FileExporter.fileExport(uid, filename, driver, -1, 0);
+        }
+    }
+}
index 9b699fe..4c62457 100644 (file)
@@ -80,6 +80,7 @@ public class Export {
         extToType.put("pdf", 7);
         extToType.put("svg", 8);
         extToType.put("ps", 9);
+        extToType.put("pos", 9);
     }
 
     private static boolean svgLoaded;
@@ -97,7 +98,12 @@ public class Export {
     }
 
     public static int getType(String ext) {
-        return extToType.get(ext);
+       Integer type = extToType.get(ext);
+       if (type == null) {
+           return -1;
+       }
+
+        return type;
     }
 
     /**
diff --git a/scilab/modules/graphic_export/src/jni/Driver.cpp b/scilab/modules/graphic_export/src/jni/Driver.cpp
new file mode 100644 (file)
index 0000000..f943b78
--- /dev/null
@@ -0,0 +1,234 @@
+#include "Driver.hxx"
+/* Generated by GIWS (version 1.3.0) */
+/*
+
+Copyright 2007-2008 INRIA
+Copyright 2008-2011 DIGITEO
+
+Author : Sylvestre Ledru & others
+
+This is generated code.
+
+This software is a computer program whose purpose is to hide the complexity
+of accessing Java objects/methods from C++ code.
+
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
+*/
+
+namespace org_scilab_modules_graphic_export {
+
+// Returns the current env
+
+JNIEnv * Driver::getCurrentEnv() {
+JNIEnv * curEnv = NULL;
+jint res=this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+if (res != JNI_OK) {
+throw GiwsException::JniException(getCurrentEnv());
+}
+return curEnv;
+}
+// Destructor
+
+Driver::~Driver() {
+JNIEnv * curEnv = NULL;
+this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+
+curEnv->DeleteGlobalRef(this->instance);
+curEnv->DeleteGlobalRef(this->instanceClass);
+}
+// Constructors
+Driver::Driver(JavaVM * jvm_) {
+jmethodID constructObject = NULL ;
+jobject localInstance ;
+jclass localClass ;
+const std::string construct="<init>";
+const std::string param="()V";
+jvm=jvm_;
+
+JNIEnv * curEnv = getCurrentEnv();
+
+localClass = curEnv->FindClass( this->className().c_str() ) ;
+if (localClass == NULL) {
+  throw GiwsException::JniClassNotFoundException(curEnv, this->className());
+}
+
+this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass));
+
+/* localClass is not needed anymore */
+curEnv->DeleteLocalRef(localClass);
+
+if (this->instanceClass == NULL) {
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+
+
+constructObject = curEnv->GetMethodID( this->instanceClass, construct.c_str() , param.c_str() ) ;
+if(constructObject == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+
+localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ;
+if(localInstance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+this->instance = curEnv->NewGlobalRef(localInstance) ;
+if(this->instance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+/* localInstance not needed anymore */
+curEnv->DeleteLocalRef(localInstance);
+
+                /* Methods ID set to NULL */
+jbooleansetDriverjstringjava_lang_StringID=NULL;
+voidsetPathjstringjava_lang_StringID=NULL;
+voidendjstringjava_lang_StringID=NULL;
+
+
+}
+
+Driver::Driver(JavaVM * jvm_, jobject JObj) {
+        jvm=jvm_;
+
+        JNIEnv * curEnv = getCurrentEnv();
+
+jclass localClass = curEnv->GetObjectClass(JObj);
+        this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass));
+        curEnv->DeleteLocalRef(localClass);
+
+        if (this->instanceClass == NULL) {
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+        }
+
+        this->instance = curEnv->NewGlobalRef(JObj) ;
+        if(this->instance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+        }
+        /* Methods ID set to NULL */
+        jbooleansetDriverjstringjava_lang_StringID=NULL;
+voidsetPathjstringjava_lang_StringID=NULL;
+voidendjstringjava_lang_StringID=NULL;
+
+
+}
+
+// Generic methods
+
+void Driver::synchronize() {
+if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK) {
+throw GiwsException::JniMonitorException(getCurrentEnv(), "Driver");
+}
+}
+
+void Driver::endSynchronize() {
+if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK) {
+throw GiwsException::JniMonitorException(getCurrentEnv(), "Driver");
+}
+}
+// Method(s)
+
+bool Driver::setDriver (JavaVM * jvm_, char * driver){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID jbooleansetDriverjstringjava_lang_StringID = curEnv->GetStaticMethodID(cls, "setDriver", "(Ljava/lang/String;)Z" ) ;
+if (jbooleansetDriverjstringjava_lang_StringID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "setDriver");
+}
+
+jstring driver_ = curEnv->NewStringUTF( driver );
+if (driver != NULL && driver_ == NULL)
+{
+throw GiwsException::JniBadAllocException(curEnv);
+}
+
+
+                        jboolean res =  static_cast<jboolean>( curEnv->CallStaticBooleanMethod(cls, jbooleansetDriverjstringjava_lang_StringID ,driver_));
+                        curEnv->DeleteLocalRef(driver_);
+curEnv->DeleteLocalRef(cls);
+if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+return (res == JNI_TRUE);
+
+}
+
+void Driver::setPath (JavaVM * jvm_, char * path){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID voidsetPathjstringjava_lang_StringID = curEnv->GetStaticMethodID(cls, "setPath", "(Ljava/lang/String;)V" ) ;
+if (voidsetPathjstringjava_lang_StringID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "setPath");
+}
+
+jstring path_ = curEnv->NewStringUTF( path );
+if (path != NULL && path_ == NULL)
+{
+throw GiwsException::JniBadAllocException(curEnv);
+}
+
+
+                         curEnv->CallStaticVoidMethod(cls, voidsetPathjstringjava_lang_StringID ,path_);
+                        curEnv->DeleteLocalRef(path_);
+curEnv->DeleteLocalRef(cls);
+if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+}
+
+void Driver::end (JavaVM * jvm_, char * uid){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID voidendjstringjava_lang_StringID = curEnv->GetStaticMethodID(cls, "end", "(Ljava/lang/String;)V" ) ;
+if (voidendjstringjava_lang_StringID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "end");
+}
+
+jstring uid_ = curEnv->NewStringUTF( uid );
+if (uid != NULL && uid_ == NULL)
+{
+throw GiwsException::JniBadAllocException(curEnv);
+}
+
+
+                         curEnv->CallStaticVoidMethod(cls, voidendjstringjava_lang_StringID ,uid_);
+                        curEnv->DeleteLocalRef(uid_);
+curEnv->DeleteLocalRef(cls);
+if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+}
+
+}
diff --git a/scilab/modules/graphic_export/src/jni/Driver.giws.xml b/scilab/modules/graphic_export/src/jni/Driver.giws.xml
new file mode 100644 (file)
index 0000000..d35159a
--- /dev/null
@@ -0,0 +1,25 @@
+<!--
+ * 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
+ *
+ -->
+<package name="org.scilab.modules.graphic_export">
+  <object name="Driver">
+    <method name="setDriver" returnType="boolean" modifier="static">
+      <parameter name="driver" type="String"/>
+    </method>
+    <method name="setPath" returnType="void" modifier="static">
+      <parameter name="path" type="String"/>
+    </method>
+    <method name="end" returnType="void" modifier="static" >
+      <parameter name="uid" type="String"/>
+    </method>
+  </object>
+</package>
diff --git a/scilab/modules/graphic_export/src/jni/Driver.hxx b/scilab/modules/graphic_export/src/jni/Driver.hxx
new file mode 100644 (file)
index 0000000..d2911fc
--- /dev/null
@@ -0,0 +1,160 @@
+/* Generated by GIWS (version 1.3.0) */
+/*
+
+Copyright 2007-2008 INRIA
+Copyright 2008-2011 DIGITEO
+
+Author : Sylvestre Ledru & others
+
+This is generated code.
+
+This software is a computer program whose purpose is to hide the complexity
+of accessing Java objects/methods from C++ code.
+
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
+*/
+
+
+#ifndef __ORG_SCILAB_MODULES_GRAPHIC_EXPORT_DRIVER__
+#define __ORG_SCILAB_MODULES_GRAPHIC_EXPORT_DRIVER__
+#include <iostream>
+#include <string>
+#include <string.h>
+#include <stdlib.h>
+#include <jni.h>
+
+#include "GiwsException.hxx"
+
+#ifndef _MSC_VER /* Defined anyway with Visual */
+#if !defined(byte)
+typedef signed char byte;
+#else
+#pragma message("Byte has been redefined elsewhere. Some problems can happen")
+#endif
+#endif
+
+
+#ifndef GIWSEXPORT
+# if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define GIWSEXPORT
+#   else
+#     define GIWSEXPORT __declspec(dllexport)
+#   endif
+# else
+#     define GIWSEXPORT
+# endif
+#endif
+
+namespace org_scilab_modules_graphic_export {
+class GIWSEXPORT Driver {
+
+private:
+JavaVM * jvm;
+
+protected:
+jmethodID jbooleansetDriverjstringjava_lang_StringID; // cache method id
+jmethodID voidsetPathjstringjava_lang_StringID; // cache method id
+jmethodID voidendjstringjava_lang_StringID; // cache method id
+
+
+
+jobject instance;
+jclass instanceClass; // cache class
+
+
+/**
+* Get the environment matching to the current thread.
+*/
+virtual JNIEnv * getCurrentEnv();
+
+public:
+// Constructor
+/**
+* Create a wrapping of the object from a JNIEnv.
+* It will call the default constructor
+* @param JEnv_ the Java Env
+*/
+Driver(JavaVM * jvm_);
+
+/**
+* Create a wrapping of an already existing object from a JNIEnv.
+* The object must have already been instantiated
+* @param JEnv_ the Java Env
+* @param JObj the object
+*/
+Driver(JavaVM * jvm_, jobject JObj);
+
+
+/** 
+* This is a fake constructor to avoid the constructor
+* chaining when dealing with extended giws classes 
+*/
+#ifdef FAKEGIWSDATATYPE
+Driver(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
+#endif
+
+// Destructor
+~Driver();
+
+// Generic method
+// Synchronization methods
+/**
+* Enter monitor associated with the object.
+* Equivalent of creating a "synchronized(obj)" scope in Java.
+*/
+void synchronize();
+
+/**
+* Exit monitor associated with the object.
+* Equivalent of ending a "synchronized(obj)" scope.
+*/
+void endSynchronize();
+
+// Methods
+static bool setDriver(JavaVM * jvm_, char * driver);
+
+static void setPath(JavaVM * jvm_, char * path);
+
+static void end(JavaVM * jvm_, char * uid);
+
+
+                        /**
+                        * Get class name to use for static methods
+                        * @return class name to use for static methods
+                        */
+                        
+                static const std::string className()
+                {
+                return "org/scilab/modules/graphic_export/Driver";
+                }
+                
+};
+
+
+}
+#endif
index c9d413c..d97837a 100644 (file)
@@ -16,6 +16,8 @@
 #include <map>
 #include <string.h>
 
+#include "dynlib_graphic_objects.h"
+
 extern "C"
 {
     void ScilabNativeView__createObject(char* pstId);
@@ -23,7 +25,7 @@ extern "C"
     void ScilabNativeView__updateObject(char* pstId, char* pstProperty);
 }
 
-class ScilabView
+class GRAPHIC_OBJECTS_IMPEXP ScilabView
 {
 private :
     ScilabView() {}
index 09c1226..8f971b4 100644 (file)
@@ -62,6 +62,7 @@ GUI_CPP_SOURCES = \
 src/cpp/InitUIMenu.cpp \
 src/jni/CallScilabBridge.cpp \
 src/jni/Jxclick.cpp \
+src/jni/SwingView.cpp \
 src/cpp/CallJxclick.cpp \
 src/jni/Jxgetmouse.cpp \
 src/cpp/CallJxgetmouse.cpp \
index 04a3062..fb72577 100644 (file)
@@ -144,7 +144,8 @@ am__objects_1 = libscigui_algo_la-buildMainWindowTitle.lo \
        libscigui_algo_la-ScilabTermination_wrap.lo
 am__objects_2 = libscigui_algo_la-InitUIMenu.lo \
        libscigui_algo_la-CallScilabBridge.lo \
-       libscigui_algo_la-Jxclick.lo libscigui_algo_la-CallJxclick.lo \
+       libscigui_algo_la-Jxclick.lo libscigui_algo_la-SwingView.lo \
+       libscigui_algo_la-CallJxclick.lo \
        libscigui_algo_la-Jxgetmouse.lo \
        libscigui_algo_la-CallJxgetmouse.lo \
        libscigui_algo_la-CallColorChooser.lo \
@@ -591,6 +592,7 @@ GUI_CPP_SOURCES = \
 src/cpp/InitUIMenu.cpp \
 src/jni/CallScilabBridge.cpp \
 src/jni/Jxclick.cpp \
+src/jni/SwingView.cpp \
 src/cpp/CallJxclick.cpp \
 src/jni/Jxgetmouse.cpp \
 src/cpp/CallJxgetmouse.cpp \
@@ -1152,6 +1154,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUiobjectForegroundColor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SetUiobjectVisible.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-Slider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-SwingView.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-Toolbar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-UiDisplayTree.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-UiTable.Plo@am__quote@
@@ -1528,6 +1531,13 @@ libscigui_algo_la-Jxclick.lo: src/jni/Jxclick.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) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_algo_la-Jxclick.lo `test -f 'src/jni/Jxclick.cpp' || echo '$(srcdir)/'`src/jni/Jxclick.cpp
 
+libscigui_algo_la-SwingView.lo: src/jni/SwingView.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_algo_la-SwingView.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-SwingView.Tpo -c -o libscigui_algo_la-SwingView.lo `test -f 'src/jni/SwingView.cpp' || echo '$(srcdir)/'`src/jni/SwingView.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_algo_la-SwingView.Tpo $(DEPDIR)/libscigui_algo_la-SwingView.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/jni/SwingView.cpp' object='libscigui_algo_la-SwingView.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) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_algo_la-SwingView.lo `test -f 'src/jni/SwingView.cpp' || echo '$(srcdir)/'`src/jni/SwingView.cpp
+
 libscigui_algo_la-CallJxclick.lo: src/cpp/CallJxclick.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_algo_la-CallJxclick.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-CallJxclick.Tpo -c -o libscigui_algo_la-CallJxclick.lo `test -f 'src/cpp/CallJxclick.cpp' || echo '$(srcdir)/'`src/cpp/CallJxclick.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_algo_la-CallJxclick.Tpo $(DEPDIR)/libscigui_algo_la-CallJxclick.Plo
index c7e0f31..cc134b2 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
     <ClCompile Include="..\cpp\UiDisplayTree.cpp" />
     <ClCompile Include="..\cpp\UiTable.cpp" />
     <ClCompile Include="..\jni\ScilabTermination_wrap.c" />
+    <ClCompile Include="..\jni\SwingView.cpp" />
     <ClCompile Include="addmenu.c" />
     <ClCompile Include="buildMainWindowTitle.c" />
     <ClCompile Include="..\cpp\CallClipboard.cpp" />
     <ClInclude Include="..\..\includes\SetUiobjectEnable.h" />
     <ClInclude Include="..\..\includes\UiDisplayTree.h" />
     <ClInclude Include="..\..\includes\UiTable.h" />
+    <ClInclude Include="..\jni\SwingView.hxx" />
     <ClInclude Include="buildMainWindowTitle.h" />
     <ClInclude Include="..\cpp\CallClipboard.hxx" />
     <ClInclude Include="..\..\includes\CallColorChooser.h" />
index a1b639d..33ed7fd 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
     <ClCompile Include="..\cpp\UiTable.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\cpp\SetUiobjectRotate.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\cpp\SetUiobjectScale.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\cpp\SetUiobjectShear.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\cpp\GetUiobjectScale.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\cpp\GetUiobjectShear.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\cpp\GetConsoleShowHiddenHandles.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="ScilabTermination.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\jni\SwingView.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="buildMainWindowTitle.h">
     <ClInclude Include="..\..\includes\GetUiobjectEnable.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\includes\GetUiobjectScale.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\includes\GetUiobjectShear.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\includes\SetUiobjectEnable.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\includes\SetUiobjectRotate.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\includes\SetUiobjectScale.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\includes\SetUiobjectShear.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\includes\UiDisplayTree.h">
       <Filter>Header Files</Filter>
     </ClInclude>
     <ClInclude Include="ScilabTermination.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\jni\SwingView.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="LibScilab_Import.def">
index a0fa223..d232260 100644 (file)
@@ -121,6 +121,8 @@ public final class SwingView implements GraphicView {
 
     private static SwingView me;
 
+    private static boolean headless;
+
     private Map<String, TypedObject> allObjects;
 
     /**
@@ -138,6 +140,10 @@ public final class SwingView implements GraphicView {
         }
     }
 
+    public static void setHeadless(boolean headless) {
+        SwingView.headless = headless;
+    }
+
     public static SwingViewObject getFromId(String id) {
         TypedObject typedObject = me.allObjects.get(id);
 
@@ -209,7 +215,7 @@ public final class SwingView implements GraphicView {
 
     @Override
     public void createObject(String id) {
-        if (!GraphicsEnvironment.isHeadless()) {
+        if (!headless && !GraphicsEnvironment.isHeadless()) {
             boolean isValid = (Boolean) GraphicController.getController().getProperty(id, __GO_VALID__);
             if (!isValid) {
                 return;
diff --git a/scilab/modules/gui/src/jni/SwingView.cpp b/scilab/modules/gui/src/jni/SwingView.cpp
new file mode 100644 (file)
index 0000000..a090385
--- /dev/null
@@ -0,0 +1,176 @@
+#include "SwingView.hxx"
+/* Generated by GIWS (version 2.0.0) with command:
+giws -e -r -f SwingView.giws.xml 
+*/
+/*
+
+Copyright 2007-2008 INRIA
+Copyright 2008-2011 DIGITEO
+Copyright 2011-2012 Scilab Enterprises
+
+Author : Sylvestre Ledru & others
+
+This is generated code.
+
+This software is a computer program whose purpose is to hide the complexity
+of accessing Java objects/methods from C++ code.
+
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
+*/
+
+namespace org_scilab_modules_gui {
+
+                // Static declarations (if any)
+                
+// Returns the current env
+
+JNIEnv * SwingView::getCurrentEnv() {
+JNIEnv * curEnv = NULL;
+jint res=this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+if (res != JNI_OK) {
+throw GiwsException::JniException(getCurrentEnv());
+}
+return curEnv;
+}
+// Destructor
+
+SwingView::~SwingView() {
+JNIEnv * curEnv = NULL;
+this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+
+curEnv->DeleteGlobalRef(this->instance);
+curEnv->DeleteGlobalRef(this->instanceClass);
+}
+// Constructors
+SwingView::SwingView(JavaVM * jvm_) {
+jmethodID constructObject = NULL ;
+jobject localInstance ;
+jclass localClass ;
+
+const std::string construct="<init>";
+const std::string param="()V";
+jvm=jvm_;
+
+JNIEnv * curEnv = getCurrentEnv();
+
+localClass = curEnv->FindClass( this->className().c_str() ) ;
+if (localClass == NULL) {
+  throw GiwsException::JniClassNotFoundException(curEnv, this->className());
+}
+
+this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass));
+
+/* localClass is not needed anymore */
+curEnv->DeleteLocalRef(localClass);
+
+if (this->instanceClass == NULL) {
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+
+
+constructObject = curEnv->GetMethodID( this->instanceClass, construct.c_str() , param.c_str() ) ;
+if(constructObject == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+
+localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ;
+if(localInstance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+this->instance = curEnv->NewGlobalRef(localInstance) ;
+if(this->instance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+}
+/* localInstance not needed anymore */
+curEnv->DeleteLocalRef(localInstance);
+
+                /* Methods ID set to NULL */
+voidsetHeadlessjbooleanbooleanID=NULL;
+
+
+}
+
+SwingView::SwingView(JavaVM * jvm_, jobject JObj) {
+        jvm=jvm_;
+
+        JNIEnv * curEnv = getCurrentEnv();
+
+jclass localClass = curEnv->GetObjectClass(JObj);
+        this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass));
+        curEnv->DeleteLocalRef(localClass);
+
+        if (this->instanceClass == NULL) {
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+        }
+
+        this->instance = curEnv->NewGlobalRef(JObj) ;
+        if(this->instance == NULL){
+throw GiwsException::JniObjectCreationException(curEnv, this->className());
+        }
+        /* Methods ID set to NULL */
+        voidsetHeadlessjbooleanbooleanID=NULL;
+
+
+}
+
+// Generic methods
+
+void SwingView::synchronize() {
+if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK) {
+throw GiwsException::JniMonitorException(getCurrentEnv(), "SwingView");
+}
+}
+
+void SwingView::endSynchronize() {
+if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK) {
+throw GiwsException::JniMonitorException(getCurrentEnv(), "SwingView");
+}
+}
+// Method(s)
+
+void SwingView::setHeadless (JavaVM * jvm_, bool headless){
+
+JNIEnv * curEnv = NULL;
+jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+jclass cls = curEnv->FindClass( className().c_str() );
+
+jmethodID voidsetHeadlessjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "setHeadless", "(Z)V" ) ;
+if (voidsetHeadlessjbooleanbooleanID == NULL) {
+throw GiwsException::JniMethodNotFoundException(curEnv, "setHeadless");
+}
+
+jboolean headless_ = (static_cast<bool>(headless) ? JNI_TRUE : JNI_FALSE);
+
+                         curEnv->CallStaticVoidMethod(cls, voidsetHeadlessjbooleanbooleanID ,headless_);
+                        curEnv->DeleteLocalRef(cls);
+if (curEnv->ExceptionCheck()) {
+throw GiwsException::JniCallMethodException(curEnv);
+}
+}
+
+}
diff --git a/scilab/modules/gui/src/jni/SwingView.giws.xml b/scilab/modules/gui/src/jni/SwingView.giws.xml
new file mode 100644 (file)
index 0000000..fc0663f
--- /dev/null
@@ -0,0 +1,19 @@
+<!--
+ * 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
+ *
+ -->
+<package name="org.scilab.modules.gui">
+  <object name="SwingView">
+    <method name="setHeadless" returnType="void" modifier="static">
+      <parameter name="headless" type="boolean"/>
+    </method>
+  </object>
+</package>
\ No newline at end of file
diff --git a/scilab/modules/gui/src/jni/SwingView.hxx b/scilab/modules/gui/src/jni/SwingView.hxx
new file mode 100644 (file)
index 0000000..622567b
--- /dev/null
@@ -0,0 +1,162 @@
+/* Generated by GIWS (version 2.0.0) with command:
+giws -e -r -f SwingView.giws.xml 
+*/
+/*
+
+Copyright 2007-2008 INRIA
+Copyright 2008-2011 DIGITEO
+Copyright 2011-2012 Scilab Enterprises
+
+Author : Sylvestre Ledru & others
+
+This is generated code.
+
+This software is a computer program whose purpose is to hide the complexity
+of accessing Java objects/methods from C++ code.
+
+This software is governed by the CeCILL-B license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL-B
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-B license and that you accept its terms.
+*/
+
+
+#ifndef __ORG_SCILAB_MODULES_GUI_SWINGVIEW__
+#define __ORG_SCILAB_MODULES_GUI_SWINGVIEW__
+#include <iostream>
+#include <string>
+#include <string.h>
+#include <stdlib.h>
+#include <jni.h>
+
+#include "GiwsException.hxx"
+
+        #if !defined(byte) | !defined(_MSC_VER) /* Defined anyway with Visual */
+                typedef signed char byte;
+        #else
+                #pragma message("Byte has been redefined elsewhere. Some problems can happen")
+        #endif
+
+
+#ifndef GIWSEXPORT
+# if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define GIWSEXPORT
+#   else
+#     define GIWSEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if __GNUC__ >= 4
+#     define GIWSEXPORT __attribute__ ((visibility ("default")))
+#   else
+#     define GIWSEXPORT
+#   endif
+# endif
+#endif
+
+namespace org_scilab_modules_gui {
+class GIWSEXPORT SwingView {
+
+private:
+JavaVM * jvm;
+
+protected:
+jmethodID voidsetHeadlessjbooleanbooleanID; // cache method id
+
+
+
+jobject instance;
+jclass instanceClass; // cache class
+
+                       
+// Caching (if any)
+
+
+/**
+* Get the environment matching to the current thread.
+*/
+virtual JNIEnv * getCurrentEnv();
+
+public:
+// Constructor
+/**
+* Create a wrapping of the object from a JNIEnv.
+* It will call the default constructor
+* @param JEnv_ the Java Env
+*/
+SwingView(JavaVM * jvm_);
+
+/**
+* Create a wrapping of an already existing object from a JNIEnv.
+* The object must have already been instantiated
+* @param JEnv_ the Java Env
+* @param JObj the object
+*/
+SwingView(JavaVM * jvm_, jobject JObj);
+
+
+/** 
+* This is a fake constructor to avoid the constructor
+* chaining when dealing with extended giws classes 
+*/
+#ifdef FAKEGIWSDATATYPE
+SwingView(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
+#endif
+
+// Destructor
+~SwingView();
+
+// Generic method
+// Synchronization methods
+/**
+* Enter monitor associated with the object.
+* Equivalent of creating a "synchronized(obj)" scope in Java.
+*/
+void synchronize();
+
+/**
+* Exit monitor associated with the object.
+* Equivalent of ending a "synchronized(obj)" scope.
+*/
+void endSynchronize();
+
+// Methods
+static void setHeadless(JavaVM * jvm_, bool headless);
+
+
+                        /**
+                        * Get class name to use for static methods
+                        * @return class name to use for static methods
+                        */
+                        
+                static const std::string className()
+                {
+                return "org/scilab/modules/gui/SwingView";
+                }
+                
+};
+
+
+}
+#endif